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=-10.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, 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 2FD36C4708F for ; Wed, 2 Jun 2021 10:46:48 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id F09136138C for ; Wed, 2 Jun 2021 10:46:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F09136138C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk 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=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID: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=blxOqDfMh/U1GXlniRZP+kDoGmanB86beBMZSTJNH1U=; b=v5y8LlHSe8hexC LUY6a9YHGF7bsGmIlhIKqC4C7UKswwqZLouYm4qxySc91X4geEm0pJdDlrwAEDh1j3TqTgCfTEnQB gj/mfBqiuCFh2+ehz3EP1rZae3Mm8ZI4cb+lueYGPZQHdt8Pkv3zdcaFG1lXUDjnB0Q/AB6FK4AHS /WcOPjC3bqz3UA06QmmveE324x7QVgYksBjjdWvxE/8O/l4FPs96qQkDIAA8gIc/bSUUVO65OQg4T IYaO6dPaqAo6GwFBTpITIvyatMV+1EvnqZ7h/CdlTQwGLI5TcT1JLw7PxMH9QYbfTbEOTyn8yPowg siUSAp3CyHKLVVO9KLyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loOMy-003Qdi-OE; Wed, 02 Jun 2021 10:45:04 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loOMr-003Qb6-1o for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 10:45:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qYu8Ts1bocEFsnGvP/afFPXEZr07RjH9FpTtWVZLYEs=; b=ylvDKbIwGwezg3/kif1P+zkXT arbiVveeV4MTPzepIHP5eN1vpmGE/3kVkP9abSNWv0nRziMtsYzilaj/6KoET09rVXJccLBtyESld YjzREIbdyzzwmozLeLEyQM9oUS2NecNlX3hpH5AVn8SVs1fHF4nOqBWpjQ/DBT7sXs3gK8sNUfX6z jbp5ckdNvMJodF9TVyHY7Jb/fOzADM311QKdsuK6hVjmYVjJ3RbvsYA9p6wA7C2NSrdmYF5EQrxYA zV7q8Mr7iZD9WqpOVy/vxKirhCRXFjpJYAeDd0ojW+uGHOwI8TpxLxaZjCL0pH9JiF2lGeOv5lPoT UTVZEnEVw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:44616) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1loOMn-000120-50; Wed, 02 Jun 2021 11:44:53 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1loOMk-00013t-I7; Wed, 02 Jun 2021 11:44:50 +0100 Date: Wed, 2 Jun 2021 11:44:50 +0100 From: "Russell King (Oracle)" To: Kefeng Wang Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , linux-kernel@vger.kernel.org, Andrew Morton , Jungseung Lee Subject: Re: [PATCH v2 4/7] ARM: mm: print out correct page table entries Message-ID: <20210602104450.GH30436@shell.armlinux.org.uk> References: <20210602070246.83990-1-wangkefeng.wang@huawei.com> <20210602070246.83990-5-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210602070246.83990-5-wangkefeng.wang@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_034457_121301_97F22E68 X-CRM114-Status: GOOD ( 17.50 ) 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 Wed, Jun 02, 2021 at 03:02:43PM +0800, Kefeng Wang wrote: > Like commit 67ce16ec15ce ("arm64: mm: print out correct page table entries") > does, drop the struct mm_struct argument of show_pte(), print the tables > based on the faulting address. > > Signed-off-by: Kefeng Wang This can be misleading on 32-bit ARM. The effective page tables for each thread are the threads *own* page tables. There is no hardware magic for addresses above PAGE_OFFSET being directed to the init_mm page tables. So, when we hit a fault in kernel space, we need to be printing the currently in-use page tables associated with the running thread. Hence: > /* > - * This is useful to dump out the page tables associated with > - * 'addr' in mm 'mm'. > + * Dump out the page tables associated with 'addr' in the currently active mm > */ > -void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr) > +void show_pte(const char *lvl, unsigned long addr) > { > pgd_t *pgd; > - > - if (!mm) > + struct mm_struct *mm; > + > + if (addr < TASK_SIZE) { > + mm = current->active_mm; > + if (mm == &init_mm) { > + printk("%s[%08lx] user address but active_mm is swapper\n", > + lvl, addr); > + return; > + } > + } else { > mm = &init_mm; > + } is incorrect here. It's completely fine for architectures where kernel accesses always go to the init_mm page tables, but for 32-bit ARM that is not the case. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel