From patchwork Tue Sep 12 10:44:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Weisbecker X-Patchwork-Id: 138153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp378072vqx; Tue, 12 Sep 2023 05:44:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6jaCCtkT0sKJZYjcxWU5NW8VAPOQZaV+chKlGw/OcI3QT4Jy3DXbL18PJo5rc/i3GCe4M X-Received: by 2002:a9d:7595:0:b0:6bd:708:c1f2 with SMTP id s21-20020a9d7595000000b006bd0708c1f2mr11651711otk.14.1694522674913; Tue, 12 Sep 2023 05:44:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694522674; cv=none; d=google.com; s=arc-20160816; b=HIG8zkWp88VZ5IY8jQNzAdrriV7f5Sq+LxWL0cSYsyWW0optRYVS9jWN8nMbx6QPHZ cFDxVf5RHOzK8EfkC5TedPvKEUOpCVprbV7dPJx/fULTPebPi6Qj20Cfey998GkpKObO cd8Z0fwsMs9wMKbngn4SKPTRPeIQBhrbSQ/HOOLQ5X4PGOjuROchEhtgC0aHCsf4dMky 1RfrPihvgIPUa63kq9zDsAHsfpdIq0h9y2i18Xzpec3kaGidRAeLAXYs9FzWzxF4hpNs q1p6BWGMKEAqNZJZMcwS1lHt6k3RRQvYv9dLgJqAB4Qzp52dbtys7bSO9Ccuy6yyk8b3 0a5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZAiMGopUwyL/M3ozQV9VdceOhAEEV9kRjWuC9GRkVVQ=; fh=CGeRqfKKrYaxvvhOGObLHRUUue/LLUSLAzhwrHrEV+s=; b=qygksuO2tKZRJ9t9uBzaGPYybuFuKsGofQqINsyq9BrR2t+fT1fFnjp4HyG9Tw9AiC e6gjl7EUrH9DpBWkF7IZ27nR8Ay/OsmuQ/TQQJEAEThBRT0zXunQHIf61jYapN1vqrQU 9q0dxiDGJBYPt3SRWzZCz5HjJ8Om10KEtg9aOA1NW93jpkwqoQship6nHT6Znfb2CuFh sNafDSTczLl/sQUjo1HeVCTJ2iOS43bXxK/5LxfDQb39QJH8P9ooc3SLEgU0TsLXicF4 QiN+XdAnuFiMjtuK/xCoWgF3Z6+73z34AF68qqauZcN0ByW9WMXzbLsff9K5VJZWLZy0 uJXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HVplCqOX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id n31-20020a056a000d5f00b0068ff3927553si311219pfv.35.2023.09.12.05.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 05:44:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HVplCqOX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 9D30A81C0C98; Tue, 12 Sep 2023 03:46:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234470AbjILKpx (ORCPT + 37 others); Tue, 12 Sep 2023 06:45:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234493AbjILKoy (ORCPT ); Tue, 12 Sep 2023 06:44:54 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8DC51987 for ; Tue, 12 Sep 2023 03:44:24 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19AB6C433C8; Tue, 12 Sep 2023 10:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694515464; bh=1xq6Mgf32EY2JQOJHQcEgJ3L7Kjn6lb+CzCCKEAz46M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVplCqOXjJormHSlR2bAyrpRlkyfPFfJEe2vJuJn5mL6+u6rPaN61klmUFrLzRuSe 5Sa1L92QTSATpU1dj8EkdTWjGsnj/WWzmhP8KOGqMIUfVIkFeEKWjk8b2tG0zjp/b9 xqtgWfjjpOwTfTEbUOLbrKRWtRUcX4PIqv58T7E96oZUUX8ILH8QB9nm8VGAt+Rdkp 6IWYMbPSlcWUa/MQkDUqeFHp0NISKywyiGYeDJfCXZnVJzCE82s8FW3NxJre0QFigG rpIRrVXQIh+eEOB++P+ea8VLh8U/vXk81EPR4mlUeCvn5KRm114kdG83D0MpdSGNOL ok5tAtzcqTA7g== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Joel Fernandes , Thomas Gleixner , vineethrp@gmail.com Subject: [PATCH 5/5] timers: Tag (hr)timer softirq as hotplug safe Date: Tue, 12 Sep 2023 12:44:06 +0200 Message-Id: <20230912104406.312185-6-frederic@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230912104406.312185-1-frederic@kernel.org> References: <20230912104406.312185-1-frederic@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Sep 2023 03:46:17 -0700 (PDT) X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776835808613616282 X-GMAIL-MSGID: 1776835808613616282 Specific stress involving frequent CPU-hotplug operations, such as running rcutorture for example, may trigger the following message: "NOHZ tick-stop error: local softirq work is pending, handler #02!!!" This happens in the CPU-down hotplug process, after CPUHP_AP_SMPBOOT_THREADS whose teardown callback parks ksoftirqd, and before the target CPU shuts down through CPUHP_AP_IDLE_DEAD. In this fragile intermediate state, softirqs waiting for threaded handling may be forever ignored and eventually reported by the idle task as in the above example. However some vectors are known to be safe as long as the corresponding subsystems have teardown callbacks handling the migration of their events. The above error message reports pending timers softirq although this vector can be considered as hotplug safe because the CPUHP_TIMERS_PREPARE teardown callback performs the necessary migration of timers after the death of the CPU. Hrtimers also have a similar hotplug handling. Therefore this error message, as far as (hr-)timers are concerned, can be considered spurious and the relevant softirq vectors can be marked as hotplug safe. Signed-off-by: Frederic Weisbecker Reviewed-by: Joel Fernandes (Google) --- include/linux/interrupt.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index a92bce40b04b..4a1dc88ddbff 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -569,8 +569,12 @@ enum * 2) rcu_report_dead() reports the final quiescent states. * * _ IRQ_POLL: irq_poll_cpu_dead() migrates the queue + * + * _ (HR)TIMER_SOFTIRQ: (hr)timers_dead_cpu() migrates the queue */ -#define SOFTIRQ_HOTPLUG_SAFE_MASK (BIT(RCU_SOFTIRQ) | BIT(IRQ_POLL_SOFTIRQ)) +#define SOFTIRQ_HOTPLUG_SAFE_MASK (BIT(TIMER_SOFTIRQ) | BIT(IRQ_POLL_SOFTIRQ) |\ + BIT(HRTIMER_SOFTIRQ) | BIT(RCU_SOFTIRQ)) + /* map softirq index to softirq name. update 'softirq_to_name' in * kernel/softirq.c when adding a new softirq.