Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1380269ybt; Thu, 18 Jun 2020 07:25:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr6mjHtYblDmUkMk0ed3znAhFoCqFDtj147FVh/KSSZEcf4T6c1Rv93nxFtGzu3dAA2ymw X-Received: by 2002:aa7:d158:: with SMTP id r24mr4229778edo.272.1592490344987; Thu, 18 Jun 2020 07:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592490344; cv=none; d=google.com; s=arc-20160816; b=F+/X0hhA+/beaZlX7sEILtsFdPZYJRzEBQSue79E7/eSPNsaDHYDKTx3V9XKWFkjSu 3mW9/Ob+o7EhrE8/wTYobDKKUXylOobPvSwqjodnsf5MxHSKqheHLgRf+eOWTamtolWB usqUNkV2JZhWqCwB09RHPAZXcfRWpwrzDmx4zXd2fztqkxEXIUfi1UvMHSjMZJCXb4HD MPW6vo4hVQEA1skGx795JvhXvtksvvs99/58x7i/MjB3UA8hpRz+F8i3iF4bhoMUiCfK huJWf/oLAj0V9XMIR27ywhmkxpVeiE0g0XbdL5MLvYs7oHj8dQexhwKuYpKurfOi780p sn8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=orFwpO1CYTWcbSPl5FHi+FyKV29fgeuGh0PH347dP+s=; b=jKjW8cVR9ZmyF9lHuaAkvS/ghnuxmU5+g6LOow15agG5P91CzUrsbAHigVahCGSYfD IKLtuD5lgFgcPtZxmMTRFVDDph+EWcUW26GX5aXdZxGRzCzuFDeR9RJAt+V4lezZgqtO /YXgHPq/TpN/MfRpKQMoJsuM4rboC6o0VeV+IY8ZJslFP9aPAYxE58mBZ7bf3d8sEBbu qouWHD+owV3MtwaiVI2Ii6jFC6tm7XarnnKLUgaqLsr4u38Pm4HDNGd6ysEMGOyqZOCA 5VnIkG8jwrYEnXMOYSU6rhq2FOS9Gm7oy0+WFV41GCV+3+Q/hCoZR9GUUKqYttlxf5qy C8XA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb10si2831624edb.410.2020.06.18.07.25.22; Thu, 18 Jun 2020 07:25:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730714AbgFROWP (ORCPT + 99 others); Thu, 18 Jun 2020 10:22:15 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:29808 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728033AbgFROWO (ORCPT ); Thu, 18 Jun 2020 10:22:14 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 49nkf96Dz2z9v22D; Thu, 18 Jun 2020 16:22:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id fKTzY7i6T9qx; Thu, 18 Jun 2020 16:22:09 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 49nkf95BPcz9v22C; Thu, 18 Jun 2020 16:22:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B04C78B84F; Thu, 18 Jun 2020 16:22:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ibpuocsAlwuq; Thu, 18 Jun 2020 16:22:11 +0200 (CEST) Received: from [10.25.210.22] (po15451.idsi0.si.c-s.fr [10.25.210.22]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5B6938B849; Thu, 18 Jun 2020 16:22:11 +0200 (CEST) Subject: Re: [PATCH 3/3] powerpc/8xx: Provide ptep_get() with 16k pages To: Michael Ellerman , Peter Zijlstra Cc: Benjamin Herrenschmidt , Paul Mackerras , Will Deacon , Andrew Morton , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org References: <341688399c1b102756046d19ea6ce39db1ae4742.1592225558.git.christophe.leroy@csgroup.eu> <20200615132244.GR2531@hirez.programming.kicks-ass.net> <87wo45db8d.fsf@mpe.ellerman.id.au> <20200617143826.GJ2531@hirez.programming.kicks-ass.net> <87pn9xchql.fsf@mpe.ellerman.id.au> From: Christophe Leroy Message-ID: Date: Thu, 18 Jun 2020 16:21:16 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <87pn9xchql.fsf@mpe.ellerman.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 18/06/2020 à 02:58, Michael Ellerman a écrit : > Peter Zijlstra writes: >> On Thu, Jun 18, 2020 at 12:21:22AM +1000, Michael Ellerman wrote: >>> Peter Zijlstra writes: >>>> On Mon, Jun 15, 2020 at 12:57:59PM +0000, Christophe Leroy wrote: >> >>>>> +#if defined(CONFIG_PPC_8xx) && defined(CONFIG_PPC_16K_PAGES) >>>>> +#define __HAVE_ARCH_PTEP_GET >>>>> +static inline pte_t ptep_get(pte_t *ptep) >>>>> +{ >>>>> + pte_t pte = {READ_ONCE(ptep->pte), 0, 0, 0}; >>>>> + >>>>> + return pte; >>>>> +} >>>>> +#endif >>>> >>>> Would it make sense to have a comment with this magic? The casual reader >>>> might wonder WTH just happened when he stumbles on this :-) >>> >>> I tried writing a helpful comment but it's too late for my brain to form >>> sensible sentences. >>> >>> Christophe can you send a follow-up with a comment explaining it? In >>> particular the zero entries stand out, it's kind of subtle that those >>> entries are only populated with the right value when we write to the >>> page table. >> >> static inline pte_t ptep_get(pte_t *ptep) >> { >> unsigned long val = READ_ONCE(ptep->pte); >> /* 16K pages have 4 identical value 4K entries */ >> pte_t pte = {val, val, val, val); >> return pte; >> } >> >> Maybe something like that? > > I think val wants to be pte_basic_t, but otherwise yeah I like that much > better. > I sent a patch for that. I'll also send one to fix mm/debug_vm_pgtable.c which also uses READ_ONCE() to access page table entries. Christophe