From patchwork Fri Apr 12 12:04:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiongfeng Wang X-Patchwork-Id: 10898081 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 A6536922 for ; Fri, 12 Apr 2019 12:07:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84D4328E53 for ; Fri, 12 Apr 2019 12:07:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78F4E28E62; Fri, 12 Apr 2019 12:07:34 +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 5ACDE28E53 for ; Fri, 12 Apr 2019 12:07:33 +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=iFE+i9G3c3F0Ip39oULQ1A8n1/7DO8Cm8/AMtWUVz3Q=; b=m7plyQmvP0iiPp t+N7zr0V9tqdOkTDNF5tR2SRGV40Y1e2M1gUNpIPzs7+wwAO1cm6WwsQCSCgIVL929EuGSJJ8R2F4 VdaZ5CcLS8Tk9aedLNeOrgfPuALlgQL7kcFjM48HTwOzCZ6ZKe23SvsAlLydV2Kg1YXg2gAf3Oipz egtoUGgYckCOFBS+cTaRIorDKqN9ZflQ9nUmPexAP+4a55pMRn/FVWzzGYyCTsKVQEXrTGXp/EUKF wuo0azXkD09z6auWry9MWBUUk/y1Zp+1LECExH+AKm6k2IKcfvUk8Y4TUbbCSlUIfY7oZN9XoGfwW OB0yldY9AYqjOqZ3kH7Q==; 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 1hEuxw-0006yz-Ci; Fri, 12 Apr 2019 12:07:32 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEux4-0005PM-ST for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2019 12:06:46 +0000 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 1927465C30D0C7DA98B0; Fri, 12 Apr 2019 20:06:30 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 12 Apr 2019 20:06:21 +0800 From: Xiongfeng Wang To: , , , , Subject: [RFC PATCH 3/3] stop_machine: mask sdei before running the callback Date: Fri, 12 Apr 2019 20:04:59 +0800 Message-ID: <1555070699-3685-4-git-send-email-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1555070699-3685-1-git-send-email-wangxiongfeng2@huawei.com> References: <1555070699-3685-1-git-send-email-wangxiongfeng2@huawei.com> 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-20190412_050639_826567_B90E6037 X-CRM114-Status: UNSURE ( 8.69 ) X-CRM114-Notice: Please train this message. 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: linux-kernel@vger.kernel.org, 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 Kprobes use 'stop_machine' to modify code which could be run in the sdei event handler at the same time. This patch mask sdei before running the stop_machine callback to avoid this race condition. Signed-off-by: Xiongfeng Wang --- kernel/stop_machine.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 067cb83..7b95632 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -22,6 +22,9 @@ #include #include #include +#ifdef CONFIG_ARM64 +#include +#endif /* * Structure to determine completion condition and record errors. May @@ -208,6 +211,9 @@ static int multi_cpu_stop(void *data) case MULTI_STOP_DISABLE_IRQ: local_irq_disable(); hard_irq_disable(); +#ifdef CONFIG_ARM64 + sdei_mask_local_cpu(); +#endif break; case MULTI_STOP_RUN: if (is_active) @@ -227,6 +233,9 @@ static int multi_cpu_stop(void *data) } } while (curstate != MULTI_STOP_EXIT); +#ifdef CONFIG_ARM64 + sdei_unmask_local_cpu(); +#endif local_irq_restore(flags); return err; }