Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp248285pxa; Tue, 11 Aug 2020 01:47:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4nSBcV7pF9CXa4h/Y9LmLR0gBDNJZd+VqEGylrTys8kjs4knYiGeGrrHAUPfA356TLNb1 X-Received: by 2002:a17:906:c18d:: with SMTP id g13mr24723987ejz.239.1597135639653; Tue, 11 Aug 2020 01:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597135639; cv=none; d=google.com; s=arc-20160816; b=lSanOAIcrZ5lsbJVaEVSy/3RuPn/G6/WxFg2oEo0ZV9ldLi7fX2luw0QwN3P+pbYyX vgCeYFnfsnK8TeQteez63ddlIMCWcgf6kEe/3CFQhCWzdyXh636XJO0vmiW7vgq/zgSm vGOVvFo3zI1PNzKLAl7pUgSkGw4wgM5xVnBzYMagwpxLtNKuLUETy+L85V/+oOIrAFiQ pRIz/uKm9PjZ7D13MjnlPRAdQlCgeApWlQu68nPCaYHAGzj2T9Vg+5/F5NvI8zJO36mo PzST9rebNlao94ahm2DP1CCQYoi5clJRKEqkACfN8/rQmdHNl4gxBYgu/S1HE9sjWv+9 fPsQ== 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=CKeCbht9+I/cKIV97LwNQwtBN6MyvsrLxhEgwxUO6HQ=; b=kVQGhKB95yGBwq8Pj0F5hJIg9HWx0Q0uqlL6JmJ0aCCePqclNq8xj86JuDyU8WFISN l+L7+aZSKc0o+1GyIqRFXFwPzX+FVJ3xu5zfx3HrFec9VnVYJblqii+NT217OMMwjgVz sTlI6qzZBwtgNPjsUlwcIDJDyLUC3RBBw6RErHdPS/ZqBjbP6qVWlZHn61AEy3fB0OJt LuRjX0O+rQ+/qWLFjFzAUY5awE1v2tWk4cJc0dUGo3P4MO+bEdh3Uhm39hW3AsVFI2Ci wBMMUMUVuis8wlPCUnMdfB6UoU3eN/TcH/+5jbKi2Jcy9xII/rhHWLPcBFlMb9vfQ32e wwfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="H/7JjMT3"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si12415488ejz.135.2020.08.11.01.46.56; Tue, 11 Aug 2020 01:47:19 -0700 (PDT) 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=fail header.i=@infradead.org header.s=merlin.20170209 header.b="H/7JjMT3"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728350AbgHKIqI (ORCPT + 99 others); Tue, 11 Aug 2020 04:46:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728224AbgHKIqH (ORCPT ); Tue, 11 Aug 2020 04:46:07 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24DFAC06174A for ; Tue, 11 Aug 2020 01:46:07 -0700 (PDT) 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; bh=CKeCbht9+I/cKIV97LwNQwtBN6MyvsrLxhEgwxUO6HQ=; b=H/7JjMT3LY1QStd9fOUNKK2mO6 0gZ++c8b+koflECpA/6UrWjjQgS/bZuYFvq1Ua/JGbcxht2JLzVZWxo8Kg12F6vjpXT+YFaW9zxF2 ZbSqRp6xp6EsSWtVkscJd52O0b8GSxmkjbjC/FDbvJerkyVSBaORU4EtZMSoy8gx8oTSo84e4YGes WCnR6h8PHgyAG1bbriaroUF3UOg6q97P9U3I/hr4JOZCW79KeZU/M6ITSSlXnnO1xMAzwngcHm3fn hJiDDmb1q8rsbTAlPw31NxBfFSWBUoB4vvS2BSfqy1S1sToLey3LsxIRYqQdi/dw9L9/MJPuWpQMT upC8CKgw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1k5Pup-0004ph-Nw; Tue, 11 Aug 2020 08:45:54 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id A102C980C9F; Tue, 11 Aug 2020 10:45:48 +0200 (CEST) Date: Tue, 11 Aug 2020 10:45:48 +0200 From: Peter Zijlstra To: "Jin, Yao" Cc: mingo@redhat.com, oleg@redhat.com, acme@kernel.org, jolsa@kernel.org, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, alexander.shishkin@linux.intel.com, mark.rutland@arm.com Subject: Re: [PATCH v1 2/2] perf/core: Fake regs for leaked kernel samples Message-ID: <20200811084548.GW3982@worktop.programming.kicks-ass.net> References: <20200731025617.16243-1-yao.jin@linux.intel.com> <20200731025617.16243-2-yao.jin@linux.intel.com> <20200804114900.GI2657@hirez.programming.kicks-ass.net> <4c958d61-11a7-9f3e-9e7d-d733270144a1@linux.intel.com> <20200805124454.GP2657@hirez.programming.kicks-ass.net> <797aa4de-c618-f340-ad7b-cef38c96b035@linux.intel.com> <56957a58-6292-e075-8c30-6230450e3518@linux.intel.com> <20200811075924.GU3982@worktop.programming.kicks-ass.net> 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 Tue, Aug 11, 2020 at 04:31:10PM +0800, Jin, Yao wrote: > Hi Peter, > > On 8/11/2020 3:59 PM, Peter Zijlstra wrote: > > On Tue, Aug 11, 2020 at 03:50:43PM +0800, Jin, Yao wrote: > > > Could I post v2 which basically refers to your patch but removes some > > > conditions since I see some issues in test if we use these conditions. > > > > > > 1. Remove '!event->attr.exclude_hv || !event->attr.exclude_host || > > > !event->attr.exclude_guest' at the entry of sanitize_sample_regs(). > > > > > > 2. Remove '!attr.exclude_hv || !attr.exclude_host || !attr.exclude_guest' > > > at the perf_event_open syscall entry. > > > > exclude_host, maybe -- due to the dodgy semantics of it, but the others > > should definitely be there. > > > > exclude_guest and exclude_hv are tricky too. > > If we do 'perf record -e cycles:u' in both host and guest, we can see: > > event->attr.exclude_guest = 0 > > thus sanitize_sample_regs() returns regs directly even if exclude_kernel = 1. > > And in guest, exclude_hv = 0, it's out of my expectation too. I'm confused, how can 'perf record -e cycles:u' _ever_ have exclude_guest=0, exclude_hv=0 ? That simply makes no sense and is utterly broken. You explicitly ask for userspace-only, reporting hypervisor or guest events is a straight up bug.