From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D4F42206A7 for ; Fri, 20 Dec 2024 19:00:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734721230; cv=none; b=e072niN1oYZTMDnXJpZBYbjbI09fdWTMa3WHVt802D2V7a88UTieI32ceKCjRg39MO+XduCRTyxJVz1zt+uwz+q4/2W8Dz1Yd9yECdUZcsQSayXOm1zc6OqUk3ghdJppGqxLq7v30sn4FxZQ2lgCufj6B8uh7H8ok1IHnjINcms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734721230; c=relaxed/simple; bh=DcI407VL3jzMpdIUpTsQAQ7Fwrv0oYJ68zmeYct2Wl0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=N1Frh53XAaJ2Y0swZXBrVXKKLdtMjdyLl7niExPVBzXRKN9XbGvnDCTXZmmg90O3P+eFC55N4MlTfFfemwbBxjvAS+TMNbTwplQTWvMffyJhZy7s72LaVL6pcZijnv3IxxMPB4XQjE+6lvGoSkoOIglB5qUpoE1fHuljkzKKWTk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Mfh47htI; arc=none smtp.client-ip=209.85.160.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Mfh47htI" Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-46677ef6910so22394831cf.2 for ; Fri, 20 Dec 2024 11:00:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734721216; x=1735326016; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=sIKsmEYBJU5cUCCOWLWX32/3tfdNXhpSh22eOWASL7s=; b=Mfh47htIzc08vx5w06bKJJaYMitmo2755Z5CVZb+L9dkEeFFjZDocdhNL86Q1r+Zpx 7ua5lGQIlr2o7B6fbUj5pBA+3QMTmaTdznlhr/4s7nzofV3B8dX21HtacRvNCV2Qh+dp 0fPutFvdhZB71mwy2aO2x+PGhDa/PaebSIFhyBrZmMW+UBsp0hLRZIvxIrjOrKov+5bG g9WUFmBO8o/BoaztWgH9GqEJtgYBhQAY3R0+eD3OLdzE9RLm6s/AzWGq5lOQ0lTrbwH8 /nZtBMi7FMHjZf5l+IFEr3mo4yu441jzHYXHErKlKnizjUt6OFwQkSG1xMJqG2VJWBqh tJOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734721216; x=1735326016; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sIKsmEYBJU5cUCCOWLWX32/3tfdNXhpSh22eOWASL7s=; b=aqgcO8s3XS6Wdn4m90EzUiGr/12sGsnaV3e1Rf1BvlAC6Z2nv4O6LK16IE428Ixh9T 2QSzP3lATn4It8wxtcdfZc6Cfv4xDiFfPsKebSw4PFMByYSfVmYBiuTMs9elbkt+0FI0 hMmdQ7+C0+pk4ZHO4dcH05PJOfdChjKDqdRDY0oAgF0WINNex94IaSVaBKaZJt9EpYy/ ktwDUhf5Bdw6wutVhXIcDReVZALknKjCBvdNFBPNgNdSHnQ/iZlR8qZUYdPqvuogVGrp DD8t+IoxCRWMZ1TJePORxuVGwyiT3DGn15aBrpQxP/44o/DCzEPcIDnl7D4Gsli6x1x+ pQiw== X-Forwarded-Encrypted: i=1; AJvYcCXhoCns5kIq0hQAXBUODKcVaxaxEUBqkXt8ig48wt/Hfd6VM7Erggv2Paq2cw3to7yehRxTjgBeLUsqjzA=@vger.kernel.org X-Gm-Message-State: AOJu0YwmczvGOfT9yULSedrm9hhBNUqpACk6MyZDLdTcuj995ESz7W39 JZrq9A4a3eBJQkuBgLxMYATtqZ1ZZhRMxw14lQ9aXRqCo/QXWn7r X-Gm-Gg: ASbGncsDSK7UwZBcE+DSl9/eH4RAabITQzuFtQyexnKWTe8B2xe8vWGrzlN95bU8xQn 6lMdjkodjQ1kBYDgf8AnUFdBbzyYLObNUOfR9ZHeT8QiX5HQaFOqIqff/3VUIZ6zIp/3B6t0yxl COYqXaMA1DvvBwnfO8v7CHQ8JZBgj/IYc9okYhRrIPx8hmDThHOb/1QkJOwZR5XEkxtC+34foAW UDtkeZo+PwmEpXDJ6eHShLD6nvPg7sg4IFlHCsG2enZPw6GzlSv1ZPrlsdRDg+wZdyqp9kogJNu OPMDpqtUfCg0bz+JKkR8SP8U3KBkdxT0La45+WvkddQHyP4= X-Google-Smtp-Source: AGHT+IEvWHz9wFWRe0xpJhj8GL8Jpmis1TM+GIs5mhBnfsxebBmE8kIRjGSFBPRKg8djD+mgqP/Mjw== X-Received: by 2002:ac8:5a91:0:b0:467:6283:3c92 with SMTP id d75a77b69052e-46a4a8e21fdmr58136851cf.12.1734721216057; Fri, 20 Dec 2024 11:00:16 -0800 (PST) Received: from fauth-a1-smtp.messagingengine.com (fauth-a1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46a3e64cf0fsm19354691cf.18.2024.12.20.11.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 11:00:15 -0800 (PST) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfauth.phl.internal (Postfix) with ESMTP id 019101200073; Fri, 20 Dec 2024 14:00:15 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Fri, 20 Dec 2024 14:00:15 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddtvddgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvf evuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceo sghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpeehud fgudffffetuedtvdehueevledvhfelleeivedtgeeuhfegueevieduffeivdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsohhquhhnodhmvg hsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedqudejjeekheeh hedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmhgvrdhnrghmvg dpnhgspghrtghpthhtohepuddvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehr hihothhkkhhrleeksehgmhgrihhlrdgtohhmpdhrtghpthhtohepsghighgvrghshieslh hinhhuthhrohhnihigrdguvgdprhgtphhtthhopegtlhhrkhiflhhlmhhssehkvghrnhgv lhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnh gvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhrthdquggvvhgvlheslhhishhtshdr lhhinhhugidruggvvhdprhgtphhtthhopehlohhnghhmrghnsehrvgguhhgrthdrtghomh dprhgtphhtthhopehmihhnghhosehrvgguhhgrthdrtghomhdprhgtphhtthhopehpvght vghriiesihhnfhhrrgguvggrugdrohhrghdprhgtphhtthhopehrohhsthgvughtsehgoh houghmihhsrdhorhhg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 20 Dec 2024 14:00:14 -0500 (EST) Date: Fri, 20 Dec 2024 11:00:13 -0800 From: Boqun Feng To: Ryo Takakura Cc: bigeasy@linutronix.de, clrkwllms@kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, longman@redhat.com, mingo@redhat.com, peterz@infradead.org, rostedt@goodmis.org, tglx@linutronix.de, will@kernel.org Subject: Re: [PATCH] lockdep: Fix wait context check on softirq for PREEMPT_RT Message-ID: References: <20241220161016.422991-1-ryotkkr98@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241220161016.422991-1-ryotkkr98@gmail.com> On Sat, Dec 21, 2024 at 01:10:16AM +0900, Ryo Takakura wrote: > On Thu, 19 Dec 2024 14:27:11 -0800, Boqun Feng wrote: > >The following is the rough idea: > > > >Regards, > >Boqun > > > >----->8 > >diff --git a/include/linux/bottom_half.h b/include/linux/bottom_half.h > >index fc53e0ad56d9..7191a753e983 100644 > >--- a/include/linux/bottom_half.h > >+++ b/include/linux/bottom_half.h > >@@ -4,6 +4,7 @@ > > > > #include > > #include > >+#include > > > > #if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_TRACE_IRQFLAGS) > > extern void __local_bh_disable_ip(unsigned long ip, unsigned int cnt); > >@@ -15,9 +16,12 @@ static __always_inline void __local_bh_disable_ip(unsigned long ip, unsigned int > > } > > #endif > > > >+extern struct lockdep_map bh_lock_map; > >+ > > static inline void local_bh_disable(void) > > { > > __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET); > >+ lock_map_acquire_read(&bh_lock_map); > > } > > > > extern void _local_bh_enable(void); > >@@ -25,11 +29,13 @@ extern void __local_bh_enable_ip(unsigned long ip, unsigned int cnt); > > > > static inline void local_bh_enable_ip(unsigned long ip) > > { > >+ lock_map_release(&bh_lock_map); > > __local_bh_enable_ip(ip, SOFTIRQ_DISABLE_OFFSET); > > } > > > > static inline void local_bh_enable(void) > > { > >+ lock_map_release(&bh_lock_map); > > __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET); > > } > > > >diff --git a/kernel/softirq.c b/kernel/softirq.c > >index 8b41bd13cc3d..17d9bf6e0caf 100644 > >--- a/kernel/softirq.c > >+++ b/kernel/softirq.c > >@@ -1066,3 +1066,13 @@ unsigned int __weak arch_dynirq_lower_bound(unsigned int from) > > { > > return from; > > } > >+ > >+static struct lock_class_key bh_lock_key; > >+struct lockdep_map bh_lock_map = { > >+ .name = "local_bh", > >+ .key = &bh_lock_key, > >+ .wait_type_outer = LD_WAIT_FREE, > >+ .wait_type_inner = LD_WAIT_CONFIG, /* PREEMPT_RT makes BH preemptible. */ > >+ .lock_type = LD_LOCK_PERCPU, > >+}; > >+EXPORT_SYMBOL_GPL(bh_lock_map); > > Self-tests are now all passing. Thanks! > It looks good to me. Good! Do you want to continue working on this based on the above changes? If so, feel free. Regards, Boqun > > Sincerely, > Ryo Takakura