From patchwork Thu Aug 1 08:16:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 11070351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCF7E1395 for ; Thu, 1 Aug 2019 08:28:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE1BC283A6 for ; Thu, 1 Aug 2019 08:28:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B216C283C5; Thu, 1 Aug 2019 08:28:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3CE7C283A6 for ; Thu, 1 Aug 2019 08:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SXMLkbmZVFiK/rGV7YmOOUJSl4bcJ9/O6xIHf9QTBIo=; b=kdIaOxA8esutVA 6pz/7OvZ6k5XkI6NoatvR7yRuSLA3Auy2LvY5ulG3Gz9KxsY/XiqvyN5t/fefXtEfLsQhbsS2660L 1wSWW75wfQhMqRjxQhGEyaxu2w9luKgXLrBbaWbNb2zwWLS3kFGL6DEXMlOKoygS1Ps8RDkbJey40 ftisEaMZNgN0yoZvfo7JK6/V4ly1uiepynf5k5uOaXIfrcHXz818Slmhb8NNrBtczOOpfh4UtFn0+ atLDq6M/hNLGN/tDd0HQ8qbxLgpjwfOIQXcUX0YyS+3q/6YkEsrlvDKfGwa+quOgl5HrffHfwqaX6 EkAId/pKVE5K6k7xHDoQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1ht6S4-0006Lx-MC; Thu, 01 Aug 2019 08:28:44 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1ht6L9-0003uz-2p for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2019 08:21:36 +0000 Received: by mail-pg1-x542.google.com with SMTP id n9so27510828pgc.1 for ; Thu, 01 Aug 2019 01:21:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VcM2nk9n3X98Yf/dvDVr4bULZaEs8I54Pvp1eUOtnUY=; b=wgago/zpfmyqQLLQdap7Xa8Uept+x1Qd1u033aMgpN9UcZ2k7xYDBKbb5+pAmTYGgD xC0edVXG08xxx5WF8v25YYSNhl7HmBj9YBcqUxBZKs17aXRlpwxG6PgS2mETq4g6D47P b/+wh1/eVUzBRinby/9SHWDbNCMO7HEhhQvRfOihSoqAuNP2z00/tm9PPpJqXaBngIua gUXFe57xxGWupNlan4xHj5ulZWnqY6FKmEJ00v+KbEbiHhP+rvhpjyEX1zjTqlJE75EW Iiyc2AY4u/qxd3536giEWMQrGCiPYXOZ0VVJbuqFv1J1Ws1noO/dSsWJolYOORmclwWU rPuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VcM2nk9n3X98Yf/dvDVr4bULZaEs8I54Pvp1eUOtnUY=; b=hNvQqV9QVTeu+O43qeSiSMyfpGrXe4QBboYQmd3R+LrHHaleQsYCzUDzVtMZxcHNhN DQkmZCPRjoNR12Vlqx8NtkiyAYr8cSmK0nUXO9IMIAijzp9tG3AxOwEINlD0V1J13Hu/ yBobTYoxeyCdmUCJat7sYD7KcwfKjDlkrtMioTNTLxzo4nO6X0k+9td0va6WraQHF4Zt bRXk1CA4qQbM3scoc11mA55KwleJ+FGcVxPeDuMZeNVNnWUxQ6mExBuJxEN9/Ag6s3e2 2XL9XBNeSsMJ2GUluXH4W+A/E4FBRhaIU33HcDcI7gefOuMod65fKVJ8s5byko1zMRMq EDBw== X-Gm-Message-State: APjAAAXeEI4RIEGdJRiyIBP6Ewwwh2Vaeb59UYEzUaz4Ho8Tk10S+8SW eE+1hvFnyzZ2qmOIamgU3t1xQg== X-Google-Smtp-Source: APXvYqz0smOXC/yRZCeLsmsqR+rYdReSDcJ5waTey1emtkemTksgldVG2ZffWaFMsTKpL11UnFLb9g== X-Received: by 2002:a17:90a:8a91:: with SMTP id x17mr7257741pjn.95.1564647694091; Thu, 01 Aug 2019 01:21:34 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id p19sm80677529pfn.99.2019.08.01.01.21.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Aug 2019 01:21:33 -0700 (PDT) From: Viresh Kumar To: stable@vger.kernel.org Subject: [PATCH ARM32 v4.4 V2 46/47] ARM: ensure that processor vtables is not lost after boot Date: Thu, 1 Aug 2019 13:46:30 +0530 Message-Id: <1292f4e03c65f4cfa4665df9c0e6f7fb8bd526cc.1564646727.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190801_012135_168442_847B1CEC X-CRM114-Status: GOOD ( 12.27 ) 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: Mark Rutland , Julien Thierry , Marc Zyngier , Viresh Kumar , guohanjun@huawei.com, Will Deacon , mark.brown@arm.com, Catalin Marinas , Russell King , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Russell King Commit 3a4d0c2172bcf15b7a3d9d498b2b355f9864286b upstream. Marek Szyprowski reported problems with CPU hotplug in current kernels. This was tracked down to the processor vtables being located in an init section, and therefore discarded after kernel boot, despite being required after boot to properly initialise the non-boot CPUs. Arrange for these tables to end up in .rodata when required. Reported-by: Marek Szyprowski Tested-by: Krzysztof Kozlowski Fixes: 383fb3ee8024 ("ARM: spectre-v2: per-CPU vtables to work around big.Little systems") Signed-off-by: Russell King Signed-off-by: Viresh Kumar --- arch/arm/mm/proc-macros.S | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S index 212147c78f4b..d36a283b4099 100644 --- a/arch/arm/mm/proc-macros.S +++ b/arch/arm/mm/proc-macros.S @@ -259,6 +259,13 @@ .endm .macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0, bugs=0 +/* + * If we are building for big.Little with branch predictor hardening, + * we need the processor function tables to remain available after boot. + */ +#if 1 // defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) + .section ".rodata" +#endif .type \name\()_processor_functions, #object .align 2 ENTRY(\name\()_processor_functions) @@ -294,6 +301,9 @@ ENTRY(\name\()_processor_functions) .endif .size \name\()_processor_functions, . - \name\()_processor_functions +#if 1 // defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) + .previous +#endif .endm .macro define_cache_functions name:req