linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Pilcher <arequipeno@gmail.com>
To: axboe@kernel.dk, pavel@ucw.cz
Cc: linux-leds@vger.kernel.org, linux-block@vger.kernel.org,
	linux@vger.kernel.org, gregkh@linuxfoundation.org,
	kabel@kernel.org
Subject: [PATCH 00/18] Introduce block device LED trigger
Date: Fri,  3 Sep 2021 15:45:30 -0500	[thread overview]
Message-ID: <20210903204548.2745354-1-arequipeno@gmail.com> (raw)

This patch series adds a new "blkdev" LED trigger for disk (or other block
device) activity LEDs.

It has the following functionality.

* Supports all types of block devices, including virtual devices
  (unlike the existing disk trigger which only works with ATA devices).

* LEDs can be configured to show read activity, write activity, or both.

* Supports multiple devices and multiple LEDs in arbitrary many-to-many
  configurations.  For example, it is possible to configure multiple
  devices with device-specific read activity LEDs and a shared write
  activity LED.  (See Documentation/leds/ledtrig-blkdev.rst in the first
  patch.)

* Doesn't add any overhead in the I/O path.  Like the netdev LED trigger,
  it periodically checks the configured devices for activity and blinks
  its LEDs as appropriate.

* Blink duration (per LED) and interval between activity checks (global)
  are configurable.

* Requires minimal changes to the block subsystem.

  - Adds 1 pointer to struct gendisk,

  - Adds (inline function) call in device_add_disk() to ensure that the
    pointer is initialized to NULL (as protection against any drivers
    that allocate a gendisk themselves and don't use kzalloc()), and

  - Adds call in del_gendisk() to remove a device from the trigger when
    that device is being removed.

  These changes are all in patch #4, "block: Add block device LED trigger
  integrations."

* The trigger can be mostly built as a module.

  When the trigger is modular, a small portion is built in to provide a
  "stub" function which can be called from del_gendisk().  The stub calls
  into the modular code via a function pointer when needed.  The trigger
  also needs the ability to find gendisk's by name, which requires access
  to the un-exported block_class and disk_type symbols.

NOTES:

* This patch series applies cleanly to the linux-block and linux-next
  (20210903) trees.  All patches other than the block subsystem patch
  (patch #4) apply cleanly to the linux-leds tree.

* All patches compile (modulo warnings) with the trigger disabled,
  modular, or built-in.

Ian Pilcher (18):
  docs: Add block device (blkdev) LED trigger documentation
  ledtrig-blkdev: Add build infra for block device LED trigger
  ledtrig-blkdev: Add function placeholders needed by block changes
  block: Add block device LED trigger integrations
  ledtrig-blkdev: Implement functions called from block subsystem
  ledtrig-blkdev: Add function to get gendisk by name
  ledtrig-blkdev: Add constants, data types, and global variables
  ledtrig-blkdev: Add miscellaneous helper functions
  ledtrig-blkdev: Periodically check devices for activity & blink LEDs
  ledtrig-blkdev: Add function to associate the trigger with an LED
  ledtrig-blkdev: Add function to associate a device with an LED
  ledtrig-blkdev: Add function to remove LED/device association
  ledtrig-blkdev: Add function to disassociate a device from all LEDs
  ledtrig-blkdev: Add function to disassociate an LED from the trigger
  ledtrig-blkdev: Add sysfs attributes to [un]link LEDs & devices
  ledtrig-blkdev: Add blink_time & interval sysfs attributes
  ledtrig-blkdev: Add mode (read/write/rw) sysfs attributue
  ledtrig-blkdev: Add initialization & exit functions

 Documentation/ABI/testing/sysfs-block         |   9 +
 .../testing/sysfs-class-led-trigger-blkdev    |  48 ++
 Documentation/leds/index.rst                  |   1 +
 Documentation/leds/ledtrig-blkdev.rst         | 144 ++++
 block/genhd.c                                 |   4 +
 drivers/leds/trigger/Kconfig                  |  18 +
 drivers/leds/trigger/Makefile                 |   2 +
 drivers/leds/trigger/ledtrig-blkdev-core.c    |  78 ++
 drivers/leds/trigger/ledtrig-blkdev.c         | 767 ++++++++++++++++++
 drivers/leds/trigger/ledtrig-blkdev.h         |  27 +
 include/linux/genhd.h                         |   3 +
 include/linux/leds.h                          |  20 +
 12 files changed, 1121 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-class-led-trigger-blkdev
 create mode 100644 Documentation/leds/ledtrig-blkdev.rst
 create mode 100644 drivers/leds/trigger/ledtrig-blkdev-core.c
 create mode 100644 drivers/leds/trigger/ledtrig-blkdev.c
 create mode 100644 drivers/leds/trigger/ledtrig-blkdev.h

-- 
2.31.1


             reply	other threads:[~2021-09-03 20:45 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 20:45 Ian Pilcher [this message]
2021-09-03 20:45 ` [PATCH 01/18] docs: Add block device (blkdev) LED trigger documentation Ian Pilcher
2021-09-04  6:29   ` Pavel Machek
2021-09-05 14:49     ` Ian Pilcher
2021-09-05 18:42       ` Pavel Machek
2021-09-05 23:13         ` Ian Pilcher
2021-09-03 20:45 ` [PATCH 02/18] ledtrig-blkdev: Add build infra for block device LED trigger Ian Pilcher
2021-09-03 20:45 ` [PATCH 03/18] ledtrig-blkdev: Add function placeholders needed by block changes Ian Pilcher
2021-09-04 16:57   ` kernel test robot
2021-09-03 20:45 ` [PATCH 04/18] block: Add block device LED trigger integrations Ian Pilcher
2021-09-03 20:45 ` [PATCH 05/18] ledtrig-blkdev: Implement functions called from block subsystem Ian Pilcher
2021-09-03 20:45 ` [PATCH 06/18] ledtrig-blkdev: Add function to get gendisk by name Ian Pilcher
2021-09-03 20:45 ` [PATCH 07/18] ledtrig-blkdev: Add constants, data types, and global variables Ian Pilcher
2021-09-03 20:45 ` [PATCH 08/18] ledtrig-blkdev: Add miscellaneous helper functions Ian Pilcher
2021-09-04  6:00   ` Greg KH
2021-09-04 22:43     ` Ian Pilcher
2021-09-03 20:45 ` [PATCH 09/18] ledtrig-blkdev: Periodically check devices for activity & blink LEDs Ian Pilcher
2021-09-04  6:01   ` Greg KH
2021-09-05 14:39     ` Ian Pilcher
2021-09-05 14:51       ` Greg KH
2021-09-05 14:56         ` Ian Pilcher
2021-09-05 15:12           ` Greg KH
2021-09-05 16:55             ` Eric Biggers
2021-09-03 20:45 ` [PATCH 10/18] ledtrig-blkdev: Add function to associate the trigger with an LED Ian Pilcher
2021-09-03 20:45 ` [PATCH 11/18] ledtrig-blkdev: Add function to associate a device " Ian Pilcher
2021-09-03 20:45 ` [PATCH 12/18] ledtrig-blkdev: Add function to remove LED/device association Ian Pilcher
2021-09-03 20:45 ` [PATCH 13/18] ledtrig-blkdev: Add function to disassociate a device from all LEDs Ian Pilcher
2021-09-03 20:45 ` [PATCH 14/18] ledtrig-blkdev: Add function to disassociate an LED from the trigger Ian Pilcher
2021-09-03 20:45 ` [PATCH 15/18] ledtrig-blkdev: Add sysfs attributes to [un]link LEDs & devices Ian Pilcher
2021-09-04  5:57   ` Greg KH
2021-09-04 21:28     ` Ian Pilcher
2021-09-04  5:59   ` Greg KH
2021-09-04 22:35     ` Ian Pilcher
2021-09-05 14:51       ` Greg KH
2021-09-05 15:33         ` Ian Pilcher
2021-09-05 16:43           ` Greg KH
2021-09-03 20:45 ` [PATCH 16/18] ledtrig-blkdev: Add blink_time & interval sysfs attributes Ian Pilcher
2021-09-03 20:45 ` [PATCH 17/18] ledtrig-blkdev: Add mode (read/write/rw) sysfs attributue Ian Pilcher
2021-09-04  5:57   ` Greg KH
2021-09-04 21:01     ` Ian Pilcher
2021-09-05 14:50       ` Greg KH
2021-09-03 20:45 ` [PATCH 18/18] ledtrig-blkdev: Add initialization & exit functions Ian Pilcher
2021-09-04  6:35 ` [PATCH 00/18] Introduce block device LED trigger Pavel Machek

Reply instructions:

You may reply publicly 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=20210903204548.2745354-1-arequipeno@gmail.com \
    --to=arequipeno@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=gregkh@linuxfoundation.org \
    --cc=kabel@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).