xen: fix initialization of wallclock time for PVHVM on migration
PATCH v2 1/1 xen: fix initialization of wallclock time for PVHVM on migration
Call update_domain_wallclock_time on hvm_latch_shinfo_size even if the bitness of the guest has already been set, this fixes the problem with the wallclock not being set for PVHVM guests on resume from migration.
---
Since this is a bug fix, I think it is suitable for inclusion in the 4.3 release, and backported to older releases.
--- xen/arch/x86/hvm/hvm.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-)
xen/arch/x86/hvm/hvm.c +6 -14
@@ -3404,21 +3404,13 @@ static void hvm_latch_shinfo_size(struct domain *d)*/ if ( current->domain == d ) { new_has_32bit = (hvm_guest_x86_mode (current) !=8 ); -if (new_has_32bit != d->arch.has_32bit_shinfo) { +if (new_has_32bit != d->arch.has_32bit_shinfo) d->arch.has_32bit_shinfo = new_has_32bit; -/* -* Make sure that the timebase in the shared info -* structure is correct for its new bit-ness. We should -* arguably try to convert the other fields as well, but -* that's much more problematic (e.g. what do you do if -* you're going from 64 bit to 32 bit and there's an event -* channel pending which doesn't exist in the 32 bit -* version?). Just setting the wallclock time seems to be -* sufficient for everything we do, even if it is a bit of -* a hack. -*/ -update_domain_wallclock_time (d); - } +/* +* Make sure that the timebase in the shared info +* structure is correct. +*/ +update_domain_wallclock_time (d); } }
Signature · 7 lines
1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 9 lines · Roger Pau Monne
Call
update_domain_wallclock_timeonhvm_latch_shinfo_sizeeven if the bitness of the guest has already been set, this fixes the problem with the wallclock not being set for PVHVM guests on resume from migration.Signed-off-by Roger Pau Monné <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc George Dunlap <[email protected]>
May as well write directly into d->arch.has_32bit_shinfo and get rid of new_has_32bit. But apart from that:
Quoted 39 lines
---
Since this is a bug fix, I think it is suitable for inclusion in the 4.3 release, and backported to older releases.--- xen/arch/x86/hvm/hvm.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-)xen/arch/x86/hvm/hvm.c +6
-14@@ -3404,21 +3404,13 @@ static void hvm_latch_shinfo_size(struct domain *d)*/ if ( current->domain == d ) { new_has_32bit = (hvm_guest_x86_mode (current) !=8 ); -if (new_has_32bit != d->arch.has_32bit_shinfo) { +if (new_has_32bit != d->arch.has_32bit_shinfo) d->arch.has_32bit_shinfo = new_has_32bit; -/* -* Make sure that the timebase in the shared info -* structure is correct for its new bit-ness. We should -* arguably try to convert the other fields as well, but -* that's much more problematic (e.g. what do you do if -* you're going from 64 bit to 32 bit and there's an event -* channel pending which doesn't exist in the 32 bit -* version?). Just setting the wallclock time seems to be -* sufficient for everything we do, even if it is a bit of -* a hack. -*/ -update_domain_wallclock_time (d); - } +/* +* Make sure that the timebase in the shared info +* structure is correct. +*/ +update_domain_wallclock_time (d); } }
Quoted 7 lines · Keir Fraser
Quoted 5 lines · Roger Pau Monne
Call
update_domain_wallclock_timeonhvm_latch_shinfo_sizeeven if the bitness of the guest has already been set, this fixes the problem with the wallclock not being set for PVHVM guests on resume from migration.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc George Dunlap <[email protected]>May as well write directly into
d->arch.has_32bit_shinfoand get rid ofnew_has_32bit. But apart from that:Acked-by Keir Fraser <[email protected]>
Yikes - we have had a patch in the XenServer patch queue for donkeys years which implements the same fix as this.
I had still not manage to decide whether it was a gross hack which we needed to discard or whether it needed upstreaming.
I guess this answers the question.
~Andrew
Quoted 46 lines
Quoted 30 lines
---
Since this is a bug fix, I think it is suitable for inclusion in the 4.3 release, and backported to older releases.--- xen/arch/x86/hvm/hvm.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-)xen/arch/x86/hvm/hvm.c +1
-12@@ -3404,21 +3404,13 @@ static void hvm_latch_shinfo_size(struct domain *d)*/ if ( current->domain == d ) { new_has_32bit = (hvm_guest_x86_mode (current) !=8 ); -if (new_has_32bit != d->arch.has_32bit_shinfo) { +if (new_has_32bit != d->arch.has_32bit_shinfo) d->arch.has_32bit_shinfo = new_has_32bit; -/* -* Make sure that the timebase in the shared info -* structure is correct for its new bit-ness. We should -* arguably try to convert the other fields as well, but -* that's much more problematic (e.g. what do you do if -* you're going from 64 bit to 32 bit and there's an event -* channel pending which doesn't exist in the 32 bit -* version?). Just setting the wallclock time seems to be -* sufficient for everything we do, even if it is a bit of -* a hack. -*/ xen/arch/x86/hvm/hvm.c static void hvm_latch_shinfo_size(struct domain *d) · line 3416
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +5
-2-update_domain_wallclock_time (d); - } +/* +* Make sure that the timebase in the shared info +* structure is correct. +*/ +update_domain_wallclock_time (d); } }_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 18 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
Quoted 7 lines · Keir Fraser
Quoted 5 lines · Roger Pau Monne
Call
update_domain_wallclock_timeonhvm_latch_shinfo_sizeeven if the bitness of the guest has already been set, this fixes the problem with the wallclock not being set for PVHVM guests on resume from migration.Quoted 8 lines
Quoted 4 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc George Dunlap <[email protected]>May as well write directly into
d->arch.has_32bit_shinfoand get rid ofnew_has_32bit. But apart from that:Acked-by Keir Fraser <[email protected]>
Quoted 7 lines
Yikes - we have had a patch in the XenServer patch queue for donkeys years which implements the same fix as this.
I had still not manage to decide whether it was a gross hack which we needed to discard or whether it needed upstreaming.
I guess this answers the question.
Sounds like an ack/review then...
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Andrew Cooper
Reviewed-byQuoted 20 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
Quoted 7 lines · Keir Fraser
Quoted 5 lines · Roger Pau Monne
Call
update_domain_wallclock_timeonhvm_latch_shinfo_sizeeven if the bitness of the guest has already been set, this fixes the problem with the wallclock not being set for PVHVM guests on resume from migration.Quoted 8 lines
Quoted 4 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc George Dunlap <[email protected]>May as well write directly into
d->arch.has_32bit_shinfoand get rid ofnew_has_32bit. But apart from that:Acked-by Keir Fraser <[email protected]>Yikes - we have had a patch in the XenServer patch queue for donkeys years which implements the same fix as this.
Quoted 7 lines
Quoted 4 lines
I had still not manage to decide whether it was a gross hack which we needed to discard or whether it needed upstreaming.
I guess this answers the question.
Sounds like an ack/review then...
Jan
On closer inspection our patch is not actually so similar, but it still is achieving the same effect using a rather more convoluted method.
I am rather embarrased to say that the patch in our queue completely abuses HVM_PARAM_32BIT, value 8 (which is why that value is curiously missing upstream, given HVM_PARAM_VIRIDIAN at 9)
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 17 lines · Andrew Cooper
Quoted 7 lines · Keir Fraser
Quoted 5 lines · Roger Pau Monne
Call
update_domain_wallclock_timeonhvm_latch_shinfo_sizeeven if the bitness of the guest has already been set, this fixes the problem with the wallclock not being set for PVHVM guests on resume from migration.Quoted 8 lines
Quoted 4 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc George Dunlap <[email protected]>May as well write directly into
d->arch.has_32bit_shinfoand get rid ofnew_has_32bit. But apart from that:Acked-by Keir Fraser <[email protected]>
Quoted 7 lines
Yikes - we have had a patch in the XenServer patch queue for donkeys years which implements the same fix as this.
I had still not manage to decide whether it was a gross hack which we needed to discard or whether it needed upstreaming.
I guess this answers the question.
I believe the morally right(er) patch would be bigger and more fragile. This is a bit of a hack, but the whole idea of inferring shared-info bitness from sampling some cpu's execution mode is a bit odd (but necessary).
-- Keir
Quoted 49 lines
~Andrew
Quoted 46 lines
Quoted 30 lines
---
Since this is a bug fix, I think it is suitable for inclusion in the 4.3 release, and backported to older releases.--- xen/arch/x86/hvm/hvm.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-)xen/arch/x86/hvm/hvm.c +1
-12@@ -3404,21 +3404,13 @@ static void hvm_latch_shinfo_size(struct domain *d)*/ if ( current->domain == d ) { new_has_32bit = (hvm_guest_x86_mode (current) !=8 ); -if (new_has_32bit != d->arch.has_32bit_shinfo) { +if (new_has_32bit != d->arch.has_32bit_shinfo) d->arch.has_32bit_shinfo = new_has_32bit; -/* -* Make sure that the timebase in the shared info -* structure is correct for its new bit-ness. We should -* arguably try to convert the other fields as well, but -* that's much more problematic (e.g. what do you do if -* you're going from 64 bit to 32 bit and there's an event -* channel pending which doesn't exist in the 32 bit -* version?). Just setting the wallclock time seems to be -* sufficient for everything we do, even if it is a bit of -* a hack. -*/ xen/arch/x86/hvm/hvm.c static void hvm_latch_shinfo_size(struct domain *d) · line 3416
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +5
-2-update_domain_wallclock_time (d); - } +/* +* Make sure that the timebase in the shared info +* structure is correct. +*/ +update_domain_wallclock_time (d); } }_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 24 lines · Keir Fraser
Quoted 22 lines · Andrew Cooper
Quoted 7 lines · Keir Fraser
Quoted 5 lines · Roger Pau Monne
Call
update_domain_wallclock_timeonhvm_latch_shinfo_sizeeven if the bitness of the guest has already been set, this fixes the problem with the wallclock not being set for PVHVM guests on resume from migration.Quoted 8 lines
Quoted 4 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc George Dunlap <[email protected]>May as well write directly into
d->arch.has_32bit_shinfoand get rid ofnew_has_32bit. But apart from that:Acked-by Keir Fraser <[email protected]>Yikes - we have had a patch in the XenServer patch queue for donkeys years which implements the same fix as this.
I had still not manage to decide whether it was a gross hack which we needed to discard or whether it needed upstreaming.
Quoted 6 lines
Quoted 1 line
I guess this answers the question.
I believe the morally right(er) patch would be bigger and more fragile. This is a bit of a hack, but the whole idea of inferring shared-info bitness from sampling some cpu's execution mode is a bit odd (but necessary).
-- Keir
The way XenServer does this is that the windows drivers explicitly make a hypercall to set their intended bitness using HVM_PARAM_32BIT, value 8, but it is itself a gross hack.
~Andrew
Quoted 48 lines
Quoted 47 lines
~Andrew
Quoted 44 lines
Quoted 29 lines
---
Since this is a bug fix, I think it is suitable for inclusion in the 4.3 release, and backported to older releases.--- xen/arch/x86/hvm/hvm.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-)xen/arch/x86/hvm/hvm.c +1
-12@@ -3404,21 +3404,13 @@ static void hvm_latch_shinfo_size(struct domain *d)*/ if ( current->domain == d ) { new_has_32bit = (hvm_guest_x86_mode (current) !=8 ); -if (new_has_32bit != d->arch.has_32bit_shinfo) { +if (new_has_32bit != d->arch.has_32bit_shinfo) d->arch.has_32bit_shinfo = new_has_32bit; -/* -* Make sure that the timebase in the shared info -* structure is correct for its new bit-ness. We should -* arguably try to convert the other fields as well, but -* that's much more problematic (e.g. what do you do if -* you're going from 64 bit to 32 bit and there's an event -* channel pending which doesn't exist in the 32 bit -* version?). Just setting the wallclock time seems to be -* sufficient for everything we do, even if it is a bit of -* a hack. -*/ xen/arch/x86/hvm/hvm.c static void hvm_latch_shinfo_size(struct domain *d) · line 3416
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +5
-2-update_domain_wallclock_time (d); - } +/* +* Make sure that the timebase in the shared info +* structure is correct. +*/ +update_domain_wallclock_time (d); } }_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 5 lines · Roger Pau Monne
Call
update_domain_wallclock_timeonhvm_latch_shinfo_sizeeven if the bitness of the guest has already been set, this fixes the problem with the wallclock not being set for PVHVM guests on resume from migration.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc George Dunlap <[email protected]>May as well write directly into
d->arch.has_32bit_shinfoand get rid ofnew_has_32bit.
Yeah, I certainly will want to do that as I commit it, even if it grows the patch size.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 9 lines · Roger Pau Monne
Call
update_domain_wallclock_timeonhvm_latch_shinfo_sizeeven if the bitness of the guest has already been set, this fixes the problem with the wallclock not being set for PVHVM guests on resume from migration.Signed-off-by Roger Pau Monné <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc George Dunlap <[email protected]>
Re the release:
Quoted 29 lines
---
Since this is a bug fix, I think it is suitable for inclusion in the 4.3 release, and backported to older releases.--- xen/arch/x86/hvm/hvm.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-)xen/arch/x86/hvm/hvm.c +1
-12@@ -3404,21 +3404,13 @@ static void hvm_latch_shinfo_size(struct domain *d)*/ if ( current->domain == d ) { new_has_32bit = (hvm_guest_x86_mode (current) !=8 ); -if (new_has_32bit != d->arch.has_32bit_shinfo) { +if (new_has_32bit != d->arch.has_32bit_shinfo) d->arch.has_32bit_shinfo = new_has_32bit; -/* -* Make sure that the timebase in the shared info -* structure is correct for its new bit-ness. We should -* arguably try to convert the other fields as well, but -* that's much more problematic (e.g. what do you do if -* you're going from 64 bit to 32 bit and there's an event -* channel pending which doesn't exist in the 32 bit -* version?). Just setting the wallclock time seems to be -* sufficient for everything we do, even if it is a bit of -* a hack. -*/
xen/arch/x86/hvm/hvm.c static void hvm_latch_shinfo_size(struct domain *d) · line 3416
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +5
-2-update_domain_wallclock_time (d); - } +/* +* Make sure that the timebase in the shared info +* structure is correct. +*/ +update_domain_wallclock_time (d); } }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel