Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2628411rwa; Mon, 22 Aug 2022 10:42:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR47lJOpZLHRWebu1AYG1QMopMPD7pK4/YhgYkQTKzTHxhjI6kRe/rEVCfPEym/wcpJqvOTk X-Received: by 2002:a17:90b:4ad1:b0:1fb:5d3:3a36 with SMTP id mh17-20020a17090b4ad100b001fb05d33a36mr12993574pjb.174.1661190157786; Mon, 22 Aug 2022 10:42:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661190157; cv=none; d=google.com; s=arc-20160816; b=bJMDdKT2xhApcEUV0VIUDoi1e+LIiluffQvY5lg/DdEBgkB3pld0ggbFFRlyTzGGnX 5vXCfNaddBJ5Wvwwz/K7Fwr6MXk3cwZJ6wdpRrERvUU8XBiAuzEyxeN0SLZ3C0eYcSev G5zTEghG/zF7RHlFlFAoXfRuKnzKi9qUGomB1uSnshx8Swr+JvlVaUEEDFz9Gm2Qz8in BEhou8zjEWwk33FVk9Vnwwh8YV1KKfqDPvOUQ2yVZ6f0ybOVs6CgBT1ub3UjfaDnW1jk u0QX+k25IxYLy8OqBLJbozfnPJU/PceTXWaHJLsGHIatz7KAlPXy5wyaLVM2gLEphZpV 1jEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pgna4G+ORkwBzTExUNzYbFkMVR58lcZ1tipVS99VrCA=; b=WXw+OQFPrVfYj8q8fJEfdkCuQUuvROMU//DjmyZMwCh3jcbURMMoyicdrNWn8eu/1J FWeFS7cajQhXGF8vRX/Lm6kJMFBc+iY271VY1nbRkXkKdfnstDK7RkL2L+/PWQ/8vq3E +kyG3Q0KZHYOvDmDn0So+xdnYMRi9N5m2EeOFrdTOPCF8pOPMab4lucYE8P3oeAi/gEF NOG6+YP7OK9qem7XdBONSrc3I4bgtNEHhX/XKwM4yyeRuV+bCZyImpp+Bt3pkTzqsecg DgDP++G0t2XSVpnqgIQVA69mX5RjdkoLXka6TCHHaj8kT+3mPLwE+hxTJk9gZgtk8GGM O4hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=u8lhnh+i; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h20-20020a17090aa89400b001d991dfad30si15175804pjq.153.2022.08.22.10.42.26; Mon, 22 Aug 2022 10:42:37 -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=@infradead.org header.s=casper.20170209 header.b=u8lhnh+i; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235301AbiHVQos (ORCPT + 99 others); Mon, 22 Aug 2022 12:44:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236320AbiHVQop (ORCPT ); Mon, 22 Aug 2022 12:44:45 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAA0F19027 for ; Mon, 22 Aug 2022 09:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=pgna4G+ORkwBzTExUNzYbFkMVR58lcZ1tipVS99VrCA=; b=u8lhnh+ikact0cMnMKwecu96jg YxEqXE052FfErSiTCh5bdaYrdBv3/bxlC71cukHzFd4bLqBxEXG2CatEXgiAlGHDnJGtgvBz7nF5B EI5A7FXXR1FNZAo5Yg9vujiN4CuN76crEzzk+vTgG1r9aXuqNkRHEsTMMRr6Alk6uYa4isk8GAfxJ r1eqtmg1JwTZwACtKa+dH0rFBz8KzeLym5OFW+a39ynu4qQBAqJYHtddxqaJ6EMGCGmja+6kjr1JT MD5y63TYYQc+h0o5DqwUXbeoR7B23k3r7EAfqOKkzinc5CZVPyjR6thOkzuo0wN6Ct2YqXYujxrzs MCHtYJhw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQAXI-00ET7y-1S; Mon, 22 Aug 2022 16:44:24 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id AE3C19804A3; Mon, 22 Aug 2022 18:44:22 +0200 (CEST) Date: Mon, 22 Aug 2022 18:44:22 +0200 From: Peter Zijlstra To: Ravi Bangoria Cc: acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, songliubraving@fb.com, eranian@google.com, alexey.budankov@linux.intel.com, ak@linux.intel.com, mark.rutland@arm.com, megha.dey@intel.com, frederic@kernel.org, maddy@linux.ibm.com, irogers@google.com, kim.phillips@amd.com, linux-kernel@vger.kernel.org, santosh.shukla@amd.com Subject: Re: [RFC v2] perf: Rewrite core context handling Message-ID: References: <20220113134743.1292-1-ravi.bangoria@amd.com> <35394cb7-a490-5aeb-b3a8-0f46e3c8ca28@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <35394cb7-a490-5aeb-b3a8-0f46e3c8ca28@amd.com> 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_NONE,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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 02, 2022 at 11:40:34AM +0530, Ravi Bangoria wrote: > On 13-Jun-22 8:25 PM, Peter Zijlstra wrote: > > On Mon, Jun 13, 2022 at 04:35:11PM +0200, Peter Zijlstra wrote: > >> @@ -12125,6 +12232,8 @@ SYSCALL_DEFINE5(perf_event_open, > >> goto err_task; > >> } > >> > >> + // XXX premature; what if this is allowed, but we get moved to a PMU > >> + // that doesn't have this. > >> if (is_sampling_event(event)) { > >> if (event->pmu->capabilities & PERF_PMU_CAP_NO_INTERRUPT) { > >> err = -EOPNOTSUPP; > > > > No; this really should be against the event's native PMU. If the event > > can't natively sample, it can't sample when placed in another group > > either. > > Right. But IIUC, the question was, would there be any issue if we allow > grouping of perf_sw_context sampling event as group leader and > perf_{hw|invalid}_context counting event as group member. I think no. It > should just work fine. And, there could be real usecases of it as you > described in one old thread[1]. Like you I need to bend my brain around this again, but I'm not seeing a contradiction. The use-case from [1] is a software sampler with a bunch of non-sampling uncore events. The uncore events aren't sampling, the are simply read by the software event (SAMPLE_READ). And moving the sampling software event to the non-sample capable uncore PMU shouldn't matter. That is; the code as it stands here seems right, we should check is_sampling_event() against an event's native pmu->capabilities. Or am I misunderstanding things?