Received: by 10.213.65.68 with SMTP id h4csp1369765imn; Mon, 19 Mar 2018 02:07:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELttMNljHqI05wZBMSnKhm9v0lqKbDBHxDJvpskFnLSmLtWiubkngBiJqlv/QUzD6qMK7aJA X-Received: by 10.98.133.86 with SMTP id u83mr9649604pfd.172.1521450469095; Mon, 19 Mar 2018 02:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521450469; cv=none; d=google.com; s=arc-20160816; b=JeKvLYGNyVVsBvN64w+rUS62aolLVf0RhvCaTI8TLwNu+l1HnQmG3mrRiEA2YtQn/D tH7bmYB/jRqIburJDHeuB/ONPiOVSYGbOjmPRsnIXm7dg2zSmewHzNHrlQ0ashrbmtqU vPSWn44IV/N+ahQsWFXUl5PP5uyuwE9WVWSKJKkEFepKwojoyjavUt3+ApFm3LmHt/dr LD7AZIk8UaUilRLbiQH80VPjHucuVvMqHLf9+DvxF2VFJRHR772ADZ4opgz1xIfhdt75 RNu6gJXDqHN6JGgT4hwD/s9MHhKDYgEk/fDUHm5thaDkqouIno3y5H36iUfpQ7oP1RCu 6JDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=WE+QIESkVFXOypJ7a/ii3vhytj1k1qWe+aFU8KztuLE=; b=QT1cyOEW5ZO4oAhFLcgXM7JrBEFXx02Yo9SXHX3KE+SokT8G5lVrQLkuVTNZm7xd1R NbdAGsrsBxHiMRXlP2RtYg/iwQQG9McCE2vRtw3n2rHL3FHBPMTrVhJ97wlP68lPYr1F R+eGA5sabR2BVUaGr142QPlurxEYgAUfDmaCz5f2ujFELeViY/KXuOpoz79RPm65OEVz TEO85vDpTpT2M5cfZB8X9RHLOgLnNiKwXGFUaPOCFXItF9im/Wfk4EYHmyKjHzTsdYNz VbXcLJQA4wRLsGLcpgnieu5OSJWGjwhvxD604RZacHvag6xEHiu7knn5N70GziUtIXeJ an9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=TEyulzxv; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c23-v6si6548787plk.341.2018.03.19.02.07.34; Mon, 19 Mar 2018 02:07:49 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=TEyulzxv; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932277AbeCSJEm (ORCPT + 99 others); Mon, 19 Mar 2018 05:04:42 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33627 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755022AbeCSJEk (ORCPT ); Mon, 19 Mar 2018 05:04:40 -0400 Received: by mail-wm0-f67.google.com with SMTP id s206so11626925wme.0; Mon, 19 Mar 2018 02:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=WE+QIESkVFXOypJ7a/ii3vhytj1k1qWe+aFU8KztuLE=; b=TEyulzxv+ZLRly85GthmfWLICOb2lflzKDd0GaWO63230McgK/sT/ZXF3PuOX1pPTo r29Y+2tqiROisgcg0rS+KWovyTVC+bKg3UHg4pGO1IkoYtBWhWV0W0Sfd0cn3BUFoXl9 bIoK3HZhQFau5x0J3vgRPpeAhNFAjb6NB1b3muyt6pCRMKUIEUp7F3DtL9f/VWpgPU8D oNd0qUbTOHeen3Sofrn2DoijtWdI+E5lph8VUbA0pBFpKsh09TDEqUmRPCsFLSoJP6uQ b9GWVzl66MrjwJOhsbK/OLN6Bgp66aVsOqLja90fe8OQFUsE18tzUldyHC2YlCFwU/bs qGqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WE+QIESkVFXOypJ7a/ii3vhytj1k1qWe+aFU8KztuLE=; b=AyvGG5fC1kS3E0B2DUEZB3kNQsoG2n+oseQzCV6ZbI6D8oHbzKJhMLPxMUYLQRbcwK /JnNZ54I+LkOr6BOgMdq+fd6T9NMVHRqBfAwX+v+8b638pLT6FE9nmGGWsTk2EYUD5PN Pvp0xFLdvUIF2/J1AY/IO2BeY9EcCQYpya0ehg4mvrGsLD+s1XYJ/khaRq2uHYDvXMVC ZVR3XJohkefv4awe2nFKisj1d7+5DD4hqTT6y6+5Wew3M5Mx0/PiImvKgmLTEVdnuYdP cM8w0iuP0smYjMnWzr+ZLQGU8Zz5TiPnomXfWCWsvKBlgAsTV+NdPKAZa3oqHqSU6IfZ MmOA== X-Gm-Message-State: AElRT7FcGte7MlS9E7N7a0PUjKMRf7VYWZov0hHp7vKbNYVDHjyRbIb+ wQVdjUV+Zd+PKd/g3qt9CR0= X-Received: by 10.80.143.33 with SMTP id 30mr9263324edy.148.1521450279328; Mon, 19 Mar 2018 02:04:39 -0700 (PDT) Received: from [10.201.49.203] (nat-pool-mxp-u.redhat.com. [149.6.153.187]) by smtp.googlemail.com with ESMTPSA id 58sm3678180edt.12.2018.03.19.02.04.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 02:04:38 -0700 (PDT) Subject: Re: [PATCH v5 03/11] perf/x86/intel/pt: Introduce a new function to get the capability of Intel PT To: "Kang, Luwei" , "kvm@vger.kernel.org" Cc: "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "rkrcmar@redhat.com" , "linux-kernel@vger.kernel.org" , "joro@8bytes.org" References: <1520165241-15819-1-git-send-email-luwei.kang@intel.com> <1520165241-15819-4-git-send-email-luwei.kang@intel.com> <98515f5f-9c8a-8e1a-4fef-c9a8a0e9e8f5@redhat.com> <82D7661F83C1A047AF7DC287873BF1E167EFC0C8@SHSMSX101.ccr.corp.intel.com> From: Paolo Bonzini Message-ID: Date: Mon, 19 Mar 2018 10:04:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <82D7661F83C1A047AF7DC287873BF1E167EFC0C8@SHSMSX101.ccr.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/03/2018 08:17, Kang, Luwei wrote: >>> +u32 pt_cap_get_ex(u32 *caps, enum pt_capabilities cap) { >>> + struct pt_cap_desc *cd = &pt_caps[cap]; >>> + u32 c = caps[cd->leaf * PT_CPUID_REGS_NUM + cd->reg]; >>> + unsigned int shift = __ffs(cd->mask); >>> + >>> + return (c & cd->mask) >> shift; >>> +} >>> +EXPORT_SYMBOL_GPL(pt_cap_get_ex); >>> + >> >> You should change pt_cap_get to use this function. Also, "_ex" is not a very common suffix, so perhaps you can call it >> __pt_cap_get. >> >> I don't have any other comments on patches 1-3, so when you resend we can ask the x86 maintainers for approval. >> > > Hi Paolo, > Is that like this? Yes, thanks. Paolo > --- a/arch/x86/events/intel/pt.c > +++ b/arch/x86/events/intel/pt.c > @@ -76,14 +76,20 @@ > PT_CAP(psb_periods, 1, CPUID_EBX, 0xffff0000), > }; > > -u32 pt_cap_get(enum pt_capabilities cap) > +u32 __pt_cap_get(u32 *caps, enum pt_capabilities cap) > { > struct pt_cap_desc *cd = &pt_caps[cap]; > - u32 c = pt_pmu.caps[cd->leaf * PT_CPUID_REGS_NUM + cd->reg]; > + u32 c = caps[cd->leaf * PT_CPUID_REGS_NUM + cd->reg]; > unsigned int shift = __ffs(cd->mask); > > return (c & cd->mask) >> shift; > } > +EXPORT_SYMBOL_GPL(__pt_cap_get); > + > +u32 pt_cap_get(enum pt_capabilities cap) > +{ > + return __pt_cap_get(pt_pmu.caps, cap); > +} > EXPORT_SYMBOL_GPL(pt_cap_get); > > static ssize_t pt_cap_show(struct device *cdev, > diff --git a/arch/x86/include/asm/intel_pt.h b/arch/x86/include/asm/intel_pt.h > index 2de4db0..3a4f524 100644 > --- a/arch/x86/include/asm/intel_pt.h > +++ b/arch/x86/include/asm/intel_pt.h > @@ -27,9 +27,11 @@ enum pt_capabilities { > #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL) > void cpu_emergency_stop_pt(void); > extern u32 pt_cap_get(enum pt_capabilities cap); > +extern u32 __pt_cap_get(u32 *caps, enum pt_capabilities cap); > #else > static inline void cpu_emergency_stop_pt(void) {} > static inline u32 pt_cap_get(enum pt_capabilities cap) { return 0; } > +static u32 __pt_cap_get(u32 *caps, enum pt_capabilities cap) { return 0; } > > > Thanks, > Luwei Kang >