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] [day] [month] [year] [list]
Message-ID: <gsnto74tdexc.fsf@coltonlewis-kvm.c.googlers.com>
Date: Wed, 11 Sep 2024 22:05:35 +0000
From: Colton Lewis <coltonlewis@...gle.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: kvm@...r.kernel.org, oliver.upton@...ux.dev, seanjc@...gle.com, 
	peterz@...radead.org, mingo@...hat.com, acme@...nel.org, namhyung@...nel.org, 
	mark.rutland@....com, alexander.shishkin@...ux.intel.com, jolsa@...nel.org, 
	irogers@...gle.com, adrian.hunter@...el.com, kan.liang@...ux.intel.com, 
	will@...nel.org, linux@...linux.org.uk, catalin.marinas@....com, 
	mpe@...erman.id.au, npiggin@...il.com, christophe.leroy@...roup.eu, 
	naveen@...nel.org, hca@...ux.ibm.com, gor@...ux.ibm.com, 
	agordeev@...ux.ibm.com, borntraeger@...ux.ibm.com, svens@...ux.ibm.com, 
	tglx@...utronix.de, bp@...en8.de, dave.hansen@...ux.intel.com, x86@...nel.org, 
	hpa@...or.com, linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-arm-kernel@...ts.infradead.org, linuxppc-dev@...ts.ozlabs.org, 
	linux-s390@...r.kernel.org
Subject: Re: [PATCH 4/5] x86: perf: Refactor misc flag assignments

Ingo Molnar <mingo@...nel.org> writes:

> * Colton Lewis <coltonlewis@...gle.com> wrote:

>> Break the assignment logic for misc flags into their own respective
>> functions to reduce the complexity of the nested logic.

>> Signed-off-by: Colton Lewis <coltonlewis@...gle.com>
>> ---
>>   arch/x86/events/core.c            | 31 +++++++++++++++++++++++--------
>>   arch/x86/include/asm/perf_event.h |  2 ++
>>   2 files changed, 25 insertions(+), 8 deletions(-)

>> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
>> index 760ad067527c..87457e5d7f65 100644
>> --- a/arch/x86/events/core.c
>> +++ b/arch/x86/events/core.c
>> @@ -2948,16 +2948,34 @@ unsigned long  
>> perf_arch_instruction_pointer(struct pt_regs *regs)
>>   	return regs->ip + code_segment_base(regs);
>>   }

>> +static unsigned long common_misc_flags(struct pt_regs *regs)
>> +{
>> +	if (regs->flags & PERF_EFLAGS_EXACT)
>> +		return PERF_RECORD_MISC_EXACT_IP;
>> +
>> +	return 0;
>> +}
>> +
>> +unsigned long perf_arch_guest_misc_flags(struct pt_regs *regs)
>> +{
>> +	unsigned long guest_state = perf_guest_state();
>> +	unsigned long flags = common_misc_flags();
>> +
>> +	if (guest_state & PERF_GUEST_USER)
>> +		flags |= PERF_RECORD_MISC_GUEST_USER;
>> +	else if (guest_state & PERF_GUEST_ACTIVE)
>> +		flags |= PERF_RECORD_MISC_GUEST_KERNEL;
>> +
>> +	return flags;
>> +}
>> +
>>   unsigned long perf_arch_misc_flags(struct pt_regs *regs)
>>   {
>>   	unsigned int guest_state = perf_guest_state();
>> -	int misc = 0;
>> +	unsigned long misc = common_misc_flags();

> So I'm quite sure this won't even build at this point ...

Must have been a wrongly resolved conflict after rebase. I had thought I
rebuilt before sending but something slipped.

It's fixed

> Thanks,

> 	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ