From nobody Tue Apr 7 11:15:47 2026 Received: from 011.lax.mailroute.net (011.lax.mailroute.net [199.89.1.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C9C53CB2C8 for ; Fri, 13 Mar 2026 17:15:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773422144; cv=none; b=KIyd3tVbDcoK3Y1YbNXsWMhekXqLhF40J5wcQeHbIjupPjeaiY4rxvMhEADUFOTMuRuOm6YtfGoThEn5d1i/hDJCU6WzMHC7A6iZieeWnmwSuVBwOBi4fmUaE37KbwGKNPE/z5ek/D/szyG86FkFsI7bp2Br8lF1b2lSw0/ytFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773422144; c=relaxed/simple; bh=QFFdNhOdOwGXJ4npUpDe4HJ3wdnAPNjPLwem2MgbZSQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KG5v0KqDzmWudCcTyJuqnTi/J9gS0aO/QB+K0P25k4MWxQeE0icjj/NIlXG2/StSoaJOSiuBf8Bnbua7+jcf+yPhrLFICD2kDgeA+44iOgZwj1yGKRE4JRKkX8/ahuSEbcxjWg/WZxkapOn30k8Wqx79lam5RsrmOOUiKPWFkYw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=lgu44Plr; arc=none smtp.client-ip=199.89.1.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="lgu44Plr" Received: from localhost (localhost [127.0.0.1]) by 011.lax.mailroute.net (Postfix) with ESMTP id 4fXWMy5M1Jz1XM6JQ; Fri, 13 Mar 2026 17:15:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1773422134; x=1776014135; bh=rqDya 3T7i8mdq+ElLkCryFm2OgjCy660RT53p+BiPpo=; b=lgu44PlrIkmNNsiHhaz2t oCDgcxyDQZKwfSvxY9aa8ZSF4PBef1qTAGsIUQNqHQLN4iJZz8RPmJ96/bIe6NFX z9JJcLyAxr9LMoMB7quoM0MP8ibuDAE3GVXEnwR59ZUwVku8SxpvAof4ZIAkfhnV VT7C6+X5vwh7LUunNvLpD9ba4eheUGWvIwy1kdYUXiP93slrtvfwc87yUh3aQTGk xYuURQnwtV4/1Mo7LhP6esopFFfnYxPOSR/WFNP+tKeYKKVOMKWowiyRdMR9rj+F JBs5Y9kPtR1D3mkXAxBM19iMOOuznHO4J/8mcKW0GYTdJbW9Ojr4LdJKlRNPFOIv Q== X-Virus-Scanned: by MailRoute Received: from 011.lax.mailroute.net ([127.0.0.1]) by localhost (011.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id W8_0SNfvRe5I; Fri, 13 Mar 2026 17:15:34 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.180.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 011.lax.mailroute.net (Postfix) with ESMTPSA id 4fXWMl3kvlz1XMFjb; Fri, 13 Mar 2026 17:15:31 +0000 (UTC) From: Bart Van Assche To: Peter Zijlstra Cc: Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , linux-kernel@vger.kernel.org, Marco Elver , Bart Van Assche , Grant Grundler , Andrew Morton , Arjan van de Ven , Benoit Boissinot Subject: [PATCH 1/3] locking: Fix rwlock support in Date: Fri, 13 Mar 2026 10:15:07 -0700 Message-ID: <20260313171510.230998-2-bvanassche@acm.org> X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog In-Reply-To: <20260313171510.230998-1-bvanassche@acm.org> References: <20260313171510.230998-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Architecture support for rwlocks must be available whether or not CONFIG_DEBUG_SPINLOCK has been defined. Move the definitions of the arch_{read,write}_{lock,trylock,unlock}() macros such that these become visbile if CONFIG_DEBUG_SPINLOCK=3Dn. This patch prepares for converting do_raw_{read,write}_trylock() into inline functions. Without this patch that conversion triggers a build failure for UP architectures, e.g. arm-ep93xx. I used the following kernel configuration to build the kernel for that architecture: CONFIG_ARCH_MULTIPLATFORM=3Dy CONFIG_ARCH_MULTI_V7=3Dn CONFIG_ATAGS=3Dy CONFIG_MMU=3Dy CONFIG_ARCH_MULTI_V4T=3Dy CONFIG_CPU_LITTLE_ENDIAN=3Dy CONFIG_ARCH_EP93XX=3Dy Fixes: fb1c8f93d869 ("[PATCH] spinlock consolidation") Signed-off-by: Bart Van Assche --- include/linux/spinlock_up.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h index 1e84e71ca495..3a50976471d7 100644 --- a/include/linux/spinlock_up.h +++ b/include/linux/spinlock_up.h @@ -48,16 +48,6 @@ static inline void arch_spin_unlock(arch_spinlock_t *loc= k) lock->slock =3D 1; } =20 -/* - * Read-write spinlocks. No debug version. - */ -#define arch_read_lock(lock) do { barrier(); (void)(lock); } while (0) -#define arch_write_lock(lock) do { barrier(); (void)(lock); } while (0) -#define arch_read_trylock(lock) ({ barrier(); (void)(lock); 1; }) -#define arch_write_trylock(lock) ({ barrier(); (void)(lock); 1; }) -#define arch_read_unlock(lock) do { barrier(); (void)(lock); } while (0) -#define arch_write_unlock(lock) do { barrier(); (void)(lock); } while (0) - #else /* DEBUG_SPINLOCK */ #define arch_spin_is_locked(lock) ((void)(lock), 0) /* for sched/core.c and kernel_lock.c: */ @@ -68,4 +58,14 @@ static inline void arch_spin_unlock(arch_spinlock_t *loc= k) =20 #define arch_spin_is_contended(lock) (((void)(lock), 0)) =20 +/* + * Read-write spinlocks. No debug version. + */ +#define arch_read_lock(lock) do { barrier(); (void)(lock); } while (0) +#define arch_write_lock(lock) do { barrier(); (void)(lock); } while (0) +#define arch_read_trylock(lock) ({ barrier(); (void)(lock); 1; }) +#define arch_write_trylock(lock) ({ barrier(); (void)(lock); 1; }) +#define arch_read_unlock(lock) do { barrier(); (void)(lock); } while (0) +#define arch_write_unlock(lock) do { barrier(); (void)(lock); } while (0) + #endif /* __LINUX_SPINLOCK_UP_H */