[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Functions _spin_lock_cb() and handle_ro_raz()


  • To: Federico Serafini <federico.serafini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 14 Jun 2023 16:03:14 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=idzF+XoztxYgX8JO67OttnbNM4lNfBbri2Bo0G5K1pQ=; b=hF0EmfY819OFmR5jZ0ZsIUj5tWU/dYMInDlUG5wkPWwnLW8yvw63u5c/+XtQqqKyd6uVBhUC3Hb3Fe+O3dyoSe81yenKVlOlouMFvVAwVNVVEQEBQs1wm1hScFyTIUsZEPtVuAlNxJKs92OSdI1K/8kgMkJqy1gz/D9ZlXpS4KFmTxyuhfni3670zMwy49VSHyTinacN2jxq66Y5Hz3qbUb1WPI675v20C7oz/11IwXtz4hsKJQkajmxoHXqoj6P08RQRWs4+LO7Nsx3l8bwxiVF0vwKs235DEgMcv3sqT9kAMjbCT/k+RwZmm2eH0wdPkx+jFZHrScmsnUXnZv2yw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DLCa4Moy9s1n8aLlg39bvH185ZsuTSwnHkhSwm8kv3Qfa2KvAxwO0wYpu/HeykojEfBb77C4jc6WlDO5LPqbjI0yJxwMJtyCDc/X+cX4cnbQZDjMdD/sBZIwTxqkKIwhYN54BdxL814wluti2JblxVuTojlHbQUjQLTqR9MkXSmaHsqy3Hk0k+6JIW/Mhw5XbMG9+Q+MVcR2cWnRrxVt2susGDbjNcR5qYFQTmrXgyu53ejwfShsW7gM5yMefQcXjArsE8uv4fzxmROTGTdomjC2YjizmZ8Iw5wPscOQyDrvP2QGHaX4L5mPT4tj5beWFLKX9aIrEB6PMgEERQhaCg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 14 Jun 2023 14:03:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.