From owner-freebsd-java@FreeBSD.ORG Sun Jun 2 05:17:09 2013 Return-Path: Delivered-To: java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 859DE63D for ; Sun, 2 Jun 2013 05:17:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 282611817 for ; Sun, 2 Jun 2013 05:17:08 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r525Gx9E034190; Sun, 2 Jun 2013 08:16:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r525Gx9E034190 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r525GwfK034189; Sun, 2 Jun 2013 08:16:58 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 2 Jun 2013 08:16:58 +0300 From: Konstantin Belousov To: ????????? Subject: Re: System.currentTimeMillis() is totally wrong after call JNA mlockall Message-ID: <20130602051658.GZ3047@kib.kiev.ua> References: <1370140389.34142.YahooMailNeo@web15306.mail.cnb.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u0iPJxgGkE/yllRJ" Content-Disposition: inline In-Reply-To: <1370140389.34142.YahooMailNeo@web15306.mail.cnb.yahoo.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: "java@freebsd.org" X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2013 05:17:09 -0000 --u0iPJxgGkE/yllRJ Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 02, 2013 at 10:33:09AM +0800, ????????? wrote: > Hi, > I recently found that Cassandra 1.2.4 could not shutdown when enable JNA, > so I try to solve it, and found that under OpenJDK6/FreeBSD,=9A > System.currentTimeMillis() is totally wrong after call JNA mlockall, > time seams to not change anymore. You did not specified the version of the system. I assume this is either 9-STABLE or HEAD ? Also, I believe you use TSC as timecounter, check with the sysctl kern.timecounter.hardware. Try the patch below. I also added the C program that should exhibit the same behaviour of reporting the stale time. diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 3890157..c45b974 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1050,8 +1050,9 @@ exec_new_vmspace(imgp, sv) vm_object_reference(obj); error =3D vm_map_fixed(map, obj, 0, sv->sv_shared_page_base, sv->sv_shared_page_len, - VM_PROT_READ | VM_PROT_EXECUTE, VM_PROT_ALL, - MAP_COPY_ON_WRITE | MAP_ACC_NO_CHARGE); + VM_PROT_READ | VM_PROT_EXECUTE, + VM_PROT_READ | VM_PROT_EXECUTE, + MAP_INHERIT_SHARE | MAP_ACC_NO_CHARGE); if (error) { vm_object_deallocate(obj); return (error); /* $Id: time_mlock.c,v 1.4 2013/06/02 05:15:53 kostik Exp kostik $ */ #include #include #include #include #include #include #include #include int main(void) { time_t t; pid_t child; if (mlockall(MCL_CURRENT | MCL_FUTURE) =3D=3D -1) err(1, "mlockall"); fflush(stdout); child =3D fork(); if (child =3D=3D -1) { err(1, "fork"); } else if (child =3D=3D 0) { time(&t); printf("%s", ctime(&t)); sleep(3); time(&t); printf("%s", ctime(&t)); } return (0); } --u0iPJxgGkE/yllRJ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJRqtVJAAoJEJDCuSvBvK1BNPQP/A/XWJAlxZsSyTjpR8EoiAZ4 nEXHGZDreMTbuHSGMzbBot3j+x60q1Fg13f5IkqG2zCEEvuRsi4QwbRChIdzGdEj 3dGQSj4UFCkTAwKKCXCnZQoc3DZMfz0CQ1UczSAeH4rldNu4y1cjz/nXkwCc5dVY S2CBqYdqQO6kfcOSm6ocvdEGYKbadvZBE1tEHr+b0Rq9AMlz4FTNdZ/l5Gbckb/A MIBBQuLkvhhlDNHZ7s8pTg7q8NX9llcUm4sp1UswEjMowAQzZg2ntrCtnmWiiiHD PyneefjrfI4UTk611Ta2N1Hn94gRoxekgvoumz5qWaOIWu3/mp2Q2UKEnvBXeVjH lhG24TIE2seDSIcm0FqygJy2vyoV2QIFmp0fOqBK04dXmM+DNt6opegq6fuBSa7L T+Vwf6xsgwtLOYjWu0BFAAlEE4r7dX0glIw9q0iDBW11DxyK4dnAw4b1C0nM9aqf dNngMXAD9u6l7qNFvcEDwqCDR43mUxPGB96la5QahXsyvlOIClng7p1yvjSS38ML WT91g/3yl9FH5fG+YcbvPUoBNy6Ffs4CeLwnjKWpVUACw/vl4xuP+7tHLvVnZTZ3 88TSgoVaW4+jOCMxBqnZaMxGbTG7k8K9ZHX+BH6ffHKkCnbM9/Itq6jNB333l0Gu Xuj2S2UuDPV3pL4ZFs82 =OCt5 -----END PGP SIGNATURE----- --u0iPJxgGkE/yllRJ--