x86/hvm: remove default ioreq server
PATCH 1/1 x86/hvm: remove default ioreq server
My recent patch [1] to qemu-xen-traditional removes the last use of the 'default' ioreq server in Xen. (This is a catch-all ioreq server that is used if no explicitly registered I/O range is targetted).
This patch can be applied once that patch is committed, to remove the (>100 lines of) redundant code in Xen.
[1] https://lists.xenproject.org/archives/html/xen-devel/2018-08/msg00270.html
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
--- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/hvm.c | 27 --------- xen/arch/x86/hvm/ioreq.c | 123 +++++---------------------------------- xen/include/asm-x86/hvm/domain.h | 1 - xen/include/asm-x86/hvm/ioreq.h | 4 +- 5 files changed, 19 insertions(+), 138 deletions(-)
xen/arch/x86/hvm/dm.c +1 -1
@@ -411,7 +411,7 @@ static int dm_op(const struct dmop_args *op_args)if ( data->pad[0 ] || data->pad[1 ] || data->pad[2 ] )break ; - rc =hvm_create_ioreq_server (d, false, data->handle_bufioreq, + rc =hvm_create_ioreq_server (d, data->handle_bufioreq, &data->id);break ; }
xen/arch/x86/hvm/hvm.c +0 -27
@@ -4098,7 +4098,6 @@ static int hvm_allow_set_param(struct domain *d,* since the domain may need to be paused. */ case HVM_PARAM_IDENT_PT : -case HVM_PARAM_DM_DOMAIN :case HVM_PARAM_ACPI_S_STATE :/* The remaining parameters should not be set by the guest. */ default :
@@ -4373,13 +4372,6 @@ static int hvm_allow_get_param(struct domain *d,case HVM_PARAM_ALTP2M :case HVM_PARAM_X87_FIP_WIDTH :break ; -/* -* The following parameters must not be read by the guest -* since the domain may need to be paused. -*/ -case HVM_PARAM_IOREQ_PFN : -case HVM_PARAM_BUFIOREQ_PFN : -case HVM_PARAM_BUFIOREQ_EVTCHN :/* The remaining parameters should not be read by the guest. */ default :if ( d == current->domain )
@@ -4433,25 +4425,6 @@ static int hvmop_get_param(case HVM_PARAM_X87_FIP_WIDTH : a.value = d->arch.x87_fip_width;break ; -case HVM_PARAM_IOREQ_PFN : -case HVM_PARAM_BUFIOREQ_PFN : -case HVM_PARAM_BUFIOREQ_EVTCHN : -/* -* It may be necessary to create a default ioreq server here, -* because legacy versions of QEMU are not aware of the new API for -* explicit ioreq server creation. However, if the domain is not -* under construction then it will not be QEMU querying the -* parameters and thus the query should not have that side-effect. -*/ -if ( !d->creation_finished ) - { - rc =hvm_create_ioreq_server (d, true, -HVM_IOREQSRV_BUFIOREQ_LEGACY ,NULL ); -if ( rc !=0 && rc != -EEXIST ) - goto out; - } - -/*FALLTHRU*/ default : a.value = d->arch.hvm_domain.params[a.index];break ;
xen/arch/x86/hvm/ioreq.c +16 -107
346 lines not on this page · raw message
xen/include/asm-x86/hvm/domain.h +0 -1
@@ -97,7 +97,6 @@ struct hvm_pi_ops { };#define MAX_NR_IOREQ_SERVERS 8 -#define DEFAULT_IOSERVID 0struct hvm_domain {/* Guest page range used for non-default ioreq servers */
xen/include/asm-x86/hvm/ioreq.h +2 -2
@@ -23,8 +23,8 @@ bool hvm_io_pending(struct vcpu *v);bool handle_hvm_io_completion (struct vcpu *v);bool is_ioreq_server_page (struct domain *d,const struct page_info *page); -int hvm_create_ioreq_server (struct domain *d,bool is_default, -int bufioreq_handling,ioservid_t *id); +int hvm_create_ioreq_server (struct domain *d,int bufioreq_handling, +ioservid_t *id);int hvm_destroy_ioreq_server (struct domain *d,ioservid_t id); int hvm_get_ioreq_server_info(struct domain *d, ioservid_t id, unsigned long *ioreq_gfn,
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Paul Durrant
My recent patch [1] to qemu-xen-traditional removes the last use of the 'default' ioreq server in Xen. (This is a catch-all ioreq server that is used if no explicitly registered I/O range is targetted).
This patch can be applied once that patch is committed, to remove the (>100 lines of) redundant code in Xen.
[1] https://lists.xenproject.org/archives/html/xen-devel/2018-08/msg00270.html
Signed-off-by Paul Durrant <[email protected]>
Quoted 10 lines
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>--- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/hvm.c | 27 --------- xen/arch/x86/hvm/ioreq.c | 123 +++++---------------------------------- xen/include/asm-x86/hvm/domain.h | 1 - xen/include/asm-x86/hvm/ioreq.h | 4 +- 5 files changed, 19 insertions(+), 138 deletions(-)
Wow - what a diffstat!
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
xen/arch/x86/hvm/hvm.c static int hvm_allow_set_param(struct domain *d, · line 4103
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 07.08.18 at 12:03, <[email protected]> wrote:
xen/arch/x86/hvm/hvm.c +0
-1@@ -4098,7 +4098,6 @@ static int hvm_allow_set_param(struct domain *d,* since the domain may need to be paused. */ case HVM_PARAM_IDENT_PT : -case HVM_PARAM_DM_DOMAIN :case HVM_PARAM_ACPI_S_STATE :/* The remaining parameters should not be set by the guest. */ default :
How come you remove it here, but not from hvmop_set_param()? And how is this related to qemu-trad _only_ anyway? Or wait - is this just a leftover (and hence its removal not directly related to the purpose of this patch)? If so, half a sentence in the description would have helped recognizing this.
Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0
-0@@ -4373,13 +4372,6 @@ static int hvm_allow_get_param(struct domain *d,case HVM_PARAM_ALTP2M :case HVM_PARAM_X87_FIP_WIDTH :break ;
xen/arch/x86/hvm/hvm.c static int hvm_allow_get_param(struct domain *d, · line 4377
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +0
-7-/* -* The following parameters must not be read by the guest -* since the domain may need to be paused. -*/ -case HVM_PARAM_IOREQ_PFN : -case HVM_PARAM_BUFIOREQ_PFN : -case HVM_PARAM_BUFIOREQ_EVTCHN :/* The remaining parameters should not be read by the guest. */ default :if ( d == current->domain )
Shouldn't you also remove the (or at least some) uses of these params from libxc? If all of them can go away, perhaps even their definitions should be commented out in the public header (or be put inside #ifdef __XEN__, as the values might want using in hvm_allow_{g,s}et_param() to uniformly deny access), considering that - as the comment you remove says - they were not usable from guests themselves. (I don't think they should be removed altogether, to keep a record of which values they used, as I don't think we want to re-use the values going forward.)
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 21 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 07 August 2018 11:37
To: Paul Durrant <[email protected]>
Cc: Andrew Cooper <[email protected]>; xen-devel <xen- [email protected]>
Subject: Re: [PATCH] x86/hvm: remove default ioreq serverxen/arch/x86/hvm/hvm.c static int hvm_allow_set_param(struct domain
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 07.08.18 at 12:03, <[email protected]> wrote:
xen/arch/x86/hvm/hvm.c +0
-0@@ -4098,7 +4098,6 @@ static int hvm_allow_set_param(struct domain*d,
xen/arch/x86/hvm/hvm.c static int hvm_allow_set_param(struct domain *d, · line 4103
Quoted 7 lines
xen/arch/x86/hvm/hvm.c +0
-1* since the domain may need to be paused. */ case HVM_PARAM_IDENT_PT : -case HVM_PARAM_DM_DOMAIN :case HVM_PARAM_ACPI_S_STATE :/* The remaining parameters should not be set by the guest. */ default :
Quoted 5 lines
How come you remove it here, but not from
hvmop_set_param()? And how is this related to qemu-trad _only_ anyway? Or wait - is this just a leftover (and hence its removal not directly related to the purpose of this patch)? If so, half a sentence in the description would have helped recognizing this.
I remove it here because it no longer has the semantic of pausing the domain. In fact that disappeared a while ago and this should have been cleaned up then. So, yes, I should have called it out in the commit comment. Sorry about that.
Quoted 17 lines
xen/arch/x86/hvm/hvm.c static int hvm_allow_get_param(struct domain
Quoted 2 lines
xen/arch/x86/hvm/hvm.c +0
-0@@ -4373,13 +4372,6 @@ static int hvm_allow_get_param(struct domain*d,
xen/arch/x86/hvm/hvm.c static int hvm_allow_get_param(struct domain *d, · line 4377
Quoted 13 lines
xen/arch/x86/hvm/hvm.c +0
-7case HVM_PARAM_ALTP2M :case HVM_PARAM_X87_FIP_WIDTH :break ; -/* -* The following parameters must not be read by the guest -* since the domain may need to be paused. -*/ -case HVM_PARAM_IOREQ_PFN : -case HVM_PARAM_BUFIOREQ_PFN : -case HVM_PARAM_BUFIOREQ_EVTCHN :/* The remaining parameters should not be read by the guest. */ default :if ( d == current->domain )
Quoted 10 lines
Shouldn't you also remove the (or at least some) uses of these params from libxc? If all of them can go away, perhaps even their definitions should be commented out in the public header (or be put inside #ifdef
__XEN__, as the values might want using in hvm_allow_{g,s}et_param() to uniformly deny access), considering that - as the comment you remove says - they were not usable from guests themselves. (I don't think they should be removed altogether, to keep a record of which values they used, as I don't think we want to re-use the values going forward.)
Note that the PFN params have to stay because, prior to direct resource mapping, upstream QEMU makes use of the PFNs in question and so the save/restore code in Xen has to preserve their values. The EVTCHN param can probably go away totally though... I don't think the save/restore code touches that. I guess the param definition should stay in the header but a comment be added that it is deprecated. I can also completely disallow get/set of that parameter too (with EOPNOTSUPP or EINVAL?) if you think that is a reasonable thing to do.
Paul
Quoted 3 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 32 lines
Quoted 21 lines
Quoted 1 line · On 07.08.18 at 12:48, <[email protected]> wrote:
From: Jan Beulich [mailto:[email protected]]
Sent: 07 August 2018 11:37Review static int hvm_allow_get_param(struct domain
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 07.08.18 at 12:03, <[email protected]> wrote:
(quoted diff) +0
-0@@ -4373,13 +4372,6 @@ static int hvm_allow_get_param(struct domain*d,
xen/arch/x86/hvm/hvm.c static int hvm_allow_get_param(struct domain *d, · line 4377
Quoted 13 lines
xen/arch/x86/hvm/hvm.c +0
-7case HVM_PARAM_ALTP2M :case HVM_PARAM_X87_FIP_WIDTH :break ; -/* -* The following parameters must not be read by the guest -* since the domain may need to be paused. -*/ -case HVM_PARAM_IOREQ_PFN : -case HVM_PARAM_BUFIOREQ_PFN : -case HVM_PARAM_BUFIOREQ_EVTCHN :/* The remaining parameters should not be read by the guest. */ default :if ( d == current->domain )Quoted 10 lines
Shouldn't you also remove the (or at least some) uses of these params from libxc? If all of them can go away, perhaps even their definitions should be commented out in the public header (or be put inside #ifdef
__XEN__, as the values might want using in hvm_allow_{g,s}et_param() to uniformly deny access), considering that - as the comment you remove says - they were not usable from guests themselves. (I don't think they should be removed altogether, to keep a record of which values they used, as I don't think we want to re-use the values going forward.)
Quoted 8 lines
Note that the PFN params have to stay because, prior to direct resource mapping, upstream QEMU makes use of the PFNs in question and so the save/restore code in Xen has to preserve their values. The EVTCHN param can probably go away totally though... I don't think the save/restore code touches that. I guess the param definition should stay in the header but a comment be added that it is deprecated. I can also completely disallow get/set of that parameter too (with EOPNOTSUPP or EINVAL?) if you think that is a reasonable thing to do.
I indeed think so, yes. ENODATA, EPERM, or EOPNOTSUPP would all seem fine to me (in the order of my personal preference).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel