From: Jan Beulich <jbeulich@suse.com>
To: Ian Jackson <iwj@xenproject.org>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>,
"George Dunlap" <george.dunlap@citrix.com>
Subject: Re: [PATCH 2/2][4.15?] x86: fix build when NR_CPUS == 1
Date: Tue, 2 Mar 2021 14:37:01 +0100 [thread overview]
Message-ID: <b2277907-b629-b398-858c-6bc5c4e2a0a0@suse.com> (raw)
In-Reply-To: <24638.12124.687863.290191@mariner.uk.xensource.com>
On 02.03.2021 13:28, Ian Jackson wrote:
> Jan Beulich writes ("Re: [PATCH 2/2][4.15?] x86: fix build when NR_CPUS == 1"):
>> On 01.03.2021 17:03, Ian Jackson wrote:
>>> Jan Beulich writes ("[PATCH 2/2][4.15?] x86: fix build when NR_CPUS == 1"):
>>>> In this case the compiler is recognizing that no valid array indexes
>>>> remain (in x2apic_cluster()'s access to per_cpu(cpu_2_logical_apicid,
>>>> ...)), but oddly enough isn't really consistent about the checking it
>>>> does (see the code comment).
>>> ...
>>>> - if (this_cpu == cpu || x2apic_cluster(this_cpu) != x2apic_cluster(cpu))
>>>> + if ( this_cpu == cpu )
>>>> + continue;
>>>> + /*
>>>> + * Guard in particular against the compiler suspecting out-of-bounds
>>>> + * array accesses below when NR_CPUS=1 (oddly enough with gcc 10 it
>>>> + * is the 1st of these alone which actually helps, not the 2nd, nor
>>>> + * are both required together there).
>>>> + */
>>>> + BUG_ON(this_cpu >= NR_CPUS);
>>>> + BUG_ON(cpu >= NR_CPUS);
>>>> + if ( x2apic_cluster(this_cpu) != x2apic_cluster(cpu) )
>>>> continue;
>>>
>>> Is there some particular reason for not putting the BUG_ON before the
>>> if test ? That would avoid the refactoring.
>>
>> I want it to be as close as possible to the place where the issue
>> is. I also view the refactoring as a good thing, since it allows
>> a style correction as a side effect.
>
> I'm afraid that at this stage of the release I would prefer changes to
> be as small as reasonably sensible. So unless there is some
> reason, other than taste, style or formatting, could we please just
> introduce the new BUG_ON and not also do other refactoring.
FAOD: That's fine - I'll keep this queued for 4.16 then. I did put
a question mark behind the version anyway.
Jan
next prev parent reply other threads:[~2021-03-02 13:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-01 8:27 [PATCH 0/2][4.15?] fix build when NR_CPUS == 1 Jan Beulich
2021-03-01 8:30 ` [PATCH 1/2][4.15?] sched: " Jan Beulich
2021-03-01 15:57 ` Ian Jackson
2021-03-01 17:50 ` Dario Faggioli
2021-03-01 8:31 ` [PATCH 2/2][4.15?] x86: " Jan Beulich
2021-03-01 14:01 ` Roger Pau Monné
2021-03-01 15:14 ` Jan Beulich
2021-03-01 18:00 ` Roger Pau Monné
2021-03-02 9:59 ` Jan Beulich
2021-03-02 10:57 ` Roger Pau Monné
2021-03-02 11:18 ` Jan Beulich
2021-03-01 16:03 ` Ian Jackson
2021-03-02 10:02 ` Jan Beulich
2021-03-02 12:28 ` Ian Jackson
2021-03-02 13:37 ` Jan Beulich [this message]
2021-03-01 8:33 ` [PATCH 0/2][4.15?] " Jan Beulich
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=b2277907-b629-b398-858c-6bc5c4e2a0a0@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=iwj@xenproject.org \
--cc=roger.pau@citrix.com \
--cc=wl@xen.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.