xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>, george.dunlap@citrix.com
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Robert VanVossen <Robert.VanVossen@dornerworks.com>,
	Dario Faggioli <dfaggioli@suse.com>,
	Joshua Whitehead <josh.whitehead@dornerworks.com>,
	Meng Xu <mengxu@cis.upenn.edu>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 2/6] xen/sched: Use %*pb[l] instead of cpumask_scn{, list}printf()
Date: Fri, 7 Sep 2018 17:07:47 +0100	[thread overview]
Message-ID: <baf91ce9-4dad-8f32-d84e-2e305734363f@citrix.com> (raw)
In-Reply-To: <5B929F1002000078001E67B5@prv1-mh.provo.novell.com>

On 07/09/18 16:53, Jan Beulich wrote:
>>>> On 07.09.18 at 17:35, <george.dunlap@citrix.com> wrote:
>> On 09/07/2018 04:17 PM, Jan Beulich wrote:
>>>>>> On 07.09.18 at 15:56, <andrew.cooper3@citrix.com> wrote:
>>>> On 07/09/18 09:03, Jan Beulich wrote:
>>>>>>>> On 06.09.18 at 14:08, <andrew.cooper3@citrix.com> wrote:
>>>>>> @@ -2059,11 +2058,10 @@ csched_dump_pcpu(const struct scheduler *ops, int 
>> cpu)
>>>>>>      spc = CSCHED_PCPU(cpu);
>>>>>>      runq = &spc->runq;
>>>>>>  
>>>>>> -    cpumask_scnprintf(cpustr, sizeof(cpustr), per_cpu(cpu_sibling_mask, 
>> cpu));
>>>>>> -    printk("CPU[%02d] nr_run=%d, sort=%d, sibling=%s, ",
>>>>>> -           cpu, spc->nr_runnable, spc->runq_sort_last, cpustr);
>>>>>> -    cpumask_scnprintf(cpustr, sizeof(cpustr), per_cpu(cpu_core_mask, cpu));
>>>>>> -    printk("core=%s\n", cpustr);
>>>>>> +    printk("CPU[%02d] nr_run=%d, sort=%d, sibling=%*pb, core=%*pb\n",
>>>>>> +           cpu, spc->nr_runnable, spc->runq_sort_last,
>>>>>> +           nr_cpu_ids, per_cpu(cpu_sibling_mask, cpu),
>>>>>> +           nr_cpu_ids, per_cpu(cpu_core_mask, cpu));
>>>>> Strictly speaking here and elsewhere you should wrap the CPU mask
>>>>> accesses in cpumask_bits().
>>>> Why? Its barely used, and is another example of a helper which only adds
>>>> to code volume.
>>> If anyone added (e.g. for debugging) a leading field to struct cpumask,
>>> your code would break, while all code anywhere else would still be fine.
>> Do all other current users use cpumask_bits() for dereferencing?
>>
>> I took Andy's "Its[sic] barely used" comment to mean there were lots of
>> other places which also just passed a cpumask_t pointer directly into
>> something expecting a bitmap.  If all other use cases either use
>> cpumask_bits() or ->bits, then we should do the same here.  If there are
>> lots of places where we assume (void *)mask == (void *)mask->bits, then
>> we should probably document that the structure should match that (and
>> maybe add a BUILD_BUG_ON() if we can manage it).
> I'm unaware of places which don't go through ->bits.

All the printing, seeing as I didn't hit a single cpumask_bits() in this
series.

The cpumask infrastructure itself uses ->bits, which is less verbose
than the helper.

I don't think we need to go as far as having a BUILD_BUG_ON(), because I
don't expect that the layout of a cpumask would change, even for
debugging, but I also don't see the point in keeping cpumask_bits() when
almost nothing uses it.

~Andrew

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

  reply	other threads:[~2018-09-07 16:07 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06 12:08 [PATCH 0/6] xen: Use %*pb[l] for printing bitmaps Andrew Cooper
2018-09-06 12:08 ` [PATCH 1/6] xen/vsprintf: Introduce " Andrew Cooper
2018-09-06 16:32   ` Wei Liu
2018-09-07  7:41   ` Jan Beulich
2018-09-07 13:01     ` Andrew Cooper
2018-09-07 15:14       ` Jan Beulich
2018-09-25 13:06         ` Andrew Cooper
2018-09-25 13:22           ` Jan Beulich
2018-09-06 12:08 ` [PATCH 2/6] xen/sched: Use %*pb[l] instead of cpumask_scn{, list}printf() Andrew Cooper
2018-09-07  8:03   ` Jan Beulich
2018-09-07 13:56     ` Andrew Cooper
2018-09-07 14:42       ` George Dunlap
2018-09-07 15:17       ` Jan Beulich
2018-09-07 15:35         ` George Dunlap
2018-09-07 15:53           ` Jan Beulich
2018-09-07 16:07             ` Andrew Cooper [this message]
2018-09-10  6:39               ` Jan Beulich
2018-09-07 14:42   ` George Dunlap
2018-09-12  8:05     ` Dario Faggioli
2018-09-06 12:08 ` [PATCH 3/6] xen/common: Use %*pb[l] instead of {cpu, node}mask_scn{, list}printf() Andrew Cooper
2018-09-06 16:32   ` Wei Liu
2018-09-07  8:06   ` Jan Beulich
2018-09-07  8:30   ` Juergen Gross
2018-09-06 12:08 ` [PATCH 4/6] xen/x86: Use %*pb[l] instead of cpumask_scn{, list}printf() Andrew Cooper
2018-09-06 16:33   ` Wei Liu
2018-09-07  8:12   ` Jan Beulich
2018-09-07 14:00     ` Andrew Cooper
2018-09-06 12:08 ` [PATCH 5/6] xen/bitmap: Drop all bitmap_scn{, list}printf() infrastructure Andrew Cooper
2018-09-06 16:34   ` Wei Liu
2018-09-12  8:09   ` Dario Faggioli
2018-09-06 12:08 ` [PATCH RFC 6/6] xen/keyhandler: Drop keyhandler_scratch Andrew Cooper
2018-09-06 16:31   ` Wei Liu
2018-09-07  8:24   ` Jan Beulich

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=baf91ce9-4dad-8f32-d84e-2e305734363f@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=Robert.VanVossen@dornerworks.com \
    --cc=dfaggioli@suse.com \
    --cc=george.dunlap@citrix.com \
    --cc=josh.whitehead@dornerworks.com \
    --cc=mengxu@cis.upenn.edu \
    --cc=xen-devel@lists.xen.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).