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=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 8CBF4C4360F for ; Fri, 5 Apr 2019 03:06:53 +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 5BAEA217D4 for ; Fri, 5 Apr 2019 03:06:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AATjcziy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BAEA217D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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.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-Dc; 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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(); } -- 1.7.12.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel