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=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no 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 89A98CA9ED3 for ; Mon, 4 Nov 2019 08:53:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 34D3821929 for ; Mon, 4 Nov 2019 08:53:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34D3821929 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A9E156B0005; Mon, 4 Nov 2019 03:53:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A4EB86B0006; Mon, 4 Nov 2019 03:53:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93D0C6B0007; Mon, 4 Nov 2019 03:53:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 7B3D76B0005 for ; Mon, 4 Nov 2019 03:53:47 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 1C380584D for ; Mon, 4 Nov 2019 08:53:47 +0000 (UTC) X-FDA: 76117982094.01.paint36_5b30b910a6a37 X-HE-Tag: paint36_5b30b910a6a37 X-Filterd-Recvd-Size: 9534 Received: from mail-oi1-f193.google.com (mail-oi1-f193.google.com [209.85.167.193]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 Nov 2019 08:53:46 +0000 (UTC) Received: by mail-oi1-f193.google.com with SMTP id m193so13431342oig.0 for ; Mon, 04 Nov 2019 00:53:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ftGbwwjNOfRweFmtue9SSD86OxwGEsa99D0pa3CKj2k=; b=n989/zz9fDPeCAJhTEi1npg8bcs4PywJJr5GV6qxCEtNUy2Nig0CoGQ1pg9RRDvXid /ai9/3lVpyIYABoQxQfcK01X23jovsY6zhY1D22sVYzcqopozMptkccJJhVFs3qldNop anw90iaxpDpzuEXEX6wukIRuxQVaOqykhJySHmkCqzfgJuW/VLGgKjK8pWbU0QGTtKMe iAx9ElgnD5CI83G6zIjFqiX9+C2iIyupYLV0dZZMscbxMHG3bT8BSlw/RaosH//oGUPm YRD0tx5+2pTPbc473xWCE6BJSmCy2cCSU2dnyUrizyrMtYOEWIhiGELUgpqUWwqs7mFd yJdw== X-Gm-Message-State: APjAAAVFMSixO+j3RWbJg4PWp/S0B1rEPubxt7C1lV4XSB2AOLUY0Hrs Hx1hiyInqFPZoTzHnwgKaMRPoRCdp6yUMWV9c20= X-Google-Smtp-Source: APXvYqwHBlxWvX9baD3gMlRXyGYNGxo8XeR6zpTu9ocP235D46KuJQHptAVE+pdBySSjAAujVU5GG1b4JqAjn27tERM= X-Received: by 2002:aca:882:: with SMTP id 124mr32125oii.54.1572857625673; Mon, 04 Nov 2019 00:53:45 -0800 (PST) MIME-Version: 1.0 References: <1572850587-20314-1-git-send-email-rppt@kernel.org> <1572850587-20314-6-git-send-email-rppt@kernel.org> In-Reply-To: <1572850587-20314-6-git-send-email-rppt@kernel.org> From: Geert Uytterhoeven Date: Mon, 4 Nov 2019 09:53:34 +0100 Message-ID: Subject: Re: [PATCH v3 05/13] m68k: mm: use pgtable-nopXd instead of 4level-fixup To: Mike Rapoport Cc: Linux MM , Andrew Morton , Anton Ivanov , Arnd Bergmann , "David S. Miller" , Greentime Hu , Greg Ungerer , Helge Deller , "James E.J. Bottomley" , Jeff Dike , "Kirill A. Shutemov" , Linus Torvalds , Mark Salter , Matt Turner , Michal Simek , Peter Rosin , Richard Weinberger , Rolf Eike Beer , Russell King , Sam Creasey , Vincent Chen , Vineet Gupta , alpha , Linux-Arch , Linux ARM , linux-c6x-dev@linux-c6x.org, Linux Kernel Mailing List , linux-m68k , Parisc List , linux-um@lists.infradead.org, sparclinux , Mike Rapoport Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Mike, On Mon, Nov 4, 2019 at 7:57 AM Mike Rapoport wrote: > From: Mike Rapoport > m68k has two or three levels of page tables and can use appropriate > pgtable-nopXd and folding of the upper layers. > > Replace usage of include/asm-generic/4level-fixup.h and explicit > definitions of __PAGETABLE_PxD_FOLDED in m68k with > include/asm-generic/pgtable-nopmd.h for two-level configurations and with > include/asm-generic/pgtable-nopud.h for three-lelve configurations and > adjust page table manipulation macros and functions accordingly. > > Signed-off-by: Mike Rapoport > Acked-by: Greg Ungerer Thanks for your patch! The build error reported for v1 by kbuild test robot when building for sun3x is still there (m68k defconfig or sun3x_defconfig): arch/m68k/sun3x/dvma.c: In function =E2=80=98dvma_map_cpu=E2=80=99: arch/m68k/sun3x/dvma.c:98:33: error: passing argument 2 of =E2=80=98pmd_alloc=E2=80=99 from incompatible pointer type [-Werror=3Dincompatible-pointer-types] if((pmd =3D pmd_alloc(&init_mm, pgd, vaddr)) =3D=3D NULL) { ^~~ In file included from arch/m68k/sun3x/dvma.c:17: include/linux/mm.h:1875:61: note: expected =E2=80=98pud_t *=E2=80=99 {a= ka =E2=80=98struct *=E2=80=99} but argument is of type =E2=80=98pgd_t *=E2=80=99 {= aka =E2=80=98struct *=E2=80=99} static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address) ~~~~~~~^~~ This indeed boots fine on ARAnyM, which emulates on 68040. It would be good to have some boot testing on '020/030, too. > --- a/arch/m68k/mm/kmap.c > +++ b/arch/m68k/mm/kmap.c > @@ -196,17 +198,21 @@ void __iomem *__ioremap(unsigned long physaddr, uns= igned long size, int cachefla > printk ("\npa=3D%#lx va=3D%#lx ", physaddr, virta= ddr); > #endif > pgd_dir =3D pgd_offset_k(virtaddr); > - pmd_dir =3D pmd_alloc(&init_mm, pgd_dir, virtaddr); > + p4d_dir =3D p4d_offset(pgd_dir, virtaddr); > + pud_dir =3D pud_offset(p4d_dir, virtaddr); > + pmd_dir =3D pmd_alloc(&init_mm, pud_dir, virtaddr); > if (!pmd_dir) { > printk("ioremap: no mem for pmd_dir\n"); > return NULL; > } > > if (CPU_IS_020_OR_030) { > +#if CONFIG_PGTABLE_LEVELS =3D=3D 3 This check puzzled me a bit: when we get here, CONFIG_PGTABLE_LEVELS is always true. However, the check cannot be removed, as the code it protects fails to comp= ile when building for Coldfire. Perhaps this can be made more clear by reverting the order? I.e. #if CONFIG_PGTABLE_LEVELS =3D=3D 3 if (CPU_IS_020_OR_030) { ... } else #endif { Or is there some better way? > pmd_dir->pmd[(virtaddr/PTRTREESIZE) & 15] =3D phy= saddr; > physaddr +=3D PTRTREESIZE; > virtaddr +=3D PTRTREESIZE; > size -=3D PTRTREESIZE; > +#endif > } else { > pte_dir =3D pte_alloc_kernel(pmd_dir, virtaddr); > if (!pte_dir) { > @@ -258,19 +264,24 @@ void __iounmap(void *addr, unsigned long size) > { > unsigned long virtaddr =3D (unsigned long)addr; > pgd_t *pgd_dir; > + p4d_t *p4d_dir; > + pud_t *pud_dir; > pmd_t *pmd_dir; > pte_t *pte_dir; > > while ((long)size > 0) { > pgd_dir =3D pgd_offset_k(virtaddr); > - if (pgd_bad(*pgd_dir)) { > - printk("iounmap: bad pgd(%08lx)\n", pgd_val(*pgd_= dir)); > - pgd_clear(pgd_dir); > + p4d_dir =3D p4d_offset(pgd_dir, virtaddr); > + pud_dir =3D pud_offset(p4d_dir, virtaddr); > + if (pud_bad(*pud_dir)) { > + printk("iounmap: bad pgd(%08lx)\n", pud_val(*pud_= dir)); > + pud_clear(pud_dir); > return; > } > - pmd_dir =3D pmd_offset(pgd_dir, virtaddr); > + pmd_dir =3D pmd_offset(pud_dir, virtaddr); > > if (CPU_IS_020_OR_030) { > +#if CONFIG_PGTABLE_LEVELS =3D=3D 3 Likewise. > int pmd_off =3D (virtaddr/PTRTREESIZE) & 15; > int pmd_type =3D pmd_dir->pmd[pmd_off] & _DESCTYP= E_MASK; > > @@ -341,14 +355,17 @@ void kernel_set_cachemode(void *addr, unsigned long= size, int cmode) > > while ((long)size > 0) { > pgd_dir =3D pgd_offset_k(virtaddr); > - if (pgd_bad(*pgd_dir)) { > - printk("iocachemode: bad pgd(%08lx)\n", pgd_val(*= pgd_dir)); > - pgd_clear(pgd_dir); > + p4d_dir =3D p4d_offset(pgd_dir, virtaddr); > + pud_dir =3D pud_offset(p4d_dir, virtaddr); > + if (pud_bad(*pud_dir)) { > + printk("iocachemode: bad pud(%08lx)\n", pud_val(*= pud_dir)); > + pud_clear(pud_dir); > return; > } > - pmd_dir =3D pmd_offset(pgd_dir, virtaddr); > + pmd_dir =3D pmd_offset(pud_dir, virtaddr); > > if (CPU_IS_020_OR_030) { > +#if CONFIG_PGTABLE_LEVELS =3D=3D 3 Likewise > int pmd_off =3D (virtaddr/PTRTREESIZE) & 15; > > if ((pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK) =3D= =3D _PAGE_PRESENT) { Gr{oetje,eeting}s, Geert --=20 Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k= .org In personal conversations with technical people, I call myself a hacker. Bu= t when I'm talking to journalists I just say "programmer" or something like t= hat. -- Linus Torvalds