Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6DFBAEB64D8 for ; Wed, 14 Jun 2023 16:23:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.549028.857347 (Exim 4.92) (envelope-from ) id 1q9THD-0006EU-Ct; Wed, 14 Jun 2023 16:23:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 549028.857347; Wed, 14 Jun 2023 16:23:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q9THD-0006EN-9o; Wed, 14 Jun 2023 16:23:19 +0000 Received: by outflank-mailman (input) for mailman id 549028; Wed, 14 Jun 2023 16:23:18 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q9THB-0006E8-VV for xen-devel@lists.xenproject.org; Wed, 14 Jun 2023 16:23:17 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c365f86f-0acf-11ee-8611-37d641c3527e; Wed, 14 Jun 2023 18:23:15 +0200 (CEST) Received: from [192.168.1.125] (unknown [176.206.20.8]) by support.bugseng.com (Postfix) with ESMTPSA id 7EB674EE0738; Wed, 14 Jun 2023 18:23:14 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c365f86f-0acf-11ee-8611-37d641c3527e Message-ID: Date: Wed, 14 Jun 2023 18:23:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: Functions _spin_lock_cb() and handle_ro_raz() Content-Language: en-US To: Jan Beulich Cc: xen-devel@lists.xenproject.org References: <4c13ea0f-9e53-62b2-feb8-45381d4f652b@suse.com> From: Federico Serafini Organization: BUGSENG srl In-Reply-To: <4c13ea0f-9e53-62b2-feb8-45381d4f652b@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 14/06/23 16:03, Jan Beulich wrote: > On 14.06.2023 15:08, Federico Serafini wrote: >> Hello everyone, >> >> I am working on the violations of MISRA C:2012 Rule 8.10, >> whose headline says: >> "An inline function shall be declared with the static storage class". >> >> For both ARM64 and X86_64 builds, >> function _spin_lock_cb() defined in spinlock.c violates the rule. >> Such function is declared in spinlock.h without >> the inline function specifier: are there any reasons to do this? > Since this function was mentioned elsewhere already, I'm afraid I > have to be a little blunt and ask back: Did you check the history > of the function. Yes, it is intentional to be that way, for the > function to be inlined into _spin_lock(), and for it to also be > available for external callers (we have just one right now, but > that could change). > >> What about solving the violation by moving the function definition in >> spinlock.h and declaring it as static inline? > Did you try whether that would work at least purely mechanically? > I'm afraid you'll find that it doesn't, because of LOCK_PROFILE_* > being unavailable then. Yet we also don't want to expose all that > in the header. > > In the earlier context I did suggest already to make the function > an always-inline one in spinlock.c, under a slightly altered name, > and then have _spin_lock_cb() be a trivial wrapper just like > _spin_lock() is. I guess best is going to be if I make and post a > patch ... > > Jan Thank you for the information. Federico