Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp182117lqs; Thu, 13 Jun 2024 07:23:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWV9e0H4hvp0xri6cWapxvFzSjOlFj5s11x+bnYv9r8DGBAAxGLeOoh8akHABe4fk8AY+XGBDBxEaJaezYMxk5Zl/l9kWGbd2mTrsl5Lg== X-Google-Smtp-Source: AGHT+IGS7MzUGYDF59V5w1oZiBuuJ3qYoQx3rrXLOV0srL1VF31meapyAdPtJ/plLV4QRAoBBCvr X-Received: by 2002:a05:6830:1603:b0:6f9:b4e8:7bda with SMTP id 46e09a7af769-6fa1bf71f45mr5160901a34.16.1718288612220; Thu, 13 Jun 2024 07:23:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718288612; cv=pass; d=google.com; s=arc-20160816; b=iQ1HOl7zQfuSFfAA77pTGD3qV0rBxpYzbLaIYsmQPngxpl+EugR0+F84wJUUUzsnC0 /EW2ezZfD8AFVYsvjpsr66krbNpVsumIS0GjAFRk8KuwIL9gNOhgUgE7zJRroVDJ8rA6 ZADgGtNJP+/QE4GQ7pXNJm/5e4RDfvk0W0h9wPNMyGUxyETpfk8kHuKLhu6IlVbOkfMK SuGRVTX4Iz2hYr1oaIZ8KZctlTn+8KZ53MB8XUXtAy19u6bF/sUhHJnc6jm/uFabYCfC 5cIhoOebOktZtBRP211hzUxk3tj0Q06fVSW0ObY5wjXaSD/2/xCdIlvK3PdX7M2+RsTy 4I2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=m7TJj5Nsr7e2H/YfmZt25uBxrUAbjXLqqwNfw8vmDpc=; fh=k7GiACuoPAwa7nYHqvAgn0hSjZ1rLwG5/s20O8kgTps=; b=XPVO3Rhbd9p8aLBtVxNo/+eTvopSiDMMM5lSJovSBNrJedba7DF7k1TKKmJd3EvoZK 5anKL7hQvGI5b4ez65WxG7vpv26tbtriWq6Q0kRNskmf5d6JYUL6q+pFIDwyUm6B6Oy+ M7KtaMKCljmnn1PFCH+kTKATH0ZiCRqGqipHXdgcxJWlDY6N/ZiI4scKdBm7tLlyMW4Y +n1jL8m1DaWTyoU5JMNUdqBrrhjxGEYfNGjBnyyar7WhjtOFqKqSSmxnNW5Qzqucm3sh aURvZvsrdhdIRh/fp0wPSCDb/6QzbMgraXNbrJEpT+Ttg0qddIqT91jawDy92vHYkdXQ GL0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=FQgCtM44; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-213087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213087-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-798abd1cafesi145424285a.472.2024.06.13.07.23.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 07:23:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=FQgCtM44; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-213087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213087-linux.lists.archive=gmail.com@vger.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5FE331C243D7 for ; Thu, 13 Jun 2024 11:23:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB448142E8E; Thu, 13 Jun 2024 11:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="FQgCtM44" Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 4DEFF14388E for ; Thu, 13 Jun 2024 11:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718277793; cv=none; b=JF+w/OGFX0crsjKvL6OpbTR/+PJgUGI0HYUim5QXT5esc/qONxe1mt2lye3unGIDnpPkQLtzUAKEtcByGVA7wBdqr1TbchUEymqNWJjj9gzxUb2XoAWDC9xwpDeuVFskEBd70PJKP95PqbB0i0Y5K+XNQtWz9NZB/wVJ3Pd9bY4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718277793; c=relaxed/simple; bh=jaoFXH8LP9UDt/CXkteKVcrj10H6yKq54b94OsUOCO0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=RzsLBhAxAJzEpO/I2MTKTU6SZWXRGvuE3rILkKBIQkJPTWjSE0xlA6FSp7IdNDFx6UTnddu1RvyF5OLMnnY251LCeI8J7oLcgZsoPAMZIWaWe1WsWTS/pZxETem/d21ku657trwzNha/GMNh/woMvFPAZM2T7OnwyghElOfTOX8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=FQgCtM44; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2ebe40673d8so8501341fa.3 for ; Thu, 13 Jun 2024 04:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718277789; x=1718882589; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=m7TJj5Nsr7e2H/YfmZt25uBxrUAbjXLqqwNfw8vmDpc=; b=FQgCtM44bXSTZHJrbNNJkSk+4Rr7/rofonrSgMvCtadOg3gPzDFd11roXcEB3QJOGL gfByedx/+patPvYFa8FGIaYsTXMSyxUBMzsHR9lfEd4tWEMFiw1xlsFxlM9oo3tKndig tPCi2qSqymVcNDoRycEFab7uxY+sjQzH1A+K6rN5sdX7OebH/rOLH/JeL8TsO4GWkWtQ jMUYwNkotuQTnzLV15d8e8bgI4Msl0UooEegthC2Pz6XUHk3kAAoihpsX0lL0Lpcg3KH Y7IIfPb/9pnKP2kmNw9T5VQWoDqJGt6b0AkMT42jzNErOiG9d5BgjRT26PZENhIbdmju ZHTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718277789; x=1718882589; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m7TJj5Nsr7e2H/YfmZt25uBxrUAbjXLqqwNfw8vmDpc=; b=NblIWBEXPQx3ABRrmYK5zemvrGUHqIjwxVhJWUyeZ4tSlUJoj+UF0tZJjtFMZguVVD S+WPmHuP1JvODjKpo9boLlsicvv6pnIkT5pQM6t/YiCRgg7o1FWSPgXDUpIqkoGm2ijF u0XfmjxLkoTvjbAtDSbUNsp09n6J7STd4sJelgzPpHcNqKN+8GVBGPDKJLksupQs6nCZ 3r8zSCppFMITaA/R1fQvAaEU8Wra+lKZS5g9v4aatRqgqRJQxAXSkeAY6BoYe8EcQjYm UnqlunmqNPZ/aFG4B0oDF/S+m6OtJzjdD710WvJ/POJjaO7DkGYENM2KuCrOTDD+KJaK rGZQ== X-Forwarded-Encrypted: i=1; AJvYcCWwtn3a69NeY1pwiMKJvtvKXd7fedXbeZMds5XbwsHhjSH7RZ9a2VHHBmKD0KkDqvZ9v3MTD59N0fabv7qRx/GT9E3S96E+KbMnPTX9 X-Gm-Message-State: AOJu0YzqsF5MNB+NNisHTk11V6DQt0fw4/aih8AjEW+YdDMdVAqIVUjG FHUy5uNYESCYcrg289akaRraniLq2x3IYsvKLcS1jfTWoXu9XZCoQ218kyzu//XVilcgqV8JGxn HfRdoIV7iQ5zIiqYnrzBg3ZqpdkcoZDyrAgnjFg== X-Received: by 2002:a05:6512:acb:b0:52c:8a37:6d06 with SMTP id 2adb3069b0e04-52c9a3b9b71mr3354441e87.10.1718277789443; Thu, 13 Jun 2024 04:23:09 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240613092830.15761-1-brgl@bgdev.pl> <20240613092830.15761-3-brgl@bgdev.pl> <2024061356-uptake-ideology-e57b@gregkh> In-Reply-To: <2024061356-uptake-ideology-e57b@gregkh> From: Bartosz Golaszewski Date: Thu, 13 Jun 2024 13:22:58 +0200 Message-ID: Subject: Re: [PATCH v8 2/2] misc: gpio-virtuser: new virtual testing driver for the GPIO API To: Greg Kroah-Hartman Cc: Linus Walleij , Jonathan Corbet , "Rafael J . Wysocki" , Arnd Bergmann , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jun 13, 2024 at 12:02=E2=80=AFPM Greg Kroah-Hartman wrote: > > On Thu, Jun 13, 2024 at 11:28:30AM +0200, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > > > The GPIO subsystem used to have a serious problem with undefined behavi= or > > and use-after-free bugs on hot-unplug of GPIO chips. This can be > > considered a corner-case by some as most GPIO controllers are enabled > > early in the boot process and live until the system goes down but most > > GPIO drivers do allow unbind over sysfs, many are loadable modules that > > can be (force) unloaded and there are also GPIO devices that can be > > dynamically detached, for instance CP2112 which is a USB GPIO expender. > > > > Bugs can be triggered both from user-space as well as by in-kernel user= s. > > We have the means of testing it from user-space via the character devic= e > > but the issues manifest themselves differently in the kernel. > > > > This is a proposition of adding a new virtual driver - a configurable > > GPIO consumer that can be configured over configfs (similarly to > > gpio-sim) or described on the device-tree. > > > > This driver is aimed as a helper in spotting any regressions in > > hot-unplug handling in GPIOLIB. > > > > Signed-off-by: Bartosz Golaszewski > > --- > > .../admin-guide/gpio/gpio-virtuser.rst | 176 ++ > > Documentation/admin-guide/gpio/index.rst | 1 + > > sysfs documentation needs to go in Documentation/ABI/ not in a random > .rst file where the tools that check this will not catch it. > This is a testing driver, not representing real hardware. Do we hold such modules to the same standard? > > MAINTAINERS | 8 + > > drivers/misc/Kconfig | 8 + > > drivers/misc/Makefile | 1 + > > drivers/misc/gpio-virtuser.c | 1790 +++++++++++++++++ > > Why not put this in drivers/gpio/? Why misc? > Because it's quite... well "misc". It's not a GPIO chip provider (drivers/gpio/ is for GPIO providers), it's only a GPIO consumer. It also has an interface that doesn't fit any particular subsystem. > > +Both attributes allow to read and set arrays of GPIO values. User must= pass > > +exactly the number of values that the array contains in the form of a = string > > +containing zeroes and ones representing inactive and active GPIO state= s > > +respectively. In this example: ``echo 11 > values``. > > sysfs is "one value per file", so why are there multiple values here? > > If you want to just use this for testing, and want to put whatever you > want in the files, just use debugfs, that's what it is there for, not > sysfs. > Debugfs doesn't allow me to attach attributes to a particular device which is what I want here. Bart > > +config GPIO_VIRTUSER > > + tristate "GPIO Virtual User Testing Module" > > + select CONFIGFS_FS > > + select IRQ_WORK > > + help > > + This enables the configurable, configfs-based virtual GPIO cons= umer > > + testing driver. > > + > > module name? > > And you need more documentation here, I have no idea what this means > when it shows up in a Kconfig help entry :( > > thanks, > > greg k-h