From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 468A9C433E2 for ; Tue, 7 Jul 2020 16:38:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 158E320708 for ; Tue, 7 Jul 2020 16:38:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 158E320708 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B16356B009A; Tue, 7 Jul 2020 12:38:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AA0C26B009B; Tue, 7 Jul 2020 12:38:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 967D86B009C; Tue, 7 Jul 2020 12:38:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 7D5C36B009A for ; Tue, 7 Jul 2020 12:38:03 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id ED5EB1EE6 for ; Tue, 7 Jul 2020 16:38:02 +0000 (UTC) X-FDA: 77011836804.20.fan83_5f1019126eb5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id BEB98180C07AF for ; Tue, 7 Jul 2020 16:38:02 +0000 (UTC) X-HE-Tag: fan83_5f1019126eb5 X-Filterd-Recvd-Size: 4118 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jul 2020 16:38:02 +0000 (UTC) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 70C791C0C0A; Tue, 7 Jul 2020 18:37:58 +0200 (CEST) Date: Tue, 7 Jul 2020 18:37:58 +0200 From: Pavel Machek To: Michal Hocko Cc: Jann Horn , "Catangiu, Adrian Costin" , "linux-mm@kvack.org" , "linux-pm@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "linux-api@vger.kernel.org" , "akpm@linux-foundation.org" , "rjw@rjwysocki.net" , "len.brown@intel.com" , "fweimer@redhat.com" , "keescook@chromium.org" , "luto@amacapital.net" , "wad@chromium.org" , "mingo@kernel.org" , "bonzini@gnu.org" , "Graf (AWS), Alexander" , "MacCarthaigh, Colm" , "Singh, Balbir" , "Sandu, Andrei" , "Brooker, Marc" , "Weiss, Radu" , "Manwaring, Derek" Subject: Re: [RFC]: mm,power: introduce MADV_WIPEONSUSPEND Message-ID: <20200707163758.GA1947@amd> References: <20200703113026.GT18446@dhcp22.suse.cz> <20200707073823.GA3820@dhcp22.suse.cz> <20200707080726.GA32357@amd> <20200707085847.GA5913@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cWoXeonUoKmBZSoM" Content-Disposition: inline In-Reply-To: <20200707085847.GA5913@dhcp22.suse.cz> User-Agent: Mutt/1.5.23 (2014-03-12) X-Rspamd-Queue-Id: BEB98180C07AF X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > > > You can do it seqlock-style, kind of - you reserve the first byte of > > > > the page or so as a "is this page initialized" marker, and after ev= ery > > > > read from the page, you do a compiler barrier and check whether that > > > > byte has been cleared. > > >=20 > > > This is certainly possible yet wery awkwar interface to use IMHO. > > > MADV_EXTERNALY_VOLATILE would express the actual semantic much better. > > > I might not still understand the expected usecase but if the target > > > application has to be changed anyway then why not simply use a > > > transparent and proper signaling mechanism like poll on a fd. That > >=20 > > The goal is to have cryprographically-safe get_random_number() with 0 > > syscalls. > >=20 > > You'd need to do: > >=20 > > if (!poll(did_i_migrate)) { > > use_prng_seed(); > > if (poll(did_i_migrate)) { > > /* oops_they_migrated_me_in_middle_of_computation, > > lets_redo_it() */ > > goto retry: > > } > > } > >=20 > > Which means two syscalls.. >=20 > Is this a real problem though? Do we have any actual numbers? E.g. how > often does the migration happen so that 2 syscalls would be visible in > actual workloads? Please go through the thread and try to understand it. You'd need syscalls per get_randomness(), not per migration. Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --cWoXeonUoKmBZSoM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl8EpOUACgkQMOfwapXb+vIrGQCfa8t3eRPUQJN4sgdBPhRqIXIN Md0AoL/VSUKG0fqXzutn3A1vlMnmAH5A =B3/F -----END PGP SIGNATURE----- --cWoXeonUoKmBZSoM--