Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp2613rdb; Wed, 14 Feb 2024 10:49:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUUbsPu8plx6hjlVgma/pGPbwD7rkI1aTDL69qt3lzpv8v6T0bsPphU2LkN9CDueAACc0dT9MQUbRRlGYaQ9G+ItWtjLm/rhXx419MQpw== X-Google-Smtp-Source: AGHT+IEnX8XtH169Sy6tijTcaHm9Z1HMqbMLPz8S5nCpWnmHlkqiy/bI3C//6KXaR9k3cBOCPUk4 X-Received: by 2002:a05:6e02:507:b0:363:8877:81af with SMTP id d7-20020a056e02050700b00363887781afmr4007362ils.16.1707936586952; Wed, 14 Feb 2024 10:49:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707936586; cv=pass; d=google.com; s=arc-20160816; b=rio3B05FRj5Byh35ZaEidLrAzBn18kobkPOAARn65fPUFoqe2woQqNidG8DYL/LrlE n/qqqvOt50cprmbGb/BUGXJHE7WQfXFscbmE3AagAPENQJpOthuFVimFtk0/rTRG0E0c 57Y2oShkwO6TYGO1Z9yRGqLnlHaONv4U2THJZBCoiTAiavsMlJFFBFhiW7pLsx48dlJP 6uikC1yAA1KdcJoaTAzzE3XoBC4kGwnBzCFJy/RHyp6P6I2BleHzTakDo/4mNhdlqk1M svMycir6cgUGS/hCKAQDbO+Not9DD0l0v83m9zXkedWHSv65sU0ZKyubz/OklK7CTOMG A3mw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=GXyeRnr/vqq6CADaRMnG9QCanF3v1LblKm4357/mRUU=; fh=ZuywtoLEK2yK3BwiSjGBRHdgNR4nsCh2qZSTaU2I2w8=; b=DVl3IjYnTc70Pe+pFLZJb30GiSzrua6hrmlcec9MkH+f72DwwnQNKYln8pLk2n8uHz uV1qma8xzADQzRO3xq67LYDLQ6vNB0/+MGdWqnR0A06WskWbgfVeRU3tmkt2bP1mW64L 2Vc4NIXhuWrEviTwsgZHrGfAxcL1ut6WU9iwSCu/8QSOk51NsKJ4dV+A1dAfW75bXETV stqWTq2mv9fPvJwtzjkTuU6bMg9mKKi4hX4HDxiOztUR+ieCbiQW9VdgIu2XAb6Jnv+C d1955UA2j/YUJFNX4FUgqRbr2/InumMiIZTHawVQH1mQcsbKuFLEE17AIcSEmYmW9n1V 9Bww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MPIIXwfz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-65825-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCVVnPTaG+DhnTg61EbIQTyLhTPV5fNenljvFWI8/wp+z9dJOXlD43FXHFv9Wb2+xuEAzaq+lXxBdgi5IMP2CN9keIyH2t50ZhHHkk2KRQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l129-20020a632587000000b005dc5069298fsi4146789pgl.711.2024.02.14.10.49.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 10:49:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65825-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MPIIXwfz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-65825-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E8B3B280FA0 for ; Wed, 14 Feb 2024 18:44:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47D7D604AB; Wed, 14 Feb 2024 18:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MPIIXwfz" 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 62F7712CD95; Wed, 14 Feb 2024 18:44:37 +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=1707936277; cv=none; b=ODgoW3IlLrvvuNz0bJKRAnuS1WSZvphz1y8Z9npsj6DFhunxb3lFeI+doyoWbBwVT5vkV2PLWdsuSsGwj0cL37OuYrh1QpvBgF0+BTuktHx+1KlXfgBPHumFIfY6W6trvDdIfOjVrnvv8eXsZ+Bh1M36SNsRRUEWHvSSAwXJIr4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707936277; c=relaxed/simple; bh=p2c4INhu1ft4+yh96H2P3PPmFRifbuDMKDxl0VrMN3c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AXznwaxcG6hCMrtnwlit69kqZ3kLlubOpLoeeZgNAAaltNbhjqdNkFHYKHpMFn314I1Ntrsc3VKHPNrpi1yhUVJjFcOW46hP40Oo32mimvq33827rOH7mR4sIsZgL9oP1m4ID1egXXrkrqIcgXstQzJ265/Dm8H6zVY6Gdti+/8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MPIIXwfz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0653C433F1; Wed, 14 Feb 2024 18:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707936276; bh=p2c4INhu1ft4+yh96H2P3PPmFRifbuDMKDxl0VrMN3c=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=MPIIXwfzl7Mw8AF/IMoUuaTEREDARtYl7SwxRSd/xyGamq2+HCgc67WrhvMJweA/y zoy87vYKaqhbzQYCMF1Cj+Xy5KSrCm1+pDca4++3DVxaV453kqZvqAVttgFTM2VI+t o7SDNmFwr91g3D/D3Svz/XNb3EnhiPFuAE+ScdU9YREtUaVpTED7ZMEuj7ac1QMW5c Lt1hsKj7ONspqHxzZaf4tl217j1HHag7F7nJFFf3KffPOSHH2AJMVqiAloqj0w4GrL fszRv1b3t4pMxlXaiXrKJQsQ0dm2Y3VhlnKG0rp0LePTRMJsUhuLiroN/BG47ZEJwp Fwkellni3MbTw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 5B235CE0AB0; Wed, 14 Feb 2024 10:44:36 -0800 (PST) Date: Wed, 14 Feb 2024 10:44:36 -0800 From: "Paul E. McKenney" To: Bartosz Golaszewski Cc: Linus Walleij , Kent Gibson , Alex Elder , Geert Uytterhoeven , Andy Shevchenko , Wolfram Sang , Mark Brown , Dan Carpenter , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v2 0/4] gpio: fix SRCU bugs Message-ID: <4a08c610-c249-4b56-b09c-09e1fd07f723@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20240214084419.6194-1-brgl@bgdev.pl> 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: <20240214084419.6194-1-brgl@bgdev.pl> On Wed, Feb 14, 2024 at 09:44:15AM +0100, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Here are four fixes to some bugs in recent SRCU changes. The first one fixes > an actual race condition. The other three just make lockdep happy. For 1/4-3/4: Acked-by: Paul E. McKenney For 4/4, you are playing with fire, but I will assume that you know what you are doing. ;-) Thanx, Paul > v1 -> v2: > - use srcu_dereference() instead of rcu_dereference_protected() as > advised by Paul > - add a patch using rcu_dereference_check(..., 1) in deprecated > interfaces that return the address of the RCU-protected chip structure > to external users (who shouldn't use it anyway but well...) > - pick up review tags for patches 1/4 and 2/4 > > Bartosz Golaszewski (4): > gpio: take the SRCU read lock in gpiod_hog() > gpio: cdev: use correct pointer accessors with SRCU > gpio: use srcu_dereference() with SRCU-protected pointers > gpio: don't let lockdep complain about inherently dangerous RCU usage > > drivers/gpio/gpiolib-cdev.c | 25 ++++++++++++------------- > drivers/gpio/gpiolib-sysfs.c | 5 +++-- > drivers/gpio/gpiolib.c | 32 ++++++++++++++++++-------------- > drivers/gpio/gpiolib.h | 3 ++- > 4 files changed, 35 insertions(+), 30 deletions(-) > > -- > 2.40.1 >