From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
Jan Beulich <JBeulich@suse.com>,
Frediano Ziglio <frediano.ziglio@cloud.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>
Subject: Re: [PATCH] xen/bitops: Fix break with in a for_each_set_bit() loop
Date: Fri, 22 Nov 2024 08:54:44 +0100 [thread overview]
Message-ID: <Z0A4xER41zciSbiW@macbook> (raw)
In-Reply-To: <bb6736b2-ec3e-4e72-bd6c-fabeccc3654b@citrix.com>
On Thu, Nov 21, 2024 at 05:35:16PM +0000, Andrew Cooper wrote:
> On 21/11/2024 4:32 pm, Roger Pau Monné wrote:
> > On Thu, Nov 21, 2024 at 02:50:00PM +0000, Andrew Cooper wrote:
> >> diff --git a/xen/common/bitops.c b/xen/common/bitops.c
> >> index 91ae961440af..0edd62d25c28 100644
> >> --- a/xen/common/bitops.c
> >> +++ b/xen/common/bitops.c
> >> @@ -110,6 +110,22 @@ static void __init test_for_each_set_bit(void)
> >>
> >> if ( ull != ull_res )
> >> panic("for_each_set_bit(uint64) expected %#"PRIx64", got %#"PRIx64"\n", ull, ull_res);
> >> +
> >> + /* Check that we break from the middle of the loop */
> >> + ui = HIDE(0x80001008U);
> >> + ui_res = 0;
> >> + for_each_set_bit ( i, ui )
> >> + {
> >> + static __initdata unsigned int count;
> > Preferably as you suggested without the static variable, I may suggest
> > that you use ui_tmp instead of plain tmp as the variable name?
>
> For this, I'd prefer not to.
>
> For ui, ul and ull, there are a pair of variables with precise usage.
>
> This is one random number that gets as far as 2. And it's test code.
My suggestion was on the basis that we might need to add more 'tmp'
variables of different types in the future maybe? No strong opinion
anyway, I'm fine if you prefer to leave as plain 'tmp'.
Thanks, Roger.
prev parent reply other threads:[~2024-11-22 7:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-21 14:50 [PATCH] xen/bitops: Fix break with in a for_each_set_bit() loop Andrew Cooper
2024-11-21 15:19 ` Frediano Ziglio
2024-11-21 15:59 ` Andrew Cooper
2024-11-21 16:07 ` Jan Beulich
2024-11-21 16:29 ` Andrew Cooper
2024-11-21 16:32 ` Roger Pau Monné
2024-11-21 17:35 ` Andrew Cooper
2024-11-22 7:54 ` Roger Pau Monné [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=Z0A4xER41zciSbiW@macbook \
--to=roger.pau@citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=frediano.ziglio@cloud.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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.