Date: Thu, 22 Nov 2018 12:04:16 -0800 From: Matthew Wilcox Subject: Re: [PATCH 10/17] prmem: documentation Message-ID: <20181122200416.GS3065@bombadil.infradead.org> References: <6f60afc9-0fed-7f95-a11a-9a2eef33094c@gmail.com> <386C0CB1-C4B1-43E2-A754-DA8DBE4FB3CB@gmail.com> <9373ccf0-f51b-4bfa-2b16-e03ebf3c670d@huawei.com> <2e52e103-15d0-0c26-275f-894dfd07e8ec@huawei.com> <1166e55c-0c06-195c-a501-383b4055ea46@gmail.com> <3BB9DE07-E0AE-43E2-99F1-E4AA774CD462@amacapital.net> <5e10c8e4-aa71-1eea-b1ce-50d7d0a60e8c@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5e10c8e4-aa71-1eea-b1ce-50d7d0a60e8c@gmail.com> To: Igor Stoppa Cc: Andy Lutomirski , Andy Lutomirski , Igor Stoppa , Nadav Amit , Kees Cook , Peter Zijlstra , Mimi Zohar , Dave Chinner , James Morris , Michal Hocko , Kernel Hardening , linux-integrity , LSM List , Dave Hansen , Jonathan Corbet , Laura Abbott , Randy Dunlap , Mike Rapoport , "open list:DOCUMENTATION" , LKML , Thomas Gleixner List-ID: On Thu, Nov 22, 2018 at 09:27:02PM +0200, Igor Stoppa wrote: > I have studied the code involved with Nadav's patchset. > I am perplexed about these sentences you wrote. > > More to the point (to the best of my understanding): > > poking_init() > ------------- > 1. it gets one random poking address and ensures to have at least 2 > consecutive PTEs from the same PMD > 2. it then proceeds to map/unmap an address from the first of the 2 > consecutive PTEs, so that, later on, there will be no need to > allocate pages, which might fail, if poking from atomic context. > 3. at this point, the page tables are populated, for the address that > was obtained at point 1, and this is ok, because the address is fixed > > write_rare > ---------- > 4. it can happen on any available core / thread at any time, therefore > each of them needs a different address No? Each CPU has its own CR3 (eg each CPU might be running a different user task). If you have _one_ address for each allocation, it may or may not be mapped on other CPUs at the same time -- you simply don't care. The writable address can even be a simple formula to calculate from the read-only address, you don't have to allocate an address in the writable mapping space.