From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: Jan Beulich <jbeulich@suse.com>,
michal.orzel@amd.com, xenia.ragiadakou@amd.com,
ayan.kumar.halder@amd.com, consulting@bugseng.com,
Andrew Cooper <andrew.cooper3@citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
Julien Grall <julien@xen.org>, Wei Liu <wl@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS
Date: Tue, 19 Sep 2023 11:19:39 +0200 [thread overview]
Message-ID: <ed1f468463841e7f3f5bb90de4d9a227@bugseng.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2309081236360.6458@ubuntu-linux-20-04-desktop>
On 08/09/2023 21:37, Stefano Stabellini wrote:
> On Fri, 8 Sep 2023, Nicola Vetrini wrote:
>> On 08/09/2023 13:59, Jan Beulich wrote:
>> > On 08.09.2023 13:57, Jan Beulich wrote:
>> > > On 08.09.2023 10:48, Nicola Vetrini wrote:
>> > > > There is a build error due to -Werror because of a pointer comparison at
>> > > > line 469 of common/numa.c:
>> > > > i = min(PADDR_BITS, BITS_PER_LONG - 1);
>> > > > where
>> > > > #define PADDR_BITS 52
>> > > >
>> > > > I guess PADDR_BITS can become unsigned or gain a cast
>> > >
>> > > While generally converting constants to unsigned comes with a certain
>> > > risk, I think for this (and its siblings) this ought to be okay. As to
>> > > the alternative of a cast - before considering that, please consider
>> > > e.g. adding 0u (as we do elsewhere in the code base to deal with such
>> > > cases).
>> >
>> > And just after sending I realized that this would still be disliked by
>> > Misra's type system. (Much like then aiui the 1 above will need to
>> > become 1u. Which is all pretty horrible.)
>> >
>> > Jan
>>
>> I have a proposal: in our tests we enabled an ECLAIR configuration
>> that allows
>> to bypass the
>> constraint imposed by Rule 10.4 that warrants the 1U iff the value is
>> constant
>> and both types
>> can represent it correctly (in this case BITS_PER_LONG -1). This would
>> allow
>> using the proposed
>> solution and documenting why it's ok not to respect R10.4. What do you
>> think?
>
> I think that would be OK. I think we would want to document this in
> rules.rst. Please send a patch.
I checked: that configuration is already enabled in current staging, so
perhaps the only
action in that regard would be to send a patch documenting it in
rules.rst.
I just noticed one further issue with making BYTES_PER_LONG unsigned, in
that causes
several instances of (1U << 3) to appear inside the file
xen/arch/x86/xen.lds
produced by the build, which in turn causes ld to fail on that 'U'. For
reference, the version of ld used by the build is the following:
GNU ld (GNU Binutils for Ubuntu) 2.38
The following is a snippet of the output:
. = ALIGN((1 << 12));
__ro_after_init_end = .;
__start_bug_frames = .;
*(.bug_frames.0)
__stop_bug_frames_0 = .;
*(.bug_frames.1)
__stop_bug_frames_1 = .;
*(.bug_frames.2)
__stop_bug_frames_2 = .;
*(.bug_frames.3)
__stop_bug_frames_3 = .;
*(.rodata)
*(.rodata.*)
*(.data.rel.ro)
*(.data.rel.ro.*)
. = ALIGN((1U << 3)); __start_vpci_array = .;
*(SORT(.data.vpci.*)) __end_vpci_array = .;
} :text
.note.gnu.build-id : AT(ADDR(".note.gnu.build-id") - (((((((261 >> 8)
* 0xffff000000000000) | (261 << 39))) + ((1 << 39) / 2)) + (64 << 30)) +
(1 << 30))) {
__note_gnu_build_id_start = .;
*(.note.gnu.build-id)
__note_gnu_build_id_end = .;
--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)
next prev parent reply other threads:[~2023-09-19 9:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-05 7:31 [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS Nicola Vetrini
2023-09-05 7:46 ` Jan Beulich
2023-09-05 8:20 ` Nicola Vetrini
2023-09-05 8:33 ` Jan Beulich
2023-09-06 15:57 ` Nicola Vetrini
2023-09-06 16:02 ` Jan Beulich
2023-09-07 1:33 ` Stefano Stabellini
2023-09-07 6:42 ` Jan Beulich
2023-09-08 8:48 ` Nicola Vetrini
2023-09-08 11:57 ` Jan Beulich
2023-09-08 11:59 ` Jan Beulich
2023-09-08 14:53 ` Nicola Vetrini
2023-09-08 15:09 ` Nicola Vetrini
2023-09-11 6:43 ` Jan Beulich
2023-09-08 19:37 ` Stefano Stabellini
2023-09-19 9:19 ` Nicola Vetrini [this message]
2023-09-19 9:33 ` Jan Beulich
2023-09-19 9:54 ` Nicola Vetrini
2023-09-19 9:59 ` Jan Beulich
2023-10-04 13:23 ` Nicola Vetrini
2023-10-16 10:31 ` 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=ed1f468463841e7f3f5bb90de4d9a227@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=andrew.cooper3@citrix.com \
--cc=ayan.kumar.halder@amd.com \
--cc=consulting@bugseng.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
--cc=xenia.ragiadakou@amd.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.