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=-15.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 76C06C433ED for ; Fri, 21 May 2021 02:44:03 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 05F976121E for ; Fri, 21 May 2021 02:44:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 05F976121E Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Message-ID:In-Reply-To: Subject:cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=R2UdImgv7bE1tdN4yeZ+auSdn3qcZkZlRDAxpDzhQXk=; b=ea0P6hnGaUbNIWxfoNFWYNrHdR M/Fva9f5VORpHlWss3p7kQjFaebw47W5zYFe3v7daVIrk+B0BZ8C5cMu1Q08FlukUKbz/WxxPcMbj bCZ6FjAX7JZ1T2hihFo7HEyr8qqAx5m3ysPPVatO+KbWgeGhc09LEaWaLpKGMvJB8sUMhZtrjuYOX 7c/DsT8ZfkfQGSSKj0ZWUYjINobj2OwaFf5OUf1esRa5QfX5vg9jHZRViUa3HQSQnsWUbZs2ucK2Z ZDI20Df28WXsZt3UN/innl/AzsUPl4iSrwE01AuAuf+UZG42yOsNStTAKvWBnJTwrEuJrynVEm/gG pC6f2PSA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljv6E-003Y8G-Oq; Fri, 21 May 2021 02:41:19 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljv69-003Y79-9V for linux-arm-kernel@desiato.infradead.org; Fri, 21 May 2021 02:41:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:References: Message-ID:In-Reply-To:Subject:cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=clTNK84qmQnT49cW6tGZ0mkoH1KVBt8rRddpIhtzd0w=; b=h2toIupgJ1PSLocq9+eQU7pBf9 KJP2NjTfMhDV1Gt+kGKxFjB3kHbYtJZSjzx73yPlpYy3zYltxVKbV9onS/VbaQw46/79eT/UMjpZY 7O3jLUa0vztvb3F4AlZId+vglUJR0viTI+jC7hLhdT9sE/0XpIVLf5lrGctW4Z8Si+sfDHwJlDkU0 coipFyYtWSL8/5zX+jYd+4qS4iPu8bVIOmrw6nKzNP0Wdz9kW9IjYw3441SL4/9+DG3xxK3D2U6qd mimmWjlQr2wHlD62eoJv5QaMnDPSHbvFEX2TIJ9g0FYa8CYCyIHpux/GomMBzpHFGoYSJH7X0XveR /9yrGbYw==; Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljv64-00GmM8-9N for linux-arm-kernel@lists.infradead.org; Fri, 21 May 2021 02:41:09 +0000 Received: by mail-qk1-x72c.google.com with SMTP id k127so18389628qkc.6 for ; Thu, 20 May 2021 19:41:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=clTNK84qmQnT49cW6tGZ0mkoH1KVBt8rRddpIhtzd0w=; b=FxZ3pPNP3r7fr9GQhaPsgaA0oEfdhBPJQAw+4Hpjpz6htCWmQ0/9JhdsN49sFbCLfO RtKLLefmbAM4smuFkrjbLIn4dO9xkWuE6MbZ7PaEnSCucPviP2zAbmXU8FW9Ac0LTZja XerHR8GGYd+9fct4cNNraXHn8cUvmeiYSRSfsqk5pruB46Zz2vJmWKoPxYYaeeYx2zDB L82vf/+i3mYvy6+FSvu2/CgZ1zBU7E+N5/2h+uOg958QqYy5O8UCNcVnLxmpD59InOPx t3/eb9AQ9C9M77kHV3EK75TS/pl2KLR7K3rzgVnQsCES2JvKBmp8StAduOtXET60ZBl5 kw+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=clTNK84qmQnT49cW6tGZ0mkoH1KVBt8rRddpIhtzd0w=; b=V+chgj0IQbEyioPEs04VAIWPiQx5OSJCz82UsDL7tFhYvAFksCQTkox6lBliU+T0LI Z/l3KI3QPcOIhJM6xWHz7yNHhKjQKcJolG49mmxGEsRQxaLGkzOvDXb40wkGyL7w7XIH V0VQA9qd06zP1Oy8Ywe65NjwlWhBhFZcf4JHtSDHfsl4Pi/OyMGg4rGhZPYS20tZqxGh 5mgqpHPmFjLN17FHcHz7+IZpxvggBWx3PWXpail33jlXlJwqe6uyeB4XPrsRnOcXh05g i11ab70Q2JIq2Qr34lkoMzd3MiMvLglA6ReDsWRx8isPL1FJX75qjrUl7Zv1U9JWiEFW DtiA== X-Gm-Message-State: AOAM532JvrZ6Dz0sEvAY1x6Jnydqaam4XwCs+jTtPss6GNJUke9V9rM3 NVcuVs7ZUsWeGiqNDLOyD0+wjY51XN8Xeg== X-Google-Smtp-Source: ABdhPJxVvMC3v4V0bceqoWJlw1Fq60XDP/8PB6CsXBpgkq+puRi6otC/EH2aZu7PD2aAAXOjHkmGmQ== X-Received: by 2002:a37:9d81:: with SMTP id g123mr9321375qke.280.1621564865802; Thu, 20 May 2021 19:41:05 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id h16sm3274617qke.43.2021.05.20.19.41.04 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Thu, 20 May 2021 19:41:05 -0700 (PDT) Date: Thu, 20 May 2021 19:41:03 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Russell King cc: linux-arm-kernel@lists.infradead.org, Anshuman Khandual , Thomas Gleixner , Allison Randal , linux-kernel@vger.kernel.org Subject: Re: [PATCH] ARM: update __swp_entry_to_pte() to use PTE_TYPE_FAULT In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210520_194108_365372_4C952E79 X-CRM114-Status: GOOD ( 25.31 ) 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 Thu, 13 May 2021, Russell King wrote: > Swap entries use a faulting PTE which have the least two significant > bits as zero. Due to this, the use of PTE_TYPE_FAULT was overlooked, > but really should have been included in __swp_entry_to_pte(). > > Convert this macro to use PTE_TYPE_FAULT to properly document what is > going on here, and use __pte() to convert the swp_entry_t to a pte_t. > > This results in no change to the resulting kernel text. > > Signed-off-by: Russell King Hmm. Speaking as one who occasionally has to trawl through all the architectures considering their __swp_entry() implementations, I would much prefer you to drop this patch: I don't think it helps anyone to insist on ORing in (something which when one searches further turns out to be) 0. But if you really want to keep it, please remember it's not just __swp_entry_to_pte() that "needs" changing: __pte_to_swp_entry() ought to mask it off, pte_clear() ought to set it, pte_none() ought to compare against it, page table initialization ought to memset with it, and probably more :) Thanks, Hugh > --- > arch/arm/include/asm/pgtable.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h > index c02f24400369..c43e07d6046d 100644 > --- a/arch/arm/include/asm/pgtable.h > +++ b/arch/arm/include/asm/pgtable.h > @@ -303,7 +303,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) > #define __swp_entry(type,offset) ((swp_entry_t) { ((type) << __SWP_TYPE_SHIFT) | ((offset) << __SWP_OFFSET_SHIFT) }) > > #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) > -#define __swp_entry_to_pte(swp) ((pte_t) { (swp).val }) > +#define __swp_entry_to_pte(swp) __pte((swp).val | PTE_TYPE_FAULT) > > /* > * It is an error for the kernel to have more swap files than we can > -- > 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel