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=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 B2E66C433DB for ; Thu, 25 Mar 2021 10:08:57 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 2C1CE61A23 for ; Thu, 25 Mar 2021 10:08:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C1CE61A23 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc: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=MDFLtOn0XuE7D0rmOsnBgGyoMtofoYHIZh68TaH854c=; b=HTiOYasScm7RbbLZDF4Ua3atr PIC22HXVSsLJF5A+z63ICAIYN9KGpFeOZ631bKARMWf0pyZY7OQiS11SWiRm5FIk2HlqMmSjsZtGs A52IoQYvve6wSFw/si2wLDe7fa7fyiwX5LXgyMsT707SS9qVqHp4zuBo4XKAeV0kTQpxEM9YAQNXr IEHW8cRdm/pKkATC+53mQxGYwFbRQ6N23C51yEEKYJwat45VUo5h4DK6sChlJ97Bv6RxEvIE4aQv3 KeJY00cwbWadAcSMRKp2pjGu/itCE8uDB2V87064qT+WBQshetVkeFSwB9w5UfEhOKR7spiBtHlG9 eH51HHVfw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lPMsh-001BVa-2M; Thu, 25 Mar 2021 10:06:23 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lPMsX-001BU5-4E for linux-arm-kernel@lists.infradead.org; Thu, 25 Mar 2021 10:06: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=xe6ylj/Aipy5eoc+Obq+1c+zJSRHW8XclzYOw2iqLCs=; b=hPXOiulEAAW7UncDYf+e0EZiD vae10Xiph4oqbWA9EUUe88dCiUCETxcbekCdbxhbMNFLIW44k7PzW7x3NStM9ybKCphoI6HOOtEt1 zHpYIk3+JLxZcYwQ+XPWtOxaN3DcRYW2esHiammjafjhRApT2GizViKtofl8Mo1iXjz0ZfsJ7Mgbv d5on9SJq0TfBce/Sn0VuXFNPeYj0eM3g7uFAPLCXMU+Ck3+h2UrqN+PITMtIjOxBKDDq1sDqruW3P EtXXp+6yRMxQ+SHg+SE/6ugI2aizt7/9x4FCZDHD1Ss0bT83sV3vjbwdmgsaSiY+3+k4QIk6O0fpc 5hOXl2efg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:51710) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lPMsT-0001Xr-Jq; Thu, 25 Mar 2021 10:06:09 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1lPMsQ-0005v5-22; Thu, 25 Mar 2021 10:06:06 +0000 Date: Thu, 25 Mar 2021 10:06:06 +0000 From: Russell King - ARM Linux admin To: Liu Xiang Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, liuxiang_1999@126.com, liuxiang1999@gmail.com Subject: Re: [PATCH] ARM: fix smp_processor_id() in preemptible warning in harden_branch_predictor() Message-ID: <20210325100605.GL1463@shell.armlinux.org.uk> References: <20210325095049.6948-1-liu.xiang@zlingsmart.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210325095049.6948-1-liu.xiang@zlingsmart.com> 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-20210325_100613_330645_70805836 X-CRM114-Status: GOOD ( 13.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Thu, Mar 25, 2021 at 05:50:49PM +0800, Liu Xiang wrote: > When CONFIG_HARDEN_BRANCH_PREDICTOR is selected and user aborts occur, > there is a warning: > > BUG: using smp_processor_id() in preemptible [00000000] code: errnotest/577 > caller is __do_user_fault.constprop.4+0x24/0x88 > CPU: 1 PID: 577 Comm: errnotest Not tainted 4.14.188-rt87-fmsh-00004-g58055877a #1 > Hardware name: FMSH PSOC Platform > [<8010d6d4>] (unwind_backtrace) from [<8010a228>] (show_stack+0x10/0x14) > [<8010a228>] (show_stack) from [<80698f44>] (dump_stack+0x7c/0x98) > [<80698f44>] (dump_stack) from [<803d17d0>] (check_preemption_disabled+0xc4/0xfc) > [<803d17d0>] (check_preemption_disabled) from [<80110eb8>] (__do_user_fault.constprop.4+0x24/0x88) > [<80110eb8>] (__do_user_fault.constprop.4) from [<801112e4>] (do_page_fault+0x2dc/0x310) > [<801112e4>] (do_page_fault) from [<801012a8>] (do_DataAbort+0x38/0xb8) > [<801012a8>] (do_DataAbort) from [<8010b03c>] (__dabt_usr+0x3c/0x40) > Exception stack(0xb21d1fb0 to 0xb21d1ff8) > 1fa0: fffffff4 00000000 00000054 fffffff4 > 1fc0: 00000000 00000000 7ed81cc8 7ed81ca0 0007a440 00000000 00000000 00000000 > 1fe0: 00000000 7ed81ca0 00010493 0001f330 20030010 ffffffff This is not the right fix - preemption is supposed to be disabled before this function is called. I'm not sure at the present time what the right fix is supposed to be because I've forgotten most of the background behind why this was placed where it is. -- 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