public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: vincent.weaver@maine.edu, ak@linux.intel.com,
	peterz@infradead.org, alexander.shishkin@linux.intel.com,
	acme@redhat.com, jolsa@redhat.com, eranian@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] perf/x86: Disable non generic regs for software/probe events
Date: Mon, 27 May 2019 14:33:09 -0400	[thread overview]
Message-ID: <85585e79-612c-f667-dc2a-e4b589d13778@linux.intel.com> (raw)
In-Reply-To: <20190525084808.GA15802@gmail.com>



On 5/25/2019 4:48 AM, Ingo Molnar wrote:
> 
> * kan.liang@linux.intel.com <kan.liang@linux.intel.com> wrote:
> 
>> @@ -57,6 +57,11 @@ static unsigned int pt_regs_offset[PERF_REG_X86_MAX] = {
>>   #endif
>>   };
>>   
>> +u64 non_generic_regs_mask(void)
>> +{
>> +	return (~((1ULL << PERF_REG_X86_XMM0) - 1));
>> +}
>> +
>>   u64 perf_reg_value(struct pt_regs *regs, int idx)
>>   {
>>   	struct x86_perf_regs *perf_regs;
>> diff --git a/include/linux/perf_regs.h b/include/linux/perf_regs.h
>> index 4767474..c1c3454 100644
>> --- a/include/linux/perf_regs.h
>> +++ b/include/linux/perf_regs.h
>> @@ -9,6 +9,8 @@ struct perf_regs {
>>   	struct pt_regs	*regs;
>>   };
>>   
>> +u64 non_generic_regs_mask(void);
> 
> This is a *constant* value, why is it in a separate function, not an
> inline?
> 
> Or rather, since it's obviously a constant, name it in such a way.
> (PERF_REG_X86_NON_GENERIC_MASK or so. >
> To the generic code define it as 0 if arch headers haven't overriden it.
>

I will name it PERF_REG_NON_GENERIC_MASK in generic code.

Perf tool also defined a similar macro. I think I will define 
PERF_REG_NON_GENERIC_MASK in X86 uapi header. So both kernel and user 
space can use it.

I will send out V2 to address all comments.

Thanks,
Kan

>> +u64 __weak non_generic_regs_mask(void)
>> +{
>> +	return 0;
>> +}
>> +
>> +static inline bool has_non_generic_regs(struct perf_event *event)
>> +{
>> +	u64 mask = non_generic_regs_mask();
>> +
>> +	return ((event->attr.sample_regs_user & mask) ||
>> +		(event->attr.sample_regs_intr & mask));
> 
> 'return' is not a function ...
> 
>> +	/* only support generic regs */
>> +	if (has_non_generic_regs(event))
>> +		return -EOPNOTSUPP;
> 
> In human readable comments please use complete sentences with no
> unnecessary abbreviations, i.e. "Only support generic registers".
> 
> Thanks,
> 
> 	Ingo
> 

      reply	other threads:[~2019-05-27 18:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23 18:36 [PATCH 1/2] perf/x86: Disable non generic regs for software/probe events kan.liang
2019-05-23 18:36 ` [PATCH 2/2] perf/x86/regs: Check reserved bits kan.liang
2019-05-25  8:49   ` Ingo Molnar
2019-05-24 13:03 ` [PATCH 1/2] perf/x86: Disable non generic regs for software/probe events Vince Weaver
2019-05-24 13:09   ` Liang, Kan
2019-05-25  8:48 ` Ingo Molnar
2019-05-27 18:33   ` Liang, Kan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85585e79-612c-f667-dc2a-e4b589d13778@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=vincent.weaver@maine.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox