Skip to contentSkip to conversation

Kexec and libxenctlr.so

DISCUSSION Julien Grall 4 participants 12 messages Jun 11, 2020 – Jul 21, 2020

lore
Share & tools
lore
#0 lore raw

Hi all,

kexec-tools has an option to load dynamically libxenctlr.so (not .so.4.x) (see [1]).

Given that the library has never been considered stable, it is probably a disaster that is waiting to happen.

Looking at the tree kexec is using the follow libxc functions:
- xc_kexec_get_range()
- xc_kexec_load()
- xc_kexec_unload()
- xc_kexec_status()
- xc_kexec_exec()
- xc_version()
- xc_interface_open()
- xc_interface_close()
- xc_get_max_cpus()
- xc_get_machine_memory_map()

I think it is uncontroversial that we want a new stable library for all the xc_kexec_* functions (maybe libxenexec)?

However I am not entirely sure where to put the others.

I am thinking to introduce libxensysctl for xc_get_max_cpus() as it is a XEN_SYSCTL. We could possibly include xc_get_machine_memory_map() (despite it is a XENMEM_).

For xc_version(), I am thinking to extend libxentoolcore to also include "stable xen API".

Any opinion on the approach?

Cheers,

[1] https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=894bea9335f57b62cbded7b02ab7d58308b647d8

#1 lore raw
Quoted 20 lines · Julien Grall

Hi all,

kexec-tools has an option to load dynamically libxenctlr.so (not .so.4.x) (see [1]).

Given that the library has never been considered stable, it is probably a disaster that is waiting to happen.

Looking at the tree kexec is using the follow libxc functions:
   - xc_kexec_get_range()
   - xc_kexec_load()
   - xc_kexec_unload()
   - xc_kexec_status()
   - xc_kexec_exec()
   - xc_version()
   - xc_interface_open()
   - xc_interface_close()
   - xc_get_max_cpus()
   - xc_get_machine_memory_map()

I think it is uncontroversial that we want a new stable library for all the xc_kexec_* functions (maybe libxenexec)?

Quoted 7 lines

However I am not entirely sure where to put the others.

I am thinking to introduce libxensysctl for xc_get_max_cpus() as it is a XEN_SYSCTL. We could possibly include xc_get_machine_memory_map() (despite it is a XENMEM_).

For xc_version(), I am thinking to extend libxentoolcore to also include "stable xen API".

Any opinion on the approach?

You could consider hypfs (at least for some of the functionality).

xc_version() and xc_get_max_cpus() would be rather easy. xc_get_machine_memory_map() is using a stable hypercall used by the kernel, too.

Juergen

#2 lore raw

Hi,

Quoted 23 lines · Jürgen Groß
Quoted 22 lines · Julien Grall

Hi all,

kexec-tools has an option to load dynamically libxenctlr.so (not .so.4.x) (see [1]).

Given that the library has never been considered stable, it is probably a disaster that is waiting to happen.

Looking at the tree kexec is using the follow libxc functions:
    - xc_kexec_get_range()
    - xc_kexec_load()
    - xc_kexec_unload()
    - xc_kexec_status()
    - xc_kexec_exec()
    - xc_version()
    - xc_interface_open()
    - xc_interface_close()
    - xc_get_max_cpus()
    - xc_get_machine_memory_map()

I think it is uncontroversial that we want a new stable library for all the xc_kexec_* functions (maybe libxenexec)?

However I am not entirely sure where to put the others.

Quoted 7 lines
Quoted 5 lines

I am thinking to introduce libxensysctl for xc_get_max_cpus() as it is a XEN_SYSCTL. We could possibly include xc_get_machine_memory_map() (despite it is a XENMEM_).

For xc_version(), I am thinking to extend libxentoolcore to also include "stable xen API".

Any opinion on the approach?

You could consider hypfs (at least for some of the functionality).

That would work!

Quoted 2 lines

xc_version() and xc_get_max_cpus() would be rather easy.

I am guessing we will need a fallback to the normal hypercalls if hypfs is not present.

Quoted 2 lines

xc_get_machine_memory_map() is using a stable hypercall used by the kernel, too.

IIUC, you are suggesting to put this one in hypfs library as well. Is that correct?

Thank you for the input!

Cheers,

Signature · 1 line
Julien Grall
#3 lore raw
Quoted 32 lines · Julien Grall

Hi,

Quoted 29 lines · Jürgen Groß
Quoted 27 lines · Julien Grall

Hi all,

kexec-tools has an option to load dynamically libxenctlr.so (not .so.4.x) (see [1]).

Given that the library has never been considered stable, it is probably a disaster that is waiting to happen.

Looking at the tree kexec is using the follow libxc functions:
    - xc_kexec_get_range()
    - xc_kexec_load()
    - xc_kexec_unload()
    - xc_kexec_status()
    - xc_kexec_exec()
    - xc_version()
    - xc_interface_open()
    - xc_interface_close()
    - xc_get_max_cpus()
    - xc_get_machine_memory_map()

I think it is uncontroversial that we want a new stable library for all the xc_kexec_* functions (maybe libxenexec)?

However I am not entirely sure where to put the others.

I am thinking to introduce libxensysctl for xc_get_max_cpus() as it is a XEN_SYSCTL. We could possibly include xc_get_machine_memory_map() (despite it is a XENMEM_).

For xc_version(), I am thinking to extend libxentoolcore to also include "stable xen API".

Any opinion on the approach?

Quoted 8 lines
Quoted 1 line

You could consider hypfs (at least for some of the functionality).

That would work!

Quoted 2 lines

xc_version() and xc_get_max_cpus() would be rather easy.

I am guessing we will need a fallback to the normal hypercalls if hypfs is not present.

Or we don't support kexec-tools running on a system without hypfs (or the related functions would return an error on those systems).

Quoted 5 lines
Quoted 3 lines

xc_get_machine_memory_map() is using a stable hypercall used by the kernel, too.

IIUC, you are suggesting to put this one in hypfs library as well. Is that correct?

Not really. I wanted to point out that this call would be a good candidate for another stable library, maybe part of libxenexec?

In theory the memory map could be dumped via a hypfs node, either as a string (not nice for working with it) or as binary blob, of course.

Juergen

#4 lore raw
Quoted 38 lines · Jürgen Groß
Quoted 37 lines · Julien Grall

Hi,

Quoted 23 lines · Jürgen Groß
Quoted 22 lines · Julien Grall

Hi all,

kexec-tools has an option to load dynamically libxenctlr.so (not .so.4.x) (see [1]).

Given that the library has never been considered stable, it is probably a disaster that is waiting to happen.

Looking at the tree kexec is using the follow libxc functions:
    - xc_kexec_get_range()
    - xc_kexec_load()
    - xc_kexec_unload()
    - xc_kexec_status()
    - xc_kexec_exec()
    - xc_version()
    - xc_interface_open()
    - xc_interface_close()
    - xc_get_max_cpus()
    - xc_get_machine_memory_map()

I think it is uncontroversial that we want a new stable library for all the xc_kexec_* functions (maybe libxenexec)?

However I am not entirely sure where to put the others.

Quoted 7 lines
Quoted 5 lines

I am thinking to introduce libxensysctl for xc_get_max_cpus() as it is a XEN_SYSCTL. We could possibly include xc_get_machine_memory_map() (despite it is a XENMEM_).

For xc_version(), I am thinking to extend libxentoolcore to also include "stable xen API".

Any opinion on the approach?

You could consider hypfs (at least for some of the functionality).

That would work!

Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

xc_version() and xc_get_max_cpus() would be rather easy.

I am guessing we will need a fallback to the normal hypercalls if hypfs is not present.

Or we don't support kexec-tools running on a system without hypfs (or the related functions would return an error on those systems).

AFAICT, hypfs allows you to modify runtime parameters which is not required for kexec.

Such feature could be undesirable in some setup and therefore I don't think this is acceptable to impose that for kexec.

Quoted 16 lines
Quoted 6 lines
Quoted 4 lines

xc_get_machine_memory_map() is using a stable hypercall used by the kernel, too.

IIUC, you are suggesting to put this one in hypfs library as well. Is that correct?

Not really. I wanted to point out that this call would be a good candidate for another stable library, maybe part of libxenexec?

In theory the memory map could be dumped via a hypfs node, either as a string (not nice for working with it) or as binary blob, of course.

Juergen

Signature · 1 line
Julien Grall
#5 lore raw
Quoted 41 lines · Julien Grall
Quoted 38 lines · Jürgen Groß
Quoted 37 lines · Julien Grall

Hi,

Quoted 23 lines · Jürgen Groß
Quoted 22 lines · Julien Grall

Hi all,

kexec-tools has an option to load dynamically libxenctlr.so (not .so.4.x) (see [1]).

Given that the library has never been considered stable, it is probably a disaster that is waiting to happen.

Looking at the tree kexec is using the follow libxc functions:
    - xc_kexec_get_range()
    - xc_kexec_load()
    - xc_kexec_unload()
    - xc_kexec_status()
    - xc_kexec_exec()
    - xc_version()
    - xc_interface_open()
    - xc_interface_close()
    - xc_get_max_cpus()
    - xc_get_machine_memory_map()

I think it is uncontroversial that we want a new stable library for all the xc_kexec_* functions (maybe libxenexec)?

However I am not entirely sure where to put the others.

Quoted 7 lines
Quoted 5 lines

I am thinking to introduce libxensysctl for xc_get_max_cpus() as it is a XEN_SYSCTL. We could possibly include xc_get_machine_memory_map() (despite it is a XENMEM_).

For xc_version(), I am thinking to extend libxentoolcore to also include "stable xen API".

Any opinion on the approach?

You could consider hypfs (at least for some of the functionality).

That would work!

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

xc_version() and xc_get_max_cpus() would be rather easy.

I am guessing we will need a fallback to the normal hypercalls if hypfs is not present.

Or we don't support kexec-tools running on a system without hypfs (or the related functions would return an error on those systems).

AFAICT, hypfs allows you to modify runtime parameters which is not required for kexec.

Well, and? kexec won't use this functionality.

libxenctrl allows to create domains, which isn't required for kexec. And kexec doesn't do it.

We could still have the entry points for that functionality in libxenexec, which could use libxenhypfs (and maybe others).

Quoted 1 line

Such feature could be undesirable in some setup and therefore I don't think this is acceptable to impose that for kexec.

If we really have setups where this would be an issue we'd need to modify the flask integration of hypfs to be able to disallow write access to hypfs. Or we could even add per-node access rights.

Juergen

#6 lore raw

Hi Juergen,

Quoted 49 lines · Jürgen Groß
Quoted 48 lines · Julien Grall
Quoted 44 lines · Jürgen Groß
Quoted 32 lines · Julien Grall

Hi,

Quoted 29 lines · Jürgen Groß
Quoted 27 lines · Julien Grall

Hi all,

kexec-tools has an option to load dynamically libxenctlr.so (not .so.4.x) (see [1]).

Given that the library has never been considered stable, it is probably a disaster that is waiting to happen.

Looking at the tree kexec is using the follow libxc functions:
    - xc_kexec_get_range()
    - xc_kexec_load()
    - xc_kexec_unload()
    - xc_kexec_status()
    - xc_kexec_exec()
    - xc_version()
    - xc_interface_open()
    - xc_interface_close()
    - xc_get_max_cpus()
    - xc_get_machine_memory_map()

I think it is uncontroversial that we want a new stable library for all the xc_kexec_* functions (maybe libxenexec)?

However I am not entirely sure where to put the others.

I am thinking to introduce libxensysctl for xc_get_max_cpus() as it is a XEN_SYSCTL. We could possibly include xc_get_machine_memory_map() (despite it is a XENMEM_).

For xc_version(), I am thinking to extend libxentoolcore to also include "stable xen API".

Any opinion on the approach?

Quoted 8 lines
Quoted 1 line

You could consider hypfs (at least for some of the functionality).

That would work!

Quoted 2 lines

xc_version() and xc_get_max_cpus() would be rather easy.

I am guessing we will need a fallback to the normal hypercalls if hypfs is not present.

Or we don't support kexec-tools running on a system without hypfs (or the related functions would return an error on those systems).

Quoted 6 lines
Quoted 1 line

AFAICT, hypfs allows you to modify runtime parameters which is not required for kexec.

Well, and? kexec won't use this functionality.

libxenctrl allows to create domains, which isn't required for kexec. And kexec doesn't do it.

And so does libc... so that was clear not my point...

Quoted 9 lines

We could still have the entry points for that functionality in libxenexec, which could use libxenhypfs (and maybe others).

Quoted 1 line

Such feature could be undesirable in some setup and therefore I don't think this is acceptable to impose that for kexec.

If we really have setups where this would be an issue we'd need to modify the flask integration of hypfs to be able to disallow write access to hypfs. Or we could even add per-node access rights.

... Not everyone wants to use flask and I don't think this should be a condition to forbid runtime configuration change for all the system.

You may want to set a minimal Xen with no runtime configuration support and no flask. Yet you may want to kexec for updating your Xen.

Even with the runtime bits removed, I still don't think we should impose to build hypfs in the hypervisor given there are already always built hypercalls.

Cheers,

Signature · 1 line
Julien Grall
#7 lore raw
Quoted 71 lines · Julien Grall

Hi Juergen,

Quoted 49 lines · Jürgen Groß
Quoted 48 lines · Julien Grall
Quoted 44 lines · Jürgen Groß
Quoted 32 lines · Julien Grall

Hi,

Quoted 29 lines · Jürgen Groß
Quoted 27 lines · Julien Grall

Hi all,

kexec-tools has an option to load dynamically libxenctlr.so (not .so.4.x) (see [1]).

Given that the library has never been considered stable, it is probably a disaster that is waiting to happen.

Looking at the tree kexec is using the follow libxc functions:
    - xc_kexec_get_range()
    - xc_kexec_load()
    - xc_kexec_unload()
    - xc_kexec_status()
    - xc_kexec_exec()
    - xc_version()
    - xc_interface_open()
    - xc_interface_close()
    - xc_get_max_cpus()
    - xc_get_machine_memory_map()

I think it is uncontroversial that we want a new stable library for all the xc_kexec_* functions (maybe libxenexec)?

However I am not entirely sure where to put the others.

I am thinking to introduce libxensysctl for xc_get_max_cpus() as it is a XEN_SYSCTL. We could possibly include xc_get_machine_memory_map() (despite it is a XENMEM_).

For xc_version(), I am thinking to extend libxentoolcore to also include "stable xen API".

Any opinion on the approach?

Quoted 8 lines
Quoted 1 line

You could consider hypfs (at least for some of the functionality).

That would work!

Quoted 2 lines

xc_version() and xc_get_max_cpus() would be rather easy.

I am guessing we will need a fallback to the normal hypercalls if hypfs is not present.

Or we don't support kexec-tools running on a system without hypfs (or the related functions would return an error on those systems).

Quoted 6 lines
Quoted 1 line

AFAICT, hypfs allows you to modify runtime parameters which is not required for kexec.

Well, and? kexec won't use this functionality.

libxenctrl allows to create domains, which isn't required for kexec. And kexec doesn't do it.

And so does libc... so that was clear not my point...

Quoted 9 lines

We could still have the entry points for that functionality in libxenexec, which could use libxenhypfs (and maybe others).

Quoted 1 line

Such feature could be undesirable in some setup and therefore I don't think this is acceptable to impose that for kexec.

If we really have setups where this would be an issue we'd need to modify the flask integration of hypfs to be able to disallow write access to hypfs. Or we could even add per-node access rights.

Quoted 5 lines

... Not everyone wants to use flask and I don't think this should be a condition to forbid runtime configuration change for all the system.

You may want to set a minimal Xen with no runtime configuration support and no flask. Yet you may want to kexec for updating your Xen.

Even with the runtime bits removed, I still don't think we should impose to build hypfs in the hypervisor given there are already always built hypercalls.

There might be a misunderstanding here.

I just wanted to point out that in case you need a new stable interface between kexec and the hypervisor you could consider using hypfs for that purpose instead of introducing a new hypercall.

In case all hypercalls are already present, then fine.

If not I don't see why introducing a new hypercall should be preferred over using an existing mechanism.

Juergen

#8 lore raw
Quoted 3 lines · Jürgen Groß

I just wanted to point out that in case you need a new stable interface between kexec and the hypervisor you could consider using hypfs for that purpose instead of introducing a new hypercall.

I am not looking to introduce a new interface with the hypervisor. Instead I am looking to have a stable library that can be used by Kexec.

The underlying communication with the hypervisor doesn't need to be stable.

Cheers,

Signature · 1 line
Julien Grall
#9 lore raw
In reply to Julien Grall
Quoted 20 lines · Julien Grall

Hi all,

kexec-tools has an option to load dynamically libxenctlr.so (not .so.4.x) (see [1]).

Given that the library has never been considered stable, it is probably a disaster that is waiting to happen.

Looking at the tree kexec is using the follow libxc functions:
- xc_kexec_get_range()
- xc_kexec_load()
- xc_kexec_unload()
- xc_kexec_status()
- xc_kexec_exec()
- xc_version()
- xc_interface_open()
- xc_interface_close()
- xc_get_max_cpus()
- xc_get_machine_memory_map()

Quoted 2 lines

I think it is uncontroversial that we want a new stable library for all the xc_kexec_* functions (maybe libxenexec)?

That sounds fine to me.

Looking at the list of functions, all the xc_kexec_* ones are probably already rather stable.

For xc_interface_open / close, they are perhaps used only to obtain an xc handle such that it can be used to make hypercalls. You new kexec library is going to expose its own handle with a xencall handle wrapped inside, so you can do away with an xc handle.

Quoted 7 lines

However I am not entirely sure where to put the others.

I am thinking to introduce libxensysctl for xc_get_max_cpus() as it is a XEN_SYSCTL. We could possibly include xc_get_machine_memory_map() (despite it is a XENMEM_).

Introducing an libxensysctl before we stabilise sysctl interface seems wrong to me. We can bury the call inside libxenkexec itself for the time being.

Quoted 3 lines

For xc_version(), I am thinking to extend libxentoolcore to also include "stable xen API".

If you can do without an xc handle, do you still need to call xc_version?

Wei.

Quoted 6 lines

Any opinion on the approach?

Cheers,

[1] https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=894bea9335f57b62cbded7b02ab7d58308b647d8

Acked-by Magnus Damm
#10 lore raw

Hi Wei,

Quoted 21 lines · Wei Liu
Quoted 20 lines · Julien Grall

Hi all,

kexec-tools has an option to load dynamically libxenctlr.so (not .so.4.x) (see [1]).

Given that the library has never been considered stable, it is probably a disaster that is waiting to happen.

Looking at the tree kexec is using the follow libxc functions:
- xc_kexec_get_range()
- xc_kexec_load()
- xc_kexec_unload()
- xc_kexec_status()
- xc_kexec_exec()
- xc_version()
- xc_interface_open()
- xc_interface_close()
- xc_get_max_cpus()
- xc_get_machine_memory_map()

Quoted 7 lines
Quoted 2 lines

I think it is uncontroversial that we want a new stable library for all the xc_kexec_* functions (maybe libxenexec)?

That sounds fine to me.

Looking at the list of functions, all the xc_kexec_* ones are probably already rather stable.

That's my understanding as well.

Although, we may want to rethink some of the hypercalls (such as KEXEC_cmd_kexec_get_range) in the future as they have different layout between 32-bit and 64-bit. Thanksfully this wasn't exposed outside of libxc, so it shouldn't be an issue to have a stable library.

Quoted 5 lines

For xc_interface_open / close, they are perhaps used only to obtain an xc handle such that it can be used to make hypercalls. You new kexec library is going to expose its own handle with a xencall handle wrapped inside, so you can do away with an xc handle.

I have already a PoC for the new library. I had to tweak a bit the list of helpers as some use hypercalls arguments directly. Below, the proposed interface:

/* Callers who don't care don't need to #include <xentoollog.h> */ struct xentoollog_logger;

typedef struct xenkexec_handle xenkexec_handle;

typedef struct xenkexec_segments xenkexec_segments;

xenkexec_handle *xenkexec_open(struct xentoollog_logger *logger,

                               unsigned int open_flags);

int xenkexec_close(xenkexec_handle *khdl);

int xenkexec_exec(xenkexec_handle *khdl, int type); int xenkexec_get_range(xenkexec_handle *khdl, int range, int nr,

                       uint64_t *size, uint64_t *start);

int xenkexec_load(xenkexec_handle *khdl, uint8_t type, uint16_t arch,
uint64_t entry_maddr, uint32_t nr_segments, xenkexec_segments *segments);
int xenkexec_unload(xenkexec_handle *khdl, int type);
int xenkexec_status(xenkexec_handle *khdl, int type);

xenkexec_segments *xenkexec_allocate_segments(xenkexec_handle *khdl,

                                              unsigned int nr);

void xenkexec_free_segments(xenkexec_handle *khdl, xenkexec_segments *segs);

int xenkexec_update_segment(xenkexec_handle *khdl, xenkexec_segments *segs,
unsigned int idx, void *buffer, size_t
buffer_size,

                            uint64_t dest_maddr, size_t dest_size);
Quoted 4 lines
Quoted 4 lines

However I am not entirely sure where to put the others.

Quoted 8 lines
Quoted 4 lines

I am thinking to introduce libxensysctl for xc_get_max_cpus() as it is a XEN_SYSCTL. We could possibly include xc_get_machine_memory_map() (despite it is a XENMEM_).

Introducing an libxensysctl before we stabilise sysctl interface seems wrong to me. We can bury the call inside libxenkexec itself for the time being.

That would work for me.

Quoted 7 lines
Quoted 4 lines

For xc_version(), I am thinking to extend libxentoolcore to also include "stable xen API".

If you can do without an xc handle, do you still need to call xc_version?

Looking at kexec, xc_version() is used by crashdump to determine which architecture is used by Xen (in this case 32-bit x86 vs 64-bit x86).

The was introcuded by commit:

commit cdbc9b011fe43407908632d842e3a39e495e48d9

Author: Ian Campbell <[email protected]>
Date:   Fri Mar 16 10:10:24 2007 +0000

Set crash dump ELF header e_machine field based on underlying
hypervisor architecture.

This is necessary when running Xen with a 64 bit hypervisor and 32 bit domain 0 since the CPU crash notes will be 64 bit.

Detecting the hypervisor archiecture requires libxenctrl and
therefore this
support is optional and disabled by default.

As we drop support for 32-bit Xen quite a long time ago, we may be able to remove the call to xc_version().

Cheers,

Signature · 1 line
Julien Grall
#11 lore raw
Quoted 32 lines · Julien Grall

Hi Wei,

Quoted 21 lines · Wei Liu
Quoted 20 lines · Julien Grall

Hi all,

kexec-tools has an option to load dynamically libxenctlr.so (not .so.4.x) (see [1]).

Given that the library has never been considered stable, it is probably a disaster that is waiting to happen.

Looking at the tree kexec is using the follow libxc functions:
- xc_kexec_get_range()
- xc_kexec_load()
- xc_kexec_unload()
- xc_kexec_status()
- xc_kexec_exec()
- xc_version()
- xc_interface_open()
- xc_interface_close()
- xc_get_max_cpus()
- xc_get_machine_memory_map()

Quoted 7 lines
Quoted 2 lines

I think it is uncontroversial that we want a new stable library for all the xc_kexec_* functions (maybe libxenexec)?

That sounds fine to me.

Looking at the list of functions, all the xc_kexec_* ones are probably already rather stable.

Quoted 7 lines

That's my understanding as well.

Although, we may want to rethink some of the hypercalls (such as KEXEC_cmd_kexec_get_range) in the future as they have different layout between 32-bit and 64-bit. Thanksfully this wasn't exposed outside of libxc, so it shouldn't be an issue to have a stable library.

Oh, that's good to hear.

Quoted 30 lines
Quoted 5 lines

For xc_interface_open / close, they are perhaps used only to obtain an xc handle such that it can be used to make hypercalls. You new kexec library is going to expose its own handle with a xencall handle wrapped inside, so you can do away with an xc handle.

I have already a PoC for the new library. I had to tweak a bit the list of helpers as some use hypercalls arguments directly. Below, the proposed interface:

/* Callers who don't care don't need to #include <xentoollog.h> */ struct xentoollog_logger;

typedef struct xenkexec_handle xenkexec_handle;

typedef struct xenkexec_segments xenkexec_segments;

xenkexec_handle *xenkexec_open(struct xentoollog_logger *logger,

                               unsigned int open_flags);

int xenkexec_close(xenkexec_handle *khdl);

int xenkexec_exec(xenkexec_handle *khdl, int type); int xenkexec_get_range(xenkexec_handle *khdl, int range, int nr,

                       uint64_t *size, uint64_t *start);

int xenkexec_load(xenkexec_handle *khdl, uint8_t type, uint16_t arch,
uint64_t entry_maddr, uint32_t nr_segments, xenkexec_segments *segments);
int xenkexec_unload(xenkexec_handle *khdl, int type);
int xenkexec_status(xenkexec_handle *khdl, int type);

Quoted 9 lines

xenkexec_segments *xenkexec_allocate_segments(xenkexec_handle *khdl,

                                              unsigned int nr);

void xenkexec_free_segments(xenkexec_handle *khdl, xenkexec_segments *segs);

int xenkexec_update_segment(xenkexec_handle *khdl, xenkexec_segments *segs,
unsigned int idx, void *buffer, size_t
buffer_size,

                            uint64_t dest_maddr, size_t dest_size);

You definitely have more experience in kexec than I do. This list looks sensible.

Quoted 43 lines
Quoted 5 lines
Quoted 5 lines

However I am not entirely sure where to put the others.

Quoted 8 lines
Quoted 4 lines

I am thinking to introduce libxensysctl for xc_get_max_cpus() as it is a XEN_SYSCTL. We could possibly include xc_get_machine_memory_map() (despite it is a XENMEM_).

Introducing an libxensysctl before we stabilise sysctl interface seems wrong to me. We can bury the call inside libxenkexec itself for the time being.

That would work for me.

Quoted 7 lines
Quoted 4 lines

For xc_version(), I am thinking to extend libxentoolcore to also include "stable xen API".

If you can do without an xc handle, do you still need to call xc_version?

Looking at kexec, xc_version() is used by crashdump to determine which architecture is used by Xen (in this case 32-bit x86 vs 64-bit x86).

The was introcuded by commit:

commit cdbc9b011fe43407908632d842e3a39e495e48d9

Author: Ian Campbell <[email protected]>
Date:   Fri Mar 16 10:10:24 2007 +0000

Set crash dump ELF header e_machine field based on underlying hypervisor
architecture.

This is necessary when running Xen with a 64 bit hypervisor and 32 bit domain 0 since the CPU crash notes will be 64 bit.

Detecting the hypervisor archiecture requires libxenctrl and therefore
this
support is optional and disabled by default.

Quoted 7 lines

As we drop support for 32-bit Xen quite a long time ago, we may be able to remove the call to xc_version().

Does Arm care about the bitness of the hypervisor?

Wei.

Quoted 4 lines

Cheers,

Signature · 1 line
Julien Grall