Message ID | 168172838267.404.2145343215039139861.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2028174vqo; Mon, 17 Apr 2023 03:57:02 -0700 (PDT) X-Google-Smtp-Source: AKy350brQxVmDAZE6Egv1LQmqxhsFDBYgVgF3MaRWl64fg2Kw//jMg3Hcjw50nqTFHr6Ybr40cwP X-Received: by 2002:a17:903:2611:b0:19c:fc41:2dfd with SMTP id jd17-20020a170903261100b0019cfc412dfdmr9805723plb.29.1681729022205; Mon, 17 Apr 2023 03:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681729022; cv=none; d=google.com; s=arc-20160816; b=pG3NbzKlUnRTm0SMGWZQj8/T+pCIvla5ATsxmmB/GYOnUYGo8su/PjzeQpC46Qbpyq Z76hcKCMw3prKkWyjnDjCYGLzxrEZEU95hH68DF4N6KvaKRIPNFIm1p/Kb+KpqA4w1xD HwgzI7Pd/rBwAK762ZEW7Qz8aEOCQl9xB0zepX1YRRQ0KRFENrQloH6ALWikuSW3NXjV E/RcZIf/RJCiVqUaKay1TEJ9Zij/JK896O9SeQ+kbEEt9eIBo/G4xCfYrol97CtQaSMk hclG4oy2hkCQdnWlELggsqcAu6PhsaTSbDozy2TDZ977WL3F8zjygUvMfacIjGC7wmmc a28A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=5eA6cpMlDoXM/feBsjdSQtbytvZF3ftPkyQkd1ItisU=; b=Y8qb/wnJ7U32yFIYnv94EbEuzW0w31Xn7DaGGnQBxdTxnSSpM1z3YRRkhIw5cqMHyT bB865LVaJWwHOhtrKPQVdQcPQhuD5HU5L8ubjnM7jYxH+LbXOy6Mf4R5RypoZNmGfT4Q y50u5vX2FvxjamyMz6NFgbTSt46uEIzQM7rftnXjU7xZxCATi6AxvBsxe7598f1adhsc 7aiXMnOYTqkc/xcfmUDMe+ptdmpOuhgNpfq8GJs05AI7TnhiVmLYghNxr9g4trHKDhRm h0KD4CQ95FnF6/mNIUEJFfkmz1JsviyVhaoToYLu2lSHUtWvEBgTO1qMwyRNxqSRmFyI /scA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vnXatkmD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=utQHqfLh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a170902b28900b00194bcc88b52si11138643plr.363.2023.04.17.03.56.47; Mon, 17 Apr 2023 03:57:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vnXatkmD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=utQHqfLh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229685AbjDQKtO (ORCPT <rfc822;leviz.kernel.dev@gmail.com> + 99 others); Mon, 17 Apr 2023 06:49:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbjDQKsw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 17 Apr 2023 06:48:52 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64CF549DD; Mon, 17 Apr 2023 03:47:55 -0700 (PDT) Date: Mon, 17 Apr 2023 10:46:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681728383; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5eA6cpMlDoXM/feBsjdSQtbytvZF3ftPkyQkd1ItisU=; b=vnXatkmDsKi49XwemwtPCuOFA92Lmem0/U9//fHK7cWF9RCnLg3mMSKgo9gVNpxy5IjOFq 4IMfzdk+NXu75tTPG9yOT1z9wpJ6GLqLUC9YzOgPXV8od/laxtOBa2rQGoIEONALuVW7Za aBCzT/DixB2Jp7yRHd7VMLxunwDNMoLeTjobu5Ga1P6VNaMYptFhdrGo4U6VdLO+IchuFW mNlz1nERhsZhwX9Kr0ITFkLlrZwTq9wSRgQoBcQ+XLZcg0ar22nlM/y+w//XYQtRdduvMw nSEP2fTZ0U+SPZP3vccGI6GdB71COLleLkbSjGOI8/JBtio90GZB/dZWFVGb/A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681728383; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5eA6cpMlDoXM/feBsjdSQtbytvZF3ftPkyQkd1ItisU=; b=utQHqfLhtTxFz7VuYZzcoY3xrqbpC0GoGeR2APIb14dxHfhTnltGqgFSLVz5ShDuYNW/2X ejqu5l+RX0LeBfCw== From: "tip-bot2 for Yang Jihong" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/core: Fix hardlockup failure caused by perf throttle Cc: Yang Jihong <yangjihong1@huawei.com>, "Peter Zijlstra (Intel)" <peterz@infradead.org>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230227023508.102230-1-yangjihong1@huawei.com> References: <20230227023508.102230-1-yangjihong1@huawei.com> MIME-Version: 1.0 Message-ID: <168172838267.404.2145343215039139861.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758952566843846456?= X-GMAIL-MSGID: =?utf-8?q?1763420691081479688?= |
Series |
[tip:,perf/core] perf/core: Fix hardlockup failure caused by perf throttle
|
|
Commit Message
tip-bot2 for Thomas Gleixner
April 17, 2023, 10:46 a.m. UTC
The following commit has been merged into the perf/core branch of tip: Commit-ID: 15def34e2635ab7e0e96f1bc32e1b69609f14942 Gitweb: https://git.kernel.org/tip/15def34e2635ab7e0e96f1bc32e1b69609f14942 Author: Yang Jihong <yangjihong1@huawei.com> AuthorDate: Mon, 27 Feb 2023 10:35:08 +08:00 Committer: Peter Zijlstra <peterz@infradead.org> CommitterDate: Fri, 14 Apr 2023 16:08:22 +02:00 perf/core: Fix hardlockup failure caused by perf throttle commit e050e3f0a71bf ("perf: Fix broken interrupt rate throttling") introduces a change in throttling threshold judgment. Before this, compare hwc->interrupts and max_samples_per_tick, then increase hwc->interrupts by 1, but this commit reverses order of these two behaviors, causing the semantics of max_samples_per_tick to change. In literal sense of "max_samples_per_tick", if hwc->interrupts == max_samples_per_tick, it should not be throttled, therefore, the judgment condition should be changed to "hwc->interrupts > max_samples_per_tick". In fact, this may cause the hardlockup to fail, The minimum value of max_samples_per_tick may be 1, in this case, the return value of __perf_event_account_interrupt function is 1. As a result, nmi_watchdog gets throttled, which would stop PMU (Use x86 architecture as an example, see x86_pmu_handle_irq). Fixes: e050e3f0a71b ("perf: Fix broken interrupt rate throttling") Signed-off-by: Yang Jihong <yangjihong1@huawei.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20230227023508.102230-1-yangjihong1@huawei.com --- kernel/events/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c index fb3e436..82b95b8 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -9433,8 +9433,8 @@ __perf_event_account_interrupt(struct perf_event *event, int throttle) hwc->interrupts = 1; } else { hwc->interrupts++; - if (unlikely(throttle - && hwc->interrupts >= max_samples_per_tick)) { + if (unlikely(throttle && + hwc->interrupts > max_samples_per_tick)) { __this_cpu_inc(perf_throttled_count); tick_dep_set_cpu(smp_processor_id(), TICK_DEP_BIT_PERF_EVENTS); hwc->interrupts = MAX_INTERRUPTS;