Sorry, I should have mentioned that an improper sorting of the cpreg_list could lead to a migration failure when cpu_post_load considers an incoming register as missing in the cpreg_indexes array. However, as long as the two lists are exactly the same, the problem does not occur.
On Fri, Oct 11, 2013 at 8:41 PM, Peter Maydell <peter.mayd...@linaro.org>wrote: > On 12 October 2013 02:38, Alvise Rigo <a.r...@virtualopensystems.com> > wrote: > > Both KVM and TCG populate the cpreg_list with 64 bit registers IDs, but > in the TCG side the cpreg_list is sorted using the 32 bit id version while > in the kvm side the 64 bit id version is used. > > This patch makes the sorting of the cpreg_list consistent between KVM > and TCG. > > ...this commit message doesn't say why this is a bad thing. > > > Signed-off-by: Alvise Rigo <a.r...@virtualopensystems.com> > > --- > > target-arm/helper.c | 12 ++++++++---- > > 1 file changed, 8 insertions(+), 4 deletions(-) > > > > diff --git a/target-arm/helper.c b/target-arm/helper.c > > index 2a98be7..834041e 100644 > > --- a/target-arm/helper.c > > +++ b/target-arm/helper.c > > @@ -225,10 +225,14 @@ static void count_cpreg(gpointer key, gpointer > opaque) > > > > static gint cpreg_key_compare(gconstpointer a, gconstpointer b) > > { > > - uint32_t aidx = *(uint32_t *)a; > > - uint32_t bidx = *(uint32_t *)b; > > - > > - return aidx - bidx; > > + uint64_t aidx = cpreg_to_kvm_id(*(uint32_t *)a); > > + uint64_t bidx = cpreg_to_kvm_id(*(uint32_t *)b); > > + > > + if (aidx > bidx) > > + return 1; > > + if (aidx < bidx) > > + return -1; > > Coding standard requires braces. > > > + return 0; > > } > > > > static void cpreg_make_keylist(gpointer key, gpointer value, gpointer > udata) > > -- > > 1.8.1.2 > > >