File tree Expand file tree Collapse file tree 5 files changed +14
-2
lines changed Expand file tree Collapse file tree 5 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ int idxd_wq_enable(struct idxd_wq *wq)
196196 }
197197
198198 wq -> state = IDXD_WQ_ENABLED ;
199+ set_bit (wq -> id , idxd -> wq_enable_map );
199200 dev_dbg (dev , "WQ %d enabled\n" , wq -> id );
200201 return 0 ;
201202}
@@ -223,6 +224,7 @@ int idxd_wq_disable(struct idxd_wq *wq, bool reset_config)
223224
224225 if (reset_config )
225226 idxd_wq_disable_cleanup (wq );
227+ clear_bit (wq -> id , idxd -> wq_enable_map );
226228 wq -> state = IDXD_WQ_DISABLED ;
227229 dev_dbg (dev , "WQ %d disabled\n" , wq -> id );
228230 return 0 ;
Original file line number Diff line number Diff line change 1111#include <linux/idr.h>
1212#include <linux/pci.h>
1313#include <linux/ioasid.h>
14+ #include <linux/bitmap.h>
1415#include <linux/perf_event.h>
1516#include <uapi/linux/idxd.h>
1617#include "registers.h"
@@ -299,6 +300,7 @@ struct idxd_device {
299300 int rdbuf_limit ;
300301 int nr_rdbufs ; /* non-reserved read buffers */
301302 unsigned int wqcfg_size ;
303+ unsigned long * wq_enable_map ;
302304
303305 union sw_err_reg sw_err ;
304306 wait_queue_head_t cmd_waitq ;
Original file line number Diff line number Diff line change @@ -151,6 +151,12 @@ static int idxd_setup_wqs(struct idxd_device *idxd)
151151 if (!idxd -> wqs )
152152 return - ENOMEM ;
153153
154+ idxd -> wq_enable_map = bitmap_zalloc_node (idxd -> max_wqs , GFP_KERNEL , dev_to_node (dev ));
155+ if (!idxd -> wq_enable_map ) {
156+ kfree (idxd -> wqs );
157+ return - ENOMEM ;
158+ }
159+
154160 for (i = 0 ; i < idxd -> max_wqs ; i ++ ) {
155161 wq = kzalloc_node (sizeof (* wq ), GFP_KERNEL , dev_to_node (dev ));
156162 if (!wq ) {
Original file line number Diff line number Diff line change @@ -49,11 +49,12 @@ static void idxd_device_reinit(struct work_struct *work)
4949 goto out ;
5050
5151 for (i = 0 ; i < idxd -> max_wqs ; i ++ ) {
52- struct idxd_wq * wq = idxd -> wqs [i ];
52+ if (test_bit (i , idxd -> wq_enable_map )) {
53+ struct idxd_wq * wq = idxd -> wqs [i ];
5354
54- if (wq -> state == IDXD_WQ_ENABLED ) {
5555 rc = idxd_wq_enable (wq );
5656 if (rc < 0 ) {
57+ clear_bit (i , idxd -> wq_enable_map );
5758 dev_warn (dev , "Unable to re-enable wq %s\n" ,
5859 dev_name (wq_confdev (wq )));
5960 }
Original file line number Diff line number Diff line change @@ -1405,6 +1405,7 @@ static void idxd_conf_device_release(struct device *dev)
14051405 struct idxd_device * idxd = confdev_to_idxd (dev );
14061406
14071407 kfree (idxd -> groups );
1408+ bitmap_free (idxd -> wq_enable_map );
14081409 kfree (idxd -> wqs );
14091410 kfree (idxd -> engines );
14101411 ida_free (& idxd_ida , idxd -> id );
You can’t perform that action at this time.
0 commit comments