From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E81BDC41513 for ; Thu, 17 Aug 2023 07:37:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348549AbjHQHh2 (ORCPT ); Thu, 17 Aug 2023 03:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348461AbjHQHhO (ORCPT ); Thu, 17 Aug 2023 03:37:14 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FF932D5F; Thu, 17 Aug 2023 00:37:08 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-68878ca7ca0so1637366b3a.0; Thu, 17 Aug 2023 00:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692257827; x=1692862627; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=ULKXK6qR5c9VRBpWLFKmezxiq8+/JqbJFDTXkM6zgIY=; b=ZtP8zijoeaZNhyrK2BOvwnFcaXAIBBAvfS34UhePeKzkACjxF3wIlN55Mi+h7MTU3W lZZHqFb9n0QrLWraMNHQDriu5uAr0Gvc3ACPuk9aTgYUbXMnvE19Pi8Rhibvp2s7lIJH Z+BQF0HSMpZpebLNtzB89ea3qhNTGpNFMI0YD73n8Cr1vlqkfymPfz5NK+BQIxDORFJa A9NXFaStzLzyFb8/I6KDUOmXD0R1EbgnNdPyJ4BX8102iseWYuFsi4Wjzsdf6XJCKeRG SEA0FHF/mLYBomK4PPLpuBwucWIogaqbbwCr0aqVvlS4qSaAVNmnoiYCjlXtseFS23AS iFlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692257827; x=1692862627; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ULKXK6qR5c9VRBpWLFKmezxiq8+/JqbJFDTXkM6zgIY=; b=OGf6IoHSwd8UsYjT98AaZQ3qQh82Iswg2kuW7/l8IsJLcD+LFF5Z8gDCX7kAxE67Ed b+TeL0YxCeo+OL2ifb2LjCsEeP2vYmvA65v8SbJRZ22IXX6FJlMOkqFdMn+C0LDZFu2p UCklitz4cuYFeh+CuR/x9mxWidiFIY7XVyAEkpGHST2l49LkGSw/kPbAcGYrL/zr+NxS Ve+JCQqSHmGpVhLhEN15ZTBeZt20AZajqVQ4yoz7sBzUTpMfkKhXCdv8uNiLN2L7XoMD CO8tTHi6HS4Mu3xDTs8tsPssfqfdeo9DW3SJNWlsOxOUnswMyaAs/zZsvjzJcZucn4xl jAOQ== X-Gm-Message-State: AOJu0Yx4csBXrIorN1z5BopdwRnonkz7uTzte2LgMcmDakzhxzNeVxc+ 9oRSDMszS7Xixncrsi2nTXjmBRU/dps= X-Google-Smtp-Source: AGHT+IFp+VczPYtP3Lkrr7z+0huyXGBRexY3/CrU2WmTcbxAUUtzsgJARGI0oo0f2z2QG2r0NgEyIw== X-Received: by 2002:a05:6a20:4ca4:b0:12d:f1ac:e2cd with SMTP id fq36-20020a056a204ca400b0012df1ace2cdmr3073766pzb.32.1692257827512; Thu, 17 Aug 2023 00:37:07 -0700 (PDT) Received: from sol ([220.235.36.234]) by smtp.gmail.com with ESMTPSA id p1-20020aa78601000000b00687260020b1sm781878pfn.72.2023.08.17.00.37.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 00:37:07 -0700 (PDT) Date: Thu, 17 Aug 2023 15:37:02 +0800 From: Kent Gibson To: Bartosz Golaszewski Cc: Linus Walleij , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH 0/5] gpio: cdev: bail out of poll() if the device goes down Message-ID: References: <20230816122032.15548-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 17, 2023 at 09:27:37AM +0200, Bartosz Golaszewski wrote: > On Thu, Aug 17, 2023 at 6:41 AM Kent Gibson wrote: > > > > On Wed, Aug 16, 2023 at 11:41:06PM +0200, Linus Walleij wrote: > > > On Wed, Aug 16, 2023 at 2:20 PM Bartosz Golaszewski wrote: > > > > > > > From: Bartosz Golaszewski > > > > > > > > Wake up all three wake queues (the one associated with the character > > > > device file, the one for V1 line events and the V2 line request one) > > > > when the underlying GPIO device is unregistered. This way we won't get > > > > stuck in poll() after the chip is gone as user-space will be forced to > > > > go back into a new system call and will see that gdev->chip is NULL. > > > > > > > > Bartosz Golaszewski (5): > > > > gpio: cdev: ignore notifications other than line status changes > > > > gpio: cdev: rename the notifier block and notify callback > > > > gpio: cdev: wake up chardev poll() on device unbind > > > > gpio: cdev: wake up linereq poll() on device unbind > > > > gpio: cdev: wake up lineevent poll() on device unbind > > > > > > I see why this is needed and while the whole notification chain > > > is a bit clunky I really cannot think about anything better so: > > > Reviewed-by: Linus Walleij > > > > > > > The issue I have is with the repurposing/reuse of the existing notifier > > block that sends line changed events to the chardev. > > Correct me if I'm wrong, but now all line requests will receive those > > events as well. > > They have no business receiving those events, and it scales badly. > > > > My preference would be for a separate nb for the chip removal to keep > > those two classes of events distinct. > > > > I would normally agree if there was a risk of abuse of those > notifications by drivers but this is all private to gpiolib. And line > requests that receive line state notifications simply ignore them. > This isn't a bottleneck codepath IMO so where's the issue? We would be > using a second notifier head of 40 bytes to struct gpio_device for no > reason. > Yeah, this is a space/time trade-off, and you've gone with space over time. I would select time over space. 40 bytes per device is negligable, and there is never a case where the line request wants to see a change event - it either relates to a different request, or it was triggered by the request itself. Is there an echo in here ;-)? Cheers, Kent.