Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6325478ybl; Mon, 23 Dec 2019 04:10:56 -0800 (PST) X-Google-Smtp-Source: APXvYqzpn0Pb24gcTrdBjn3OrOrBDEd1sx8La2N9wH0/6fi9a23I89zuXRnm9P/1vXLh4ydMsuL2 X-Received: by 2002:aca:ed57:: with SMTP id l84mr146744oih.8.1577103055652; Mon, 23 Dec 2019 04:10:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577103055; cv=none; d=google.com; s=arc-20160816; b=mOzBdN110hrMlzznYgH6qAkgttHnu90ukfCWI3frXVdzaVWaL8CtafpLeR4+E8uNSd gm9qneOSB14lPI+vPGtG0kUxz8eNWFm34ZQy751Z8W5ZirVwBhqOWM81XXcMkw446fsY CWCvyD9IqDdVrKfNr+Jyg4QMmsp+xQ7rOg8DdAtLE7nn2+ZvHE66Bqj63RwtT4XVLRsI BXxcEF3daYSosN4KCAWkS+CmyB7AA4Bex4ld9zFalqDaIEI6OdOCxC0xzr7lrwyGAIeg WbXIQ7HbtCPGJcFZL3xSAi8PVu/MebiSLHfqMxtBAN1YTtiQZSGC3uyShilsYOCKCT/W YuNQ== 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; bh=hFK3Bj5JnB1+LCbsh16FGgJmUPAsrkA7N2DvwUNp5lo=; b=Oa3Kr901Bejin9YTVu8lRKChNWgA3BPqHyPDOq0roJ0YI7dfyyI3W72sNMjqAuAWYk BmOzs+Qf4gD2UbC3yXmfhEVo3nh+yJF3OZl4AEk1Nbxbm/lnn6KKVGwrGnEZAibdFhke 0VwKaHm01v4kgyZ+/gl0BQ7bhbzJs+o6piCpuPSlhyRvL6VzIkR5b3qyD2+kFEmR+MYX 3YVV0+UQ1jziwlDGr+93zwU38N4eu+nMMdj1beKECteJ60lT1qPF7kVkd6/8tkJw8/Ay oHR/UKbas6KS+lGnKwN7naXCiu+xPg+Ynb02omLYR6qfONtkpwXzsfg/9Y40uc0LC8sq eCCw== ARC-Authentication-Results: i=1; mx.google.com; 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 l17si1970911oie.41.2019.12.23.04.10.43; Mon, 23 Dec 2019 04:10:55 -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; 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 S1726834AbfLWMKF (ORCPT + 99 others); Mon, 23 Dec 2019 07:10:05 -0500 Received: from foss.arm.com ([217.140.110.172]:44080 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726257AbfLWMKF (ORCPT ); Mon, 23 Dec 2019 07:10:05 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C11BA1FB; Mon, 23 Dec 2019 04:10:04 -0800 (PST) Received: from localhost (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 36A063F68F; Mon, 23 Dec 2019 04:10:04 -0800 (PST) Date: Mon, 23 Dec 2019 12:10:02 +0000 From: Andrew Murray To: Marc Zyngier Cc: Marc Zyngier , Catalin Marinas , Will Deacon , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sudeep Holla , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 15/18] perf: arm_spe: Handle guest/host exclusion flags Message-ID: <20191223121002.GB42593@e119886-lin.cambridge.arm.com> References: <20191220143025.33853-1-andrew.murray@arm.com> <20191220143025.33853-16-andrew.murray@arm.com> <865zi8imr7.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <865zi8imr7.wl-maz@kernel.org> User-Agent: Mutt/1.10.1+81 (426a6c1) (2018-08-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 22, 2019 at 12:10:52PM +0000, Marc Zyngier wrote: > On Fri, 20 Dec 2019 14:30:22 +0000, > Andrew Murray wrote: > > > > A side effect of supporting the SPE in guests is that we prevent the > > host from collecting data whilst inside a guest thus creating a black-out > > window. This occurs because instead of emulating the SPE, we share it > > with our guests. > > > > Let's accurately describe our capabilities by using the perf exclude > > flags to prevent !exclude_guest and exclude_host flags from being used. > > > > Signed-off-by: Andrew Murray > > --- > > drivers/perf/arm_spe_pmu.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c > > index 2d24af4cfcab..3703dbf459de 100644 > > --- a/drivers/perf/arm_spe_pmu.c > > +++ b/drivers/perf/arm_spe_pmu.c > > @@ -679,6 +679,9 @@ static int arm_spe_pmu_event_init(struct perf_event *event) > > if (attr->exclude_idle) > > return -EOPNOTSUPP; > > > > + if (!attr->exclude_guest || attr->exclude_host) > > + return -EOPNOTSUPP; > > + > > I have the opposite approach. If the host decides to profile the > guest, why should that be denied? If there is a black hole, it should > take place in the guest. Today, the host does expect this to work, and > there is no way that we unconditionally allow it to regress. That seems reasonable. Upon entering the guest we'd have to detect if the host is using SPE, and if so choose not to restore the guest registers. Instead we'd have to trap them and let the guest read/write emulated values until the host has finished with SPE - at which time we could restore the guest SPE registers to hardware. Does that approach make sense? Thanks, Andrew Murray > > M. > > -- > Jazz is not dead, it just smells funny.