Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1955897lqa; Tue, 30 Apr 2024 04:38:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXN8ouaiLh778MlOg2Y2OezhjWmeuIxt5zMfhBPZyefeIAOcNrDNbfDID5gg3IDc4rjiXAfQt3QhVUsmBwN6a4cZMhX1Bf3GZbK+6yaqQ== X-Google-Smtp-Source: AGHT+IGrO6kZ+dDYg39adS/MJb9lfLv1I+cxjmeqMg3JhIBCA8HhZB95yLpeYY8+Yzd1zt9J+8MY X-Received: by 2002:a17:906:46c3:b0:a58:a312:d2f1 with SMTP id k3-20020a17090646c300b00a58a312d2f1mr1756013ejs.13.1714477087760; Tue, 30 Apr 2024 04:38:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714477087; cv=pass; d=google.com; s=arc-20160816; b=PljkDL0U6/PHyliPlWYRF5tDNgGhYKHE5jvEz3r0YUwkpieateuhkpJ67HXbXQpFJW evu9TVciEhgxUIZ3RDh5sJyxjyLW/174QePG+KnrdHBtiqFgCNcA9BsC7jh9+DUZw/qk uZ7NQT1EjZDSoQo0P5hP833cHanhWkF0EARiopcIkeyFreHExv5l4Q0wmFm1Rvt0joZD NI/9qXreQKMcx40aLL2Ad3B0d68Y3yp9Vcd9/bUEqGIw/HSS1Lc9W2OInAexOnorUdqy CYSFmlWc3g0lgzRmnB33v2xUh6WlU8Rtf3NKYrraGxqhaQDVHjoIpuaV8QkPuerjvTws 1d4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=eiAW+x1zKVTvGTvtjODDDjCAqDM2UP0sxyHU46nIuLU=; fh=xnbFVwdHTH5HVZ60TwjT20wmttVW5p3mFmby4gZxLRo=; b=c4JTVilQQ//m9QlV38zMmEHeZbI9pF0uQH6BqGYLg6r4TRhLhSLBFa/upn7OtD194o peyXfXZ2aNh5MNVXEUVu1JYJEV46xqWi91mpdpba2LmT1ch58gRWYUxjQj/5m3MVAdnu W7hlHahC/zwkerSfkzlVu8ddyvh8O8H8GhM2wcrgCknHu5mKy2h1Zelh7jaIWZaE5v3N 6u8s/aAtNVSKO3zju/nia4sOQT4pQWgY1YoAn6fGqNsYmm9eZRZLM2ZXBdwaFyJbUhp/ FuUResVMCS/8cgQGK0SdcW8Dyp/L+qnqJH0EecRtcfOrCp6uV4ANLhljPVmC+VGtcJMN nfPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="aX09KW4/"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-163851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163851-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cb10-20020a170906a44a00b00a58bcae3894si5828886ejb.904.2024.04.30.04.38.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 04:38:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="aX09KW4/"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-163851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163851-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 434411F224A4 for ; Tue, 30 Apr 2024 11:38:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23DA812D762; Tue, 30 Apr 2024 11:38:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aX09KW4/" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D12112C47A for ; Tue, 30 Apr 2024 11:37:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714477080; cv=none; b=CLvkaCLkQOSS1JlqHoqMa/5u9nkhs87GgSX9rzhRIGH6gaZV8bgGSPfdBxSofUY/e7jEPh9Gy8qgG/De7tedjCRjEJsB++O2Kn09JOVEewdGMY4k6h2zGmsSt598M9Vh3O9oZMF4flCAGqkuF0r94lYgcM4heTzhYzNS1w/7vU8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714477080; c=relaxed/simple; bh=4gpEbG/4BWXqKWr/5VqbybEdY4EHhTTloRCq1lV4Ylg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jk1g5uc7yebwRC1pc8Aq1TfpKwKQgTPtlIebf8xq0LBl+4+p7VbS9GQXOmA4jPTaifT18+UDg3BX4XZ2uy9or3flHk3IlTO2vuiYUZYtAW9MK4umePuAR5wIao0eQsOPrrRJt7hFMX4acV2IzLMG6FfjU2HLQ5K+oDj15+SE75w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=aX09KW4/; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714477077; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=eiAW+x1zKVTvGTvtjODDDjCAqDM2UP0sxyHU46nIuLU=; b=aX09KW4/VBUT81IL0job8OAy98hlg0bMytHkdppPTLRBYt79Yn/w6Rh5IEFAv1ayEqbigb rRQEFNFdR5P4gQRAqudzxFMDYYYupGOwtscG/2UZ7SYiKE+q1rdKfLS2nz7SYDEuBAWSTg arBROw/Fm0BnqbksrgP7+6dn8RMAXZg= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-81-CSYCeH6KNHaA_j7W3RG3Yw-1; Tue, 30 Apr 2024 07:37:56 -0400 X-MC-Unique: CSYCeH6KNHaA_j7W3RG3Yw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4169d69ce6bso23952215e9.2 for ; Tue, 30 Apr 2024 04:37:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714477075; x=1715081875; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=eiAW+x1zKVTvGTvtjODDDjCAqDM2UP0sxyHU46nIuLU=; b=Her2W6e97eYskGxxqKEmQxxEAw0H78YMVVFlUhf50ZeKJY0rgIwWQU+tVIT9oo+JLA gHDcjLN0yHPSXXgqwJZ+qIQKv+UluzARNCY/RD9SzN5wDUrvT/JQNzNSuaEiVryVe823 bPJC2eTp3PayuH+8uXe3sxuJ9bL4NqwdL6cjcFGGb17J/RL7a+LN4u25a7HNDPbdPJFg UrYpFiX0V/ptgRyPOof7ESh8PWf7lJdcElNsWYnwFWZU1dvvloo54p/34jqWs1rNPdi5 GEw2WengyZsoyK/HM/ZYy4gmNG3LGE78v68ZuJqnyd0yMfqbl4U1tqsAnj2zHSmGy46S ECGQ== X-Forwarded-Encrypted: i=1; AJvYcCX/KpEQkl0ALKsJW8Apl11iek04wrUwvmgmrk3wqCLb1+t96FKlky4R3Vo267IcjMJGwCSm3ELR+4zGSxgnvjzlgW0hsTI6U9V6Dqv4 X-Gm-Message-State: AOJu0YyFmvUvIhJMx3WlV8CvpKddkVKCmzp90i1jeICbl+6Np/7/HpP9 WIh8BFYLBFmCg6bZUqXR7ZMrESKG+3RVLmo735gowrdNrILTYna56kbyXxQOJFeNIilblUWVLA5 L10ZGYI3fG0CserQLOHxdDnuahOxCIUhxjhP5AIpyWrd8bEnkSQjP3j167oXoIw== X-Received: by 2002:a05:600c:3d9b:b0:41b:fe6e:8a0e with SMTP id bi27-20020a05600c3d9b00b0041bfe6e8a0emr1846691wmb.13.1714477075175; Tue, 30 Apr 2024 04:37:55 -0700 (PDT) X-Received: by 2002:a05:600c:3d9b:b0:41b:fe6e:8a0e with SMTP id bi27-20020a05600c3d9b00b0041bfe6e8a0emr1846679wmb.13.1714477074783; Tue, 30 Apr 2024 04:37:54 -0700 (PDT) Received: from ?IPV6:2a09:80c0:192:0:5dac:bf3d:c41:c3e7? ([2a09:80c0:192:0:5dac:bf3d:c41:c3e7]) by smtp.gmail.com with ESMTPSA id je1-20020a05600c1f8100b0041adf358058sm25048834wmb.27.2024.04.30.04.37.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Apr 2024 04:37:54 -0700 (PDT) Message-ID: <29fd6909-73d2-4b7e-99ef-0101cde1ba8a@redhat.com> Date: Tue, 30 Apr 2024 13:37:53 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/3] arm64/mm: Refactor PMD_PRESENT_INVALID and PTE_PROT_NONE bits To: Catalin Marinas , Ryan Roberts Cc: Will Deacon , Joey Gouly , Ard Biesheuvel , Mark Rutland , Anshuman Khandual , Peter Xu , Mike Rapoport , Shivansh Vij , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240429140208.238056-1-ryan.roberts@arm.com> <20240429140208.238056-2-ryan.roberts@arm.com> <839d6975-ce12-4fc9-aa3b-8ec5787bf577@arm.com> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y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Px2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 30.04.24 13:11, Catalin Marinas wrote: > On Mon, Apr 29, 2024 at 06:15:45PM +0100, Ryan Roberts wrote: >> On 29/04/2024 17:20, Catalin Marinas wrote: >>> On Mon, Apr 29, 2024 at 03:02:05PM +0100, Ryan Roberts wrote: >>>> diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h >>>> index dd9ee67d1d87..de62e6881154 100644 >>>> --- a/arch/arm64/include/asm/pgtable-prot.h >>>> +++ b/arch/arm64/include/asm/pgtable-prot.h >>>> @@ -18,14 +18,7 @@ >>>> #define PTE_DIRTY (_AT(pteval_t, 1) << 55) >>>> #define PTE_SPECIAL (_AT(pteval_t, 1) << 56) >>>> #define PTE_DEVMAP (_AT(pteval_t, 1) << 57) >>>> -#define PTE_PROT_NONE (_AT(pteval_t, 1) << 58) /* only when !PTE_VALID */ >>>> - >>>> -/* >>>> - * This bit indicates that the entry is present i.e. pmd_page() >>>> - * still points to a valid huge page in memory even if the pmd >>>> - * has been invalidated. >>>> - */ >>>> -#define PMD_PRESENT_INVALID (_AT(pteval_t, 1) << 59) /* only when !PMD_SECT_VALID */ >>>> +#define PTE_INVALID (_AT(pteval_t, 1) << 59) /* only when !PTE_VALID */ >>> >>> Nitpick - I prefer the PTE_PRESENT_INVALID name as it makes it clearer >>> it's a present pte. We already have PTE_VALID, calling it PTE_INVALID >>> looks like a negation only. >> >> Meh, for me the pte can only be valid or invalid if it is present. So it's >> implicit. And if you have PTE_PRESENT_INVALID you should also have >> PTE_PRESENT_VALID. >> >> We also have pte_mkinvalid(), which is core-mm-defined. In your scheme, surely >> it should be pte_mkpresent_invalid()? >> >> But you're the boss, I'll change this to PTE_PRESENT_INVALID. :-( > > TBH, I don't have a strong opinion but best to avoid the bikeshedding. > I'll leave the decision to you ;). It would match the pmd_mkinvalid() > core code. But if you drop 'present' make sure you add a comment above > that it's meant for present ptes. FWIW, I was confused by present = valid | invalid Something like present = present_valid | present_invalid would be more obvious at least to me ;) -- Cheers, David / dhildenb