From patchwork Fri Apr 5 03:04:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 10886801 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 B19221390 for ; Fri, 5 Apr 2019 03:06:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94FD828B11 for ; Fri, 5 Apr 2019 03:06:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 876C128B13; Fri, 5 Apr 2019 03:06:52 +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 2244628B11 for ; Fri, 5 Apr 2019 03:06:52 +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: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:In-Reply-To:References: List-Owner; bh=dWlIO0+qoQmEQdCvdxECp0mFtlxT2z5MBNoX8oHnRxY=; b=AATjcziyY/fRgM 9oqiEy8rTduNHlwlpi1gpB/snEtmF1f2IV/DJR0sPRB5KeNiPeGMeGAyj+mQQ/KK3ZU6IZiVyEma9 ZZSbuGlKB4Cc2EIL2pm0pCQtCdB8GIkF1H8BdHcDxpuwV5b3QVMVzK51MT4K+H51w9inhbjt2O+wU Ru3KwAGBuWL4AC05RXCuIjBjjweKCWMvtchi5SVaCugPqFPcP300NmMB8yHn5SjNLkmKD87QmVv3a Uf4OkQaoBL+TFgAiv/NWWF7JRhaoxYsUlUeIGRBiUqvESdhQin5WcRT/f5dh2KlLBWFVNz4AyUsUA Oon9LFmd4FUZH9bRhRSw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hCFBm-0006Ml-9v; Fri, 05 Apr 2019 03:06:46 +0000 Received: from szxga06-in.huawei.com ([45.249.212.32] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hCFBj-0006MM-No for linux-arm-kernel@lists.infradead.org; Fri, 05 Apr 2019 03:06:45 +0000 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 7E59BA7FF3E86CF1EFB7; Fri, 5 Apr 2019 11:06:35 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.408.0; Fri, 5 Apr 2019 11:06:28 +0800 From: Hanjun Guo To: Russell King - ARM Linux admin Subject: [RFC PATCH] arm32: spectre-v2: using raw_smp_processor_id() for preemptible Date: Fri, 5 Apr 2019 11:04:58 +0800 Message-ID: <1554433498-58551-1-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190404_200643_940376_E03FE31F X-CRM114-Status: GOOD ( 10.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Hanjun Guo , linux-arm-kernel@lists.infradead.org, Jason Yan 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 When enabling CONFIG_DEBUG_PREEMPT, there is a BUG report: BUG: using smp_processor_id() in preemptible [00000000] code: remap_file_page/29696 caller is __do_user_fault+0x34/0x114 It turns out that in harden_branch_predictor() using smp_processor_id() to get current cpu's callback for harden_branch_predictor(). This seems to be a false positive report as we need this running cpu's callback to clean the cache or BTB event it's preemptible, so using raw_smp_processor_id() instead to eliminate the false positive report. Signed-off-by: Hanjun Guo --- Hi, Not sure I'm doing the right thing, so send as RFC. arch/arm/include/asm/system_misc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/asm/system_misc.h b/arch/arm/include/asm/system_misc.h index 66f6a3a..55e3b2b 100644 --- a/arch/arm/include/asm/system_misc.h +++ b/arch/arm/include/asm/system_misc.h @@ -22,7 +22,7 @@ static inline void harden_branch_predictor(void) { harden_branch_predictor_fn_t fn = per_cpu(harden_branch_predictor_fn, - smp_processor_id()); + raw_smp_processor_id()); if (fn) fn(); }