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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F18E4C52D7B for ; Wed, 14 Aug 2024 15:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:In-Reply-To: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Wp3RgWPkdUCFzuPHgIrGTTZ3GUOXugzLWnj/fmKQBpI=; b=1+/1giPQ0c3Yl59m2tkziZGXAu jh4O2ReHfsfpSMJ91H5Q5NXEwqagg+H+4xfcb0LN+wJ9/u3QScKjrIwzaCe4qqOYcaQo9mWG07QTa XwxkMIvacSM8/ZsOxBJGJfUtU7KiORHyFByI0NSVnyomWotKtPY/0NUDXhR1xd3b0aAw21JovLLDP LxXZdaXjJAgByNiAjf9VPKJPn3CxOC496alaF12nTXlt9j4w4G7JOGg1oQKBc59jWsZ80gRdvomht aKyP11Fy6OawQ/n6VOEj7jBTXIxQiaJeMQMab9/X2kpTNxiiJd1u1EPX6e/qn+7/aS4duRR837UTp 5K4wisNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seGAc-00000007Vy3-0xj9; Wed, 14 Aug 2024 15:44:18 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seG9Z-00000007ViI-3zdL for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 15:43:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723650192; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Wp3RgWPkdUCFzuPHgIrGTTZ3GUOXugzLWnj/fmKQBpI=; b=ISF0kBo539jLEWcAPnCvwkworbu+GGOnbD8d6392qPlKMsEMu+ICcOjngXvvWTVOyMalwm PkRXDNHae99exBxInXY/oNAyWEurTNYcFmn6q4ltQZj68igrxdq/UGGcU/H4OaCU5yaeaF X4eBkZ3mZb5x+W3h5O3xtoksDRD3jn4= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-130-C_famhjONBi7qxJZiQxr0A-1; Wed, 14 Aug 2024 11:43:11 -0400 X-MC-Unique: C_famhjONBi7qxJZiQxr0A-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6b79ccc1504so725536d6.3 for ; Wed, 14 Aug 2024 08:43:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723650191; x=1724254991; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Wp3RgWPkdUCFzuPHgIrGTTZ3GUOXugzLWnj/fmKQBpI=; b=iqxx5dgrsbaTx9Cg5Xs2PJncRFIeoL9HCdAUDaiAcpasUZ/fEYiuUDtnbHOz/1ujRs 8dEW98cE7V852DsLNpW6lb1RXQmVsL0EEZlu8W0Ju12d5GIC/PD1IlNQhMuiROJNRzMy Jwv9jMexVjCbYMd+Kb0iDK0sB0OF76nFEz681SD9L+uYYNiUmbyB5NSxehJAcfUHXrko giUBHXFDWD1SuwsIbqxNo+J6Ofkt1s2DdF3LW9hZPz8UNFwDERWZ6jCl4o/POnAj3ujz XUS2T7UfWZLPIrWdSSvwd/2mJOyFGITC//GiiXJb4W5dM1ZB+dB7i7jwrHyzZr7ltN71 kYcQ== X-Forwarded-Encrypted: i=1; AJvYcCWgDjhZS9ses6Fk1uD41W+8L+zED/lZ0MBnABkYDCxvYUe+fDswSa/WNkeCRfDUzT2wfwNtNUpHqCL0wkJVv7ba2XLH6rm7ZbTrNzT+fclWOn/O+Gw= X-Gm-Message-State: AOJu0YxBPKM8yhouqJkf0nExQF8uV9mpNziuTFUgDP7wR9T5LBF/8+mg ctE2lOxIk1eFBJIOLqhJqv0GtwYZ5fziaePwuBk7cQDBCb6rDFjP+1QewnCT6c0r2Qej90AZc6B eKBmd7v4goIwbOBhHzA7wDTz5u68too9rqLeE/rvXOLRtiDJwVhSfHOTf0WYcrkxju33l0v11 X-Received: by 2002:a05:620a:3704:b0:79f:44d:2b8a with SMTP id af79cd13be357-7a4ee3907bdmr238903885a.5.1723650191074; Wed, 14 Aug 2024 08:43:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYXNGxrMlqiMBIZ5ST7AxhHtA/FbXaG+GaqvRqPuCV6WzqEPOJp/I4t+RerfXsa1wlbiNflw== X-Received: by 2002:a05:620a:3704:b0:79f:44d:2b8a with SMTP id af79cd13be357-7a4ee3907bdmr238901485a.5.1723650190692; Wed, 14 Aug 2024 08:43:10 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4c7e051d4sm448353485a.123.2024.08.14.08.43.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 08:43:10 -0700 (PDT) Date: Wed, 14 Aug 2024 11:43:08 -0400 From: Peter Xu To: Jason Gunthorpe Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sean Christopherson , Oscar Salvador , Axel Rasmussen , linux-arm-kernel@lists.infradead.org, x86@kernel.org, Will Deacon , Gavin Shan , Paolo Bonzini , Zi Yan , Andrew Morton , Catalin Marinas , Ingo Molnar , Alistair Popple , Borislav Petkov , David Hildenbrand , Thomas Gleixner , kvm@vger.kernel.org, Dave Hansen , Alex Williamson , Yan Zhao Subject: Re: [PATCH 08/19] mm: Always define pxx_pgprot() Message-ID: References: <20240809160909.1023470-1-peterx@redhat.com> <20240809160909.1023470-9-peterx@redhat.com> <20240814130915.GI2032816@nvidia.com> MIME-Version: 1.0 In-Reply-To: <20240814130915.GI2032816@nvidia.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_084314_100531_45B0B9CF X-CRM114-Status: GOOD ( 23.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 14, 2024 at 10:09:15AM -0300, Jason Gunthorpe wrote: > On Fri, Aug 09, 2024 at 12:08:58PM -0400, Peter Xu wrote: > > There're: > > > > - 8 archs (arc, arm64, include, mips, powerpc, s390, sh, x86) that > > support pte_pgprot(). > > > > - 2 archs (x86, sparc) that support pmd_pgprot(). > > > > - 1 arch (x86) that support pud_pgprot(). > > > > Always define them to be used in generic code, and then we don't need to > > fiddle with "#ifdef"s when doing so. > > > > Signed-off-by: Peter Xu > > --- > > arch/arm64/include/asm/pgtable.h | 1 + > > arch/powerpc/include/asm/pgtable.h | 1 + > > arch/s390/include/asm/pgtable.h | 1 + > > arch/sparc/include/asm/pgtable_64.h | 1 + > > include/linux/pgtable.h | 12 ++++++++++++ > > 5 files changed, 16 insertions(+) > > Reviewed-by: Jason Gunthorpe > > > diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h > > index 7a4f5604be3f..b78cc4a6758b 100644 > > --- a/arch/arm64/include/asm/pgtable.h > > +++ b/arch/arm64/include/asm/pgtable.h > > @@ -384,6 +384,7 @@ static inline void __sync_cache_and_tags(pte_t pte, unsigned int nr_pages) > > /* > > * Select all bits except the pfn > > */ > > +#define pte_pgprot pte_pgprot > > static inline pgprot_t pte_pgprot(pte_t pte) > > { > > unsigned long pfn = pte_pfn(pte); > > Stylistically I've been putting the #defines after the function body, > I wonder if there is a common pattern.. Right, I see both happening in tree right now and I don't know which is better. Personally I preferred "before function" as it makes spell checks easy to match macro/func names, and also cscope indexes both macro and func, so a jump to any of them would make me look at the entry of func. I'll keep it as-is for now just to make it easy for me.. but please comment if we do have a preferred pattern the other way round, then I'll follow. Thanks, -- Peter Xu