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=-5.5 required=3.0 tests=BAYES_00, 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 2A981C433EB for ; Sat, 18 Jul 2020 05:06:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B4A62083B for ; Sat, 18 Jul 2020 05:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726623AbgGRFGw (ORCPT ); Sat, 18 Jul 2020 01:06:52 -0400 Received: from mga18.intel.com ([134.134.136.126]:7941 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbgGRFGv (ORCPT ); Sat, 18 Jul 2020 01:06:51 -0400 IronPort-SDR: 7YftjD1FvMeh2cfhLU+Hl2Z19UHAwH4voI2BitVIuI/J9Dh24sj6d2cuBq5Vr4Rv5+msav1Td9 Dd7iw7W5Prww== X-IronPort-AV: E=McAfee;i="6000,8403,9685"; a="137184356" X-IronPort-AV: E=Sophos;i="5.75,365,1589266800"; d="scan'208";a="137184356" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2020 22:06:50 -0700 IronPort-SDR: PY3XuV+vuuAtpY8rxRvZ+3vMP/33Vq1wquR8p4Yg18XVLAL6vT+hjMFvaGQsieLHuShfCSaRfd pufbVEiCB0pQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,365,1589266800"; d="scan'208";a="270979648" Received: from iweiny-desk2.sc.intel.com ([10.3.52.147]) by fmsmga008.fm.intel.com with ESMTP; 17 Jul 2020 22:06:50 -0700 Date: Fri, 17 Jul 2020 22:06:50 -0700 From: Ira Weiny To: Peter Zijlstra Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , x86@kernel.org, Dave Hansen , Dan Williams , Vishal Verma , Andrew Morton , Fenghua Yu , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH RFC V2 12/17] memremap: Add zone device access protection Message-ID: <20200718050650.GT3008823@iweiny-DESK2.sc.intel.com> References: <20200717072056.73134-1-ira.weiny@intel.com> <20200717072056.73134-13-ira.weiny@intel.com> <20200717091053.GZ10769@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200717091053.GZ10769@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 17, 2020 at 11:10:53AM +0200, Peter Zijlstra wrote: > On Fri, Jul 17, 2020 at 12:20:51AM -0700, ira.weiny@intel.com wrote: > > +static pgprot_t dev_protection_enable_get(struct dev_pagemap *pgmap, pgprot_t prot) > > +{ > > + if (pgmap->flags & PGMAP_PROT_ENABLED && dev_page_pkey != PKEY_INVALID) { > > + pgprotval_t val = pgprot_val(prot); > > + > > + static_branch_inc(&dev_protection_static_key); > > + prot = __pgprot(val | _PAGE_PKEY(dev_page_pkey)); > > + } > > + return prot; > > +} > > Every other pgprot modifying function is called pgprot_*(), although I > suppose we have the exceptions phys_mem_access_prot() and dma_pgprot(). Yea... this function kind of morphed. The issue is that this is also a 'get' with a corresponding 'put'. So I'm at a loss for what makes sense between the 2 functions. > > How about we call this one devm_pgprot() ? Dan Williams mentioned to me that the devm is not an appropriate prefix. Thus the 'dev' prefix instead. How about dev_pgprot_{get,put}()? Ira