Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp563518pxb; Tue, 5 Apr 2022 14:10:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9Q+AhST9aMScIkdrT9P6+xai9siVj4vErwvTdiY1cMNrzprS5Hv9m+MOs6vmUsr4sWHNC X-Received: by 2002:a17:90b:3a92:b0:1c6:64a5:a403 with SMTP id om18-20020a17090b3a9200b001c664a5a403mr6171725pjb.89.1649193023043; Tue, 05 Apr 2022 14:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649193023; cv=none; d=google.com; s=arc-20160816; b=bUqL8DFf2763OxUtHMHUhEKeHt2ALtdVVnLWk4oqBX+lu66k3snLQFZMIYR1pUEfBl AaARQ02EHTJh3A8wTNf1gu489W/D9Cx41hkoKO7KC60Qf2yCzE+P6a8ZkxxtbT2Vx9IP rd9Zil2HoMMmGI6Ok0bZUIdBpCSyjSZeqdwTBnFU7NifCIZNSd0DLupRMN3tVwxUqxGH Xt27Og+2zcn+e2dDJJChHzOzw+Wu4hwGXwb3xKpiIFb5M1nfhyvDtczoGjdw4M5fmnsL OYnc7pkV4AhEj8+WJVs34PyqsMRT728qMQL6wFvrhCUO32JKxYHWaSw8RADHic3WiXJR mWNw== 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=yt0rYyrwZxg63pG0971ROdocgPh4CTPB8CHSHPagIyA=; b=GtAK3ySZQ/NLfo28qRdldV1TLtEQ0VkFfEBLfCTiy9WpS8Xy5vrXoMYvIae/dmcS0N C3ntTrLosGcSsoHVzgwyJVFEryI103JprlqRgbuvYL3nV2yYaWY/PTDAm148jQnM2sme oR2vmpaXjwW5cjFpoYz2zH6+cjr94AabcU78cLfGzBxWuZQNmSgGVQ0eg3H02Wd5qyRb 4d45nk9FmhRD55Ig0sq9CsuS+yDIBujHg1MVWgpS4e8X+rv1Kzu7AqmOOyrGBBR0YvcA y5pxpmp9P99+Tzi0a38jxadt5b/eGbWoiCxHgdM7PsX0IIBFCE8e6XDQRBOOqh4b5Xqo Zdrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="p6iXMl/r"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=6FeYv2OH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id hk7-20020a17090b224700b001bd14e01fbesi3217472pjb.172.2022.04.05.14.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 14:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="p6iXMl/r"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=6FeYv2OH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2D5F45F24B; Tue, 5 Apr 2022 14:04:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346282AbiDEKnI (ORCPT + 99 others); Tue, 5 Apr 2022 06:43:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241184AbiDEIcx (ORCPT ); Tue, 5 Apr 2022 04:32:53 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B504917061; Tue, 5 Apr 2022 01:29:10 -0700 (PDT) Date: Tue, 05 Apr 2022 08:29:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649147349; 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=yt0rYyrwZxg63pG0971ROdocgPh4CTPB8CHSHPagIyA=; b=p6iXMl/rfQ/Y7vvlKS1VEXu5kSfghGKVsqKGvbZ7SWsX+xNbCMpYpgZwwjJo0RiruMxy9/ Ih+UWOQ7YSjStiobddeOCMz9ptG1O9q9n5JpO/TplYdlZwORj/TC9gQXSPlko0Tnua529j DK40lhSnIz0MkVxcodS1eRJyBSWxlfy5YKqqRCqC/p2DMnPC6I5WRg9wF7MLY6Vl4zwnMm xE5e6uBFHxlzaySZrCKe46Q+kQQq+2ZKvr4th0WvLHJvga2UrqAtl2W/RlFZ0F8Cls7e7F jkAtO1jId0KsGYXAqOR/N3+ro8Miq2BFS1qhgT2PvZYtQ2bbyEADQ2gFg8Ya+A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649147349; 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=yt0rYyrwZxg63pG0971ROdocgPh4CTPB8CHSHPagIyA=; b=6FeYv2OHDQblpguOMp8R9bMIFDZRgJYQRIHrzJM8UMLF2/SCDGcUcaSdbNobM2UoTz0JiU +oha2wS0j1IXC8AQ== From: "tip-bot2 for Namhyung Kim" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf/core: Inherit event_caps Cc: Namhyung Kim , "Peter Zijlstra (Intel)" , , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220328200112.457740-1-namhyung@kernel.org> References: <20220328200112.457740-1-namhyung@kernel.org> MIME-Version: 1.0 Message-ID: <164914734824.389.11482584782909269521.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: e3265a4386428d3d157d9565bb520aabff8b4bf0 Gitweb: https://git.kernel.org/tip/e3265a4386428d3d157d9565bb520aabff8b4bf0 Author: Namhyung Kim AuthorDate: Mon, 28 Mar 2022 13:01:12 -07:00 Committer: Peter Zijlstra CommitterDate: Tue, 05 Apr 2022 09:59:44 +02:00 perf/core: Inherit event_caps It was reported that some perf event setup can make fork failed on ARM64. It was the case of a group of mixed hw and sw events and it failed in perf_event_init_task() due to armpmu_event_init(). The ARM PMU code checks if all the events in a group belong to the same PMU except for software events. But it didn't set the event_caps of inherited events and no longer identify them as software events. Therefore the test failed in a child process. A simple reproducer is: $ perf stat -e '{cycles,cs,instructions}' perf bench sched messaging # Running 'sched/messaging' benchmark: perf: fork(): Invalid argument The perf stat was fine but the perf bench failed in fork(). Let's inherit the event caps from the parent. Signed-off-by: Namhyung Kim Signed-off-by: Peter Zijlstra (Intel) Cc: Link: https://lkml.kernel.org/r/20220328200112.457740-1-namhyung@kernel.org --- kernel/events/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/events/core.c b/kernel/events/core.c index cfde994..3980efc 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -11635,6 +11635,9 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, event->state = PERF_EVENT_STATE_INACTIVE; + if (parent_event) + event->event_caps = parent_event->event_caps; + if (event->attr.sigtrap) atomic_set(&event->event_limit, 1);