Received: by 10.213.65.68 with SMTP id h4csp14501imn; Mon, 19 Mar 2018 17:56:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELuF5wJCm6kJn1W0FVRAVG+QrD2B+SM73sY/ofyYE4agJpH6IFgDaX7OMJ/Iz+zk6W38G6qW X-Received: by 2002:a17:902:8d90:: with SMTP id v16-v6mr14303654plo.168.1521507414949; Mon, 19 Mar 2018 17:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521507414; cv=none; d=google.com; s=arc-20160816; b=DscY06X9n/ezgvPGq+MoR9h8nHplZO00XIcDqteszvE/i0QGC866qdU5YipyDqgf13 +6gc4F3My0XbHmFbW1M0hR3ye3kC91J5M8Y2ru+cjzYbrWOgDy95P+DrgsivGP6jYidf pLzyW1IrEr8zj/dnnWpBORBrv9hVqLhiWAS1dSvpRzvqdhZCzMIog3zj1ZB8cLOqsPNE ddPsnWtql6s9ZDPRtnlOE6UYniKiQUoT0hF492A9BNtsSIjy8meHA1c+ov4SbJ/YY6SR WdyUI9J/hLEgiKpqedRqL1Ag0ItCqe8qBvO1Ths0OSAnTj0qLsCEPSktexkvwKCdToJN dOew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=dKSmY1Aw/p00WDgoNADstyWvt9/aJ1qe7cg14dtos7A=; b=PT6MUNA5jS5QCJ1ETbmmUD+4/6sUW51NZBlVwn5atc5o0pynXgT++7nX7VikNrQmt5 KEXIL8xAwN7WQ4KBGVl5YA2UMXsPw8g8oV136mvMcRgvoaEhT4W1gJ34opAxNBxZizgE ND04SFoM5MQFItTRgIH1TrRlh7RAmxtGPxwu1cdJGhb1W15Mxz0Nixka7C3v8nYrQhck 8ZDPaNcKkCPJAGBi7ctYnbYZH7CTCCEppD0ICOHXdonM5YMsYtoeGNdsuhVSiNKYkapv l24x/9ZjuLaMLPtAbRERqOAoPqL9UeDcAHb/hb/SESyw0+YipwMUb1V7UfULK3mtd6eQ G4gA== 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 j8-v6si477904pli.9.2018.03.19.17.56.41; Mon, 19 Mar 2018 17:56:54 -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 S969886AbeCSS0U (ORCPT + 99 others); Mon, 19 Mar 2018 14:26:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50694 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969807AbeCSS0J (ORCPT ); Mon, 19 Mar 2018 14:26:09 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 21BBD111F; Mon, 19 Mar 2018 18:26:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 4.9 138/241] powerpc/nohash: Fix use of mmu_has_feature() in setup_initial_memory_limit() Date: Mon, 19 Mar 2018 19:06:43 +0100 Message-Id: <20180319180756.902541981@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Ellerman [ Upstream commit 4868e3508d1934d28961f940ed6b9f1e347ab52c ] setup_initial_memory_limit() is called from early_init_devtree(), which runs prior to feature patching. If the kernel is built with CONFIG_JUMP_LABEL=y and CONFIG_JUMP_LABEL_FEATURE_CHECKS=y then we will potentially get the wrong value. If we also have CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG=y we get a warning and backtrace: Warning! mmu_has_feature() used prior to jump label init! CPU: 0 PID: 0 Comm: swapper Not tainted 4.11.0-rc4-gccN-next-20170331-g6af2434 #1 Call Trace: [c000000000fc3d50] [c000000000a26c30] .dump_stack+0xa8/0xe8 (unreliable) [c000000000fc3de0] [c00000000002e6b8] .setup_initial_memory_limit+0xa4/0x104 [c000000000fc3e60] [c000000000d5c23c] .early_init_devtree+0xd0/0x2f8 [c000000000fc3f00] [c000000000d5d3b0] .early_setup+0x90/0x11c [c000000000fc3f90] [c000000000000520] start_here_multiplatform+0x68/0x80 Fix it by using early_mmu_has_feature(). Fixes: c12e6f24d413 ("powerpc: Add option to use jump label for mmu_has_feature()") Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/mm/tlb_nohash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/powerpc/mm/tlb_nohash.c +++ b/arch/powerpc/mm/tlb_nohash.c @@ -751,7 +751,7 @@ void setup_initial_memory_limit(phys_add * avoid going over total available memory just in case... */ #ifdef CONFIG_PPC_FSL_BOOK3E - if (mmu_has_feature(MMU_FTR_TYPE_FSL_E)) { + if (early_mmu_has_feature(MMU_FTR_TYPE_FSL_E)) { unsigned long linear_sz; unsigned int num_cams;