Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3184774imu; Fri, 23 Nov 2018 23:34:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/XVLp+KBQ0XlglI4dZfQTHt6FPhgMpx9MHA4eibY4H3evk6kHHyhLXBrBcv/lSU25knL2fT X-Received: by 2002:a63:c942:: with SMTP id y2mr16868038pgg.331.1543044883373; Fri, 23 Nov 2018 23:34:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543044883; cv=none; d=google.com; s=arc-20160816; b=koFbzWjzAKxox9AlmOlrtCKF7GmThXdN2/5BTDFB2+9sqN3w+cOMFQnn+4YD8KgVEL nyG+XQzbmq6HAGEZTMyDCxlUAX2tkrUyZVD/0P+j4RNHxLATVUizeFL3PVXf60G3eQMY DLbssXT1n+BopYJchPXATi8VnmvXr8hyfdy9Kqcu4Bg6amY/WuEnqz8DkpJU+h/SeEhy EMBFpgQVNb8uUOnLM0it/Br/TFSFOxOlbBY+T0A6etCPKqph823oYcpzqa78qg8h47KU /Jmmj01kzwxraDaf1hlW/u8ontpvEDJviaPl9rXPyvLrrDPtX+JNueW7RU85uQca6cnb 8lwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3iMUh2dkWeYr3Wxskhu4eNYKLzoeaX8kLN4jP9KbV3Y=; b=q5tcAVJpgLtxz3t8CA7cnCHs505R7R+tvrjiLy4rZfQ2/yB5PMVLV2EErPJIUNXO6m CVzaZe7bZsuW3IymkWmYhFMgYHd8/LaudhbxyE4zIGrQoeDQLwHuQ9vm2mEvwZLxHTSL OkG2foC6B57uQT2hjwUmDik1rDGknpwUASvXgNxgucUdAs20fjFnnJdo+FhTaEpMAwpg d9nY417PYWXGn8avAt8HJNxnqElB2nKkVfsH72zTdNVZqvf8ex/Ji4oRv28P64Dsb69r cUFR2p/u9NaCKhnFb5QIdsbGN11Oqk5rll9dkC8jC+vSSRKrYfOrKMqqs6+7uc41QRq4 LiuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=diYQAdNo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si53742435pgo.23.2018.11.23.23.34.29; Fri, 23 Nov 2018 23:34:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=diYQAdNo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392749AbeKWGpV (ORCPT + 99 others); Fri, 23 Nov 2018 01:45:21 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:50338 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726280AbeKWGpU (ORCPT ); Fri, 23 Nov 2018 01:45:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3iMUh2dkWeYr3Wxskhu4eNYKLzoeaX8kLN4jP9KbV3Y=; b=diYQAdNo0/Z1OVDUdcJUj5cyr kFIDSxC0oD+zPTGgG2cpefx6eEjJueDDF8bO7wAL31DT08IZKtnQSXTeBQiE0S26khoHh8+iLeUU0 tnhLlAdFPNmETrYCM7lM0c5OOdYuv+NqNC4Wp8cj2oNY0b4R+gUZyxL+zgytlZbX13RKtQs0u5R2O tx6TRpwrOeoaT/hJ5gguBahHSBlwQryWsQtuOdOgeW4njwKYevV4rKDrju0cESv4JTKHDMw8OvUF8 6ONLalQU7wN46hsiNcn+98H1iKB+zSYY9sKiM1ySrQXZ2lTOKdOB+w48QC7WnabPA9ITd+Rzk+7WJ e2mXwOvkw==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPvCy-0007Hx-D4; Thu, 22 Nov 2018 20:04:16 +0000 Date: Thu, 22 Nov 2018 12:04:16 -0800 From: Matthew Wilcox 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 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> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.