Skip to content

Commit c7846dc

Browse files
committed
[SQUASH] Drop threaded NAPI
This reverts the following commits 89ce123 qcacld-3.0: Enable threaded NAPI ad53cf0 msm: ipa3: Enable threaded NAPI 59918fb net: fix hangup on napi_disable for threaded napi 158caad net: fix race between napi kthread mode and busy poll 2a51a72 net: add sysfs attribute to control napi threaded mode 2a39a03 net: implement threaded-able napi poll loop support dd75fc8 net: extract napi poll functionality to __napi_poll() * Causes kernel panics at very random times, and for a very minimal/non-existent performance improvement Signed-off-by: Yahya Wessam <yahyawessam2002@gmail.com>
1 parent 9fb96f3 commit c7846dc

File tree

8 files changed

+27
-272
lines changed

8 files changed

+27
-272
lines changed

Documentation/ABI/testing/sysfs-class-net

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,3 @@ Contact: netdev@vger.kernel.org
259259
Description:
260260
Symbolic link to the PHY device this network device is attached
261261
to.
262-
263-
What: /sys/class/net/<iface>/threaded
264-
Date: Jan 2021
265-
KernelVersion: 5.12
266-
Contact: netdev@vger.kernel.org
267-
Description:
268-
Boolean value to control the threaded mode per device. User could
269-
set this value to enable/disable threaded mode for all napi
270-
belonging to this device, without the need to do device up/down.
271-
272-
Possible values:
273-
== ==================================
274-
0 threaded mode disabled for this dev
275-
1 threaded mode enabled for this dev
276-
== ==================================

drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,10 +1141,8 @@ static int __ipa_wwan_open(struct net_device *dev)
11411141
reinit_completion(&wwan_ptr->resource_granted_completion);
11421142
wwan_ptr->device_status = WWAN_DEVICE_ACTIVE;
11431143

1144-
if (ipa3_rmnet_res.ipa_napi_enable) {
1145-
dev_set_threaded(dev, true);
1144+
if (ipa3_rmnet_res.ipa_napi_enable)
11461145
napi_enable(&(wwan_ptr->napi));
1147-
}
11481146
return 0;
11491147
}
11501148

drivers/staging/qca-wifi-host-cmn/hif/src/hif_exec.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,6 @@ static struct hif_exec_context *hif_exec_napi_create(uint32_t scale)
698698
qdf_net_if_create_dummy_if((struct qdf_net_if *)&ctx->netdev);
699699
netif_napi_add(&(ctx->netdev), &(ctx->napi), hif_exec_poll,
700700
QCA_NAPI_BUDGET);
701-
dev_set_threaded(&(ctx->netdev), true);
702701
napi_enable(&ctx->napi);
703702

704703
return &ctx->exec_ctx;

drivers/staging/qca-wifi-host-cmn/hif/src/hif_napi.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ static void hif_init_rx_thread_napi(struct qca_napi_info *napii)
8282
init_dummy_netdev(&napii->rx_thread_netdev);
8383
netif_napi_add(&napii->rx_thread_netdev, &napii->rx_thread_napi,
8484
hif_rxthread_napi_poll, 64);
85-
dev_set_threaded(&napii->rx_thread_netdev, true);
8685
napi_enable(&napii->rx_thread_napi);
8786
}
8887

@@ -683,7 +682,6 @@ int hif_napi_event(struct hif_opaque_softc *hif_ctx, enum qca_napi_event event,
683682
napi = &(napii->napi);
684683
NAPI_DEBUG("%s: enabling NAPI %d",
685684
__func__, i);
686-
dev_set_threaded(napi->dev, true);
687685
napi_enable(napi);
688686
}
689687
}
@@ -695,7 +693,6 @@ int hif_napi_event(struct hif_opaque_softc *hif_ctx, enum qca_napi_event event,
695693
napi = &(napii->napi);
696694
NAPI_DEBUG("%s: disabling NAPI %d",
697695
__func__, i);
698-
dev_set_threaded(napi->dev, false);
699696
napi_disable(napi);
700697
/* in case it is affined, remove it */
701698
qdf_dev_set_irq_affinity(napii->irq,

drivers/staging/qcacld-3.0/core/dp/txrx3.0/dp_rx_thread.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,6 @@ static void dp_rx_tm_thread_napi_init(struct dp_rx_thread *rx_thread)
591591
init_dummy_netdev(&rx_thread->netdev);
592592
netif_napi_add(&rx_thread->netdev, &rx_thread->napi,
593593
dp_rx_tm_thread_napi_poll, 64);
594-
dev_set_threaded(&rx_thread->netdev, true);
595594
napi_enable(&rx_thread->napi);
596595
}
597596

include/linux/netdevice.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ struct napi_struct {
338338
struct list_head dev_list;
339339
struct hlist_node napi_hash_node;
340340
unsigned int napi_id;
341-
struct task_struct *thread;
342341
};
343342

344343
enum {
@@ -349,8 +348,6 @@ enum {
349348
NAPI_STATE_HASHED, /* In NAPI hash (busy polling possible) */
350349
NAPI_STATE_NO_BUSY_POLL,/* Do not add in napi_hash, no busy polling */
351350
NAPI_STATE_IN_BUSY_POLL,/* sk_busy_loop() owns this NAPI */
352-
NAPI_STATE_THREADED, /* The poll is performed inside its own thread*/
353-
NAPI_STATE_SCHED_THREADED,/* Napi is currently scheduled in threaded mode */
354351
};
355352

356353
enum {
@@ -361,8 +358,6 @@ enum {
361358
NAPIF_STATE_HASHED = BIT(NAPI_STATE_HASHED),
362359
NAPIF_STATE_NO_BUSY_POLL = BIT(NAPI_STATE_NO_BUSY_POLL),
363360
NAPIF_STATE_IN_BUSY_POLL = BIT(NAPI_STATE_IN_BUSY_POLL),
364-
NAPIF_STATE_THREADED = BIT(NAPI_STATE_THREADED),
365-
NAPIF_STATE_SCHED_THREADED = BIT(NAPI_STATE_SCHED_THREADED),
366361
};
367362

368363
enum gro_result {
@@ -484,8 +479,6 @@ static inline bool napi_complete(struct napi_struct *n)
484479
return napi_complete_done(n, 0);
485480
}
486481

487-
int dev_set_threaded(struct net_device *dev, bool threaded);
488-
489482
/**
490483
* napi_hash_del - remove a NAPI from global table
491484
* @napi: NAPI context
@@ -509,7 +502,20 @@ bool napi_hash_del(struct napi_struct *napi);
509502
*/
510503
void napi_disable(struct napi_struct *n);
511504

512-
void napi_enable(struct napi_struct *n);
505+
/**
506+
* napi_enable - enable NAPI scheduling
507+
* @n: NAPI context
508+
*
509+
* Resume NAPI from being scheduled on this context.
510+
* Must be paired with napi_disable.
511+
*/
512+
static inline void napi_enable(struct napi_struct *n)
513+
{
514+
BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
515+
smp_mb__before_atomic();
516+
clear_bit(NAPI_STATE_SCHED, &n->state);
517+
clear_bit(NAPI_STATE_NPSVC, &n->state);
518+
}
513519

514520
/**
515521
* napi_synchronize - wait until NAPI is not running
@@ -1687,8 +1693,6 @@ enum netdev_priv_flags {
16871693
* switch driver and used to set the phys state of the
16881694
* switch port.
16891695
*
1690-
* @threaded: napi threaded mode is enabled
1691-
*
16921696
* @macsec_ops: MACsec offloading ops
16931697
*
16941698
* FIXME: cleanup struct net_device such that network protocol info
@@ -1968,7 +1972,6 @@ struct net_device {
19681972
struct lock_class_key *qdisc_tx_busylock;
19691973
struct lock_class_key *qdisc_running_key;
19701974
bool proto_down;
1971-
unsigned threaded:1;
19721975

19731976
#if IS_ENABLED(CONFIG_MACSEC)
19741977
/* MACsec management functions */

0 commit comments

Comments
 (0)