libxl: provide libxl_bitmap_{or,and}
PATCH v7 1/1 libxl: provide libxl_bitmap_{or,and}
New functions to provide logical and and or of two bitmaps functions can be used in vNUMA configuration check function. They are also generally useful, so they have been made as public API.
---
v.1 The new functions were added.
v.2 The comments and format were corrected.
v.3 The bitmap functions were rewritten to manipulate bytes not bits. v.4 Several non-modified parameters, and local variables were changed to const
Also the code formatting was fixed.
v.5 The commit subject line now has versions and is simpler.
v.6 All descriptions in the commit history are now complete sentences.
Extraneous blank lines are gone.
v.7 Added LIBXL_BIT_HAVE_AND_OR to libxl.h; deleted extraneous comment in
libxl_utils.h; and updated the commit log to include the uses for these functions
--- tools/libxl/libxl.h | 9 ++++++ tools/libxl/libxl_utils.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_utils.h | 6 ++++ 3 files changed, 85 insertions(+)
tools/libxl/libxl.h +9 -0
@@ -84,6 +84,15 @@#define LIBXL_HAVE_CPUPOOL_QUALIFIER_TO_CPUPOOLID 1/* +* +* LIBXL_HAVE_BITMAP_AND_OR +* +* If this is defined, libxl has two libarary functions, libxl_bitmap_and +* and libxl_bitmap_or to compute the logical and and or of two bitmaps +*/ +#define LIBXL_HAVE_BITMAP_AND_OR 1 + +/* * LIBXL_HAVE_FIRMWARE_PASSTHROUGH indicates the feature for * passing in SMBIOS and ACPI firmware to HVM guests is present * in the library.
tools/libxl/libxl_utils.c +70 -0
76 lines not on this page · raw message
tools/libxl/libxl_utils.h +6 -0
@@ -90,6 +90,12 @@ int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit);void libxl_bitmap_set (libxl_bitmap *bitmap,int bit);void libxl_bitmap_reset (libxl_bitmap *bitmap,int bit);int libxl_bitmap_count_set (const libxl_bitmap *cpumap); +int libxl_bitmap_or (libxl_ctx *ctx,libxl_bitmap *or_map, +const libxl_bitmap *map1, +const libxl_bitmap *map2); +int libxl_bitmap_and (libxl_ctx *ctx,libxl_bitmap *and_map, +const libxl_bitmap *map1, +const libxl_bitmap *map2);char *libxl_bitmap_to_hex_string (libxl_ctx *ctx,const libxl_bitmap *cpumap);static inline void libxl_bitmap_set_any (libxl_bitmap *bitmap) {
Signature · 1 line
1.9.1
Quoted 2 lines · Linda Jacobson
New functions to provide logical and and or of two bitmaps functions can be used in vNUMA configuration check function.
I don't think that really justifies adding them, since we aren't actually using them for that now, how about:
New functions to provide logical and and or of two bitmaps. These are generically useful utility functions added to the public API for the benefit of libxl's users.
In the future they may also be useful internally, e.g. in the vNUMA configuration check function.
If you are happy with that, and there's no other reason to resend, then I can switch in that text as I commit.
Quoted 26 lines
Signed-off-by Linda Jacobson <[email protected]>---
v.1 The new functions were added.
v.2 The comments and format were corrected.
v.3 The bitmap functions were rewritten to manipulate bytes not bits. v.4 Several non-modified parameters, and local variables were changed to const
Also the code formatting was fixed.
v.5 The commit subject line now has versions and is simpler.
v.6 All descriptions in the commit history are now complete sentences.
Extraneous blank lines are gone.
v.7 AddedLIBXL_BIT_HAVE_AND_ORtolibxl.h; deleted extraneous comment in
libxl_utils.h; and updated the commit log to include the uses for these functions--- tools/libxl/libxl.h | 9 ++++++ tools/libxl/libxl_utils.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_utils.h | 6 ++++ 3 files changed, 85 insertions(+)tools/libxl/libxl.h +0
-0
tools/libxl/libxl.h line 90
Quoted 7 lines
tools/libxl/libxl.h +4
-0@@ -84,6 +84,15 @@#define LIBXL_HAVE_CPUPOOL_QUALIFIER_TO_CPUPOOLID 1/* +* +* LIBXL_HAVE_BITMAP_AND_OR +* +* If this is defined, libxl has two libarary functions, libxl_bitmap_and
"library".
(again, can fix on commit)
Other than those:
Quoted 10 lines · Ian Campbell
Quoted 2 lines · Linda Jacobson
New functions to provide logical and and or of two bitmaps functions can be used in vNUMA configuration check function.
I don't think that really justifies adding them, since we aren't actually using them for that now, how about:
New functions to provide logical and and or of two bitmaps. These are generically useful utility functions added to the public API for the benefit of libxl's users.
Quoted 5 lines
In the future they may also be useful internally, e.g. in the vNUMA configuration check function.
If you are happy with that, and there's no other reason to resend, then I can switch in that text as I commit.
I'm fine with this. If Wei and Julien are, please go ahead.
Quoted 29 lines
Quoted 29 lines
Signed-off-by Linda Jacobson <[email protected]>---
v.1 The new functions were added.
v.2 The comments and format were corrected.
v.3 The bitmap functions were rewritten to manipulate bytes not bits. v.4 Several non-modified parameters, and local variables were changed to const
Also the code formatting was fixed.
v.5 The commit subject line now has versions and is simpler.
v.6 All descriptions in the commit history are now complete sentences.
Extraneous blank lines are gone.
v.7 AddedLIBXL_BIT_HAVE_AND_ORtolibxl.h; deleted extraneous comment in
libxl_utils.h; and updated the commit log to include the uses for these functions--- tools/libxl/libxl.h | 9 ++++++ tools/libxl/libxl_utils.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_utils.h | 6 ++++ 3 files changed, 85 insertions(+)tools/libxl/libxl.h +0
-0@@ -84,6 +84,15 @@#define LIBXL_HAVE_CPUPOOL_QUALIFIER_TO_CPUPOOLID 1
Quoted 8 lines
tools/libxl/libxl.h line 90
Quoted 5 lines
tools/libxl/libxl.h +4
-0/* +* +* LIBXL_HAVE_BITMAP_AND_OR +* +* If this is defined, libxl has two libarary functions, libxl_bitmap_and "library".
(again, can fix on commit)
Thanks for catching the typo.
Linda Jacobson
Quoted 6 lines
Other than those:
Acked-by Ian Campbell <[email protected]>
Quoted 13 lines · Linda
Quoted 12 lines · Ian Campbell
Quoted 2 lines · Linda Jacobson
New functions to provide logical and and or of two bitmaps functions can be used in vNUMA configuration check function.
I don't think that really justifies adding them, since we aren't actually using them for that now, how about:
New functions to provide logical and and or of two bitmaps. These are generically useful utility functions added to the public API for the benefit of libxl's users.
In the future they may also be useful internally, e.g. in the vNUMA configuration check function.
Quoted 3 lines
Quoted 2 lines
If you are happy with that, and there's no other reason to resend, then I can switch in that text as I commit.
I'm fine with this. If Wei and Julien are, please go ahead.
Julien is away now. I'm of course fine with this -- it's your contribution after all, you have the final say. :-)
And congratulations to you for getting first patch accepted!
Wei.
Quoted 45 lines
Quoted 35 lines
Quoted 27 lines
Signed-off-by Linda Jacobson <[email protected]>---
v.1 The new functions were added.
v.2 The comments and format were corrected.
v.3 The bitmap functions were rewritten to manipulate bytes not bits. v.4 Several non-modified parameters, and local variables were changed to const
Also the code formatting was fixed.
v.5 The commit subject line now has versions and is simpler.
v.6 All descriptions in the commit history are now complete sentences.
Extraneous blank lines are gone.
v.7 AddedLIBXL_BIT_HAVE_AND_ORtolibxl.h; deleted extraneous comment in
libxl_utils.h; and updated the commit log to include the uses for these functions--- tools/libxl/libxl.h | 9 ++++++ tools/libxl/libxl_utils.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_utils.h | 6 ++++ 3 files changed, 85 insertions(+)tools/libxl/libxl.h +0
-0tools/libxl/libxl.h line 89
Quoted 6 lines
tools/libxl/libxl.h +4
-0@@ -84,6 +84,15 @@#define LIBXL_HAVE_CPUPOOL_QUALIFIER_TO_CPUPOOLID 1/* +* +* LIBXL_HAVE_BITMAP_AND_OR +* +* If this is defined, libxl has two libarary functions, libxl_bitmap_and "library".
Quoted 1 line
(again, can fix on commit)
Thanks for catching the typo.
Linda Jacobson
Quoted 6 lines
Other than those:
Acked-by Ian Campbell <[email protected]>
Quoted 14 lines · Wei Liu
Quoted 13 lines · Linda
Quoted 12 lines · Ian Campbell
Quoted 2 lines · Linda Jacobson
New functions to provide logical and and or of two bitmaps functions can be used in vNUMA configuration check function.
I don't think that really justifies adding them, since we aren't actually using them for that now, how about:
New functions to provide logical and and or of two bitmaps. These are generically useful utility functions added to the public API for the benefit of libxl's users.
In the future they may also be useful internally, e.g. in the vNUMA configuration check function.
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
If you are happy with that, and there's no other reason to resend, then I can switch in that text as I commit.
I'm fine with this. If Wei and Julien are, please go ahead.
Julien is away now. I'm of course fine with this -- it's your contribution after all, you have the final say. :-)
Then, Ian, please, go ahead.
Quoted 2 lines
And congratulations to you for getting first patch accepted!
Why, thank you.
Linda
Quoted 46 lines
Wei.
Quoted 43 lines
Quoted 34 lines
Quoted 26 lines
Signed-off-by Linda Jacobson <[email protected]>---
v.1 The new functions were added.
v.2 The comments and format were corrected.
v.3 The bitmap functions were rewritten to manipulate bytes not bits. v.4 Several non-modified parameters, and local variables were changed to const
Also the code formatting was fixed.
v.5 The commit subject line now has versions and is simpler.
v.6 All descriptions in the commit history are now complete sentences.
Extraneous blank lines are gone.
v.7 AddedLIBXL_BIT_HAVE_AND_ORtolibxl.h; deleted extraneous comment in
libxl_utils.h; and updated the commit log to include the uses for these functions--- tools/libxl/libxl.h | 9 ++++++ tools/libxl/libxl_utils.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_utils.h | 6 ++++ 3 files changed, 85 insertions(+)tools/libxl/libxl.h +0
-0tools/libxl/libxl.h line 89
Quoted 6 lines
tools/libxl/libxl.h +4
-0@@ -84,6 +84,15 @@#define LIBXL_HAVE_CPUPOOL_QUALIFIER_TO_CPUPOOLID 1/* +* +* LIBXL_HAVE_BITMAP_AND_OR +* +* If this is defined, libxl has two libarary functions, libxl_bitmap_and "library".
Quoted 1 line
(again, can fix on commit)
Thanks for catching the typo.
Linda Jacobson
Quoted 5 lines
Other than those:
Acked-by Ian Campbell <[email protected]>
Quoted 15 lines · Linda
Quoted 14 lines · Wei Liu
Quoted 13 lines · Linda
Quoted 12 lines · Ian Campbell
Quoted 2 lines · Linda Jacobson
New functions to provide logical and and or of two bitmaps functions can be used in vNUMA configuration check function.
I don't think that really justifies adding them, since we aren't actually using them for that now, how about:
New functions to provide logical and and or of two bitmaps. These are generically useful utility functions added to the public API for the benefit of libxl's users.
In the future they may also be useful internally, e.g. in the vNUMA configuration check function.
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
If you are happy with that, and there's no other reason to resend, then I can switch in that text as I commit.
I'm fine with this. If Wei and Julien are, please go ahead.
Julien is away now. I'm of course fine with this -- it's your contribution after all, you have the final say. :-)
Then, Ian, please, go ahead.
Done, thanks.
I had to apply with "git am --whitespace=fixup" due to the trailing whitespace which the patches added.
Ian
clarification of xen Wiki article
In reply to Linda JacobsonHi all,
I was reading
http://wiki.xen.org/wiki/XenBus
In the section on Store Organization, there is the statement "Information should not be replicated in the store and required to be consistent " I'm not sure what that means.
Can anybody clarify this for me, please?
Thanks.
linda
Re: clarification of xen Wiki article
Quoted 10 lines · Linda
Hi all,
I was readinghttp://wiki.xen.org/wiki/XenBus
In the section on Store Organization, there is the statement "Information should not be replicated in the store and required to be consistent " I'm not sure what that means.
Can anybody clarify this for me, please?
This came from the old wiki, so the history is unclear.
I suppose it could mean either:
If you replicate information in xenstore then you should not expect it to be consistent
or
Do not replicate information, do not require information to be consistent.
But let me turn the question around: What are you actually trying to achieve? i.e. what is causing this ambiguous and confusing statement to be a concern for you.
Unless the author or someone else in the know speaks up I would propose to remove this text from the wiki.
Ian.
Re: clarification of xen Wiki article
Quoted 3 lines · Ian Campbell
Unless the author or someone else in the know speaks up I would propose to remove this text from the wiki.
+1 for this.
Wei.
Quoted 1 line
Ian.
Re: clarification of xen Wiki article
Quoted 7 lines · Wei Liu
Quoted 3 lines · Ian Campbell
Unless the author or someone else in the know speaks up I would propose to remove this text from the wiki.
+1 for this.
Ian, I looked at the history of that page. It looks like it was you who created that page. Since you as the original author doesn't have idea what that sentence means I've removed that sentence.
Wei.
Quoted 3 lines
Wei.
Quoted 1 line
Ian.
Re: clarification of xen Wiki article
Quoted 11 lines · Wei Liu
Quoted 7 lines · Wei Liu
Quoted 3 lines · Ian Campbell
Unless the author or someone else in the know speaks up I would propose to remove this text from the wiki.
+1 for this.
Ian, I looked at the history of that page. It looks like it was you who created that page.
No, I imported it from the old wiki, for which wee don't have history (AFAIK). "This came from the old wiki, so the history is unclear." was in my reply.
Quoted 8 lines
Since you as the original author doesn't have idea what that sentence means I've removed that sentence.
Wei.
Quoted 3 lines
Wei.
Quoted 1 line
Ian.
Re: clarification of xen Wiki article
Quoted 10 lines · Ian Campbell
Quoted 9 lines · Wei Liu
Quoted 7 lines · Wei Liu
Quoted 3 lines · Ian Campbell
Unless the author or someone else in the know speaks up I would propose to remove this text from the wiki.
+1 for this.
Quoted 7 lines
Quoted 2 lines
Ian, I looked at the history of that page. It looks like it was you who created that page.
No, I imported it from the old wiki, for which wee don't have history (AFAIK). "This came from the old wiki, so the history is unclear." was in my reply.
Ah, OK. My change can be reverted if it turns out to be problematic.
Wei.
Quoted 9 lines
Quoted 8 lines
Since you as the original author doesn't have idea what that sentence means I've removed that sentence.
Wei.
Quoted 3 lines
Wei.
Quoted 1 line
Ian.
Re: clarification of xen Wiki article
In reply to Ian CampbellQuoted 18 lines · Ian Campbell
Quoted 10 lines · Linda
Hi all,
I was readinghttp://wiki.xen.org/wiki/XenBus
In the section on Store Organization, there is the statement "Information should not be replicated in the store and required to be consistent " I'm not sure what that means.
Can anybody clarify this for me, please?
This came from the old wiki, so the history is unclear.
I suppose it could mean either:
If you replicate information in xenstore then you should not expect it to be consistent
Quoted 8 lines
or
Do not replicate information, do not require information to be consistent.
But let me turn the question around: What are you actually trying to achieve? i.e. what is causing this ambiguous and confusing statement to be a concern for you.
Sometime soon I will be writing a front- and back- end for the 9p fs protocol. (My Outreachy project). My goall is to understand where drivers sit logically and physically, so I know what I'm doing. Part of this is to understand Xenbus and Xenstore.
When I know too little, I read carefully, and flag anything I don't understand. For now, I'll ignore this statement.
Thanks, Ian.
Linda Jacobson
Quoted 7 lines
Unless the author or someone else in the know speaks up I would propose to remove this text from the wiki.
Ian.
grant tables and driver handshaking
In reply to LindaHello all,
I will be writing a xen front and back-end pair for a 9p
transport. I have two areas where I'm still a little more muddled than I'd like to be.
Can anyone please recommend a good article on either grant tables
or the handshaking between the front and back-end drivers, or both?
I have looked at the code, but could use more verbiage.
Thanks.
Linda
Re: grant tables and driver handshaking
Quoted 5 lines · Linda
Hello all,
I will be writing a xen front and back-end pair for a 9p transport. I
have two areas where I'm still a little more muddled than I'd like to be.
Can anyone please recommend a good article on either grant tables or the
handshaking between the front and back-end drivers, or both?
The handshake protocol needs to be designed by you. Generally speaking you need to at least advertise the event channel and grant table references. You also need to advertise other information that you identify as part of the handshake process.
There is a wiki page on grant table
http://wiki.xenproject.org/wiki/Grant_Table
Wei.
Quoted 4 lines
I have looked at the code, but could use more verbiage.
Thanks.Linda
Re: grant tables and driver handshaking
Quoted 10 lines · Wei Liu
Quoted 5 lines · Linda
Hello all,
I will be writing a xen front and back-end pair for a 9p transport. I
have two areas where I'm still a little more muddled than I'd like to be.
Can anyone please recommend a good article on either grant tables or the
handshaking between the front and back-end drivers, or both?The handshake protocol needs to be designed by you. Generally speaking you need to at least advertise the event channel and grant table references. You also need to advertise other information that you identify as part of the handshake process.
OK. That explains half of my muddle.
Here's the other half. The wiki article on xenbus taks about the front-end registering with xenbus, before anything else happens. But in blkback, it looks like it too has to do some kind of setup with xenbus, too.
Since the backend is in DOM0, and is around longer than the DOMUs, this happens first. It's that interaction that I'd like a little more text on. If it exists.
Quoted 4 lines
There is a wiki page on grant table
Thanks.
Quoted 7 lines
Wei.
Quoted 4 lines
I have looked at the code, but could use more verbiage.
Thanks.Linda
Re: grant tables and driver handshaking
Quoted 11 lines · Linda
Quoted 10 lines · Wei Liu
Quoted 5 lines · Linda
Hello all,
I will be writing a xen front and back-end pair for a 9p transport. I
have two areas where I'm still a little more muddled than I'd like to be.
Can anyone please recommend a good article on either grant tables or the
handshaking between the front and back-end drivers, or both?The handshake protocol needs to be designed by you. Generally speaking you need to at least advertise the event channel and grant table references. You also need to advertise other information that you identify as part of the handshake process.
Quoted 6 lines
OK. That explains half of my muddle.
Here's the other half. The wiki article on xenbus taks about the front-end registering with xenbus, before anything else happens. But in blkback, it looks like it too has to do some kind of setup with xenbus, too.
Not sure if you still have questions in this area or not. If so please reply and preferable with the specific code snippet you find confusing.
Quoted 3 lines
Since the backend is in DOM0, and is around longer than the DOMUs, this
happens first. It's that interaction that I'd like a little more text on.
If it exists.
I'm not completely sure what you're referring to. That probably only exists in code. The interaction between backend and frontend is very driver specific.
Wei.
Quoted 12 lines
Quoted 4 lines
There is a wiki page on grant table
Thanks.
Quoted 7 lines
Wei.
Quoted 4 lines
I have looked at the code, but could use more verbiage.
Thanks.Linda
Re: grant tables and driver handshaking
Quoted 7 lines · Wei Liu
Quoted 3 lines
Since the backend is in DOM0, and is around longer than the DOMUs, this
happens first. It's that interaction that I'd like a little more text on.
If it exists.I'm not completely sure what you're referring to. That probably only exists in code. The interaction between backend and frontend is very driver specific.
Most front and backend pairs follow a similar pattern though, and it is best not to reinvent the wheel completely, even if some of the details differ.
In general everything is driven from a pair of "state" nodes in xenstore, one in the frontend dir and one in the backend dir.
These contain the enum xenbus_state from xen/include/public/io/xenbus.h (as %d formatted integers). In general both front and backend start in state 1 (XenbusStateInitialising) and each has a watch on the other end. Things generally start with the backend moving to state 2 (XenbusStateInitWait) and from there they progress n lockstep through the stages until they both reach state 4 (XenbusStateConnected), then you are up and running.
On teardown one end goes to 5 (XenbusStateClosing) and the other follows.
In Linux the place to look is the various "otherend_changed" hooks in the front and back drivers, usually the backend half is in a xenbus.c file (e.g. netback and blkback).
blkif.h has a description of the states in that case.
http://xenbits.xen.org/docs/unstable/hypercall/x86_64/include,public,io,blkif.h.html
I'm not aware of any particular docs on the general case, or at least I can't find the ones I thought we had.
Ian
Re: grant tables and driver handshaking
Quoted 22 lines · Ian Campbell
Quoted 6 lines · Wei Liu
Quoted 3 lines
Since the backend is in DOM0, and is around longer than the DOMUs, this
happens first. It's that interaction that I'd like a little more text on.
If it exists.I'm not completely sure what you're referring to. That probably only exists in code. The interaction between backend and frontend is very driver specific.
Most front and backend pairs follow a similar pattern though, and it is best not to reinvent the wheel completely, even if some of the details differ.
In general everything is driven from a pair of "state" nodes in xenstore, one in the frontend dir and one in the backend dir.
These contain the enum
xenbus_statefromxen/include/public/io/xenbus.h(as %d formatted integers). In general both front and backend start in state 1 (XenbusStateInitialising) and each has a watch on the other end. Things generally start with the backend moving to state 2 (XenbusStateInitWait) and from there they progress n lockstep through the stages until they both reach state 4 (XenbusStateConnected), then you are up and running.
Quoted 2 lines
On teardown one end goes to 5 (XenbusStateClosing) and the other follows.
Thanks, Ian. This helped a lot.
And thanks for the links, below.
Linda
Quoted 14 lines
In Linux the place to look is the various "
otherend_changed" hooks in the front and back drivers, usually the backend half is in axenbus.cfile (e.g. netback and blkback).
blkif.hhas a description of the states in that case.
http://xenbits.xen.org/docs/unstable/hypercall/x86_64/include,public,io,blkif.h.htmlI'm not aware of any particular docs on the general case, or at least I can't find the ones I thought we had.
Ian