Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5335513pxb; Sun, 7 Nov 2021 10:02:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpKmcVvwkaWHeOBM9U//pwt3VvJbuH7F0Vd9QVrqfc1/J2oq9Ki7YJmRPqMddNuPOaXNoF X-Received: by 2002:a05:6402:520b:: with SMTP id s11mr57225097edd.363.1636308130312; Sun, 07 Nov 2021 10:02:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636308130; cv=none; d=google.com; s=arc-20160816; b=XtKe6Xb5NqJo23P+tKv+zBHz+T4JDFNSqzrSRkK2KFUdhG4XPAOstg1adkFAsIz5py Siqnnp7TxkuE7gNN5Uc8he9S1W3q77xfIWQcgmtpeuZUUGmYFK+giHSY9RrbOvcKyqTQ 0keClZEjftp5r5zz5SD4r5wpIXvxq5SMgHIocJn751ZNf5VWfycOihYm+4FSWnKjffeq uaOMnHoS6wJaV3q269DgsXsi6Fqi2HiSUrRUK50LuiaRU76vjY6C9qyv+7KYt5XCMuty 7GkSLmpKiLHM1YlORsy6PkqTaR3yK1gVUD/kS80TduUiUgw4wrexh9dlI1hbT6Qq3SgA 9C/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:references:in-reply-to:user-agent:subject:cc:to:from :date:dkim-signature; bh=hWSo8DJQtX4GR7sZ4HDGGcwPNQ6XTO9xR3T8gxf+CbM=; b=TNtACuMwg1SXEZuSyGqUSzyvj5i/b6KB761jUIMnddSApnOKUlCvv+Xu/3eCopo7D/ h2TG+XLjCfPneo+lMP9y3fL+x4PHju7FCDG2mCYLkFhXs2lSFZALkqpL6FhLjOKPWoMm V3eHMe/a8GAp/l/1qhNMT9R01n9O8o55nhtFsi7J9jOAqY3xNnwF++8EusSAhfBPGNdw 2icCM8j40jBPE93UYUwuZTyiBAvIRu+m0u4e4q5mMQ4G9Q07UKqHSZgTeTZMaDipKCwa DszRg0p/+leWZj0x7RDc4lsIKZ0v9xpQpSg7FvFD5pwkCDtqRVY/jLkjt2Ilu0J8USaZ 8ouw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ry0BZOsK; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g1si29261024ejt.262.2021.11.07.10.01.46; Sun, 07 Nov 2021 10:02:10 -0800 (PST) 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=pass header.i=@gmail.com header.s=20210112 header.b=Ry0BZOsK; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234445AbhKGLAq (ORCPT + 99 others); Sun, 7 Nov 2021 06:00:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232174AbhKGLAp (ORCPT ); Sun, 7 Nov 2021 06:00:45 -0500 Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ABDFC061570 for ; Sun, 7 Nov 2021 02:58:03 -0800 (PST) Received: by mail-qk1-x729.google.com with SMTP id bq14so13019701qkb.1 for ; Sun, 07 Nov 2021 02:58:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:user-agent:in-reply-to:references :message-id:mime-version:content-transfer-encoding; bh=hWSo8DJQtX4GR7sZ4HDGGcwPNQ6XTO9xR3T8gxf+CbM=; b=Ry0BZOsKiVK5/YemWvFUeofA/NFeTHLMZiL8o7KH+EyE/ORTNoJkdAFF9qgkaIJ5r0 Sv8u3iIx1I/20p3xYyxrvgRg9Jb+304+mruE+gFRMiEvage22dqrt/567Zq+6FdNN2Vt t1ef6xuq1MRZFGc6Z6sLBtNtJ0/e/sl12fA1owcQxh6iy+BL+Wi3K2T/FTvqFW+Y8Jyb M6nnIvivrecQAYNqfFE9OrPHXq2KP9dJQkg48XM8igP1Cmdms1IgtUur8QBjv2hbk9PU jr1ZeI66rG0wirn3gstcQ3iN39qYmLtZMJzEf8xR2y3akOOjRCoUZDgIWDvh4+AkXGVI cf/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:user-agent:in-reply-to :references:message-id:mime-version:content-transfer-encoding; bh=hWSo8DJQtX4GR7sZ4HDGGcwPNQ6XTO9xR3T8gxf+CbM=; b=mTsN7ysrg0EXjQV57pBnmQfDvbYmwsRCgn7rTSQpiuGqIMT6kiGHY7o7FK51IGiKDK NG/U3bAnKwp+UtM28pq8yRfEAvB1kAZZW2gC3WLMZ8Jzh8Qop8LdSjw4YaRAlE/4FIya jQqgBNrijxn9cAxgwtUHmgvXnJRB5zDm79Ey5bdg/6rO1d1YRJVBMn1/FqfpMt8w/Qtl CWfRtT3kIVk3A/3hWyYB3hIVSHmRw6+UCMDU5zXxXBms2WuEtKrxZIMvNM6I61SSqNuq yJZIZe0BbwE8731iiARk5PcnjCyCOVIvCQTlmwT4iB3le8TmT0EufVgLUY2I0gUxLj6m WNqQ== X-Gm-Message-State: AOAM531+TgPTqLLtkXt2Lbk06nJHLUHOa6sl3/oKDpjnW24BK92kNjef Us+nQMuj62AYLMgwb07cN9eY1KHe2Uk= X-Received: by 2002:a05:620a:448e:: with SMTP id x14mr56229275qkp.406.1636282681617; Sun, 07 Nov 2021 02:58:01 -0800 (PST) Received: from [127.0.0.1] ([179.97.37.151]) by smtp.gmail.com with ESMTPSA id 17sm8952105qtw.16.2021.11.07.02.58.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Nov 2021 02:58:01 -0800 (PST) Date: Sun, 07 Nov 2021 07:57:55 -0300 From: Arnaldo Carvalho de Melo To: Ravi Bangoria , Arnaldo Carvalho de Melo , Namhyung Kim CC: Jiri Olsa , Ingo Molnar , Peter Zijlstra , linux-kernel , Andi Kleen , Ian Rogers , Stephane Eranian , Kim Phillips Subject: Re: [PATCH v3] perf evsel: Fix missing exclude_{host,guest} setting User-Agent: K-9 Mail for Android In-Reply-To: <11a4cec1-8169-0891-b9c8-4d3a7b689d86@amd.com> References: <20211029224929.379505-1-namhyung@kernel.org> <20211103072112.32312-1-ravi.bangoria@amd.com> <11a4cec1-8169-0891-b9c8-4d3a7b689d86@amd.com> Message-ID: <4F788351-0DB6-4A31-B1B5-7065BAE6C3F8@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On November 7, 2021 7:25:45 AM GMT-03:00, Ravi Bangoria wrote: > > >On 07-Nov-21 12:54 AM, Arnaldo Carvalho de Melo wrote: >> Em Fri, Nov 05, 2021 at 11:00:29AM -0700, Namhyung Kim escreveu: >>> Hello, >>> >>> On Wed, Nov 3, 2021 at 12:22 AM Ravi Bangoria wrote: >>>> >>>>> The current logic for the perf missing feature has a bug that it can >>>>> wrongly clear some modifiers like G or H=2E Actually some PMUs don'= t >>>>> support any filtering or exclusion while others do=2E But we check = it >>>>> as a global feature=2E >>>> >>>> (Sorry to pitch in bit late) >>>> >>>> AMD has one more problem on a similar line=2E On AMD, non-precise and >>>> precise sampling are provided by core and IBS pmu respectively=2E Plu= s, >>>> core pmu has filtering capability but IBS does not=2E Perf by default >>>> sets precise_ip=3D3 and exclude_guest=3D1 and goes on decreasing prec= ise_ip >>>> with exclude_guest set until perf_event_open() succeeds=2E This is >>>> causing perf to always fallback to core pmu (non-precise mode) even i= f >>>> it's perfectly feasible to do precise sampling=2E Do you guys think t= his >>>> problem should also be addressed while designing solution for Namhyun= g's >>>> patch or solve it seperately like below patch: >>>> >>>> ---><--- >>>> >>>> From 48808299679199c39ff737a30a7f387669314fd7 Mon Sep 17 00:00:00 200= 1 >>>> From: Ravi Bangoria >>>> Date: Tue, 2 Nov 2021 11:01:12 +0530 >>>> Subject: [PATCH] perf/amd/ibs: Don't set exclude_guest by default >>>> >>>> Perf tool sets exclude_guest by default while calling perf_event_open= ()=2E >>>> Because IBS does not have filtering capability, it always gets reject= ed >>>> by IBS PMU driver and thus perf falls back to non-precise sampling=2E= Fix >>>> it by not setting exclude_guest by default on AMD=2E >>>> >>>> Before: >>>> $ sudo =2E/perf record -C 0 -vvv true |& grep precise >>>> precise_ip 3 >>>> decreasing precise_ip by one (2) >>>> precise_ip 2 >>>> decreasing precise_ip by one (1) >>>> precise_ip 1 >>>> decreasing precise_ip by one (0) >>>> >>>> After: >>>> $ sudo =2E/perf record -C 0 -vvv true |& grep precise >>>> precise_ip 3 >>>> decreasing precise_ip by one (2) >>>> precise_ip 2 >>>> >>>> Reported-by: Kim Phillips >>>> Signed-off-by: Ravi Bangoria >>> >>> It'd be nice if it can cover explicit -e cycles:pp as well=2E Anyway, >>=20 >> Ravi, please consider Namhyung's request, a patch on top as I'm adding >> this already=2E > >For explicit :pp modifier, evsel->precise_max does not get set and thus p= erf >does not try with different attr->precise_ip values while exclude_guest s= et=2E >So no issue with explicit :pp: > > $ sudo =2E/perf record -C 0 -e cycles:pp -vvv |& grep "precise_ip\|excl= ude_guest" > precise_ip 2 > exclude_guest 1 > precise_ip 2 > exclude_guest 1 > switching off exclude_guest, exclude_host > precise_ip 2 > ^C > >Also, with :P modifier, evsel->precise_max gets set but exclude_guest doe= s >not and thus :P also works fine: > > $ sudo =2E/perf record -C 0 -e cycles:P -vvv |& grep "precise_ip\|exclu= de_guest" > precise_ip 3 > decreasing precise_ip by one (2) > precise_ip 2 > ^C Perfect, I'll add this analysis to the cset log message=2E - Arnaldo > >Thanks, >Ravi