From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E8A8F30DD34 for ; Wed, 21 Jan 2026 16:04:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769011444; cv=none; b=GIt3gVF42cH7Q0+/prJsnaQ/aqbj96EfL3Gtb2++2bapETa0fr+cyTb+XJKBRI7GyA+rpMUDtoSE5BcQHrA2YorOIrnLMulmX9MNuzx8iJL/uaU0K61O/Ltq28lsjq2hOpqnSi1C8a8MIOHbT0QwFOrorw6+5ZBKFrhkGwM1eus= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769011444; c=relaxed/simple; bh=I8vgGd6ZUOZ+8hnHnOwq4XNFXA9KuEMBjdZGqvaj+qY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=u+l4IwLZ+no5iUlfp3TgexFOTg3z6i0Fnl/LJM/qGthWuCYelfT3RSRvCjpUcCzTFIQd0BvAyJobNFDM93aQ/845vNP/9L265jXaJhqcqmYDj94XKSFA3+HqUbALfsD8pwH+jojeQsCfa6QsD024T3AefWqX6ibg1OgwRtuFIxk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZyaKsfmk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZyaKsfmk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C083FC4CEF1; Wed, 21 Jan 2026 16:04:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769011443; bh=I8vgGd6ZUOZ+8hnHnOwq4XNFXA9KuEMBjdZGqvaj+qY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZyaKsfmksbVFeCc7JkhgayX1ARs/BmEj3eQGlcv1f4aw8aZo0hUOrnRWKGg1O85aE wrI8Nfe4cCZ+Y/FN4sDTiv4VNOfEfayYpQAtrIWPRwZLGBH4ZXpATIWAp/Z9noMmJG Qnw1ZIt2hJYZhwcamBOEtNzFoLm+oRNYDLth9cR+XU+sd9aQ+OZEHKagHW4ANZgo7X HaJ9/yctVZj8p+wF513pc9EaGeuqt16Vaff7xMtBbnVXsl2NucP0ddtlS+KZYlOXRC 8iOmao3kbrHLYGgOVSxNFQQgwm9G0CnATNAmL5OVxe1xZNaGdjiwOnDkFCkLS6EKt5 MQ+qsN8HyHwNA== Date: Thu, 22 Jan 2026 00:04:00 +0800 From: Tzung-Bi Shih To: Bartosz Golaszewski Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , linux-kernel@vger.kernel.org Subject: Re: [PATCH] revocable: Remove redundant synchronize_srcu() call Message-ID: References: <20260121040204.2699886-1-tzungbi@kernel.org> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Jan 21, 2026 at 03:18:12PM +0000, Bartosz Golaszewski wrote: > On Wed, 21 Jan 2026 13:34:15 +0100, Tzung-Bi Shih said: > > On Wed, Jan 21, 2026 at 11:38:18AM +0100, Bartosz Golaszewski wrote: > >> On Wed, Jan 21, 2026 at 5:03 AM Tzung-Bi Shih wrote: > >> > > >> > When allocating a revocable provider via revocable_provider_alloc(), > >> > there is no revocable consumers (i.e., RCU readers) yet. Remove the > >> > redundant synchronize_srcu() call to save cycles. > >> > > >> > Signed-off-by: Tzung-Bi Shih > >> > --- > >> > To address the performance impact reported in > >> > https://lore.kernel.org/linux-gpio/CAMRc=McrFa42mNWmZtD1HKKKZ+USUKpQAAME50wbfxPM7L72gA@mail.gmail.com/. > >> > > >> > drivers/base/revocable.c | 1 - > >> > 1 file changed, 1 deletion(-) > >> > > >> > diff --git a/drivers/base/revocable.c b/drivers/base/revocable.c > >> > index f6cece275aac..b068e18a847d 100644 > >> > --- a/drivers/base/revocable.c > >> > +++ b/drivers/base/revocable.c > >> > @@ -99,7 +99,6 @@ struct revocable_provider *revocable_provider_alloc(void *res) > >> > > >> > init_srcu_struct(&rp->srcu); > >> > rcu_assign_pointer(rp->res, res); > >> > - synchronize_srcu(&rp->srcu); > >> > kref_init(&rp->kref); > >> > > >> > return rp; > >> > -- > >> > 2.52.0.457.g6b5491de43-goog > >> > > >> > >> Do you have an up-to-date integration branch with all the series and > >> fixes you posted that I could use for testing with GPIO? > > > > Please use > > https://git.kernel.org/pub/scm/linux/kernel/git/tzungbi/chrome-platform.git/log/?h=gpio_rev > > for the purpose which is based on driver-core-next and gpio/for-current > > branches. > > > > With this branch, I'm seeing the following KASAN splat when running libgpiod > tests: > > ================================================================== > BUG: KASAN: use-after-free in notifier_call_chain+0x222/0x270 > Read of size 8 at addr ffff888103ce6490 by task gpiod-test/479 > > CPU: 2 UID: 0 PID: 479 Comm: gpiod-test Not tainted > 6.19.0-rc6-yocto-standard+ #2 PREEMPT(full) > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS > rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014 > Call Trace: > > dump_stack_lvl+0x63/0x90 > print_report+0x153/0x4c7 > ? __virt_addr_valid+0x225/0x4c0 > ? kasan_addr_to_slab+0x11/0x80 > kasan_report+0x103/0x140 > ? notifier_call_chain+0x222/0x270 > ? notifier_call_chain+0x222/0x270 > __asan_report_load8_noabort+0x18/0x20 > notifier_call_chain+0x222/0x270 > blocking_notifier_call_chain+0x70/0xb0 > gpiolib_cdev_unregister+0x5a/0x70 > gpiochip_remove+0x48e/0x5a0 Weird, I didn't see the same error. What I roughly tried: (host) $ git checkout origin/gpio_rev (host) $ cat myconfig CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_KASAN=y (host) $ vng -k --config tools/testing/selftests/gpio/config \ --config myconfig (host) $ vng -b (host) $ vng --user root (vng) $ zgrep CONFIG_KASAN= /proc/config.gz CONFIG_KASAN=y (vng) $ ./libgpiod-2.2.2/tests/gpiod-test TAP version 14 ... ok 1 /gpiod/chip/open_chip_good ok 2 /gpiod/chip/open_chip_nonexistent ok 3 /gpiod/chip/open_chip_not_a_character_device ... ok 104 /gpiod/request-config/default_config ok 105 /gpiod/request-config/set_consumer ok 106 /gpiod/request-config/set_event_buffer_size (vng) $ dmesg Did I miss any configurations?