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=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 7589CC388F9 for ; Sat, 31 Oct 2020 10:33:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 2036C20791 for ; Sat, 31 Oct 2020 10:33:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="r7gApWKj"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="fHvd2F1H" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2036C20791 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=l1XnfVKGJyLOz1maQ4fs5B1S36crxu4IGkPWNBc2Wws=; b=r7gApWKjbNQCZl+BP3cnO4lKj HeZVUknlCO29hAWkdOPMrhwDrmalUkYGckAsFIKuMv42fwwWfDLfVixEewCrcSmblb95KUKRd/XPa NmT/DqBL3MzBPln2x+YHAYGRaIQJ1wGwcSYQCuIW2+DT7L8Idcl/S7td6XJQwu3HXpQ9lyi/RV0JX sEvrh/Ba4WpltNMEAmZMr7RqijhimI39BvQPKVhy8wbkWhteIMWZDq5kN7+A7mye0DUNOBuA+vTxP aA/zJQmlOTTN+C/UdboEHHrwSW9pkEf7hpejnw+XbhjdWytGM47mxf6zkJAUX+jSFW0aHyHDJ6ePs rE1i7EWWg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYoCF-0001kU-1K; Sat, 31 Oct 2020 10:33:19 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYoCC-0001jn-8c for linux-arm-kernel@lists.infradead.org; Sat, 31 Oct 2020 10:33:17 +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=fSXmY2Ss+l9g5L0iEkoM73p34L1tYPcYKQlrcN3O+uE=; b=fHvd2F1HGg7M1aKb7QJABolAl VT+lC8juhxkL3YA66tx6m69hl/C5vcQAScUVAG9p6a4kaNxZxhDj1lYLPH/DmSjaOdh7aFgUmA8Hc dYCRAm2CGpGzIdJ8CcuRc+j/CmR7To5GqDTuG1NdcBRwj1Wh8ELiN+ypwrf+MESTAPyD4KJbQK+ej P6VArMxszoA+z3IYme+UfqmTHAnmmpDHzzX4aMQ6fOTMwxsyi2tmfIAtQMKsf+7+VqAHS138GuEgT dWbL6J1UYmP1ddetBtrnn+s82OLxzBDPzGyZyaV0cx0BFU08EXHOdq3zLbvLeA7UKudjiaXUAZu67 iGj6JGjxQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:53274) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kYoC9-00074m-HL; Sat, 31 Oct 2020 10:33:13 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1kYoC8-00087d-EK; Sat, 31 Oct 2020 10:33:12 +0000 Date: Sat, 31 Oct 2020 10:33:12 +0000 From: Russell King - ARM Linux admin To: Mike Rapoport Subject: Re: [PATCH] ARM, xtensa: highmem: avoid clobbering non-page aligned memory reservations Message-ID: <20201031103312.GI1551@shell.armlinux.org.uk> References: <20201031094345.6984-1-rppt@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201031094345.6984-1-rppt@kernel.org> 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-20201031_063316_361224_6DABD872 X-CRM114-Status: GOOD ( 24.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-xtensa@linux-xtensa.org, Florian Fainelli , Chris Zankel , Linus Walleij , linux-kernel@vger.kernel.org, Mike Rapoport , Max Filippov , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org 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 Sat, Oct 31, 2020 at 11:43:45AM +0200, Mike Rapoport wrote: > From: Ard Biesheuvel > > free_highpages() iterates over the free memblock regions in high > memory, and marks each page as available for the memory management > system. > > Until commit cddb5ddf2b76 ("arm, xtensa: simplify initialization of > high memory pages") it rounded beginning of each region upwards and end of > each region downwards. > > However, after that commit free_highmem() rounds the beginning and end of > each region downwards, and we may end up freeing a page that is > memblock_reserve()d, resulting in memory corruption. > > Restore the original rounding of the region boundaries to avoid freeing > reserved pages. > > Fixes: cddb5ddf2b76 ("arm, xtensa: simplify initialization of high memory pages") > Link: https://lore.kernel.org/r/20201029110334.4118-1-ardb@kernel.org/ > Signed-off-by: Ard Biesheuvel > Co-developed-by: Mike Rapoport > Signed-off-by: Mike Rapoport > --- > > Max, Russell, > > Please let me know how do you prefer to take it upstream. > If needed this can go via memblock tree. > > v2: fix words order in the commit message I really don't understand what is going on here; there seems to be a total disconnect of communication between yourself and Ard. Ard has already submitted a different patch for this to the patch system already, sent yesterday. https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9021/1 Please discuss between yourselves how you want to solve the problem, and then submit an agreed and tested patch to those of us upstream; please don't make it for those upstream to pick one of your patches as you are at present. Thanks. > > arch/arm/mm/init.c | 4 ++-- > arch/xtensa/mm/init.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c > index d57112a276f5..c23dbf8bebee 100644 > --- a/arch/arm/mm/init.c > +++ b/arch/arm/mm/init.c > @@ -354,8 +354,8 @@ static void __init free_highpages(void) > /* set highmem page free */ > for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE, > &range_start, &range_end, NULL) { > - unsigned long start = PHYS_PFN(range_start); > - unsigned long end = PHYS_PFN(range_end); > + unsigned long start = PFN_UP(range_start); > + unsigned long end = PFN_DOWN(range_end); > > /* Ignore complete lowmem entries */ > if (end <= max_low) > diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c > index c6fc83efee0c..8731b7ad9308 100644 > --- a/arch/xtensa/mm/init.c > +++ b/arch/xtensa/mm/init.c > @@ -89,8 +89,8 @@ static void __init free_highpages(void) > /* set highmem page free */ > for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE, > &range_start, &range_end, NULL) { > - unsigned long start = PHYS_PFN(range_start); > - unsigned long end = PHYS_PFN(range_end); > + unsigned long start = PFN_UP(range_start); > + unsigned long end = PFN_DOWN(range_end); > > /* Ignore complete lowmem entries */ > if (end <= max_low) > -- > 2.28.0 > > -- 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