From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Julien Grall <julien@xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org, michal.orzel@amd.com,
xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com,
consulting@bugseng.com, jbeulich@suse.com,
andrew.cooper3@citrix.com, roger.pau@citrix.com,
Simone Ballarin <simone.ballarin@bugseng.com>,
Doug Goldstein <cardoe@cardoe.com>,
George Dunlap <george.dunlap@citrix.com>, Wei Liu <wl@xen.org>,
Jun Nakajima <jun.nakajima@intel.com>,
Kevin Tian <kevin.tian@intel.com>
Subject: Re: [XEN PATCH][for-4.19 v6 2/8] x86: add deviation for asm-only functions
Date: Thu, 02 Nov 2023 08:40:04 +0100 [thread overview]
Message-ID: <1288b2b3c262b86cb65dcfbc4e67f65b@bugseng.com> (raw)
In-Reply-To: <b914ac93-2499-4bfd-a60a-51a9f1c170ec@xen.org>
Hi Julien,
On 2023-11-02 00:42, Julien Grall wrote:
> Hi Stefano,
>
> On 01/11/2023 23:10, Stefano Stabellini wrote:
>> On Wed, 1 Nov 2023, Nicola Vetrini wrote:
>>> As stated in rules.rst, functions used only in asm modules
>>> are allowed to have no prior declaration visible when being
>>> defined, hence these functions are marked with an
>>> 'asmlinkage' macro, which is then deviated for MISRA C:2012
>>> Rule 8.4.
>>>
>>> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
>>> ---
>>> Changes in v3:
>>> - added SAF deviations for vmx counterparts to svm functions.
>>> Changes in v5:
>>> - drop SAF deviations in favour of the pseudo-attribute asmlinkage
>>> Changes in v6:
>>> - conditioned asmlinkage definition to make it overridable;
>>> - move the pseudo-attribute after the return type
>>> ---
>>> automation/eclair_analysis/ECLAIR/deviations.ecl | 9 +++++++++
>>> docs/misra/deviations.rst | 6 ++++++
>>> xen/arch/x86/hvm/svm/intr.c | 2 +-
>>> xen/arch/x86/hvm/svm/nestedsvm.c | 2 +-
>>> xen/arch/x86/hvm/svm/svm.c | 4 ++--
>>> xen/arch/x86/hvm/vmx/intr.c | 2 +-
>>> xen/arch/x86/hvm/vmx/vmx.c | 4 ++--
>>> xen/arch/x86/hvm/vmx/vvmx.c | 2 +-
>>> xen/arch/x86/traps.c | 2 +-
>>> xen/arch/x86/x86_64/traps.c | 2 +-
>>> xen/include/xen/compiler.h | 5 +++++
>>> 11 files changed, 30 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl
>>> b/automation/eclair_analysis/ECLAIR/deviations.ecl
>>> index fa56e5c00a27..06619ecf7e8d 100644
>>> --- a/automation/eclair_analysis/ECLAIR/deviations.ecl
>>> +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
>>> @@ -163,6 +163,15 @@ Therefore the absence of prior declarations is
>>> safe."
>>> -config=MC3R1.R8.4,reports+={safe,
>>> "first_area(any_loc(file(gcov)))"}
>>> -doc_end
>>> +-doc_begin="Recognize the occurrence of current_stack_pointer as a
>>> declaration."
>>> +-file_tag+={asm_defns, "^xen/arch/x86/include/asm/asm_defns\\.h$"}
>>> +-config=MC3R1.R8.4,declarations+={safe,
>>> "loc(file(asm_defns))&&^current_stack_pointer$"}
>>> +-doc_end
>>> +
>>> +-doc_begin="asmlinkage is a marker to indicate that the function is
>>> only used to interface with asm modules."
>>> +-config=MC3R1.R8.4,declarations+={safe,"loc(text(^(?s).*asmlinkage.*$,
>>> -1..0))"}
>>> +-doc_end
>>> +
>>> -doc_begin="The following variables are compiled in multiple
>>> translation units
>>> belonging to different executables and therefore are safe."
>>> -config=MC3R1.R8.6,declarations+={safe,
>>> "name(current_stack_pointer||bsearch||sort)"}
>>> diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
>>> index 8511a189253b..d468da2f5ce9 100644
>>> --- a/docs/misra/deviations.rst
>>> +++ b/docs/misra/deviations.rst
>>> @@ -133,6 +133,12 @@ Deviations related to MISRA C:2012 Rules:
>>> configuration. Therefore, the absence of prior declarations
>>> is safe.
>>> - Tagged as `safe` for ECLAIR.
>>> + * - R8.4
>>> + - Functions and variables used only by asm modules are either
>>> marked with
>>> + the `asmlinkage` macro or with a SAF-1-safe textual deviation
>>> + (see safe.json).
>>> + - Tagged as `safe` for ECLAIR.
>>
>> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
>>
>> If Julien prefers a different wording I could modify on commit as
>> needed
>
> I think my comment on the previous version was misunderstood. I have
> asked to replace all SAF-1 with asmlinkage and I thought you agreed
> with that.
>
> This is a similar situation to octal-ok. I don't think it is right to
> have multiple ways to tag a deviation.
>
> I don't particular want to see more added, and I would like the current
> ones to be gone. So what's the plan to remove SAF-1-safe?
>
> At minimum, the deviation should be extremely clear that there **must**
> be no new use of SAF-1-safe. Something like:
>
> "- Functions and variables used only by asm modules are either marked
> with the `asmlinkage` macro. Existing code may use SAF-1-safe textual
> deviation (see safe.json) but new code should not use it.
> "
>
> Obviously this is not my preference.
>
> Cheers,
I was thinking about doing a separate patch to replace the remaining SAF
comments and change the deviation message
(not yet submitted, but it's essentially ready), so that the commits
would look more coherent. Is that ok for you?
Thanks,
--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)
next prev parent reply other threads:[~2023-11-02 7:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-01 9:15 [XEN PATCH][for-4.19 v6 0/8] Fix or deviate various instances of missing declarations Nicola Vetrini
2023-11-01 9:30 ` Nicola Vetrini
2023-11-01 9:30 ` [XEN PATCH][for-4.19 v6 1/8] xen: modify or add declarations for variables where needed Nicola Vetrini
2023-11-21 8:50 ` Jan Beulich
2023-11-01 9:30 ` [XEN PATCH][for-4.19 v6 2/8] x86: add deviation for asm-only functions Nicola Vetrini
2023-11-01 23:10 ` Stefano Stabellini
2023-11-01 23:42 ` Julien Grall
2023-11-02 7:40 ` Nicola Vetrini [this message]
2023-11-02 13:27 ` Jan Beulich
2023-11-02 13:52 ` Nicola Vetrini
2023-11-01 9:30 ` [XEN PATCH][for-4.19 v6 3/8] x86: add asmlinkage macro to variables only used in asm code Nicola Vetrini
2023-11-01 23:12 ` Stefano Stabellini
2023-11-02 13:28 ` Jan Beulich
2023-11-01 9:30 ` [XEN PATCH][for-4.19 v6 4/8] x86/grant: switch included header to make declarations visible Nicola Vetrini
2023-11-01 9:30 ` [XEN PATCH][for-4.19 v6 5/8] x86/vm_event: add missing include for hvm_vm_event_do_resume Nicola Vetrini
2023-11-01 9:30 ` [XEN PATCH][for-4.19 v6 6/8] xen/console: remove stub definition in consoled.h Nicola Vetrini
2023-11-01 9:30 ` [XEN PATCH][for-4.19 v6 7/8] x86/mem_access: make function static Nicola Vetrini
2023-11-01 9:30 ` [XEN PATCH][for-4.19 v6 8/8] docs/misra: exclude three more files Nicola Vetrini
2023-11-01 9:32 ` [XEN PATCH][for-4.19 v6 0/8] Fix or deviate various instances of missing declarations Nicola Vetrini
2023-11-21 9:19 ` Jan Beulich
2023-11-22 1:52 ` 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=1288b2b3c262b86cb65dcfbc4e67f65b@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=andrew.cooper3@citrix.com \
--cc=ayan.kumar.halder@amd.com \
--cc=cardoe@cardoe.com \
--cc=consulting@bugseng.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=simone.ballarin@bugseng.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.