xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wl@xen.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [Xen-devel] [PATCH 3/3] x86: add accessors for scratch cpu mask
Date: Thu, 13 Feb 2020 16:43:59 +0100	[thread overview]
Message-ID: <6dea5029-5fb8-54e0-1544-ed5ccba2469a@suse.com> (raw)
In-Reply-To: <20200213151530.GZ4679@Air-de-Roger>

On 13.02.2020 16:15, Roger Pau Monné wrote:
> On Thu, Feb 13, 2020 at 11:12:12AM +0100, Jan Beulich wrote:
>> On 12.02.2020 17:49, Roger Pau Monne wrote:
>>> --- a/xen/arch/x86/smpboot.c
>>> +++ b/xen/arch/x86/smpboot.c
>>> @@ -57,6 +57,30 @@ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_mask);
>>>  DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, scratch_cpumask);
>>>  static cpumask_t scratch_cpu0mask;
>>>  
>>> +#ifndef NDEBUG
>>> +cpumask_t *scratch_cpumask(const char *fn)
>>
>> Please don't pass an argument that you can deduce, and then
>> provide even more meaningful data:
>>
>>> +{
>>> +    static DEFINE_PER_CPU(const char *, scratch_cpumask_use);
>>> +
>>> +    /*
>>> +     * Scratch cpumask cannot be used in IRQ context, or else we would have to
>>> +     * make sure all users have interrupts disabled while using the scratch
>>> +     * mask.
>>> +     */
>>> +    BUG_ON(in_irq());
>>> +
>>> +    if ( fn && unlikely(this_cpu(scratch_cpumask_use)) )
>>> +    {
>>> +        printk("%s: scratch CPU mask already in use by %s\n",
>>> +              fn, this_cpu(scratch_cpumask_use));
>>
>> Use __builtin_return_address(0) here, which will allow
>> identifying which of perhaps multiple uses in a function is
>> the offending one.
> 
> Will change.
> 
>>
>> Also, why in smpboot.c instead of in smp.c? This isn't a
>> boot or CPU-hot-online related function afaict.
> 
> I've added it to smpboot.c because that's where scratch_cpumask is
> defined. I could move it to smp.c, but I would prefer to keep the
> accessor as close as possible to the declaration.

May I suggest then to move the definition of the symbol?

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2020-02-13 15:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 16:49 [Xen-devel] [PATCH 0/3] x86: fixes/improvements for scratch cpumask Roger Pau Monne
2020-02-12 16:49 ` [Xen-devel] [PATCH 1/3] x86/smp: unify header includes in smp.h Roger Pau Monne
2020-02-12 23:05   ` Wei Liu
2020-02-13  9:54     ` Jan Beulich
2020-02-12 16:49 ` [Xen-devel] [PATCH 2/3] x86/smp: use a dedicated scratch cpumask in send_IPI_mask Roger Pau Monne
2020-02-13  9:59   ` Jan Beulich
2020-02-13 10:03     ` Roger Pau Monné
2020-02-13 10:19       ` Jan Beulich
2020-02-13 11:41         ` Roger Pau Monné
2020-02-13 13:35           ` Jan Beulich
2020-02-12 16:49 ` [Xen-devel] [PATCH 3/3] x86: add accessors for scratch cpu mask Roger Pau Monne
2020-02-13 10:12   ` Jan Beulich
2020-02-13 15:15     ` Roger Pau Monné
2020-02-13 15:43       ` Jan Beulich [this message]
2020-02-12 16:53 ` [Xen-devel] [PATCH 0/3] x86: fixes/improvements for scratch cpumask Sander Eikelenboom
2020-02-12 17:01   ` Roger Pau Monné
2020-02-12 17:13     ` Sander Eikelenboom
2020-02-13  9:31       ` Sander Eikelenboom
2020-02-12 21:05 ` Julien Grall
2020-02-13  9:53   ` Jan Beulich
2020-02-13 10:05     ` Roger Pau Monné

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=6dea5029-5fb8-54e0-1544-ed5ccba2469a@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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;
as well as URLs for NNTP newsgroup(s).