Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp34421lqs; Thu, 13 Jun 2024 03:02:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUwi7VU8a6TeUUbtRWnFpupGjjWi53/4myZ/3WD57poSAO+jtLt7Z+2veMgizAyxhsAD89vMb/hWeTJr5LDqksakMX7oycRpnyivmjRCA== X-Google-Smtp-Source: AGHT+IHH+nOJyySTeUKNqei/aq+WPgz2+f2ZOIClYY21DYw4I9lYmFczJFOv78vcAXL1rKhUfHyg X-Received: by 2002:a05:620a:4494:b0:796:3804:cbe2 with SMTP id af79cd13be357-797f5f00da6mr484167885a.16.1718272944816; Thu, 13 Jun 2024 03:02:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718272944; cv=pass; d=google.com; s=arc-20160816; b=ilPG3wP3tYq4tNWL94v/6vYOm50/aRKnLtNmxFUxdcRROjiw9wNoqQHHBNWFEpsZ7x 4kUfGKgn359RTTQh+vcUO54sEuhaEtxDngxKO//ilvE89TosUs90qremDmLvB7IMSoRy dJzZyyrQkOIY+m5Z+mUV9s9BPtiDihsHjceWxlHn6CLvXFtC43YN0tMXOxQfuqlxkVdQ pJIdrUc4JMD/r2erF5PEdlUio+26NRNr9p4Gv3U9174qtqvKnX0RRnp3XvNmNANwhjbX 8VOUaagQBYXk69RM/hPAQQhJjzluq+ke2OKiylxNr5K2mXk//tcHWcN8/cJpsigzJHM7 MhdQ== 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:message-id:subject:cc :to:from:date:dkim-signature; bh=zKau1KjkMSQ/1nFThMd2XS7ekYRJsljKdOvEL2mDw4A=; fh=HbDxCUsF55TEaSwlwvkWjDRhphKHFfneJemqYsyllVQ=; b=gZQdqV1yNfpCTcCUAU8kBvrwdXC5RrRKqtqKv160BGcFcA4DNXuKrRuwBruPlKgwtT eiyBYO8RPTF1v5jrshpGe8aviLivaP2RD46rpCSwGaPQ4MGfUThAGQfNGr8Utq7LTgx6 nyxmu8GXChLiDUDzY8RPtO2SqovuZuSBrBckhSV/XNco037qq6YsFiCl34+/aED30sBp catpPyg+oyTfz2hQIiHk2R+IXbnCo8Ioe4VtBGHYJeLhtVJFPEiJJLxuew4QDs5aW7h6 71+wwNXbwZOV7DecfLMBW9AG8K2FNgVHyhfhePPErFvidp0w9LRNrsg6bNLWdCh/uRQp 8MKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h5h1xFfn; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-212993-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212993-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-798abe590c0si105055385a.573.2024.06.13.03.02.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 03:02:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212993-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h5h1xFfn; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-212993-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212993-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.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 8A4331C22AEC for ; Thu, 13 Jun 2024 10:02:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E1C211411E5; Thu, 13 Jun 2024 10:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="h5h1xFfn" 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 E5B6E13E3E4; Thu, 13 Jun 2024 10:02:14 +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=1718272935; cv=none; b=EgTkNKJRe1iGwKIeBynIgayfOwUvhqNU8oXG7NVHWhqedC/Y2+8cAi5ScHDPD7Aac/WbKZ+s2by+vQ7Hy25Enr/c5iKjV9+yBAHcDHLKve7UUarsVFnAPWcK5fNMWefEBkCy8/F05MriNlGhVPqbD/gHz+ekPCDEdRTAR2icTD4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718272935; c=relaxed/simple; bh=iCniW7uaePOA1dtXDeiFM/T5PxkRK0/PIhc03+M6UJs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VDhTR4oaz8gqiXjrQsR/EI9LJg5vWBI7RBpVk6X/O72HR6Ri2ZE79x4RcUG1fnrjnEFShisCyGaS0QhhnM8JnIa8IZwojrVr73B3135VtFXsSF9iys7zm43TxlPNhpIlUEkN7DlBwkpiGKnL7SuQDwXL/qhE3zSbJq8Pk9cODMc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=h5h1xFfn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04449C2BBFC; Thu, 13 Jun 2024 10:02:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718272934; bh=iCniW7uaePOA1dtXDeiFM/T5PxkRK0/PIhc03+M6UJs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h5h1xFfnpqdoYAX5OMp1h61xokPvKyrgu5pu422puTTxN2YhTSI2v0Shv/Y3+4wV6 Dj0U91kSaCPvN1AkbmJ/GyOlCUAXr6NkuHeIH+ZjKfYJfPFa19cMTv3qbLK7f6jb4W ePTXHeELzSZk+Dr7orn5UDGZN3vOC/FfRJOAE4sk= Date: Thu, 13 Jun 2024 12:02:11 +0200 From: Greg Kroah-Hartman To: Bartosz Golaszewski 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 Subject: Re: [PATCH v8 2/2] misc: gpio-virtuser: new virtual testing driver for the GPIO API Message-ID: <2024061356-uptake-ideology-e57b@gregkh> References: <20240613092830.15761-1-brgl@bgdev.pl> <20240613092830.15761-3-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: <20240613092830.15761-3-brgl@bgdev.pl> 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 behavior > 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 users. > We have the means of testing it from user-space via the character device > 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. > 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? > +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 states > +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. > +config GPIO_VIRTUSER > + tristate "GPIO Virtual User Testing Module" > + select CONFIGFS_FS > + select IRQ_WORK > + help > + This enables the configurable, configfs-based virtual GPIO consumer > + 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