Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2270958rbb; Tue, 27 Feb 2024 17:11:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWEAy01gbyuU4kkdwRV/JGTatstSOj7NF4SBPzOXUaBWOSfAEjLHI4G0oEUbQQnqqCz+sO/mZc5Z0aPrbU+g067re49vVMovW+p92MUnw== X-Google-Smtp-Source: AGHT+IENdtEBO2CBjB7ugSjnm6klkLr+bSfHxCNPJD5lAicxVcJ9tl5hYjKCNXePqNipB9OhwjK3 X-Received: by 2002:a17:902:c40b:b0:1d9:4106:b8b5 with SMTP id k11-20020a170902c40b00b001d94106b8b5mr1146242plk.11.1709082701164; Tue, 27 Feb 2024 17:11:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709082701; cv=pass; d=google.com; s=arc-20160816; b=AGf31GbxNiQC7k2gsEskCe7jZogteeKz84AZ5Ox8Cw9sca3oiS0zqOniU6n3g4Eu+P RCb5FAnM06C+BlIG4DDTtupnuEP0L6l/5gANzgfKZu9Pk1+Z0PVh3x5nHYthBd7HhGm0 5sycvbpCIkg0QO56M+lmBiAl9p8vz0M6j4Icy22c2rGUrc+vCRrLrvK3xxZ3O6l6Sp/a m5LusmCBIiNYh1Jw7+tVv/wQmy1EKAaSMaa/RKfqTLvsrvtoStOO8GgM7OzU96ATHvHk 8zjkjCPYQWIIxsPtBzB+5pCb6XZHHIFHzDg4EHYiQDm4ngr6wscMFw24anxE4/hb0QZm /vXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qxQxvMZWjt9T0hO0TPYQxcU22VwhY9xRByh1fp2nWAE=; fh=64WJW+a7V41r4rWRQCeB0uMyUNolRwNpJehWVSupe/c=; b=UeXnyKZdOJ7LIZkUxltBK2q9CEkStmCrdRF7pnFdn5NA63DMnr/qGYQLUn+GgJPhNR KA35aGZIt0SlKdF0QbN78rQhbQtC3pxXkaDRyE5AvgUuE4yYIZHeX2PFeSXmBRqPE1xc v/4WN2BS3gpXTPrbE3odt8jzJxpPFqzAzXJKKjfB8leSl+WL8kN26u9bYjxgHaAcmrFc 9nP5/JacM6O9/gMOvG7Nt+bg6WIQbpkyUzmrf0umqBuULtMVtVq8iscjBiYyttLGWCqG EGrMr1AjkhHYWaHeZrxa/aPjxcvq8FN3S/+LdB6iW5JSs8VLPN6FWMaazNFlIMF/TDo3 1QGA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gOk+GioF; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-84273-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84273-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k11-20020a170902760b00b001dc8ebc646fsi2226319pll.124.2024.02.27.17.11.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 17:11:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84273-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gOk+GioF; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-84273-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84273-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 7DD5CB233F3 for ; Wed, 28 Feb 2024 00:29:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BA25810; Wed, 28 Feb 2024 00:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gOk+GioF" Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 C5551363; Wed, 28 Feb 2024 00:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709080168; cv=none; b=PToBUyIbI/Ha/NvRiRMhKMBybC/incANTbb6n9y6SapHRNfmYLpPtyhe+weiSbbYMr95lSXyBLvLJmp3TcEyqxQ+okMekBdoqAlI+YMV9J/0n8aqdl8C90zhwXyr/9LRvqIs5n1m1NDhHYztQTajmvrHCD9IDiNXuFQ/XN4FtQQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709080168; c=relaxed/simple; bh=6TISGXqP8reGXr3MP49CKge30gPUg3uo3jKiNzABcnY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=A6z1G3fGCGTkxhihSLSOUKYqH/29I0i8cLM897TmN8vHEm244o6m4o6Yr22pjtMWzMvV/EVWEOFPj0YsS+EW55qZXFlbYPdxkqKUcMPbZ80P+08ZfpLkOCpf6Ebe88rELLhUPmmdFsM2dFwwTmjm0VDd36OtXqdkEeIShfJpPAY= 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=gOk+GioF; arc=none smtp.client-ip=209.85.210.177 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 Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6e554f64971so285203b3a.1; Tue, 27 Feb 2024 16:29:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709080166; x=1709684966; darn=vger.kernel.org; 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=qxQxvMZWjt9T0hO0TPYQxcU22VwhY9xRByh1fp2nWAE=; b=gOk+GioFOTcaJVyTWjdTlXGUgPsyOOfGGwqVflsjyVZqOMbVRG2l8Q3LKmerfYVAT4 sOoMHs7hO6zsYxKDdAZPm+UaATqm/crpBsB+oNRP9N/KAhg8JUdM11ke0t9BxTMinJyd tWY1gvIKuJQjYlJbSNNn4SdG8pAGnKGX91o3W+JHMzMX55KBGFq3CMW+xqkUIB6gx84I m0iqlEEx3ugFqWUcUZ1th0fBWy7qfQK9S1PbnZRCqG6Jsmw3Ts3nBfnQZZWbWloEWp9i cjLcAPFpLOLax6N8pOxNODYiP9NQFnz8W+O7+R09vv0KVzDrz5zh0RXF5dlZ8VyrM62E x29w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709080166; x=1709684966; 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=qxQxvMZWjt9T0hO0TPYQxcU22VwhY9xRByh1fp2nWAE=; b=ZTl4ZInYouMpy3nCOFRz1rFEL7xbGRsShddmwFTscWP3JUwKmB48I0wjbLVKgvHo8m d7kiShH3LpbdG8gjnguewdZ9DlYJtYsevgjEjfuJztclo2jmb5qMviLzrVNlClm2BR8q O94ZZqOxiiNpUgvMXALauPlFaYHCrRcz/TULJhU9TDeSn3hyNvTeJB3bfCtwLe1aWGjs NScapg1O5IrOGgiBzqtglukFerONz/JaXVs40YjdKGTYeCSpPwqPd0Mm4YZX1eFgNH+v mhDV1gSbqa8D2y+RLHO63VEfa8hK2qlJddF95j/6V1Wzz0jH8SJtwPhxh8vr9s2bxxnT xGyA== X-Forwarded-Encrypted: i=1; AJvYcCWw4YURD/X9K2actYJFdCBgZF/UrTjlcwE2JqPNBrn83HsjFDDbPDd1vNd4uLwKYm+i5RTMcV+af9fQzOG7V1vyQ7LfcnEnPBuPzjrkRDaSDLLxY1w/MgXxAMsR561kDVG6fPprU726hw== X-Gm-Message-State: AOJu0YxW/VgAh0Ht/Tw3lXwc0xq5JLswdOHkx7iYwxH+mlXrDwY5+mxF sB8msCh8t3w0PX9RXuNEwJxAGRB7cft7bGZsqinozZYAiyaWVb9d X-Received: by 2002:a05:6a00:84a:b0:6e5:5425:e285 with SMTP id q10-20020a056a00084a00b006e55425e285mr1424566pfk.13.1709080166056; Tue, 27 Feb 2024 16:29:26 -0800 (PST) Received: from rigel ([220.235.35.85]) by smtp.gmail.com with ESMTPSA id x14-20020aa784ce000000b006e0416c42c3sm6540491pfn.198.2024.02.27.16.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 16:29:25 -0800 (PST) Date: Wed, 28 Feb 2024 08:29:19 +0800 From: Kent Gibson To: Bartosz Golaszewski Cc: Herve Codina , Linus Walleij , Saravana Kannan , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Thomas Petazzoni Subject: Re: [PATCH v2 0/2] gpio-cdev: Release IRQ used by gpio-cdev on gpio chip removal Message-ID: <20240228002919.GA4381@rigel> References: <20240227113426.253232-1-herve.codina@bootlin.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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Feb 27, 2024 at 08:31:33PM +0100, Bartosz Golaszewski wrote: > On Tue, Feb 27, 2024 at 12:34 PM Herve Codina wrote: > > > > Hi, > > > > When a gpio chip device is removed while some related gpio are used by > > the user-space (gpiomon for instance), the following warning can appear: > > remove_proc_entry: removing non-empty directory 'irq/233', leaking at least 'gpiomon' > > WARNING: CPU: 2 PID: 72 at fs/proc/generic.c:717 remove_proc_entry+0x190/0x19c > > ... > > Call trace: > > remove_proc_entry+0x190/0x19c > > unregister_irq_proc+0xd0/0x104 > > free_desc+0x4c/0xc4 > > irq_free_descs+0x6c/0x90 > > irq_dispose_mapping+0x104/0x14c > > gpiochip_irqchip_remove+0xcc/0x1a4 > > gpiochip_remove+0x48/0x100 > > ... > > > > Indeed, even if the gpio removal is notified to the gpio-cdev, the > > IRQ used is not released when it should be. > > > > This series calls the gpio removal notifier sooner in the removal > > process in order to give a chance to a notifier function to release > > the IRQ before releasing the IRQ mapping and adds the needed > > operations to release the IRQ in the gpio cdev notifier function. > > > > Compared to the previous iteration: > > https://lore.kernel.org/linux-kernel/20240220111019.133697-1-herve.codina@bootlin.com/ > > this v2 series set gdev->chip to NULL before calling gcdev_unregister(). > > > > Also, this v2 series was rebased on top of for-next branch of the GPIO > > tree. > > > > Best regards, > > Hervé Codina > > > > Changes v1 -> v2: > > - Patch 1 > > Set gdev->chip to NULL before calling gcdev_unregister() > > > > - Patch 2 > > No changes > > > > Herve Codina (2): > > gpiolib: call gcdev_unregister() sooner in the removal operations > > gpiolib: cdev: release IRQs when the gpio chip device is removed > > > > drivers/gpio/gpiolib-cdev.c | 33 ++++++++++++++++++++++----------- > > drivers/gpio/gpiolib.c | 6 +++++- > > 2 files changed, 27 insertions(+), 12 deletions(-) > > > > -- > > 2.43.0 > > > > Sorry but this is just papering over the real issue. I'd say NAK for > now as I'd really prefer to get to the root of the problem and fix it > for all GPIO interrupt users. > > Kent, Linus: what do you think? > Agreed - a broader solution makes sense to me. Cheers, Kent.