Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3052735imu; Fri, 18 Jan 2019 04:04:45 -0800 (PST) X-Google-Smtp-Source: ALg8bN66DLnlrmpo0LALul8HZfr817lqbjBXC8Fr3ZkHhPxBSH5TgDeioPmWkMvD3LmsET4JKeI3 X-Received: by 2002:a62:2f06:: with SMTP id v6mr19318343pfv.216.1547813084988; Fri, 18 Jan 2019 04:04:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547813084; cv=none; d=google.com; s=arc-20160816; b=FWyDbqqLWFsz4RVdqxbz9tuYpSNwMH4TdS4AyU39w5NCLx9jPBObO47CIAqhwT3Pky BGWXzSRJaz/F27J+kzafomU1c9fG7ITvF2VEm0FQCwCobt5d9r6KR4iufUZXUswd9mqv i4ZQCZM0Mwh6wCamwuXMlCylNkZEGtrxaShp8FB+93Hh8sVrYmdpgcDgWJwN5mrlLqdA A4JIbDLdz6XmKj+06UCVjSUKeGXWSUPtjUUzvKPVJiXwRie7pw3pLitxYJK3Nq3z7Dcc DT1RNjMPK0/FWmXH/7H5ZTfx+W5ljk5sVm7WPKKMHY6ZQ0C4y/orUdlwvo4yktNulTk3 +wFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ELgBI6i2Bpmn7X3LY1bhxhBSqNEAuOmsAJTJ9IieA5U=; b=e84IPEVPXAL7DWD7WVOkI0malryE1pNqXw5VcWAYG8oXKkJ+mMX4HPF5ApoLj1nfmI 7nNxR+vIxIWSYi9qzJZ6pVQKegKyKN8lgIvqVN5CiBtBswr6ioz8W2Yqfq4a7rS0geta ZpJfShExJ8bLkyEf0xtwhbQJEb6FW0QPf3bxY2MUTXL8/z4pV6GL0Y32PFJKts+PbaP9 OmCcuBcrocggTkx5PSJc0eCEBXIIp4XIgbVl2GTkZpFNLimT7FvSMCqHxKPyJOPmSqjh tqbAn0NxWENVFMKKgk49dhKPCqVWftuR9eshsBJIBskiIg6A3I6q9iE3VW9MimTq8EPx Wj4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=bNz5OqLm; 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 c1si4563917pld.194.2019.01.18.04.04.25; Fri, 18 Jan 2019 04:04:44 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=bNz5OqLm; 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 S1727271AbfARMB7 (ORCPT + 99 others); Fri, 18 Jan 2019 07:01:59 -0500 Received: from merlin.infradead.org ([205.233.59.134]:58030 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726593AbfARMB6 (ORCPT ); Fri, 18 Jan 2019 07:01:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ELgBI6i2Bpmn7X3LY1bhxhBSqNEAuOmsAJTJ9IieA5U=; b=bNz5OqLmO9pFEh4raDdM0Wpit p4ekGr0RCzboOIIdCBo3Yg+tdgfMVi8xOrGbhIVf7FfVciqGDVeb6Zaz0+diwQTb0EPL8PBZZfTTq Czyt9fztBHWc8caZY2hELM5wLWpfYxYWXzf4t8BrSaRuW45oASBJ6qsvXwyGGin5maqqpimXyVnR5 2Tux9OpB5Nk5sBnWCLVxQKpeJ0e28+X16zRUY0Ht+ncPialI6pNGFk5G2jrBaRYluLxlMxFvKVMsQ wXZ9Jeum/QoqCKJombvXtkgy6vZ5kfR5jr9CkICtD7RFxFuLRVEWzez9U7eUIK+K6/ycA5nxOboJ+ ib2oFKQug==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkSqO-00029C-2H; Fri, 18 Jan 2019 12:01:52 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 20B1220289CC4; Fri, 18 Jan 2019 13:01:49 +0100 (CET) Date: Fri, 18 Jan 2019 13:01:49 +0100 From: Peter Zijlstra To: Vince Weaver Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Arnaldo Carvalho de Melo Subject: Re: perf: rdpmc bug when viewing all procs on remote cpu Message-ID: <20190118120149.GC27931@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 11, 2019 at 04:52:22PM -0500, Vince Weaver wrote: > On Thu, 10 Jan 2019, Vince Weaver wrote: > > > On Thu, 10 Jan 2019, Vince Weaver wrote: > > > > > On Thu, 10 Jan 2019, Vince Weaver wrote: > > > > > > > However if you create an all-process attached to CPU event: > > > > perf_event_open(attr, -1, X, -1, 0); > > > > the mmap event index is set as if this were a valid event and so the rdpmc > > > > succeeds even though it shouldn't (we're trying to read an event value > > > > on a remote cpu with a local rdpmc). > > so on further looking at the code, it doesn't appear that rdpmc events are > explicitly marked as unavailable in the attach-cpu or attach-pid case, > it's just by luck the check for PERF_EVENT_STATE_ACTIVE catches most of > the cases? > > should an explicit check be added to zero out userpg->index in cases where > the event being measured is running on a different core? And how would we konw? We don't know what CPU will be observing the mmap(). RDPMC fundamentally only makes sense on 'self' (either task or CPU).