xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Marcus Granado <Marcus.Granado@eu.citrix.com>,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	Jan Beulich <JBeulich@suse.com>,
	Anil Madhavapeddy <anil@recoil.org>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <Andrew.Cooper3@citrix.com>,
	Juergen Gross <juergen.gross@ts.fujitsu.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	Matt Wilson <msw@amazon.com>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: Re: [PATCH 01 of 11 v3] xen, libxc: rename xenctl_cpumap to xenctl_bitmap
Date: Tue, 12 Mar 2013 19:08:27 +0100	[thread overview]
Message-ID: <1363111707.3065.53.camel@Solace> (raw)
In-Reply-To: <1363109194.32410.81.camel@zakaz.uk.xensource.com>


[-- Attachment #1.1: Type: text/plain, Size: 3599 bytes --]

On mar, 2013-03-12 at 17:26 +0000, Ian Campbell wrote:
> On Tue, 2013-03-12 at 17:06 +0000, Dario Faggioli wrote:
> > Fact is xenctl_bitmap is used within DOMCTLs, while xc_{cpu,node}map_t
> > is used by xc_*_{set,get}_affinity(), which is what, for instance, libxl
> > calls.
> 
> so xenctl_bitmap is completely internal to the library/hypervisor and
> the user of libxc doesn't see it?
> 
It's always tricky to track (at least for me), due to some "Chinese
Boxing" going on here, and that's why I had to recheck before replying.
Having done that, yes, AFAIUI, xenctl_bitmap is how Xen and libxc
exchanges the information about the cpu/node-map. What is actually used
is then cpumask_t (nodemask_t), in Xen, and xc_cpumap_t (xc_nodemap_t)
in libxc (and his callers).

> > > >  #ifndef __ASSEMBLY__
> > > > -struct xenctl_cpumap {
> > > > +struct xenctl_bitmap {
> > > >      XEN_GUEST_HANDLE_64(uint8) bitmap;
> > > > -    uint32_t nr_cpus;
> > > > +    uint32_t nr_elems;
> > > 
> > > Is this really "nr_bits" or can an entry in the bitmap be > 1 bit?
> > > 
> > I'm not sure I understand what you meant to say here, I'm afraid. The
> > field encodes the number of elements the bitmap has to accommodate and
> > deal with. In the (original) xenctl_cpumap case, that was the number of
> > CPUs... All I'm doing is generalizing that from CPUs to some unspecified
> > "element". It never was the size of the bitmap in bits, and is not
> > becoming anything like that after the change.
> 
> Ah, so it is the number of bytes allocated in the bitmap field?
> 
> nr_elems is confusing because the elements of this particular array are
> (logically at least) bits, yet nr_elems contains bytes. Why not call it
> nr_bytes if that is what it contains?
> 
Mmm... I think now I see what you mean (or so I hope)! Sorry if I did
not git your first comment right. So, you are (and you were, in your
previous email) right when saying that what I call nr_elems is the
number indeed, at least logically, nr_bits.

In fact, it is not at all the real size of the array in bytes, as can be
seen from here:

int xc_vcpu_getaffinity(xc_interface *xch, uint32_t domid, int vcpu, xc_cpumap_t cpumap)
{
    DECLARE_HYPERCALL_BUFFER(uint8_t, local);
    int cpusize;

    cpusize = xc_get_cpumap_size(xch);
    ...
    local = xc_hypercall_buffer_alloc(xch, local, cpusize);
    ...
    domctl.cmd = XEN_DOMCTL_getvcpuaffinity;
    domctl.domain = (domid_t)domid;
    domctl.u.vcpuaffinity.vcpu = vcpu;

    set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);
    domctl.u.vcpuaffinity.cpumap.nr_elems = cpusize * 8;
    ...
}

The whole point is I'm turning a collection of CPUs into something more
general. That is why I renamed the field that encodes, currently, the
"number of CPUs", into a more general "number of elements".

Now, were you saying that, since this collection of elements is,
actually, a collection of bits && that, given the fact we represent it
as an array, the elements of which are bytes, using "number of bits"
would be more appropriate and clear?

If yes, sorry again for not getting it in the first place, and, yes, I
do agree with that, and I can sed/nr_elems/nr_bits/.
If no... Well... Let's hope it's yes. :-D

Thanks and Regards,
Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2013-03-12 18:08 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-01 11:01 [PATCH 00 of 11 v3] NUMA aware credit scheduling Dario Faggioli
2013-02-01 11:01 ` [PATCH 01 of 11 v3] xen, libxc: rename xenctl_cpumap to xenctl_bitmap Dario Faggioli
2013-03-12 15:46   ` Ian Campbell
2013-03-12 17:06     ` Dario Faggioli
2013-03-12 17:26       ` Ian Campbell
2013-03-12 18:08         ` Dario Faggioli [this message]
2013-03-13  9:53           ` Ian Campbell
2013-03-13 10:13             ` Dario Faggioli
2013-02-01 11:01 ` [PATCH 02 of 11 v3] xen, libxc: introduce xc_nodemap_t Dario Faggioli
2013-02-01 11:01 ` [PATCH 03 of 11 v3] xen: sched_credit: when picking, make sure we get an idle one, if any Dario Faggioli
2013-02-01 13:57   ` Juergen Gross
2013-02-07 17:50   ` George Dunlap
2013-02-01 11:01 ` [PATCH 04 of 11 v3] xen: sched_credit: let the scheduler know about node-affinity Dario Faggioli
2013-02-01 14:30   ` Juergen Gross
2013-02-27 19:00   ` George Dunlap
2013-03-13 16:09     ` Dario Faggioli
2013-03-12 15:57   ` Ian Campbell
2013-03-12 16:20     ` Dario Faggioli
2013-03-12 16:30       ` Ian Campbell
2013-02-01 11:01 ` [PATCH 05 of 11 v3] xen: allow for explicitly specifying node-affinity Dario Faggioli
2013-02-01 14:20   ` Juergen Gross
2013-02-01 11:01 ` [PATCH 06 of 11 v3] libxc: " Dario Faggioli
2013-02-01 11:01 ` [PATCH 07 of 11 v3] libxl: " Dario Faggioli
2013-02-28 12:16   ` George Dunlap
2013-02-01 11:01 ` [PATCH 08 of 11 v3] libxl: optimize the calculation of how many VCPUs can run on a candidate Dario Faggioli
2013-02-01 14:28   ` Juergen Gross
2013-02-28 14:05   ` George Dunlap
2013-02-01 11:01 ` [PATCH 09 of 11 v3] libxl: automatic placement deals with node-affinity Dario Faggioli
2013-02-01 11:01 ` [PATCH 10 of 11 v3] xl: add node-affinity to the output of `xl list` Dario Faggioli
2013-03-12 16:04   ` Ian Campbell
2013-03-12 16:10     ` Dario Faggioli
2013-02-01 11:01 ` [PATCH 11 of 11 v3] docs: rearrange and update NUMA placement documentation Dario Faggioli
2013-02-01 13:41   ` Juergen Gross
2013-02-28 14:11   ` George Dunlap
2013-02-18 17:13 ` [PATCH 00 of 11 v3] NUMA aware credit scheduling Dario Faggioli
2013-02-19  8:11   ` Jan Beulich
2013-02-19  8:51     ` Ian Campbell
2013-02-21 13:54   ` George Dunlap
2013-02-21 14:32     ` Dario Faggioli

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=1363111707.3065.53.camel@Solace \
    --to=dario.faggioli@citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=Marcus.Granado@eu.citrix.com \
    --cc=anil@recoil.org \
    --cc=dan.magenheimer@oracle.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=juergen.gross@ts.fujitsu.com \
    --cc=msw@amazon.com \
    --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).