Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3578674imm; Sun, 17 Jun 2018 23:59:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJeIvvVGXYuB4gZz1nXZ72wqf+Z6Ek7zwxoP3/id8Y3MNEN11GyaKzq2mOtjQvr9/RgAhMz X-Received: by 2002:a17:902:9a95:: with SMTP id w21-v6mr12720535plp.168.1529305160394; Sun, 17 Jun 2018 23:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529305160; cv=none; d=google.com; s=arc-20160816; b=v3YnBbd3qUUYlMmuESHiua8bGMyAFrpALh1cKl7bR1VH3JpIEva21bux9AF2uJJ0Vb oGgA3N7gSsjJ1Gr6vnPvjxCu7yIeX3PNQ7J80fpG4Bwmi5z+RnpsS+uwkrb+4LVovzM/ MuudcD5l2W1F2hbKZaghQDw/qRqOILVopZjytCtQwBrdftWL7K94QnClLKu0YYfH+BJ1 fZxA4/9ID67AIpnslDpLe97Tm8eezNlQzA9/n0AR1EaAjUOMMyVrrU94K5kvfjbEsxRB e6l7I8qW2fiAfqvco3HsYreN2LPaS86gdQJRCBQ71BNc62W4yswuH29rflYqPf8JpTyZ yg2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:arc-authentication-results; bh=/smcjl1Ha+ltFrV+ReNIiGBGjjtIHxKfKyP50YiJGMU=; b=jrwrG8B/5O8aENoivdRyxYy+wC+J5PrC/I/dkHPXAqa0ywJoLsUOjYGIpwpr1lZb6v MOGF0dHPXSd6KyWgRYyr3PCSqTTmOXTRmOrkEFHce+vUWbZ3UKq3B3CxxGWoIPtrxOxl uzkQdYNiW/pDo6eya0ntUe6WQ7gPKv6HpdRWbApZwACEGlqRUMSPzCFG8jFcmYIa8sDp OPUGldhQRPsKPNJc4EKwChfeaZhBekQETIsc+jl7EplmC8iU//l7SvRek1ZYj81LCg2G iJGHT8w4prm/OMgrTGq+5gKQcykrRJBYQ4SYFWciewVTouv2zMB7a/YElmtZTETMCsL8 Blmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j12-v6si11308577pgf.359.2018.06.17.23.59.06; Sun, 17 Jun 2018 23:59:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755030AbeFRG6Z (ORCPT + 99 others); Mon, 18 Jun 2018 02:58:25 -0400 Received: from mail-vk0-f65.google.com ([209.85.213.65]:34286 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754884AbeFRG6Y (ORCPT ); Mon, 18 Jun 2018 02:58:24 -0400 Received: by mail-vk0-f65.google.com with SMTP id q135-v6so8894654vkh.1; Sun, 17 Jun 2018 23:58:23 -0700 (PDT) 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; bh=/smcjl1Ha+ltFrV+ReNIiGBGjjtIHxKfKyP50YiJGMU=; b=s+c+xJTyM4QnRFimICwaL+UKkOnAowlGa520onHnwDdAcVWMthJ04Hs2nK3FPgAdTw ojvLFdOL3Yah4ZxCnRzNp8JtHkmCF+yeuUNjGf4Hd055Yi+AF4ZVUR5a8JtAlGSBGUdT 5lqW2D/FYTO8O268FeLfGCjKqQSl2Ew7vdpwxJ8uG+pr6q0axOoD9Aj1sGeCBKMRc1pY /te5PPjEfbpLBPZCqoGdSZ1OJO/1TGzyh29ecgCT5HNP00IbYwgAI/ds+mxJaoP/uh5K W+wtU9WjAT9F79WZCEKSon7eUOo2mvweRGc3keumyQPYJBCmC0PGagoKrG+Yqe3M8Ksj A7Sg== X-Gm-Message-State: APt69E0Qqx3ANSgNKwHvcJigqnBTvyLWyjdJ7L5mm/ecCXUyjCKeStAr gCG4tR+AdntePTd+qA3IhAI6/tIgmC52xs7IlZc= X-Received: by 2002:a1f:2c0d:: with SMTP id s13-v6mr6255299vks.106.1529305103243; Sun, 17 Jun 2018 23:58:23 -0700 (PDT) MIME-Version: 1.0 References: <20180618060426.24497-1-gerg@linux-m68k.org> In-Reply-To: <20180618060426.24497-1-gerg@linux-m68k.org> From: Geert Uytterhoeven Date: Mon, 18 Jun 2018 08:58:11 +0200 Message-ID: Subject: Re: [PATCH] m68k: fix "bad page state" oops on ColdFire boot To: Greg Ungerer Cc: Matthew Wilcox , "Linux/m68k" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, On Mon, Jun 18, 2018 at 8:06 AM Greg Ungerer wrote: > Booting a ColdFire m68k core with MMU enabled causes a "bad page state" > oops since commit 1d40a5ea01d5 ("mm: mark pages in use for page tables"): > > BUG: Bad page state in process sh pfn:01ce2 > page:004fefc8 count:0 mapcount:-1024 mapping:00000000 index:0x0 > flags: 0x0() > raw: 00000000 00000000 00000000 fffffbff 00000000 00000100 00000200 00000000 > raw: 039c4000 > page dumped because: nonzero mapcount > Modules linked in: > CPU: 0 PID: 22 Comm: sh Not tainted 4.17.0-07461-g1d40a5ea01d5 #13 > > Fix by calling pgtable_page_dtor() in our __pte_free_tlb() code path, > so that the PG_table flag is cleared before we free the pte page. > > Signed-off-by: Greg Ungerer > CC: Matthew Wilcox > --- > arch/m68k/include/asm/mcf_pgalloc.h | 1 + > 1 file changed, 1 insertion(+) > > Matthew: I came across this thread at https://lkml.org/lkml/2018/6/17/163 > about a similar problem with openrisc. Based on that I came up > with this fix for m68k/ColdFire. Fixes the issue for me. > > diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h > index 8b707c249026..8c441eb57b80 100644 > --- a/arch/m68k/include/asm/mcf_pgalloc.h > +++ b/arch/m68k/include/asm/mcf_pgalloc.h > @@ -44,6 +44,7 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) > static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page, > unsigned long address) > { > + pgtable_page_dtor(page); > __free_page(page); > } Do you need a call to pgtable_page_dtor() in pte_free(), too? On x86 (and motorola_pgalloc.h and sun3_pgalloc.h FWIW), both functions call pgtable_page_dtor(). 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