Received: by 10.223.185.116 with SMTP id b49csp5531972wrg; Tue, 27 Feb 2018 15:16:47 -0800 (PST) X-Google-Smtp-Source: AH8x2245vU5yzx1j1WflriNVVnL2paUArmt0X3VfUPXhkO+V/z4uKwa3in0vJbuS/Ml86tcQjYy4 X-Received: by 10.99.43.73 with SMTP id r70mr12851162pgr.316.1519773407830; Tue, 27 Feb 2018 15:16:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519773407; cv=none; d=google.com; s=arc-20160816; b=lTrfjwkEYcNkbiMxXHEchNXyCx4kt5i+6Iu13GlAUCRSNLltQ0QxJt9VNqGBy2mC+1 Bxp4hUm1T7+N8WKu7VWJwn9iyuuS8sJaWhYGqTIr/UA0qORWiwE/jCgWrA7gWuXvSLO9 PMukVrGsTkFMgwu5FGfL9WsIrrkWf5ydffmnoC/1rdAG+Naas8s2kqj6ZFODHyOwUlHS 9xg7Fk8NsmVVoVapFkwkDm93POswBLe2W/xfeVT63xEaZh/4vn8OYXmK9xDm/814Vn06 lyO0KZB8EUp1Y6cC+Rj3wMBWycTJPSFHYRmdLVmC11H1AFGtPvrN44JLZY/B0+boJuhm uq3w== 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=cvO8R+Jc30VWfRQ5qVOle/DZIAnUgg09sz8IZKXnJtI=; b=V9Obopf73MlFISrlAjIEwjF7zDZ3DO6vva19bP7fI3CGb8F6E0QjRUe1YTJAvQk63K 4NKyz237aCfvQ+qLp2tl5ID2SBfEsNqQYWLU9E2eMUjgeb1WHE4uvs2kSJh6wBcb2iqE 0msYm0fzvCK+g72CrMGUkd7Usm0SAQ3uIBH+KtsrjKMhIk19MJd6szwmfsz0NbDPyxEY LXzGd1RtYDWDiZCgLbMRa8hc8ZtrdkXygLZWw+ag5d6mcigAo8GhZJDeNy2fbWNhWEQR BvfvSAkBNtlGSltZuIZI4bl6GguZQ+KopWm+JOfeiOo6CbP/WEmYJpRjtkyh8mZWgZGl o9lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=pDpW3Wwd; dkim=pass header.i=@codeaurora.org header.s=default header.b=jEezqPvb; 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 k185si162375pfc.277.2018.02.27.15.16.33; Tue, 27 Feb 2018 15:16:47 -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=pDpW3Wwd; dkim=pass header.i=@codeaurora.org header.s=default header.b=jEezqPvb; 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 S1751994AbeB0XPs (ORCPT + 99 others); Tue, 27 Feb 2018 18:15:48 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:38808 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751799AbeB0XPr (ORCPT ); Tue, 27 Feb 2018 18:15:47 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4397260849; Tue, 27 Feb 2018 23:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519773347; bh=W9/qDnv+QtfatkHr81Ittp7yygYolgtb/tZM/oenfps=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pDpW3Wwdra1+RUGEEIDZKe0yuCwYueQ8tn7arJf9HxVXKuVGOMDzs7x3T9pmYKsAu BpTFk4sfqIIaVDOAiKUJAutAkxESqv238NSaSr6qBV0tf9PIdEqUs+feU8vp1DWWNr YzdyL2HrMURirg0GN4xyG2JGBoICrnWN6zEoW0tI= 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 4D09E601E8; Tue, 27 Feb 2018 23:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519773346; bh=W9/qDnv+QtfatkHr81Ittp7yygYolgtb/tZM/oenfps=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jEezqPvbdVEbgMecTeCnjvRlwHOO0UDlsT0hL5j3PHhPmXVrILzEDsFhX5zSfb9OK A3/xzOzMu/StoS5ynNBZiGV5O2QzoKBJyaPQjFhpAnKJkoNkEBJkn9NELnY5N1N+BU cPvsVmKbVWh4gOFcZJZIZkDMWOdWJ+qWC4OsTNrc= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 27 Feb 2018 15:15:46 -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: <20180227114313.mtvyo6rdavqfj2hy@lakrids.cambridge.arm.com> References: <1519431578-11995-1-git-send-email-skannan@codeaurora.org> <1519431578-11995-2-git-send-email-skannan@codeaurora.org> <20180225143802.denbkubqjg2dc7af@salmiak> <90e7ff7d7dc1054db356fb1740ddb990@codeaurora.org> <20180227114313.mtvyo6rdavqfj2hy@lakrids.cambridge.arm.com> Message-ID: <3a57c8261e0f10b72e0533c39d9abe19@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-27 03:43, Mark Rutland wrote: > On Mon, Feb 26, 2018 at 06:11:45PM -0800, skannan@codeaurora.org wrote: >> 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? > > As I commented, I don't think that willl work without more invasive > changes as the DSU PMU's pmu::read() function has side effects on > hwc->prev_count and event_count, and could race with an IRQ handler on > another CPU. > > Is the IPI really a problem in practice? > There are a bunch of cases, but the simplest one is if you try to collect DSU stats (for analysis) while measuring power, it completely messes up the power measurements. Thanks, Saravana