[openwrt/openwrt] kernel: ltq-vectoring: Avoid flush_scheduled_work() usage

LEDE Commits lede-commits at lists.infradead.org
Sat Jun 8 14:27:23 PDT 2024


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/c7648273d08daba9a51c3130004fba8d106af538

commit c7648273d08daba9a51c3130004fba8d106af538
Author: Martin Schiller <ms at dev.tdt.de>
AuthorDate: Tue May 14 12:52:07 2024 +0200

    kernel: ltq-vectoring: Avoid flush_scheduled_work() usage
    
    This fixes some compile warnings for linux 6.6.
    
    Flushing system-wide workqueues is dangerous and will be forbidden.
    Replace system_wq with local vectoring_wq.
    
    Signed-off-by: Martin Schiller <ms at dev.tdt.de>
---
 .../lantiq/ltq-vectoring/patches/200-compat.patch  | 24 ++++++++++++++--------
 .../300-fix-compilation-warning-stack-limit.patch  |  6 +++---
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/package/kernel/lantiq/ltq-vectoring/patches/200-compat.patch b/package/kernel/lantiq/ltq-vectoring/patches/200-compat.patch
index 04c6880dde..ea68981961 100644
--- a/package/kernel/lantiq/ltq-vectoring/patches/200-compat.patch
+++ b/package/kernel/lantiq/ltq-vectoring/patches/200-compat.patch
@@ -17,7 +17,7 @@
  
  /*
   * ####################################
-@@ -118,9 +121,11 @@ struct erb_head {
+@@ -118,9 +121,13 @@ struct erb_head {
  
  static struct notifier_block g_netdev_event_handler_nb = {0};
  static struct net_device *g_ptm_net_dev = NULL;
@@ -25,12 +25,14 @@
 +static uint32_t vector_prio = TC_PRIO_CONTROL;
  static int g_dbg_enable = 0;
  
++static struct workqueue_struct *vectoring_wq;
++
 +DECLARE_WORK(xmit_work, xmit_work_handler);
 +struct sk_buff_head xmit_queue;
  
  
  /*
-@@ -129,9 +134,16 @@ static int g_dbg_enable = 0;
+@@ -129,9 +136,16 @@ static int g_dbg_enable = 0;
   * ####################################
   */
  
@@ -48,7 +50,7 @@
      struct sk_buff *skb_list = NULL;
      struct sk_buff *skb;
      struct erb_head *erb;
-@@ -179,7 +191,6 @@ static int mei_dsm_cb_func(unsigned int
+@@ -179,7 +193,6 @@ static int mei_dsm_cb_func(unsigned int
          }
      }
  
@@ -56,7 +58,7 @@
      sent_size = 0;
      segment_code = 0;
      while ( (skb = skb_list) != NULL ) {
-@@ -197,24 +208,23 @@ static int mei_dsm_cb_func(unsigned int
+@@ -197,24 +210,23 @@ static int mei_dsm_cb_func(unsigned int
              segment_code |= 0xC0;
          ((struct erb_head *)skb->data)->segment_code = segment_code;
  
@@ -75,7 +77,7 @@
 -        if ( rc == 0 )
 -            rc = ret;
 +        skb_queue_tail(&xmit_queue, skb);
-+        schedule_work(&xmit_work);
++        queue_work(vectoring_wq, &xmit_work);
  
          segment_code++;
      }
@@ -88,7 +90,7 @@
  }
  static void ltq_vectoring_priority(uint32_t priority)
  {
-@@ -242,7 +252,7 @@ static int netdev_event_handler(struct n
+@@ -242,7 +254,7 @@ static int netdev_event_handler(struct n
          return NOTIFY_DONE;
  
      netif = netdev_notifier_info_to_dev(netdev);
@@ -97,10 +99,12 @@
          return NOTIFY_DONE;
  
      g_ptm_net_dev = event == NETDEV_REGISTER ? netif : NULL;
-@@ -438,8 +448,10 @@ static int __init vectoring_init(void)
+@@ -438,8 +450,12 @@ static int __init vectoring_init(void)
  				0,
  				&g_proc_file_vectoring_dbg_seq_fops);
  
++    vectoring_wq = alloc_workqueue("vectoring", 0, 0);
++
 +    skb_queue_head_init(&xmit_queue);
 +
      register_netdev_event_handler();
@@ -109,11 +113,13 @@
      if ( g_ptm_net_dev != NULL )
          dev_put(g_ptm_net_dev);
  
-@@ -459,6 +471,8 @@ static void __exit vectoring_exit(void)
+@@ -459,6 +475,10 @@ static void __exit vectoring_exit(void)
  
      unregister_netdev_event_handler();
  
-+    flush_scheduled_work();
++    flush_workqueue(vectoring_wq);
++
++    destroy_workqueue(vectoring_wq);
 +
      remove_proc_entry("driver/vectoring", NULL);
  }
diff --git a/package/kernel/lantiq/ltq-vectoring/patches/300-fix-compilation-warning-stack-limit.patch b/package/kernel/lantiq/ltq-vectoring/patches/300-fix-compilation-warning-stack-limit.patch
index 434d7d830d..e0b7b0d4a8 100644
--- a/package/kernel/lantiq/ltq-vectoring/patches/300-fix-compilation-warning-stack-limit.patch
+++ b/package/kernel/lantiq/ltq-vectoring/patches/300-fix-compilation-warning-stack-limit.patch
@@ -1,6 +1,6 @@
 --- a/src/vectoring/ifxmips_vectoring.c
 +++ b/src/vectoring/ifxmips_vectoring.c
-@@ -298,7 +298,7 @@ static int proc_write_dbg(struct file *f
+@@ -300,7 +300,7 @@ static int proc_write_dbg(struct file *f
          DBG_ENABLE_MASK_ALL
      };
  
@@ -9,7 +9,7 @@
      char *p;
  
      int len, rlen;
-@@ -306,6 +306,10 @@ static int proc_write_dbg(struct file *f
+@@ -308,6 +308,10 @@ static int proc_write_dbg(struct file *f
      int f_enable = 0;
      int i;
  
@@ -20,7 +20,7 @@
      len = count < sizeof(str) ? count : sizeof(str) - 1;
      rlen = len - copy_from_user(str, buf, len);
      while ( rlen && str[rlen - 1] <= ' ' )
-@@ -365,6 +369,8 @@ static int proc_write_dbg(struct file *f
+@@ -367,6 +371,8 @@ static int proc_write_dbg(struct file *f
          }
      }
  




More information about the lede-commits mailing list