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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14AE9C7EE2D for ; Sun, 26 Feb 2023 20:22:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B83E6B0072; Sun, 26 Feb 2023 15:22:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 568406B0073; Sun, 26 Feb 2023 15:22:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 430276B0074; Sun, 26 Feb 2023 15:22:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 33C1F6B0072 for ; Sun, 26 Feb 2023 15:22:00 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DD5D0C070C for ; Sun, 26 Feb 2023 20:21:59 +0000 (UTC) X-FDA: 80510564358.14.46E764E Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) by imf16.hostedemail.com (Postfix) with ESMTP id 11D7E180004 for ; Sun, 26 Feb 2023 20:21:57 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of geert.uytterhoeven@gmail.com designates 209.85.160.177 as permitted sender) smtp.mailfrom=geert.uytterhoeven@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677442918; h=from:from:sender: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: in-reply-to:in-reply-to:references:references; bh=Gg5lD1thnSOjSPD2ugSmhhuDJpRIfjxQ4WV4ji/sEm4=; b=BVhybCJSX0S+HWUKNcVjmkDAO9cEpKbowze4VjU5U9kL8wnRyBcCQVbnNyCrYWD3DlI/Ew l/wWgk5JuYaSVXafsFIK1COs2U8gCh9r/NJVygudcZvgwlQ3JHpYVn39qvE6LfuCOKO6X8 nSYOuJ6L4dph8nVlsygE3RAdta98P6o= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of geert.uytterhoeven@gmail.com designates 209.85.160.177 as permitted sender) smtp.mailfrom=geert.uytterhoeven@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677442918; a=rsa-sha256; cv=none; b=QAvukWOoNdA7NPvpj/5QI6D8NHA1Opb4VVhhtU01mSsHzvoI8Fh5cbufa7Fq5pHEKF42oP 3I8UySv54byfXpUDvkRX+dmKyyl/+agcpsApKA4kyKGkFk5wyNbS+wPD17ww4hFyzkypbK mk/E/U/KUWIqTyyuwOmQlynN16Yh7fk= Received: by mail-qt1-f177.google.com with SMTP id y10so83888qtj.2 for ; Sun, 26 Feb 2023 12:21:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Gg5lD1thnSOjSPD2ugSmhhuDJpRIfjxQ4WV4ji/sEm4=; b=iN+GDq+2NT69jdXJyTozWyx9on6zj8Z1OgMoLXHzt7ARbMpkogOyvOX+UK0st+spp6 iew+7KqIgzRFO2gsdoYN7fUcgU6LYrQc4QITVyOyZMLRro5oYia+oaSZNoOed0iHBKnF 6Js28hWcN6kzs/qsqWMh7CMRrkpz0zqWLjT87py7O7unH99FuDryBr0CzujdeH//td1z ufPnJcdDnuar2Hm2XO2qniVb5hqDIzCHgme7qCNNCxqFqGxoAVkrn0af5zC6Mrbtoffl EX561rWihbNGgNzTai697UMrDgEZu59XKHRdBVcxfx7Y8wZi9TD+vtEiW96EaAE+4Yw5 JZtw== X-Gm-Message-State: AO0yUKUaa6rZo1P1TdZPkjjX7AGu4E51ESNdfYLohbJU+4VfNskpKzv3 5xmI2hVCqMWSG7yKqdWWZqLwcuDUHd4KTA== X-Google-Smtp-Source: AK7set9J/Lll0/fmcZ5RW+p4PuOR3q47Ucxf9jPwrBfsXY0Hm5FEG5fULBx+x0DWFHZGYVDVpQcQlw== X-Received: by 2002:ac8:5b08:0:b0:3bf:bee1:1a67 with SMTP id m8-20020ac85b08000000b003bfbee11a67mr15090389qtw.17.1677442917001; Sun, 26 Feb 2023 12:21:57 -0800 (PST) Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com. [209.85.219.49]) by smtp.gmail.com with ESMTPSA id y25-20020ac87c99000000b003b63b8df24asm3405403qtv.36.2023.02.26.12.21.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Feb 2023 12:21:56 -0800 (PST) Received: by mail-qv1-f49.google.com with SMTP id y12so3218297qvt.8 for ; Sun, 26 Feb 2023 12:21:56 -0800 (PST) X-Received: by 2002:a81:af5f:0:b0:536:38b4:f51 with SMTP id x31-20020a81af5f000000b0053638b40f51mr8731562ywj.5.1677442427017; Sun, 26 Feb 2023 12:13:47 -0800 (PST) MIME-Version: 1.0 References: <20230113171026.582290-1-david@redhat.com> <20230113171026.582290-12-david@redhat.com> In-Reply-To: <20230113171026.582290-12-david@redhat.com> From: Geert Uytterhoeven Date: Sun, 26 Feb 2023 21:13:33 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH mm-unstable v1 11/26] microblaze/mm: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, Andrew Morton , Hugh Dickins , John Hubbard , Jason Gunthorpe , Mike Rapoport , Yang Shi , Vlastimil Babka , Nadav Amit , Andrea Arcangeli , Peter Xu , linux-mm@kvack.org, x86@kernel.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, Michal Simek Content-Type: text/plain; charset="UTF-8" X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 11D7E180004 X-Stat-Signature: z67sz5b4t9ioyiq1jybppycieb417hdt X-HE-Tag: 1677442917-43615 X-HE-Meta: U2FsdGVkX1+9ESOe28SZ9KsiqU1nGO1y8HZ+RFDDC6vYJbPZuSofH7Cjhak/L+2tY330uPB3wZIdXD5gCSwFtSts1YOimQTNQ+yp3x5KDp2WdjjCpG5P/5o+dPZ3pBcUrqGuT/srbu9imFW5+lPJgIiFuZ482De6j43+tyYdjZITnwy2zRmLvwvnWE7422nUpy5+8x9mSxNDYq142y6hLW/8kGeLFS3qhkj6OMz9NGhmGxY45DKic+Ce6vYX2z8y1yy1WOvL7mdeZQzVG6ycXvNrPg8+IOVJ3kXEcse0q/Cognd7qMftdMCq6Kb5TvzdL6diaP2RDD4+cVwf94N4ysJNd4Sx+z1HVNa4K08HNaBsvx9uw8hOrPfS7CHDYcSHEqpJI68676ptqki4Nj+yCwPLjKmh55qt/RNQj0CuNMLQh5lBJA6cFMxf4BP//Tq9zI0y+ET2scfIPRCNsLw2fkEG72sYt7M3Ds2aB800w5VAxdeQNRFLDQRYNPqYtlH4gKkzQbRow+rWYLKFgxhhH5imbLVbFnClk4jy5aOBg9+4EArXEuxkgw+UIpqHxBOE/3r7NoVDskqCK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ogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi David, On Fri, Jan 13, 2023 at 6:16 PM David Hildenbrand wrote: > Let's support __HAVE_ARCH_PTE_SWP_EXCLUSIVE by stealing one bit > from the type. Generic MM currently only uses 5 bits for the type > (MAX_SWAPFILES_SHIFT), so the stolen bit is effectively unused. > > The shift by 2 when converting between PTE and arch-specific swap entry > makes the swap PTE layout a little bit harder to decipher. > > While at it, drop the comment from paulus---copy-and-paste leftover > from powerpc where we actually have _PAGE_HASHPTE---and mask the type in > __swp_entry_to_pte() as well. > > Cc: Michal Simek > Signed-off-by: David Hildenbrand Thanks for your patch, which is now commit b5c88f21531c3457 ("microblaze/mm: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE") in > arch/m68k/include/asm/mcf_pgtable.h | 4 +-- What is this m68k change doing here? Sorry for not noticing this earlier. Furthermore, several things below look strange to me... > arch/microblaze/include/asm/pgtable.h | 45 +++++++++++++++++++++------ > 2 files changed, 37 insertions(+), 12 deletions(-) > > diff --git a/arch/m68k/include/asm/mcf_pgtable.h b/arch/m68k/include/asm/mcf_pgtable.h > index 3f8f4d0e66dd..e573d7b649f7 100644 > --- a/arch/m68k/include/asm/mcf_pgtable.h > +++ b/arch/m68k/include/asm/mcf_pgtable.h > @@ -46,8 +46,8 @@ > #define _CACHEMASK040 (~0x060) > #define _PAGE_GLOBAL040 0x400 /* 68040 global bit, used for kva descs */ > > -/* We borrow bit 7 to store the exclusive marker in swap PTEs. */ > -#define _PAGE_SWP_EXCLUSIVE 0x080 > +/* We borrow bit 24 to store the exclusive marker in swap PTEs. */ > +#define _PAGE_SWP_EXCLUSIVE CF_PAGE_NOCACHE CF_PAGE_NOCACHE is 0x80, so this is still bit 7, thus the new comment is wrong? > > /* > * Externally used page protection values. > diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h > index 42f5988e998b..7e3de54bf426 100644 > --- a/arch/microblaze/include/asm/pgtable.h > +++ b/arch/microblaze/include/asm/pgtable.h > @@ -131,10 +131,10 @@ extern pte_t *va_to_pte(unsigned long address); > * of the 16 available. Bit 24-26 of the TLB are cleared in the TLB > * miss handler. Bit 27 is PAGE_USER, thus selecting the correct > * zone. > - * - PRESENT *must* be in the bottom two bits because swap cache > - * entries use the top 30 bits. Because 4xx doesn't support SMP > - * anyway, M is irrelevant so we borrow it for PAGE_PRESENT. Bit 30 > - * is cleared in the TLB miss handler before the TLB entry is loaded. > + * - PRESENT *must* be in the bottom two bits because swap PTEs use the top > + * 30 bits. Because 4xx doesn't support SMP anyway, M is irrelevant so we > + * borrow it for PAGE_PRESENT. Bit 30 is cleared in the TLB miss handler > + * before the TLB entry is loaded. So the PowerPC 4xx comment is still here? > * - All other bits of the PTE are loaded into TLBLO without > * * modification, leaving us only the bits 20, 21, 24, 25, 26, 30 for > * software PTE bits. We actually use bits 21, 24, 25, and > @@ -155,6 +155,9 @@ extern pte_t *va_to_pte(unsigned long address); > #define _PAGE_ACCESSED 0x400 /* software: R: page referenced */ > #define _PMD_PRESENT PAGE_MASK > > +/* We borrow bit 24 to store the exclusive marker in swap PTEs. */ > +#define _PAGE_SWP_EXCLUSIVE _PAGE_DIRTY _PAGE_DIRTY is 0x80, so this is also bit 7, thus the new comment is wrong? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds