From patchwork Wed Jul 13 13:28:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alvinzhan1234@gmail.com X-Patchwork-Id: 12916723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id CACADC433EF for ; Wed, 13 Jul 2022 13:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=WqYKPRYDvbB5OCJ1Zvgtht7xEtb4/3mEmt7OvnV4eac=; b=L0Hpyjz9kjkqi5 RgnmL05B7priOW+gWDw4StXGWuxS+tXZ8bolDoiBmsOywsAEuM9jkBVRZ/NDlnn5B/aHK+B1kUo+X FbRktBH1vE5vSEcBCyhnYusW6Ys9pZpmqlOeogKEHVI1r4tqz+21LAEbNO+PReFcYAIRGnSdp8b5S G5Yjs9Q4vpruP5IpkBT5IwF1o5VyqzUE4GEr70CyvuGQhUhr4DHBlh/RoKWSm64/Z9BL4gTTrBtP4 RVDd8TUsX/fE/ZkM3u8RSU3CBrZdCsZOfZPxUuGhms3LgY8Gr1b7rwb8TnVyIWVbRknE2zq0cDUap GZmE5jK6IfKKxc99ImTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBcQF-003w2p-Oq; Wed, 13 Jul 2022 13:28:59 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBcQD-003w1e-29 for linux-arm-kernel@lists.infradead.org; Wed, 13 Jul 2022 13:28:58 +0000 Received: by mail-pg1-x52b.google.com with SMTP id g4so10470459pgc.1 for ; Wed, 13 Jul 2022 06:28:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oS8l0DP9XOP7IcptwyyBF7p0o//V8/X4Uva/tnzgH+I=; b=oli3pkWVLTc5myDwYPzIiLZfFnOebiBXTjssvr0eGGu9PTd+yVQ44s6tUWfe4KgE7U 8/uMxcr0/YMQZ8X9kTuj1FoR5P9WWia6Hl7C1j6HHb118NS8fAP54XhgyFMtj5S8DmC0 Flj2TlXVrAG6u7xd3cTmQjFlNT0Yl+fDhlEPVf6wNaICiSGweNBCwCaJSmXbqYA7a/q0 zf0nKN20vQLcoZ69uGScPMsgzXkyM9CmlUdfj3XsqxqgB5kfgqH4FekE385EI5IKvdo9 HB91dkQ9gJEnCqVQFSWfxgocFKDpB+DXrh7bdf/Kgg60JGQaJU7/+f+7ju/IMUc29QGs xTMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oS8l0DP9XOP7IcptwyyBF7p0o//V8/X4Uva/tnzgH+I=; b=LfZwiVn0jWz66Y5Amsv1mYbHHfCFVpfUERNO11G96MJK2YBvnWasGYrFZnYvc0Z39S dAfWV+itqZ9418Edp/LdjXr6rjN5DZrlH0nfVe24y7Im4a8eDmlfk3zeTITcxPuC0F+i zb+ReDcOwh3yBo/p0PfqlKqXGaoYEibVredDvsygukLjytW/8/UKM+Wp+mu9Fssi966f Ddl3Xp2WUfTuJ8orN8yFThr1OlIhs/r+bM+MJxOWhKLkgjtAUCTSO0H0Z0Jsj8PxZyR8 N2cMrhvGbTBB2eoPVrUUZYmuVVvrZ76CBd3RFFb4vvQGH8r0kABKy9FmKJkbCaL/h0Mm Tifg== X-Gm-Message-State: AJIora+HwxdnZuYYl6CKGZZrGjwbNDTownKwyZ7WPcvqdhpcyHFiTKSR 8iuCoQ4YFQeDb7RIpj2XTvQ= X-Google-Smtp-Source: AGRyM1ultb8zQEZlRq+nP410/QqzMmsDWQrnfoxi8ex5F23hOd6xjPtNRkRlwEmIa8il/m8/ojpeWg== X-Received: by 2002:a05:6a00:124b:b0:52a:c7de:c76 with SMTP id u11-20020a056a00124b00b0052ac7de0c76mr3348008pfi.5.1657718935475; Wed, 13 Jul 2022 06:28:55 -0700 (PDT) Received: from alvinzhan-virtual-machine.localdomain (1-164-121-236.dynamic-ip.hinet.net. [1.164.121.236]) by smtp.gmail.com with ESMTPSA id kk18-20020a17090b4a1200b001ec9dce6f10sm1622316pjb.38.2022.07.13.06.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 06:28:54 -0700 (PDT) From: alvinzhan1234@gmail.com To: catalin.marinas@arm.com, will@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alvin Zhan Subject: [PATCH 1/1] arm64: Prevent offline CPU handling IRQs. Date: Wed, 13 Jul 2022 21:28:43 +0800 Message-Id: <20220713132843.49693-1-alvinzhan1234@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220713_062857_149830_C3D00C81 X-CRM114-Status: GOOD ( 13.06 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Alvin Zhan Migrate all of the IRQs on this CPU after setting it offline may still cause the IRQs to be dispatched to this CPU. To prevent offline CPU handling IRQs, we should migrate the IRQs away from this CPU before it is powered off. Signed-off-by: Alvin Zhan --- arch/arm64/kernel/smp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 62ed361a4..c4c3c5ed5 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -302,6 +302,11 @@ int __cpu_disable(void) remove_cpu_topology(cpu); numa_remove_cpu(cpu); + /* + * Migrate IRQs away from this CPU first. + */ + irq_migrate_all_off_this_cpu(); + /* * Take this CPU offline. Once we clear this, we can't return, * and we must not schedule until we're ready to give up the cpu. @@ -309,11 +314,6 @@ int __cpu_disable(void) set_cpu_online(cpu, false); ipi_teardown(cpu); - /* - * OK - migrate IRQs away from this CPU - */ - irq_migrate_all_off_this_cpu(); - return 0; }