Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp66792rdb; Mon, 15 Jan 2024 12:20:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFg2l+ZYB0RDxZ5fC4OHGyChwKt6V4jMdNWR4y2iMD2NcP2m1dlib5J06NTq40mLHj9U/cy X-Received: by 2002:a05:6a20:7883:b0:19a:4778:eb with SMTP id d3-20020a056a20788300b0019a477800ebmr5645087pzg.41.1705350015926; Mon, 15 Jan 2024 12:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705350015; cv=none; d=google.com; s=arc-20160816; b=ZUIyohR/yroRJk7dwnYYGT6OpmMWlCDjse9Eodh1vdiAZwsiJngmeWCLFNgxtjfRgo f/oqo57iu5K10nyfG6E1Jwd4RBPFGD8LIMunvOVBzhzG7LCwDhPfnjOBsHA8X2X92s0a GpB5Y3/YCv0eOJ0RgiAxwb77YG+O+1TfhZsYZZrSHblBtSW6MGLcN/ghGej0KChaIPAZ l0VWtlyqstNAVg7IcDXRt5ksxqgiI3zX4Yj4GWj6z5dqUJxQUbW7ZAXhjJHzMEdzKwZn PnXBSl/6gItT/2laRs9NNwQ3Zhg+rJlAfRYOxSBEaT+1Gze1yDd7gVcxwOWD6C49S58F vcHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=fK1cfcz5VdHUqaPh3D2ST8gwHCilhZQB43Ha1E7iCnM=; fh=P6wXOSRB3iCckVOwoLNvETjy+M9M6cby0SbuZFU1iqY=; b=zMl14HQcjvvYh1u+ypy8oYkhyWoih205wZZq1a2/aaSdMlzCn9xVolFpEiaSYii03P B8QaHlTfdGj5J4m1MAza1SANBjGOV4WgJCI/A92D1tCT8XIFZ6ZQbdntp65+YTI8BW58 r8k1H/934CgMn+XeuloQpOOCsBPqO0MYTkPX7PfkUjQch72EatdDa7geiGUqmOSzVZsv UtAFWGU86xp1DCrlRGDiWBt91Ga8uxlwxJZQO3xrPxlL5HWv3NTVCY5EiSYX91blFWFY XxOMegS3IajaOgQtHoJ7fKQppeAJoGI8Ah8d39DeyqfRL45gn1PmZoZrsKjE2k+V+xCv 1ALA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WNfur+Xn; spf=pass (google.com: domain of linux-kernel+bounces-26473-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26473-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i21-20020a17090ad35500b0028e049c06c6si7999501pjx.11.2024.01.15.12.20.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 12:20:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26473-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WNfur+Xn; spf=pass (google.com: domain of linux-kernel+bounces-26473-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26473-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3D6D8B21DF6 for ; Mon, 15 Jan 2024 20:20:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9EA31947B; Mon, 15 Jan 2024 20:19:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WNfur+Xn" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 8B72118EB0 for ; Mon, 15 Jan 2024 20:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705349991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=fK1cfcz5VdHUqaPh3D2ST8gwHCilhZQB43Ha1E7iCnM=; b=WNfur+Xn0AquGLAu/S55rLHM79V4jAMethV0CiqHS6UmepYSu3qrShr6VqasvxLZAUlKAz YXOWcwC0KOC2/d8kS4xYWnOl0ssZpMv161C7Krpq1YFRFZraO4mEpHigQ1FhgEiougdrTh Yt7Vsmep8exIlATVw4G8xQTsQK1P6lo= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-44-khzJsTUDOT6Lt8eRK2A-0A-1; Mon, 15 Jan 2024 15:19:49 -0500 X-MC-Unique: khzJsTUDOT6Lt8eRK2A-0A-1 Received: by mail-oi1-f197.google.com with SMTP id 5614622812f47-3bbacb61978so6852359b6e.3 for ; Mon, 15 Jan 2024 12:19:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705349989; x=1705954789; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fK1cfcz5VdHUqaPh3D2ST8gwHCilhZQB43Ha1E7iCnM=; b=nOrQOXOuxjv1Pk9MQS1Y05BvxoorGl4eMZG/VLlZtZWFohHpEbAm3IRzPKclJMQEDp 0PnfNnzWiQ04MJvXy/Hh1qFXoI/o1kUZqtE3cEv8/8JCHOEmzCrou9lM3WqbTxL7Lbq2 ajZSpyzMvs7chkCzS0y7tM7GNRWMVarFYa4IxNUtN6e/e8vWkhV7QFH4G383YSkNkYK0 GfGpuZoXkeEY3SGsb8B+pB1CJAo8KnmfDWIGUsRXYy7U6+TDX1fyaoPhCr9eQdBQYVcQ ZfOGD8gLWtANKAOXYB8qvU4Sbdo08+rqm4auY2ZILDM2K4N+HPsm+INVgJUscxvdZXLY CX+A== X-Gm-Message-State: AOJu0YzcykllJXI9/GtZZGXzS27FMpbUMVW72ot06pmQrevYbspiKxhk RV9mv8BEoyshP9yqz/9S638UQhPppHBCfarb8nDaDpnfEDpRDaP71BRDc+VGo8PvtOe44Dd+cc7 DCGSmHfQ69ZwFSdrQDA2JKkvO3YFAbu0Q X-Received: by 2002:a05:6808:1908:b0:3bd:5292:f34b with SMTP id bf8-20020a056808190800b003bd5292f34bmr3919300oib.79.1705349989236; Mon, 15 Jan 2024 12:19:49 -0800 (PST) X-Received: by 2002:a05:6808:1908:b0:3bd:5292:f34b with SMTP id bf8-20020a056808190800b003bd5292f34bmr3919293oib.79.1705349989012; Mon, 15 Jan 2024 12:19:49 -0800 (PST) Received: from LeoBras.redhat.com ([2804:1b3:a803:26a5:3f32:e12b:5335:3c2d]) by smtp.gmail.com with ESMTPSA id z18-20020a05620a08d200b007834386eeaesm3106329qkz.33.2024.01.15.12.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 12:19:48 -0800 (PST) From: Leonardo Bras To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Kent Overstreet , Marcelo Tosatti Cc: Leonardo Bras , linux-kernel@vger.kernel.org Subject: [PATCH v1 1/1] spinlock: Fix failing build for PREEMPT_RT Date: Mon, 15 Jan 2024 17:19:34 -0300 Message-ID: <20240115201935.2326400-1-leobras@redhat.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Since 1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to spinlock.h") build fails for PREEMPT_RT, since there is no definition available of either spin_needbreak() and rwlock_needbreak(). Since it was moved on the mentioned commit, it was placed inside a !PREEMPT_RT part of the code, making it out of reach for an RT kernel. Fix this by moving code it a few lines down so it can be reached by an RT build, where it can also make use of the *_is_contended() definition added by the spinlock_rt.h. Fixes: d1d71b30e1f85 ("sched.h: Move (spin|rwlock)_needbreak() to spinlock.h") Signed-off-by: Leonardo Bras --- include/linux/spinlock.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index eaac8b0da25b8..3fcd20de6ca88 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -449,6 +449,12 @@ static __always_inline int spin_is_contended(spinlock_t *lock) return raw_spin_is_contended(&lock->rlock); } +#define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock) + +#else /* !CONFIG_PREEMPT_RT */ +# include +#endif /* CONFIG_PREEMPT_RT */ + /* * Does a critical section need to be broken due to another * task waiting?: (technically does not depend on CONFIG_PREEMPTION, @@ -480,12 +486,6 @@ static inline int rwlock_needbreak(rwlock_t *lock) #endif } -#define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock) - -#else /* !CONFIG_PREEMPT_RT */ -# include -#endif /* CONFIG_PREEMPT_RT */ - /* * Pull the atomic_t declaration: * (asm-mips/atomic.h needs above definitions) -- 2.43.0