Received: by 10.223.185.116 with SMTP id b49csp4431540wrg; Mon, 26 Feb 2018 18:12:40 -0800 (PST) X-Google-Smtp-Source: AH8x226r2p39s8AfE983g+hqzq1J9W96CXzIZQ5gYYUsjXtHyBkTqptOvncH8JlsK6WjA5P16B0r X-Received: by 2002:a17:902:8e86:: with SMTP id bg6-v6mr12816145plb.113.1519697560053; Mon, 26 Feb 2018 18:12:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519697560; cv=none; d=google.com; s=arc-20160816; b=UIUcYn7KkwS0DvscOS9p6xKpE0P6yeSMWcgUJunnfogD5a1rcH5KEoKq5+H0pRt5At mTblW6fnDtrYQrDKApPRhx0pYX4vO5fsu0qeTmJL+T0J3zZ6l2NVX5UG9gcdZwCzt/fP RPBpafcZl9ClJU149EnOSaWkrc4mnsiWu7GzCGiqkBOLGxDe6JlzLTnXsmgujAP3ddeN wyp8QAffAN9VDTuFMqZPGL+Y6eMtXdh090x5OfgvNgCtSQUuzoOHLwhxKslsBRYp49Hb anB9WxPfjgRCZkkHeI6sfiysJlvNE85fJBhednn1XqAIhxmf5zs87ukAmod+F9hUXRKn 7GKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=yhJKPsNtPRySSjfo6fTAe5H5VSrR0/bhs8aSdWYl8zc=; b=chnrAHRPRFP90iTGToY8cOz6EH195W3VZUZwkGMFsYGiWpUOjHMKN/lNRxgcNL3CMd jXJ2KVLT3HGnFb5YTBRriAiNteIq9w8QwM0IgBA7NM08iefAGGZ16aXhmi9O91OjNjoi 63v0k5Xu4F2a8YDwlXJ3WQYWRuTBjQijjmp281HGxQRPaDGSPiF9nAr2S8tJrCNir6w9 DwqziV+XVaDJv+VHSWBbRLcwv5HUBR0vB8LOHZxit+eeZNj1PtRyw+y2WBLex8aUVP6X 4yoYCpTwZdO0U1zbyZp5m8b6+zWsyWLw/DoyxNg+lf47HDt5z88cSMN1Sx5jXYCcLGBI R9Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=KTBOBd8S; dkim=pass header.i=@codeaurora.org header.s=default header.b=KTBOBd8S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5-v6si7514892plr.335.2018.02.26.18.12.25; Mon, 26 Feb 2018 18:12:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=KTBOBd8S; dkim=pass header.i=@codeaurora.org header.s=default header.b=KTBOBd8S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751604AbeB0CLr (ORCPT + 99 others); Mon, 26 Feb 2018 21:11:47 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:51810 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751448AbeB0CLq (ORCPT ); Mon, 26 Feb 2018 21:11:46 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BA4B4607A2; Tue, 27 Feb 2018 02:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519697505; bh=EZXA4TPTkBTovIPHKrykmXTo9I8dmb28p8bR629R09k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KTBOBd8SgCi9g7c3X0u3U0V/p8xSFx5OYUpbMJjXZUn83yHINjQDA7z3HRanUIGI8 9Vpn1H/l1C9DK/TlTvvDPYggVu0IykN1PizUisyfa1TbjIRXHGCyip2NMqHl0DlCIp dQgeIrbyqo5zk7lSDkvh05kKK8rS/2dbOOKfOrLI= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 0A659601E8; Tue, 27 Feb 2018 02:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519697505; bh=EZXA4TPTkBTovIPHKrykmXTo9I8dmb28p8bR629R09k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KTBOBd8SgCi9g7c3X0u3U0V/p8xSFx5OYUpbMJjXZUn83yHINjQDA7z3HRanUIGI8 9Vpn1H/l1C9DK/TlTvvDPYggVu0IykN1PizUisyfa1TbjIRXHGCyip2NMqHl0DlCIp dQgeIrbyqo5zk7lSDkvh05kKK8rS/2dbOOKfOrLI= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 26 Feb 2018 18:11:45 -0800 From: skannan@codeaurora.org To: Mark Rutland Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , avilaj@codeaurora.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/2] perf/core: Add support for PMUs that can be read from any CPU In-Reply-To: <20180225143802.denbkubqjg2dc7af@salmiak> References: <1519431578-11995-1-git-send-email-skannan@codeaurora.org> <1519431578-11995-2-git-send-email-skannan@codeaurora.org> <20180225143802.denbkubqjg2dc7af@salmiak> Message-ID: <90e7ff7d7dc1054db356fb1740ddb990@codeaurora.org> X-Sender: skannan@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-02-25 06:38, Mark Rutland wrote: > On Fri, Feb 23, 2018 at 04:19:38PM -0800, Saravana Kannan wrote: >> Some PMUs events can be read from any CPU. So allow the PMU to mark >> events as such. For these events, we don't need to reject reads or >> make smp calls to the event's CPU and cause unnecessary wake ups. >> >> Good examples of such events would be events from caches shared across >> all CPUs. > > I think that if we need to generalize PERF_EV_CAP_READ_ACTIVE_PKG, it > would be > better to give events a pointer to a cpumask. That could then cover all > cases > quite trivially: > > static int __perf_event_read_cpu(struct perf_event *event, int > event_cpu) > { > int local_cpu = smp_processor_id(); > > if (event->read_mask && > cpumask_test_cpu(local_cpu, event->read_mask)) > event_cpu = local_cpu; > > return event_cpu; > } > This is a good improvement on my attempt. If I send a patch for this, is that something you'd be willing to incorporate into your patch set and make sure the DSU pmu driver handles it correctly? > ... in the PERF_EV_CAP_READ_ACTIVE_PKG case, we can use the exiting(?) > package > masks, and more generally we can re-use the PMU's affinit mask if it > has one. > > That said, I see that many pmu::read() implementations have > side-effects on > hwc->prev_count, and event->count, so I worry that this won't be sfe in > general > (e.g. if we race with the IRQ handler on another CPU). > Yeah, this doesn't have to be mandatory. It can be an optional mask the PMU can set up during perf event init. Peter, Is this something that's acceptable to you? Thanks, Saravana