Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2352427ybe; Tue, 3 Sep 2019 11:33:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqNYIQqnyF+O1K0Lh1RwoNUG4HmGw40OGdyIuFoqtnN5tL3AyMGgulU9CWe2shDhXE/Neb X-Received: by 2002:a63:4c5a:: with SMTP id m26mr30959175pgl.270.1567535618108; Tue, 03 Sep 2019 11:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567535618; cv=none; d=google.com; s=arc-20160816; b=NTRaYkrCV8mihs/0AJaAbXbC0YmimVL8NcFqTAsOR3o2hAoWCPwuceyn/FiVy8cq8E ThT0hGTk66KtD5alAwz9i4DJrCGSyjpbeZsDNwp64+JO8OamhaaUkkS0ve4Kr5TQnHh0 /yhIQ2LnPolisW4/+X6WYx+mPxkuunP9fDfNjOl0MK2QzrXW4C9vnjr7aJy+JnK09sGP 5sDWqjHA6UGPvdhYXUWwbcQycJoHNH41bRC9eiaBgLa/awSkF8VoMdeGR5gh7Vxw1OmX A+I1zxt6MXAdNXo9zpWolBucbgHMlPChrQKes1d0DdY5K2cGnFQZtYoFDCY3heiPY5dh nT4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0gBUah+oV564d9y6Oeohlbbw5RLyMh8BqU2IyNrqsa8=; b=y+Qa0nP0+OqPXV1P7bQj8B+3T6HPF0rXAOGmm1y0DIwoVh3Fk6Czkj8Y73Z1At3KG9 r2ckpYyEXR5i6ni2aFFx5+7HKzjpnq1yeCPEqz9H6yJoKYduQuUOGmtC0jMxsPUaeD3a A81NRQreMdB7yGwrx9UpHcbRcKTS5xuSITKkzXJjMe3rbFAZ4bN6vUP7Hm/ze/zMvHzu a11qxEOST0A6g26xMXa8zaSf/uRVMqU8VmYQYS4xSx99A1BnjznpMnNyRzGOnPHYR1Vb yN+a8qqEddiJ4+P6MqCV34yx+T6lgasW2obtcHBmEeK0kMl1L7QlBLyefA2FOZ0ivfPZ /eFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s9d0jfli; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x188si8404876pfd.55.2019.09.03.11.33.21; Tue, 03 Sep 2019 11:33:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s9d0jfli; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726270AbfICScf (ORCPT + 99 others); Tue, 3 Sep 2019 14:32:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:47966 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725977AbfICScf (ORCPT ); Tue, 3 Sep 2019 14:32:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA2EF20828; Tue, 3 Sep 2019 18:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567535554; bh=jkqGLIjzZlBP8ZD7zxshQdo67YM0NVdk0TFH7QzG15I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=s9d0jflia/PLY0CpCVjU9z1Z0F0GVvm3dNgSdhJSLaq6Wu8sFSDR1yj1rW40z3UGT Uti7o5qkX2wt0RIArZu4aphafAIQObs88DqjvYiONNknTxUthUiecAqqacR2EEagKY gPgM34SROg3fJeGsyYRlzgV3G7QsgeZO4vfAJVvA= Date: Tue, 3 Sep 2019 20:32:31 +0200 From: Greg KH To: Jacek Anaszewski Cc: Akinobu Mita , linux-leds@vger.kernel.org, LKML , Pavel Machek , Dan Murphy Subject: Re: [PATCH] leds: remove PAGE_SIZE limit of /sys/class/leds//trigger Message-ID: <20190903183231.GA26562@kroah.com> References: <1567090164-6819-1-git-send-email-akinobu.mita@gmail.com> <6ebeedab-4a7f-14ea-d62e-9184e911047f@gmail.com> <20190902181207.GA18577@kroah.com> <1cd468a3-b6e5-a93b-739a-f30288318356@gmail.com> <20190902190843.GB25019@kroah.com> <20190903140719.GA9506@kroah.com> <52bef6f9-7d96-627b-069e-02b3ffa0559e@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <52bef6f9-7d96-627b-069e-02b3ffa0559e@gmail.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 03, 2019 at 08:18:36PM +0200, Jacek Anaszewski wrote: > On 9/3/19 4:21 PM, Akinobu Mita wrote: > > 2019年9月3日(火) 23:07 Greg KH : > >> > >> On Tue, Sep 03, 2019 at 10:55:40PM +0900, Akinobu Mita wrote: > >>> 2019年9月3日(火) 4:08 Greg KH : > >>>> > >>>> On Mon, Sep 02, 2019 at 08:47:02PM +0200, Jacek Anaszewski wrote: > >>>>> On 9/2/19 8:12 PM, Greg KH wrote: > >>>>>> On Sun, Sep 01, 2019 at 06:53:34PM +0200, Jacek Anaszewski wrote: > >>>>>>> Hi Akinobu, > >>>>>>> > >>>>>>> Thank you for the patch. > >>>>>>> > >>>>>>> I have one nit below but in general it looks good to me. > >>>>>>> I've tested it with 2000 mtd triggers (~14kB file size) > >>>>>>> and it worked flawlessly. > >>>>>>> > >>>>>>> Still, I would like to have ack from Greg for it. > >>>>>>> > >>>>>>> Adding Greg on Cc. > >>>>>>> > >>>>>>> On 8/29/19 4:49 PM, Akinobu Mita wrote: > >>>>>>>> Reading /sys/class/leds//trigger returns all available LED triggers. > >>>>>>>> However, the size of this file is limited to PAGE_SIZE because of the > >>>>>>>> limitation for sysfs attribute. > >>>>>>>> > >>>>>>>> Enabling LED CPU trigger on systems with thousands of CPUs easily hits > >>>>>>>> PAGE_SIZE limit, and makes it impossible to see all available LED triggers > >>>>>>>> and which trigger is currently activated. > >>>>>>>> > >>>>>>>> This converts /sys/class/leds//trigger to bin attribute and removes > >>>>>>>> the PAGE_SIZE limitation. > >>>>>> > >>>>>> But this is NOT a binary file. A sysfs binary file is used for when the > >>>>>> kernel passes data to or from hardware without any parsing of the data > >>>>>> by the kernel. > >>>>>> > >>>>>> You are not doing that here, you are abusing the "one value per file" > >>>>>> rule of sysfs so much that you are forced to work around the limitation > >>>>>> it put in place on purpose to keep you from doing stuff like this. > >>>>>> > >>>>>> Please fix this "correctly" by creating a new api that works properly > >>>>>> and just live with the fact that this file will never work correctly and > >>>>>> move everyone to use the new api instead. > >>>>>> > >>>>>> Don't keep on abusing the interface by workarounds like this, it is not > >>>>>> ok. > >>>>> > >>>>> In the message [0] you pledged to give us exception for that, provided > >>>>> it will be properly documented in the code. I suppose you now object > >>>>> because the patch does not meet that condition. > >>>> > >>>> Well, I honestly don't remember writing that email, but it was 5 months > >>>> and many thousands of emails ago :) > >>>> > >>>> Also, you all didn't document the heck out of this. So no, I really do > >>>> not want to see this patch accepted as-is. > >>>> > >>>>> Provided that will be fixed, can we count on your ack for the > >>>>> implementation of the solution you proposed? :-) > >>>> > >>>> Let's see the patch that actually implements what I suggested first :) > >>> > >>> I'd propose introducing a new procfs file (/proc/led-triggers) and new > >>> /sys/class/leds//current-trigger api. > >>> > >>> Reading /proc/led-triggers file shows all available triggers. > >>> This violates "one value per file", but it's a procfs file. > >> > >> No, procfs files are ONLY for process-related things. Don't keep the > >> insanity of this file format by just moving it out of sysfs and into > >> procfs :) > > > > I see. > > > > How about creating one file or directory for each led-trigger in > > /sys/kernel/led-triggers directory? > > > > e.g. > > > > $ ls /sys/kernel/led-triggers > > audio-micmute ide-disk phy0assoc > > audio-mute kbd-altgrlock phy0radio > > ... > > hidpp_battery_3-full panic > I think that /sys/class/leds/triggers would better reflect the reality. > After all LED Trigger core belongs to LED subsystem. Yes, sorry, I missed that "kernel" directory, that's a non-starter, use the class directory as that is what it is for here. greg k-h