All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Julien Grall <julien.grall@gmail.com>
Cc: Stefano Stabellini <stefanos@xilinx.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v6 1/4] xen: introduce SYMBOL
Date: Thu, 10 Jan 2019 13:36:08 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1901101311110.27759@sstabellini-ThinkPad-X260> (raw)
In-Reply-To: <CAF3u54A-1_cum6u-nXm4m+60=7tFF=Y1vnR-0+fEKg2y6_68rw@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 5269 bytes --]

On Thu, 10 Jan 2019, Julien Grall wrote:
> On Thu, 10 Jan 2019, 12:29 Stefano Stabellini, <sstabellini@kernel.org> wrote:
>       On Thu, 10 Jan 2019, Jan Beulich wrote:
>       > >>> On 10.01.19 at 03:40, <julien.grall@gmail.com> wrote:
>       > > On Wed, 9 Jan 2019, 18:43 Stefano Stabellini, <sstabellini@kernel.org>
>       > > wrote:
>       > >
>       > >> Introduce a macro, SYMBOL, which is similar to RELOC_HIDE, but it is
>       > >> meant to be used everywhere symbols such as _stext and _etext are used
>       > >> in the code. It can take an array type as a parameter, and it returns
>       > >> the same type.
>       > >>
>       > >> SYMBOL is needed when accessing symbols such as _stext and _etext
>       > >> because the C standard forbids for both comparisons and substraction
>       > >> (see C Standard, 6.5.6 [ISO/IEC 9899:2011] and [1]) between pointers
>       > >> pointing to different objects. _stext, _etext, etc. are all pointers to
>       > >> different objects from ANCI C point of view.
>       > >>
>       > >
>       > > This does not make sense because you still return a pointer and therefore
>       > > the undefined behavior is still present.
>       > >
>       > > I really don't believe this patch is going to make the MISRA tool happy.
>       >
>       > Well, till now I've been assuming that no version of this series was
>       > posted without being certain the changes achieve the goal (of
>       > making that tool happy).
> 
>       No, Jan: unfortunately we cannot re-run the scanning tool against any
>       version of Xen we wish to :-(
> 
>       We cannot know in advance if a set of changes will make the tool happy
>       or not.
> 
>       If I knew that SYMBOL returning the native point type as in v6 is
>       sufficient to make the tool happy, I wouldn't be here arguing. We cannot
>       know for sure until we commit the changes, then we ask PRQA to re-scan
>       against a more recent version of Xen. It is an heavy process and for
>       this reason I preferred the safer of the two approaches.
> 
> 
> 
>       Anyway, I would rather get something in, even if insufficient, than
>       nothing. So I'll address all your comments based on returning the
>       pointer type, and submit a new version. The bothersome changes are the
>       ones to the call sites, and I would like to get those in no matter the
>       implementation of SYMBOL.
> 
> 
> It is not only insufficient but wrong when you read the commit message. You also were not convinced about this approach. 
> 
> I understand that we need to commit so we can get the result from the PRQA tool. However, we should have talked with people
> knowing MISRA to understand whether it could work.
> 
> You also didn't address my point on why Linux needs to go through unsigned long.
> 
> So I don't think it is right to merge it without more ground.
> 
> On that basis:
> 
> Nacked-by: Julien Grall <julien.grall@arm.com>

Hi Julien,

I well understanding your thinking, I am not happy with this approach.

However, changing all the call sites to use SYMBOL, even if SYMBOL does
not do what you and I think it should, is still a valuable change to
have:

1) it clearly highlight all the related violations
2) it is a burdensome set of changes to maintain off-tree which will be
   difficult to rebase and will bitrot quickly
3) it will be simple to change the implementation of SYMBOL afterwards
   as needed
4) regardless of MISRA, we still have a problem with gcc and symbols
   like _start and _end, see the comment on top of RELOC_HIDE in linux
   (include/linux/compiler-gcc.h)

In fact, even not caring about C compliance, this series is still an
improvement, a fix to a potential compiler problem. On that basis alone,
I think it is a bad decision not to merge this series.


To answer your other questions: yes, we need more information about this
compliance issue and MISRA, this is a good reason for committing the
series so that we can have the tool do a re-scan. It is also a great way
to show the problem to a MISRA expert not familiar with Xen: "look at
the way SYMBOL is used through the code..."

I don't know why Linux is using unsigned long, I looked at the commit
messages and comments but there isn't an explanation. However, it just
makes sense to me. That is how I would have implemented the solution as
well. Jan's approach looks very much like a partial workaround to me.


In conclusion, I still agree with you and disagree with Jan, but it
would be good to make progress regardless:

- I think a series introducing the usage of SYMBOL through the code
  should go in 4.12 regardless of the implementation of SYMBOL
- even the bad implementation of SYMBOL would still help with the
  potential gcc problems mentioned by Linux, if not with certifications


For everybody's reference, I have pushed both versions of the series,
the one returning the native type, as asked by Jan:
http://xenbits.xenproject.org/git-http/people/sstabellini/xen-unstable.git certifications-7

And the one returning unsigned long, as Julien and I would like:
http://xenbits.xenproject.org/git-http/people/sstabellini/xen-unstable.git certifications-7-unsigned_long


Hoping we won't get stuck on this, regards,

Stefano

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-01-10 21:36 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09 23:41 [PATCH v6 0/4] misc safety certification fixes Stefano Stabellini
2019-01-09 23:42 ` [PATCH v6 1/4] xen: introduce SYMBOL Stefano Stabellini
2019-01-10  2:40   ` Julien Grall
2019-01-10  8:24     ` Jan Beulich
2019-01-10 17:29       ` Stefano Stabellini
2019-01-10 18:46         ` Stewart Hildebrand
2019-01-10 19:03           ` Stefano Stabellini
2019-01-11 10:35           ` Jan Beulich
2019-01-11 17:01             ` Stefano Stabellini
2019-01-10 19:24         ` Julien Grall
2019-01-10 21:36           ` Stefano Stabellini [this message]
2019-01-10 23:31             ` Julien Grall
2019-01-11  2:14               ` Stefano Stabellini
2019-01-11  6:52                 ` Juergen Gross
2019-01-11 16:52                   ` Stefano Stabellini
2019-01-11 10:48                 ` Jan Beulich
2019-01-11 18:04                   ` Stefano Stabellini
2019-01-11 18:53                     ` Stewart Hildebrand
2019-01-11 20:35                       ` Julien Grall
2019-01-11 20:46                         ` Stewart Hildebrand
2019-01-11 21:37                           ` Stefano Stabellini
2019-01-14  3:45                             ` Stewart Hildebrand
2019-01-14 10:26                               ` Jan Beulich
2019-01-14 21:18                                 ` Stefano Stabellini
     [not found]                                   ` <1CACC1FB020000D800417A66@prv1-mh.provo.novell.com>
2019-01-15  8:21                                     ` Jan Beulich
2019-01-15 11:51                                       ` Julien Grall
     [not found]                                         ` <AB1DA25B020000B95C475325@prv1-mh.provo.novell.com>
2019-01-15 12:04                                           ` Jan Beulich
2019-01-15 12:23                                             ` Julien Grall
     [not found]                                               ` <BAE986750200003A5C475325@prv1-mh.provo.novell.com>
2019-01-15 12:44                                                 ` Jan Beulich
2019-01-15 20:03                                       ` Stewart Hildebrand
2019-01-16  6:01                                         ` Juergen Gross
2019-01-16 10:19                                         ` Jan Beulich
2019-01-17  0:37                                           ` Stefano Stabellini
     [not found]                                             ` <B4D3ABC30200003B88BF86FB@prv1-mh.provo.novell.com>
     [not found]                                               ` <529ED2F90200004D00417A66@prv1-mh.provo.novell.com>
2019-01-17 11:45                                                 ` Jan Beulich
2019-01-18  1:24                                                   ` Stefano Stabellini
     [not found]                                                     ` <76A2DEED0200005600417A66@prv1-mh.provo.novell.com>
2019-01-18  9:54                                                       ` Jan Beulich
2019-01-18 10:48                                                         ` Julien Grall
     [not found]                                                           ` <9F511FC70200005E5C475325@prv1-mh.provo.novell.com>
2019-01-18 11:09                                                             ` Jan Beulich
2019-01-18 15:22                                                               ` Julien Grall
     [not found]                                                                 ` <3A8206D8020000035C475325@prv1-mh.provo.novell.com>
2019-01-21  9:39                                                                   ` Jan Beulich
2019-01-21  9:34                                                             ` Jan Beulich
2019-01-21 10:22                                                               ` Julien Grall
     [not found]                                                                 ` <E16AB350020000435C475325@prv1-mh.provo.novell.com>
2019-01-21 10:31                                                                   ` Jan Beulich
2019-01-21 23:15                                                                     ` Stefano Stabellini
     [not found]                                                                       ` <5EA2B4FA0200008000417A66@prv1-mh.provo.novell.com>
2019-01-22  9:06                                                                         ` Jan Beulich
2019-01-18 23:05                                                         ` Stefano Stabellini
2019-01-21  5:24                                                           ` Stewart Hildebrand
     [not found]                                                           ` <5A96F2FD0200008D00417A66@prv1-mh.provo.novell.com>
2019-01-21  9:50                                                             ` Jan Beulich
2019-01-21 23:41                                                               ` Stefano Stabellini
2019-01-22  6:08                                                                 ` Juergen Gross
     [not found]                                                                 ` <42A2C4FA0200009000417A66@prv1-mh.provo.novell.com>
2019-01-22  9:16                                                                   ` Jan Beulich
2019-02-01 18:52                                                                     ` George Dunlap
2019-02-01 20:53                                                                       ` Stefano Stabellini
     [not found]                                                             ` <58377FAD0200004688BF86FB@prv1-mh.provo.novell.com>
2019-01-21 10:06                                                               ` Jan Beulich
2019-02-06 15:41                                                                 ` Ian Jackson
     [not found]                                           ` <C8F95655020000CAB8D7C7D4@prv1-mh.provo.novell.com>
     [not found]                                             ` <5867EFE6020000DB00417A66@prv1-mh.provo.novell.com>
     [not found]                                               ` <DACE7A5F020000B1B8D7C7D4@prv1-mh.provo.novell.com>
2019-02-07 14:51                                                 ` Jan Beulich
2019-01-15 23:36                                       ` Stefano Stabellini
2019-01-16  8:47                                         ` Juergen Gross
     [not found]                                         ` <2EA6D6FD0200001F00417A66@prv1-mh.provo.novell.com>
2019-01-16 10:25                                           ` Jan Beulich
2019-01-17  0:41                                             ` Stefano Stabellini
     [not found]                                               ` <4EA2F2F90200004D00417A66@prv1-mh.provo.novell.com>
2019-01-17 11:46                                                 ` Jan Beulich
     [not found]                                     ` <95DC675902000028AB59E961@prv1-mh.provo.novell.com>
2019-02-04  9:37                                       ` Jan Beulich
2019-02-04 19:08                                         ` Stefano Stabellini
2019-02-05  6:02                                           ` Juergen Gross
     [not found]                                           ` <2E9DDEFD0200007B00417A66@prv1-mh.provo.novell.com>
2019-02-05  7:53                                             ` Jan Beulich
2019-02-05 14:56                                         ` George Dunlap
     [not found]                                           ` <E730A9F90200001DAB59E961@prv1-mh.provo.novell.com>
2019-02-06 11:59                                             ` Jan Beulich
     [not found]                                 ` <7A8C0A4F020000EEB8D7C7D4@prv1-mh.provo.novell.com>
2019-02-06 16:21                                   ` Jan Beulich
2019-02-06 16:37                                     ` Ian Jackson
     [not found]                                       ` <08D440470200001BB8D7C7D4@prv1-mh.provo.novell.com>
2019-02-06 16:47                                         ` Jan Beulich
2019-02-06 16:52                                           ` Ian Jackson
2019-02-06 23:39                                             ` Stefano Stabellini
2019-02-07 11:48                                               ` Ian Jackson
2019-02-07 18:18                                                 ` Stefano Stabellini
2019-02-12 11:31                                                   ` Ian Jackson
2019-02-13  0:09                                                     ` Stefano Stabellini
2019-01-15 11:46                             ` Julien Grall
2019-01-15 12:23                               ` Julien Grall
2019-01-14 10:11                     ` Jan Beulich
2019-01-14 15:41                       ` Julien Grall
2019-01-14 15:52                         ` Jan Beulich
2019-01-14 16:26                           ` Stewart Hildebrand
2019-01-14 16:39                             ` Jan Beulich
2019-01-14 16:28                           ` Julien Grall
2019-01-14 16:44                             ` Jan Beulich
2019-01-14 17:24                               ` Julien Grall
2019-01-15  8:04                                 ` Jan Beulich
2019-01-10 17:22     ` Stefano Stabellini
2019-01-10  8:34   ` Jan Beulich
2019-01-10 18:09     ` Stefano Stabellini
2019-01-09 23:42 ` [PATCH v6 2/4] xen/arm: use SYMBOL when required Stefano Stabellini
2019-01-10  8:41   ` Jan Beulich
2019-01-10 17:44     ` Stefano Stabellini
2019-01-11 10:52       ` Jan Beulich
2019-01-11 16:58         ` Stefano Stabellini
2019-01-14  9:23           ` Jan Beulich
2019-01-09 23:42 ` [PATCH v6 3/4] xen/x86: " Stefano Stabellini
2019-01-10  8:43   ` Jan Beulich
2019-01-10 17:45     ` Stefano Stabellini
2019-01-09 23:42 ` [PATCH v6 4/4] xen/common: " Stefano Stabellini
2019-01-10  8:49   ` Jan Beulich
2019-01-10 17:48     ` Stefano Stabellini

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=alpine.DEB.2.10.1901101311110.27759@sstabellini-ThinkPad-X260 \
    --to=sstabellini@kernel.org \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=julien.grall@gmail.com \
    --cc=stefanos@xilinx.com \
    --cc=wei.liu2@citrix.com \
    --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.