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

Re: [PATCH 3/3] common/spinlock: Drop inline from _spin_lock_cb()


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 17 May 2022 17:42:10 +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=DNPrV+DyDhbr8Yj+oOTfeiRm3xfDfHFhqrhSn29H4xI=; b=bz5gU3gsjNvNeTGuRnzCqwqApdaLsOrTH4CvmROXZrBsJqzxzIUVyNNBg2eIGq0MQn3A3SGDfVeMzwLuywGsO61JYdCt9z9pA0IgdcqynWucRKODa9mBLB1Iclg/3z7RO7rgQHDkRkVOPU4em90VhEeDE4wUG9+4KtG/rCYkBa/YmvbwoW3iP0jUbjJawf/0di4tTxP/sg8C13iGrmAyKp02ysXTECUy5qF1mMwmw7jPcfWPyleLfaFPZye4ijW9SSFWG5iMzpmm2mJ3gw+77b8hgQs4rx2/2Zrkc83myuGqZLBoGrnoj61Q8OQpUc/5oCrAKg9sMhiuPTnQmRZ7yQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fhh06njR9ZAktDJ8zrJ6D1dTfPpVTMlgy9h3eIsc19mltPafBXWomewwKYD6xe/3TqYddrEIwdxSB0gH989axBrzNWhR6fojQZXa2Utk3vVejS2qK3eA7UYHaZwMC74kNvmUyF6W+Ac011WYKTFVxVMEuiWB3cBNPVx/hf4E7w8UJSIKR5ik2DDzzet+lh+QT+pxit+rIBRtopVUN+GS3H0+86qrEoTls0yRIByRBZZ4mg1ucVbBQSAjQ5GguPoh7p/RCfvXbKYRcqCWkTyen9Nwk4tg/nenC0M4RqL9ikWGECu7LYYsI3tfhMTCRJ6Wb3SRx74YckKqYzmIBOCDnA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Tue, 17 May 2022 15:42:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09.05.2022 15:53, Roger Pau Monné wrote:
> On Mon, May 09, 2022 at 01:24:09PM +0100, Andrew Cooper wrote:
>> This is undefined behaviour, because there is no _spin_lock_cb() in a 
>> separate
>> translation unit (C11 6.7.4.11).
>>
>> Moreover, MISRA prohibits this construct because, in the case where it is 
>> well
>> defined, the compiler is free to use either implementation and nothing
>> prevents the two from being different.
> 
> From my reading of the spec, using inline defined function with an
> extern declaration could allow the function to be (re)defined in the
> scope of a different compilation unit, kind of similar to the usage of
> the weak attribute?

Which would then result in a linking error due to duplicate symbols,
wouldn't it?

Jan




 


Rackspace

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