From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, Andrew Jones <drjones@redhat.com>,
Jim Mattson <jmattson@google.com>
Subject: Re: [kvm-unit-tests PATCH] lib/alloc_page: Revert to 'unsigned long' for @size params
Date: Tue, 14 Jul 2020 12:02:59 +0200 [thread overview]
Message-ID: <20200714120259.72dce987@ibm-vm> (raw)
In-Reply-To: <db6d8b2d-147b-d732-b638-b78a3fd980d2@redhat.com>
On Tue, 14 Jul 2020 09:12:52 +0200
Thomas Huth <thuth@redhat.com> wrote:
> On 14/07/2020 06.20, Sean Christopherson wrote:
> > Revert to using 'unsigned long' instead of 'size_t' for
> > free_pages() and get_order(). The recent change to size_t for
> > free_pages() breaks i386 with -Werror as the assert_msg() formats
> > expect unsigned longs, whereas size_t is an 'unsigned int' on i386
> > (though both longs and ints are 4 bytes).
> >
> > Message formatting aside, unsigned long is the correct choice given
> > the current code base as alloc_pages() and free_pages_by_order()
> > explicitly expect, work on, and/or assert on the size being an
> > unsigned long.
> >
> > Fixes: 73f4b202beb39 ("lib/alloc_page: change some parameter types")
> > Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
> > Cc: Andrew Jones <drjones@redhat.com>
> > Cc: Jim Mattson <jmattson@google.com>
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > ---
> [...]
> > diff --git a/lib/bitops.h b/lib/bitops.h
> > index 308aa86..dd015e8 100644
> > --- a/lib/bitops.h
> > +++ b/lib/bitops.h
> > @@ -79,7 +79,7 @@ static inline bool is_power_of_2(unsigned long n)
> > return n && !(n & (n - 1));
> > }
> >
> > -static inline unsigned int get_order(size_t size)
> > +static inline unsigned int get_order(unsigned long size)
> > {
> > return size ? fls(size) + !is_power_of_2(size) : 0;
> > }
> >
>
> get_order() already used size_t when it was introduced in commit
> f22e527df02ffaba ... is it necessary to switch it to unsigned long
> now?
>
> Apart from that, this patch fixes the compilation problems, indeed, I
> just checked it in the travis-CI.
>
> Tested-by: Thomas Huth <thuth@redhat.com>
Yeah I don't think there is any reason to change get_order...
prev parent reply other threads:[~2020-07-14 10:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-14 4:20 [kvm-unit-tests PATCH] lib/alloc_page: Revert to 'unsigned long' for @size params Sean Christopherson
2020-07-14 6:00 ` Andrew Jones
2020-07-14 7:12 ` Thomas Huth
2020-07-14 10:02 ` Claudio Imbrenda [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200714120259.72dce987@ibm-vm \
--to=imbrenda@linux.ibm.com \
--cc=drjones@redhat.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.