Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp479371pxb; Mon, 8 Nov 2021 17:03:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzI9N9Zakl8coh2hkVvJSEYEVMq/ewaeu3TEqDkmkS2ABh/RHjpiepGsufT9Be5phYkfM0n X-Received: by 2002:a17:907:7703:: with SMTP id kw3mr4471662ejc.34.1636419781428; Mon, 08 Nov 2021 17:03:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636419781; cv=none; d=google.com; s=arc-20160816; b=gBoYLzhYd3zNLLlIEEGRkO+O8JQ8dZuo5MW38Lj1REBasl+B8AGd2AqQCBSouTDu3Q kWXDLs2lDyZSgMvQyzsFn1Ml9843Baskwscg2NaNMtoPRL+7DG9rL2vco8PJyy+DGAs5 ixIX6ciccarTc5epw0OrhWSmTosPc5bJ29LYQedg5MlRA93ITj/CRC9FLnlMoY5f8t/s JjSSbTGv0/IWc2zSLFAu6yVV1apO0weMzRNFe3Izg38Ffv/Q4Frtefhfy4TUxzdU101J 5kmXQGvJ9tQbiy3c5hkPtGFSevaEZJRTW4uCFRDGdM0ETI15RJyHyBYWJ2DiL0Upxmze H0KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=IjhS3kxhetwXaiYgcJTnbbq17lp2O4y2bTsBt4Udz4Q=; b=Rd/U4kdSnbOC+CLBPVIXH4skXP/OPiFRtFYtW2nsKUW2JUsSuiaXwVJCjj8KRDLpdZ HOSL6yw8VcFIZ+E8PjNFlQa2matzsDkTueu1TF6yUNOvHFoMFInpkgLi0rJyOWhdAHmM d3XAI4V5zjgsUxS0Utk1PRlE5oI2i265SYQbRS+Tk+a8im5mj4K+h+Dds8VATXHLWGIF fT+zcxKrBtI1QLOo2t1BT7+8NyQeYDMMjZDFBdwoBQ63+cK4+3Xyn5JvCDYSIzSXG6XV +cm8LZ7RnaYGlrbhCc9QP/RIMyeHofYjhOoNMIRKwzRMbV+NXpFX1tpo16vw0GKRs3pK 0ePw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="jGk+Vd/0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p3si6399681eds.514.2021.11.08.17.02.33; Mon, 08 Nov 2021 17:03:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="jGk+Vd/0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237879AbhKHTxv (ORCPT + 99 others); Mon, 8 Nov 2021 14:53:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237645AbhKHTxv (ORCPT ); Mon, 8 Nov 2021 14:53:51 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67A84C061570; Mon, 8 Nov 2021 11:51:06 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id v23so6956210pjr.5; Mon, 08 Nov 2021 11:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IjhS3kxhetwXaiYgcJTnbbq17lp2O4y2bTsBt4Udz4Q=; b=jGk+Vd/0P4mleeeUfxZYYpjag6EOgu5O79b4VSJg1G8hvCKC8kzYgtBwIBSL25zecM BbVHlslQLYsZeraYj9Gol/D0D6I6vyHLZHx95o4pWVmfNQlwjOsa6+pLid4KQVRUnwvt 3PUBAktZF4H4Arm8zPwHX+Bo/vbAbh+VMfWryOrQPPfaUTngYmbBlyort7ZgrrjoZPyk ghCacJRI1gNkckADwzimiuITMmIesDrft0SaO4FDF9XtO+hl55c8WcNFlxfwwZD9Nshe OD21exr+Af3DYjHIM7Z6STmaO36C7MrmGkmFo1P/cZ6M0gH1f2Urf6dmiOLj14HLxrQj PImA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IjhS3kxhetwXaiYgcJTnbbq17lp2O4y2bTsBt4Udz4Q=; b=ScM1wdkZOzMjb+NrAfab5KoT9wGNzkTo5Fo7Jt+kP3tj7zcZMe0wt/teJKPCLB99UJ wQ+CoqQPxnUJthP5gtTIMLW3PLUfx4WZpCcmv9CxVsUXlAmGbsSMj+JEAg5XB7DTPg4p GEuul5K9Pn4MgaJqyp8asyGC7+mzjJ2yCbIMzdL14yE4E+X8GyyMWxvxFUPvulJ/uOeZ YGkTru5+lPI3JlrsHdj6zFbyWGQjgtnA67N9pL+hlUJqYbTg++veVMWaGMg53b4gOw8u cZnhZeJjzcD/XLYEzwR/jXMScInh+DsXS++0mHaNCNIa0sYutYZ7tPudFuz6kLCcMcys 2fSQ== X-Gm-Message-State: AOAM531m+w0pgT4+hF3StXqyFgoPb4lC/usGnHzlovH4Y3j0uaZ+6Bwd v+8JGywxh7j99EM4zO4BJzM= X-Received: by 2002:a17:90b:4b04:: with SMTP id lx4mr914448pjb.11.1636401065754; Mon, 08 Nov 2021 11:51:05 -0800 (PST) Received: from smtpclient.apple (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id m12sm170166pjr.14.2021.11.08.11.51.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Nov 2021 11:51:05 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: Using perf_event_open() to sample multiple events of a process From: Nadav Amit In-Reply-To: Date: Mon, 8 Nov 2021 11:51:04 -0800 Cc: kan.liang@linux.intel.com, LKML , linux-perf-users@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: References: <92645262-D319-4068-9C44-2409EF44888E@gmail.com> To: Peter Zijlstra X-Mailer: Apple Mail (2.3654.120.0.1.13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Nov 8, 2021, at 7:24 AM, Peter Zijlstra wrote: > > On Sat, Nov 06, 2021 at 01:57:23AM +0100, Peter Zijlstra wrote: > >> The problem seems to be that we call perf_event_set_output() before we >> set event->ctx, which is a bit of a problem. >> >> Now, afaict it's been broken since c3f00c70276d ("perf: Separate >> find_get_context() from event initialization"), which is ages ago :/ >> >> It's waaay too late to try and fix it; I'll be likely to make an even >> bigger mess if I tried. Perhaps tomorrow. >> >> Clearly FD_OUTPUT isn't much used :-( > > The below seems to fix, it's a bit of a hack, but I couldn't really come > up with anything saner. I originally considered doing a similar hack. I assume it should work, but I moved to using the ioctl workaround that you suggested. Clearly nobody is using this feature if it is broken for 11 years. There is always the option to deprecate it if there is an alternative.