pastebin - collaborative debugging tool
eckelmann.kpaste.net RSS


jobrechner kworker flexible rt-prio patch
Posted by Anonymous on Wed 9th Jan 2019 12:50
raw | new post

  1. Lukas Wunner March 23, 2017, 10:36 a.m. UTC
  2. Commit 14af60b6fb3b ("spi/pl022: Add high priority message pump
  3. support") extended the pl022 driver to optionally run the message pump
  4. kworker thread with realtime priority, subject to a bool set by the
  5. platform.
  6.  
  7. Commit ffbbdd21329f ("spi: create a message queueing infrastructure")
  8. moved a large portion of pl022 to generic code, making the realtime
  9. priority support available to other drivers.
  10.  
  11. However the priority is set to MAX_RT_PRIO - 1, higher than most IRQs
  12. and identical to the CPU timer clock threads.  This seems excessive so
  13. make the priority configurable.
  14.  
  15. Cc: Mark Brown <broonie@kernel.org>
  16. Cc: Chris Blair <chris.blair@stericsson.com>
  17. Cc: Linus Walleij <linus.walleij@linaro.org>
  18. Cc: Mathias Duckeck <m.duckeck@kunbus.de>
  19. Signed-off-by: Lukas Wunner <lukas@wunner.de>
  20. ---
  21. drivers/spi/spi-pl022.c | 4 +++-
  22.  drivers/spi/spi.c       | 8 +++++---
  23.  include/linux/spi/spi.h | 4 ++--
  24.  3 files changed, 10 insertions(+), 6 deletions(-)
  25. Comments
  26. Linus Walleij March 23, 2017, 1:10 p.m. UTC | #1
  27. On Thu, Mar 23, 2017 at 11:36 AM, Lukas Wunner <lukas@wunner.de> wrote:
  28.  
  29. > Commit 14af60b6fb3b ("spi/pl022: Add high priority message pump
  30. > support") extended the pl022 driver to optionally run the message pump
  31. > kworker thread with realtime priority, subject to a bool set by the
  32. > platform.
  33. >
  34. > Commit ffbbdd21329f ("spi: create a message queueing infrastructure")
  35. > moved a large portion of pl022 to generic code, making the realtime
  36. > priority support available to other drivers.
  37. >
  38. > However the priority is set to MAX_RT_PRIO - 1, higher than most IRQs
  39. > and identical to the CPU timer clock threads.  This seems excessive so
  40. > make the priority configurable.
  41. >
  42. > Cc: Mark Brown <broonie@kernel.org>
  43. > Cc: Chris Blair <chris.blair@stericsson.com>
  44. > Cc: Linus Walleij <linus.walleij@linaro.org>
  45. > Cc: Mathias Duckeck <m.duckeck@kunbus.de>
  46. > Signed-off-by: Lukas Wunner <lukas@wunner.de>
  47.  
  48. Looks reasonable to me.
  49. Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
  50.  
  51. Yours,
  52. Linus Walleij
  53. --
  54. To unsubscribe from this list: send the line "unsubscribe linux-spi" in
  55. the body of a message to majordomo@vger.kernel.org
  56. More majordomo info at  http://vger.kernel.org/majordomo-info.html
  57. Patch
  58. diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
  59. index f7f7ba17b40e..f66cc3b6d489 100644
  60. --- a/drivers/spi/spi-pl022.c
  61. +++ b/drivers/spi/spi-pl022.c
  62. @@ -2153,9 +2153,11 @@  static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
  63.         master->auto_runtime_pm = true;
  64.         master->transfer_one_message = pl022_transfer_one_message;
  65.         master->unprepare_transfer_hardware = pl022_unprepare_transfer_hardware;
  66. -       master->rt = platform_info->rt;
  67.         master->dev.of_node = dev->of_node;
  68.  
  69. +       if (platform_info->rt)
  70. +               master->rt_prio = MAX_RT_PRIO - 1;
  71. +
  72.         if (platform_info->num_chipselect && platform_info->chipselects) {
  73.                 for (i = 0; i < num_cs; i++)
  74.                         pl022->chipselects[i] = platform_info->chipselects[i];
  75. diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
  76. index f699ea530b88..3220f6d87a66 100644
  77. --- a/drivers/spi/spi.c
  78. +++ b/drivers/spi/spi.c
  79. @@ -1286,7 +1286,7 @@  static void spi_pump_messages(struct kthread_work *work)
  80.  
  81.  static int spi_init_queue(struct spi_master *master)
  82.  {
  83. -       struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };
  84. +       struct sched_param param = { .sched_priority = master->rt_prio };
  85.  
  86.         master->running = false;
  87.         master->busy = false;
  88. @@ -1308,9 +1308,10 @@  static int spi_init_queue(struct spi_master *master)
  89.          * request and the scheduling of the message pump thread. Without this
  90.          * setting the message pump thread will remain at default priority.
  91.          */
  92. -       if (master->rt) {
  93. +       if (master->rt_prio >= 0 && master->rt_prio < MAX_RT_PRIO) {
  94.                 dev_info(&master->dev,
  95. -                       "will run message pump with realtime priority\n");
  96. +                        "will run message pump with realtime priority %d\n",
  97. +                        master->rt_prio);
  98.                 sched_setscheduler(master->kworker_task, SCHED_FIFO, &param);
  99.         }
  100.  
  101. @@ -1862,6 +1863,7 @@  struct spi_master *spi_alloc_master(struct device *dev, unsigned size)
  102.  
  103.         device_initialize(&master->dev);
  104.         master->bus_num = -1;
  105. +       master->rt_prio = -1;
  106.         master->num_chipselect = 1;
  107.         master->dev.class = &spi_master_class;
  108.         master->dev.parent = dev;
  109. diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
  110. index 5a8c4b24f2dc..5ec405669668 100644
  111. --- a/include/linux/spi/spi.h
  112. +++ b/include/linux/spi/spi.h
  113. @@ -341,11 +341,11 @@  static inline void spi_unregister_driver(struct spi_driver *sdrv)
  114.   * @xfer_completion: used by core transfer_one_message()
  115.   * @busy: message pump is busy
  116.   * @running: message pump is running
  117. - * @rt: whether this queue is set to run as a realtime task
  118.   * @auto_runtime_pm: the core should ensure a runtime PM reference is held
  119.   *                   while the hardware is prepared, using the parent
  120.   *                   device for the spidev
  121.   * @max_dma_len: Maximum length of a DMA transfer for the device.
  122. + * @rt_prio: realtime priority of the message pump (-1 to use default prio)
  123.   * @prepare_transfer_hardware: a message will soon arrive from the queue
  124.   *     so the subsystem requests the driver to prepare the transfer hardware
  125.   *     by issuing this call
  126. @@ -522,12 +522,12 @@  struct spi_master {
  127.         bool                            idling;
  128.         bool                            busy;
  129.         bool                            running;
  130. -       bool                            rt;
  131.         bool                            auto_runtime_pm;
  132.         bool                            cur_msg_prepared;
  133.         bool                            cur_msg_mapped;
  134.         struct completion               xfer_completion;
  135.         size_t                          max_dma_len;
  136. +       int                             rt_prio;
  137.  
  138.         int (*prepare_transfer_hardware)(struct spi_master *master);
  139.         int (*transfer_one_message)(struct spi_master *master,

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}





All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at