Linux-LEDs Archive on lore.kernel.org
 help / color / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
	linux-leds@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Pavel Machek <pavel@ucw.cz>, Dan Murphy <dmurphy@ti.com>
Subject: Re: [PATCH] leds: remove PAGE_SIZE limit of /sys/class/leds/<led>/trigger
Date: Tue, 3 Sep 2019 20:32:31 +0200
Message-ID: <20190903183231.GA26562@kroah.com> (raw)
In-Reply-To: <52bef6f9-7d96-627b-069e-02b3ffa0559e@gmail.com>

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 <gregkh@linuxfoundation.org>:
> >>
> >> On Tue, Sep 03, 2019 at 10:55:40PM +0900, Akinobu Mita wrote:
> >>> 2019年9月3日(火) 4:08 Greg KH <gregkh@linuxfoundation.org>:
> >>>>
> >>>> 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/<led>/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/<led>/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/<led>/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

  reply index

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29 14:49 Akinobu Mita
2019-09-01 16:53 ` Jacek Anaszewski
2019-09-02 18:12   ` Greg KH
2019-09-02 18:47     ` Jacek Anaszewski
2019-09-02 19:08       ` Greg KH
2019-09-03 13:55         ` Akinobu Mita
2019-09-03 14:07           ` Greg KH
2019-09-03 14:21             ` Akinobu Mita
2019-09-03 14:44               ` Greg KH
2019-09-03 18:18               ` Jacek Anaszewski
2019-09-03 18:32                 ` Greg KH [this message]
2019-09-03 20:30           ` Pavel Machek
2019-09-01 17:23 ` Pavel Machek
2019-09-12 14:39 [PATCH] leds: fix /sys/class/leds/<led>/trigger Akinobu Mita
2019-09-12 14:39 ` [PATCH] leds: remove PAGE_SIZE limit of /sys/class/leds/<led>/trigger Akinobu Mita
2019-09-12 17:15   ` Jacek Anaszewski
2019-09-13  0:34     ` Akinobu Mita
2019-09-13  5:00       ` Greg Kroah-Hartman

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190903183231.GA26562@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=akinobu.mita@gmail.com \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-LEDs Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-leds/0 linux-leds/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-leds linux-leds/ https://lore.kernel.org/linux-leds \
		linux-leds@vger.kernel.org linux-leds@archiver.kernel.org
	public-inbox-index linux-leds

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-leds


AGPL code for this site: git clone https://public-inbox.org/ public-inbox