lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k18mfj0v.fsf@ashishki-desk.ger.corp.intel.com>
Date:   Wed, 30 Oct 2019 15:41:04 +0200
From:   Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To:     Peter Zijlstra <peterz@...radead.org>,
        "Kang\, Luwei" <luwei.kang@...el.com>
Cc:     "kvm\@vger.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
        "pbonzini\@redhat.com" <pbonzini@...hat.com>,
        "rkrcmar\@redhat.com" <rkrcmar@...hat.com>,
        "Christopherson\, Sean J" <sean.j.christopherson@...el.com>,
        "vkuznets\@redhat.com" <vkuznets@...hat.com>,
        "wanpengli\@tencent.com" <wanpengli@...cent.com>,
        "jmattson\@google.com" <jmattson@...gle.com>,
        "joro\@8bytes.org" <joro@...tes.org>,
        "tglx\@linutronix.de" <tglx@...utronix.de>,
        "mingo\@redhat.com" <mingo@...hat.com>,
        "bp\@alien8.de" <bp@...en8.de>, "hpa\@zytor.com" <hpa@...or.com>,
        "x86\@kernel.org" <x86@...nel.org>,
        "ak\@linux.intel.com" <ak@...ux.intel.com>,
        "thomas.lendacky\@amd.com" <thomas.lendacky@....com>,
        "acme\@kernel.org" <acme@...nel.org>,
        "mark.rutland\@arm.com" <mark.rutland@....com>,
        "jolsa\@redhat.com" <jolsa@...hat.com>,
        "namhyung\@kernel.org" <namhyung@...nel.org>,
        alexander.shishkin@...ux.intel.com
Subject: Re: [PATCH v1 3/8] KVM: x86: Allocate performance counter for PEBS event

Peter Zijlstra <peterz@...radead.org> writes:

> On Wed, Oct 30, 2019 at 04:06:36AM +0000, Kang, Luwei wrote:
>> > >  static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type,
>> > >  				  unsigned config, bool exclude_user,
>> > >  				  bool exclude_kernel, bool intr,
>> > > -				  bool in_tx, bool in_tx_cp)
>> > > +				  bool in_tx, bool in_tx_cp, bool pebs)
>> > >  {
>> > >  	struct perf_event *event;
>> > >  	struct perf_event_attr attr = {
>> > > @@ -111,9 +111,12 @@ static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type,
>> > >  		.exclude_user = exclude_user,
>> > >  		.exclude_kernel = exclude_kernel,
>> > >  		.config = config,
>> > > +		.precise_ip = pebs ? 1 : 0,
>> > > +		.aux_output = pebs ? 1 : 0,
>> > 
>> > srsly?
>> 
>> Hi Peter,
>>     Thanks for review. For aux_output, I think it should be set 1 when the guest wants to enabled PEBS by Intel PT.
>>      For precise_ip, it is the precise level in perf and set by perf command line in KVM guest, this may not reflect the accurate value (can be 0~3) here. Here set to 1 is used to allocate a counter for PEBS event and set the MSR_IA32_PEBS_ENABLE register. For PMU virtualization, KVM will trap the guest's write operation to PMU registers and allocate/free event counter from host if a counter enable/disable in guest. We can't always deduce the exact parameter of perf command line from the value of the guest writers to the register.
>
> Please, teach your MUA to wrap on 78 chars.
>
> The thing I really fell over is the gratuitous 'bool ? 1 : 0'. But yes,

Notice the .exclude_kernel assignment above that does the same thing the
other way around.

Regards,
--
Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ