kernel: fix kernel warning and network issue in the backlog threading patch
Fixes enabling it early during the boot Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
		| @@ -30,7 +30,17 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | |||||||
|  #endif |  #endif | ||||||
| --- a/net/core/dev.c | --- a/net/core/dev.c | ||||||
| +++ b/net/core/dev.c | +++ b/net/core/dev.c | ||||||
| @@ -4574,7 +4574,7 @@ static int rps_ipi_queued(struct softnet | @@ -4558,7 +4558,8 @@ static void rps_trigger_softirq(void *da | ||||||
|  |  { | ||||||
|  |  	struct softnet_data *sd = data; | ||||||
|  |   | ||||||
|  | -	____napi_schedule(sd, &sd->backlog); | ||||||
|  | +	if (!__test_and_set_bit(NAPI_STATE_SCHED, &sd->backlog.state)) | ||||||
|  | +		____napi_schedule(sd, &sd->backlog); | ||||||
|  |  	sd->received_rps++; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | @@ -4574,7 +4575,7 @@ static int rps_ipi_queued(struct softnet | ||||||
|  #ifdef CONFIG_RPS |  #ifdef CONFIG_RPS | ||||||
|  	struct softnet_data *mysd = this_cpu_ptr(&softnet_data); |  	struct softnet_data *mysd = this_cpu_ptr(&softnet_data); | ||||||
|   |   | ||||||
| @@ -39,7 +49,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | |||||||
|  		sd->rps_ipi_next = mysd->rps_ipi_list; |  		sd->rps_ipi_next = mysd->rps_ipi_list; | ||||||
|  		mysd->rps_ipi_list = sd; |  		mysd->rps_ipi_list = sd; | ||||||
|   |   | ||||||
| @@ -5755,6 +5755,8 @@ static DEFINE_PER_CPU(struct work_struct | @@ -5755,6 +5756,8 @@ static DEFINE_PER_CPU(struct work_struct | ||||||
|  /* Network device is going away, flush any packets still pending */ |  /* Network device is going away, flush any packets still pending */ | ||||||
|  static void flush_backlog(struct work_struct *work) |  static void flush_backlog(struct work_struct *work) | ||||||
|  { |  { | ||||||
| @@ -48,7 +58,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | |||||||
|  	struct sk_buff *skb, *tmp; |  	struct sk_buff *skb, *tmp; | ||||||
|  	struct softnet_data *sd; |  	struct softnet_data *sd; | ||||||
|   |   | ||||||
| @@ -5770,9 +5772,18 @@ static void flush_backlog(struct work_st | @@ -5770,9 +5773,18 @@ static void flush_backlog(struct work_st | ||||||
|  			input_queue_head_incr(sd); |  			input_queue_head_incr(sd); | ||||||
|  		} |  		} | ||||||
|  	} |  	} | ||||||
| @@ -67,7 +77,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | |||||||
|  	skb_queue_walk_safe(&sd->process_queue, skb, tmp) { |  	skb_queue_walk_safe(&sd->process_queue, skb, tmp) { | ||||||
|  		if (skb->dev->reg_state == NETREG_UNREGISTERING) { |  		if (skb->dev->reg_state == NETREG_UNREGISTERING) { | ||||||
|  			__skb_unlink(skb, &sd->process_queue); |  			__skb_unlink(skb, &sd->process_queue); | ||||||
| @@ -5780,7 +5791,18 @@ static void flush_backlog(struct work_st | @@ -5780,7 +5792,18 @@ static void flush_backlog(struct work_st | ||||||
|  			input_queue_head_incr(sd); |  			input_queue_head_incr(sd); | ||||||
|  		} |  		} | ||||||
|  	} |  	} | ||||||
| @@ -86,7 +96,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | |||||||
|  } |  } | ||||||
|   |   | ||||||
|  static bool flush_required(int cpu) |  static bool flush_required(int cpu) | ||||||
| @@ -6463,6 +6485,7 @@ static int process_backlog(struct napi_s | @@ -6463,6 +6486,7 @@ static int process_backlog(struct napi_s | ||||||
|   |   | ||||||
|  		local_irq_disable(); |  		local_irq_disable(); | ||||||
|  		rps_lock(sd); |  		rps_lock(sd); | ||||||
| @@ -94,7 +104,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | |||||||
|  		if (skb_queue_empty(&sd->input_pkt_queue)) { |  		if (skb_queue_empty(&sd->input_pkt_queue)) { | ||||||
|  			/* |  			/* | ||||||
|  			 * Inline a custom version of __napi_complete(). |  			 * Inline a custom version of __napi_complete(). | ||||||
| @@ -6472,7 +6495,8 @@ static int process_backlog(struct napi_s | @@ -6472,7 +6496,8 @@ static int process_backlog(struct napi_s | ||||||
|  			 * We can use a plain write instead of clear_bit(), |  			 * We can use a plain write instead of clear_bit(), | ||||||
|  			 * and we dont need an smp_mb() memory barrier. |  			 * and we dont need an smp_mb() memory barrier. | ||||||
|  			 */ |  			 */ | ||||||
| @@ -104,7 +114,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | |||||||
|  			again = false; |  			again = false; | ||||||
|  		} else { |  		} else { | ||||||
|  			skb_queue_splice_tail_init(&sd->input_pkt_queue, |  			skb_queue_splice_tail_init(&sd->input_pkt_queue, | ||||||
| @@ -6889,6 +6913,57 @@ int dev_set_threaded(struct net_device * | @@ -6889,6 +6914,57 @@ int dev_set_threaded(struct net_device * | ||||||
|  } |  } | ||||||
|  EXPORT_SYMBOL(dev_set_threaded); |  EXPORT_SYMBOL(dev_set_threaded); | ||||||
|   |   | ||||||
| @@ -162,7 +172,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | |||||||
|  void netif_napi_add(struct net_device *dev, struct napi_struct *napi, |  void netif_napi_add(struct net_device *dev, struct napi_struct *napi, | ||||||
|  		    int (*poll)(struct napi_struct *, int), int weight) |  		    int (*poll)(struct napi_struct *, int), int weight) | ||||||
|  { |  { | ||||||
| @@ -11367,6 +11442,9 @@ static int dev_cpu_dead(unsigned int old | @@ -11367,6 +11443,9 @@ static int dev_cpu_dead(unsigned int old | ||||||
|  	raise_softirq_irqoff(NET_TX_SOFTIRQ); |  	raise_softirq_irqoff(NET_TX_SOFTIRQ); | ||||||
|  	local_irq_enable(); |  	local_irq_enable(); | ||||||
|   |   | ||||||
| @@ -172,6 +182,14 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> | |||||||
|  #ifdef CONFIG_RPS |  #ifdef CONFIG_RPS | ||||||
|  	remsd = oldsd->rps_ipi_list; |  	remsd = oldsd->rps_ipi_list; | ||||||
|  	oldsd->rps_ipi_list = NULL; |  	oldsd->rps_ipi_list = NULL; | ||||||
|  | @@ -11706,6 +11785,7 @@ static int __init net_dev_init(void) | ||||||
|  |  		sd->cpu = i; | ||||||
|  |  #endif | ||||||
|  |   | ||||||
|  | +		INIT_LIST_HEAD(&sd->backlog.poll_list); | ||||||
|  |  		init_gro_hash(&sd->backlog); | ||||||
|  |  		sd->backlog.poll = process_backlog; | ||||||
|  |  		sd->backlog.weight = weight_p; | ||||||
| --- a/net/core/sysctl_net_core.c | --- a/net/core/sysctl_net_core.c | ||||||
| +++ b/net/core/sysctl_net_core.c | +++ b/net/core/sysctl_net_core.c | ||||||
| @@ -28,6 +28,7 @@ static int int_3600 = 3600; | @@ -28,6 +28,7 @@ static int int_3600 = 3600; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Felix Fietkau
					Felix Fietkau