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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05DAEC433F5 for ; Thu, 7 Oct 2021 06:59:36 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B0876101B for ; Thu, 7 Oct 2021 06:59:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3B0876101B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bewilderbeest.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HQ2Hn6Brmz3cBZ for ; Thu, 7 Oct 2021 17:59:33 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=bewilderbeest.net header.i=@bewilderbeest.net header.a=rsa-sha256 header.s=thorn header.b=d5tMm6wv; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=bewilderbeest.net (client-ip=71.19.156.171; helo=thorn.bewilderbeest.net; envelope-from=zev@bewilderbeest.net; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=bewilderbeest.net header.i=@bewilderbeest.net header.a=rsa-sha256 header.s=thorn header.b=d5tMm6wv; dkim-atps=neutral Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [71.19.156.171]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HQ2CR5vX6z2yWH for ; Thu, 7 Oct 2021 17:55:46 +1100 (AEDT) Received: from hatter.bewilderbeest.net (71-212-29-146.tukw.qwest.net [71.212.29.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id B8E35F6; Wed, 6 Oct 2021 23:55:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1633589744; bh=1Wnuz/Ot9jwM2pt8JkasgbgyztxL92GcR7WxaDAQsMg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=d5tMm6wvON4Ka6HD3KVoHPZnEeSqOGW5/n2AeX6jFtaU8leqXHQu8oT2UNmuqcqJ4 Wafw5+Mp3KeyDx0m0jaTH/2vxMlBW4NyWO+VwuEL3Z23iy37CM0GGSTQkSRk0qH2ql ZdtANJGsy5ExgP78bBO9UQQ46SzJQ+lw8Y5iTrMw= Date: Wed, 6 Oct 2021 23:55:38 -0700 From: Zev Weiss To: Greg Kroah-Hartman Subject: Re: [PATCH 1/9] sysfs: add sysfs_remove_bin_file_self() function Message-ID: References: <20211007000954.30621-1-zev@bewilderbeest.net> <20211007000954.30621-2-zev@bewilderbeest.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, "Rafael J. Wysocki" , Daniel Vetter , openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Jeremy Kerr , Heiner Kallweit Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" On Wed, Oct 06, 2021 at 11:12:37PM PDT, Greg Kroah-Hartman wrote: >On Wed, Oct 06, 2021 at 10:58:59PM -0700, Zev Weiss wrote: >> On Wed, Oct 06, 2021 at 10:23:33PM PDT, Greg Kroah-Hartman wrote: >> > On Wed, Oct 06, 2021 at 05:09:46PM -0700, Zev Weiss wrote: >> > > This is simply the bin_attribute analog to sysfs_remove_file_self(). >> > >> > No, no binary sysfs file should be triggering a remove. >> > >> > binary sysfs files are "pass-through-only" from userspace to hardware, >> > the kernel should not be even knowing what is read/written to them. >> > >> > What do you think this is needed for? >> > >> >> So, I initially set out to be able to activate/deactivate specific DT nodes >> at runtime by using the device-tree "reserved" status as defined in the spec >> (but not currently used anywhere in the kernel) to mean essentially "create >> a device for this but don't bind a driver to it" (leaving it to userspace to >> invoke bind/unbind or similar), and added initial support for the specific >> driver I'm concerned with at the moment (aspeed-smc) -- that was the >> previous patch series linked in the cover letter of this one. >> >> In the discussion of that series, Rob suggested as an alternate approach: >> >> > Another possibility is making 'status' writeable from userspace. It is >> > just a sysfs file. >> >> That seemed sort of appealing to me, and this seemed like the most obvious >> way to go about implementing it. Given that DT properties are binary >> attributes, I gather you'd consider that a non-starter though? > >Why would a text attribute of "status" be a binary sysfs file? That >feels really wrong as again, binary sysfs files are not supposed to be >parsed or handled by the kernel at all, they are only a pass-through. > Well, at present all device tree properties are binary sysfs files regardless of type, and from a brief git history check it appears they've been that way since DT sysfs support was introduced in commit 75b57ecf9d1d ("of: Make device nodes kobjects so they show up in sysfs"). On the surface it seems like it would make sense for string properties like status to be text files instead of binary, but (a) looking at some of the discussion that preceded that patch, it sounds like there may be some ambiguity regarding what the "true" types of different properties actually are [0], and (b) changing the contents of those files from e.g. "okay\0" to "okay\n" seems likely to lead to broken userspace, so I'd guess it's probably moot anyway. [0] https://lore.kernel.org/lkml/1363801579.17680.3.camel@pasglop/ Zev