lkml.org 
[lkml]   [2021]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH v2 06/28] locking/rwlocks: Add contention detection for rwlocks
From
Date
On 2/9/21 3:39 PM, Guenter Roeck wrote:
> On Tue, Feb 02, 2021 at 10:57:12AM -0800, Ben Gardon wrote:
>> rwlocks do not currently have any facility to detect contention
>> like spinlocks do. In order to allow users of rwlocks to better manage
>> latency, add contention detection for queued rwlocks.
>>
>> CC: Ingo Molnar <mingo@redhat.com>
>> CC: Will Deacon <will@kernel.org>
>> Acked-by: Peter Zijlstra <peterz@infradead.org>
>> Acked-by: Davidlohr Bueso <dbueso@suse.de>
>> Acked-by: Waiman Long <longman@redhat.com>
>> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
>> Signed-off-by: Ben Gardon <bgardon@google.com>
> When building mips:defconfig, this patch results in:
>
> Error log:
> In file included from include/linux/spinlock.h:90,
> from include/linux/ipc.h:5,
> from include/uapi/linux/sem.h:5,
> from include/linux/sem.h:5,
> from include/linux/compat.h:14,
> from arch/mips/kernel/asm-offsets.c:12:
> arch/mips/include/asm/spinlock.h:17:28: error: redefinition of 'queued_spin_unlock'
> 17 | #define queued_spin_unlock queued_spin_unlock
> | ^~~~~~~~~~~~~~~~~~
> arch/mips/include/asm/spinlock.h:22:20: note: in expansion of macro 'queued_spin_unlock'
> 22 | static inline void queued_spin_unlock(struct qspinlock *lock)
> | ^~~~~~~~~~~~~~~~~~
> In file included from include/asm-generic/qrwlock.h:17,
> from ./arch/mips/include/generated/asm/qrwlock.h:1,
> from arch/mips/include/asm/spinlock.h:13,
> from include/linux/spinlock.h:90,
> from include/linux/ipc.h:5,
> from include/uapi/linux/sem.h:5,
> from include/linux/sem.h:5,
> from include/linux/compat.h:14,
> from arch/mips/kernel/asm-offsets.c:12:
> include/asm-generic/qspinlock.h:94:29: note: previous definition of 'queued_spin_unlock' was here
> 94 | static __always_inline void queued_spin_unlock(struct qspinlock *lock)
> | ^~~~~~~~~~~~~~~~~~

I think the compile error is caused by the improper header file
inclusion ordering. Can you try the following change to see if it can
fix the compile error?

Cheers,
Longman

diff --git a/include/asm-generic/qrwlock.h b/include/asm-generic/qrwlock.h
index 0020d3b820a7..d7178a9439b5 100644
--- a/include/asm-generic/qrwlock.h
+++ b/include/asm-generic/qrwlock.h
@@ -10,11 +10,11 @@
 #define __ASM_GENERIC_QRWLOCK_H

 #include <linux/atomic.h>
+#include <linux/spinlock.h>
 #include <asm/barrier.h>
 #include <asm/processor.h>

 #include <asm-generic/qrwlock_types.h>
-#include <asm-generic/qspinlock.h>

 /*
  * Writer states & reader shift and bias.


\
 
 \ /
  Last update: 2021-02-10 01:58    [W:0.135 / U:2.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site