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 985BCC433F5 for ; Thu, 17 Mar 2022 10:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Subject:From:References:Cc: To:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/LO5GNtwJGv0y1aLR6Ngw93TsiWPMq0AiNDdhJ7cAro=; b=kbichtrFGRBBKN s7LE8Dx2UKaMQ0e1YJwm3uDaKsuiBbwFPy90GWwMOiZMDSgOqPUdODZouS9JhDTqslxp3qqSZUq62 Rg7jtGih8wOlufjjGDDYn9syO1swQldq05aeDl6nO6hOUMmbSO/HbVxqtkX5XwYtZEiHFsZBJqDzn Me9BHxtTSey5N2ghluDprkc3RdRdYVxwoqlku/csuVHq3YcXGDsqS1PQecwMN2R3CarVX09pXnR/D xNlT4F9PFCVMpgkGJ5MjewTuE046HJFM39bSIKztb9g/Og30fTW86DYbhx5HVuTMutlxtRkOm5ING t5m7XJ5BPPNK2KB/lfcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUmzd-00FcHO-Kr; Thu, 17 Mar 2022 10:04:29 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUmzZ-00FcFZ-DW for linux-arm-kernel@lists.infradead.org; Thu, 17 Mar 2022 10:04:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647511463; 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; bh=MBNPObCUCYNtALaMx9Iaf80ooxBHklxdAF9RYy04dD0=; b=RMMKCscrOlXKZuztnOOW1WZCy+D7pbLNJo0axR/zFvOa7s1beHNskoh7xjHzwix201L3E9 4y4g9o+3XDL77JmJQyjZPl+MMBoLsCQ1y15+JCvnD7n13Q8fCEAtQR3c1fVQp3u3smhoXz C0GSEyeanGDNXoz/cJuEWZTZ8DYY9mA= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-264-Ga3dxgLDOkKa_526h6wTAQ-1; Thu, 17 Mar 2022 06:04:21 -0400 X-MC-Unique: Ga3dxgLDOkKa_526h6wTAQ-1 Received: by mail-wr1-f71.google.com with SMTP id j67-20020adf9149000000b00203e6b7d151so684968wrj.13 for ; Thu, 17 Mar 2022 03:04:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=MBNPObCUCYNtALaMx9Iaf80ooxBHklxdAF9RYy04dD0=; b=bUeVxFayztdoR1kulFALnkL2T9qOW48GKXcQ1gCmWQ5J7HYWRoFX9uOleWPafXT1ZA ysGyhxGOytlKEzFt5b6Pr1Le9IebZ8kTrTRSVcMlDCnHc9tVrK5m47kLebkuaiFDWEUb bloVuvplEplj1S10kmqwCU9Bo4qWOp1bN3EN1kvm9MOwwe60iPAuIFS9ZwlTG5y0kpub Ko2GpTLBHqm6qx1DUpZSl88pnPDfkDTW6g/KYxvzOvMo7Lh9MaPlrZ6QvwmhOtUV9e1T GfEHH2SBxt0f2uT892G9SqsQGr8/7mXazvuyuFAwkr14Cidfk9psrSq3edNPx+R/UDsK Mzpg== X-Gm-Message-State: AOAM531rKFy/DX1KLZDsySlLqXSAn/k5l24gkygmRgHC2+Xt2UpFjRo3 4LzD8BDLDH0i+UD/qCuKaGbC+/DSEER1kfxNpgscVHp1zdUDIufD6vhESV3cMP1Br7TdL6/g3i2 ny+l68jj2MrTaf3QuggCV39vJ7O/2OIMLd2k= X-Received: by 2002:a05:600c:a4a:b0:389:e8fd:54b4 with SMTP id c10-20020a05600c0a4a00b00389e8fd54b4mr3151304wmq.168.1647511460503; Thu, 17 Mar 2022 03:04:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqDnOUQ38GHBC7qxykUWE5EEPAwQFTum3x+dhkpMIFZaDI62UNmCzA1x1kIEv/0vMQ4ejNKg== X-Received: by 2002:a05:600c:a4a:b0:389:e8fd:54b4 with SMTP id c10-20020a05600c0a4a00b00389e8fd54b4mr3151270wmq.168.1647511460156; Thu, 17 Mar 2022 03:04:20 -0700 (PDT) Received: from ?IPV6:2a09:80c0:192:0:20af:34be:985b:b6c8? ([2a09:80c0:192:0:20af:34be:985b:b6c8]) by smtp.gmail.com with ESMTPSA id g13-20020a05600c4ecd00b0038a0165f2fbsm4412271wmq.17.2022.03.17.03.04.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Mar 2022 03:04:19 -0700 (PDT) Message-ID: Date: Thu, 17 Mar 2022 11:04:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 To: Catalin Marinas Cc: linux-kernel@vger.kernel.org, Andrew Morton , Hugh Dickins , Linus Torvalds , David Rientjes , Shakeel Butt , John Hubbard , Jason Gunthorpe , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Matthew Wilcox , Vlastimil Babka , Jann Horn , Michal Hocko , Nadav Amit , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Jan Kara , Liang Zhang , Pedro Gomes , Oded Gabbay , Will Deacon , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , linux-mm@kvack.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org References: <20220315141837.137118-1-david@redhat.com> <20220315141837.137118-5-david@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v1 4/7] arm64/pgtable: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220317_030425_579379_65E1B5D9 X-CRM114-Status: GOOD ( 19.74 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 16.03.22 19:27, Catalin Marinas wrote: > On Tue, Mar 15, 2022 at 03:18:34PM +0100, David Hildenbrand wrote: >> diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h >> index b1e1b74d993c..62e0ebeed720 100644 >> --- a/arch/arm64/include/asm/pgtable-prot.h >> +++ b/arch/arm64/include/asm/pgtable-prot.h >> @@ -14,6 +14,7 @@ >> * Software defined PTE bits definition. >> */ >> #define PTE_WRITE (PTE_DBM) /* same as DBM (51) */ >> +#define PTE_SWP_EXCLUSIVE (_AT(pteval_t, 1) << 2) /* only for swp ptes */ > > I think we can use bit 1 here. > >> @@ -909,12 +925,13 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma, >> /* >> * Encode and decode a swap entry: >> * bits 0-1: present (must be zero) >> - * bits 2-7: swap type >> + * bits 2: remember PG_anon_exclusive >> + * bits 3-7: swap type >> * bits 8-57: swap offset >> * bit 58: PTE_PROT_NONE (must be zero) > > I don't remember exactly why we reserved bits 0 and 1 when, from the > hardware perspective, it's sufficient for bit 0 to be 0 and the whole > pte becomes invalid. We use bit 1 as the 'table' bit (when 0 at pmd > level, it's a huge page) but we shouldn't check for this on a swap > entry. You mean arch/arm64/include/asm/pgtable-hwdef.h:#define PTE_TABLE_BIT (_AT(pteval_t, 1) << 1) right? I wonder why it even exists, for arm64 I only spot: arch/arm64/include/asm/pgtable.h:#define pte_mkhuge(pte) (__pte(pte_val(pte) & ~PTE_TABLE_BIT)) I don't really see code that sets PTE_TABLE_BIT. Similarly, I don't see code that sets PMD_TABLE_BIT/PUD_TABLE_BIT/P4D_TABLE_BIT. Most probably setting code is not using the defines, that's why I'm not finding it. -- Thanks, David / dhildenb _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel