Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1321874
| From | Gregory CLEMENT <gregory.clement@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH net 1/6] net: mvneta: Fix for_each_present_cpu usage |
| Date | 2016-01-29 17:30 +0100 |
| Message-ID | <qWk5R-5O3-45@gated-at.bofh.it> (permalink) |
| References | <qWk5P-5O3-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This patch convert the for_each_present in on_each_cpu, instead of
applying on the present cpus it will be applied only on the online cpus.
This fix a bug reported on
http://thread.gmane.org/gmane.linux.ports.arm.kernel/468173.
Using the macro on_each_cpu (instead of a for_each_* loop) also ensures
that all the calls will be done all at once.
Fixes: f86428854480 ("net: mvneta: Statically assign queues to CPUs")
Reported-by: Stefan Roese <stefan.roese@gmail.com>
Suggested-by: Jisheng Zhang <jszhang@marvell.com>
Suggested-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
drivers/net/ethernet/marvell/mvneta.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 662c2ee268c7..90ff5c7e19ea 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2564,7 +2564,7 @@ static void mvneta_start_dev(struct mvneta_port *pp)
mvneta_port_enable(pp);
/* Enable polling on the port */
- for_each_present_cpu(cpu) {
+ for_each_online_cpu(cpu) {
struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
napi_enable(&port->napi);
@@ -2589,7 +2589,7 @@ static void mvneta_stop_dev(struct mvneta_port *pp)
phy_stop(pp->phy_dev);
- for_each_present_cpu(cpu) {
+ for_each_online_cpu(cpu) {
struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
napi_disable(&port->napi);
@@ -3057,13 +3057,11 @@ err_cleanup_rxqs:
static int mvneta_stop(struct net_device *dev)
{
struct mvneta_port *pp = netdev_priv(dev);
- int cpu;
mvneta_stop_dev(pp);
mvneta_mdio_remove(pp);
unregister_cpu_notifier(&pp->cpu_notifier);
- for_each_present_cpu(cpu)
- smp_call_function_single(cpu, mvneta_percpu_disable, pp, true);
+ on_each_cpu(mvneta_percpu_disable, pp, true);
free_percpu_irq(dev->irq, pp->ports);
mvneta_cleanup_rxqs(pp);
mvneta_cleanup_txqs(pp);
--
2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH net 0/6] mvneta fixes for SMP Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-01-29 17:30 +0100
[PATCH net 4/6] net: mvneta: Modify the queue related fields from each cpu Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-01-29 17:30 +0100
[PATCH net 5/6] net: mvneta: The mvneta_percpu_elect function should be atomic Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-01-29 17:30 +0100
Re: [PATCH net 5/6] net: mvneta: The mvneta_percpu_elect function should be atomic David Miller <davem@davemloft.net> - 2016-01-30 05:40 +0100
Re: [PATCH net 5/6] net: mvneta: The mvneta_percpu_elect function should be atomic Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-02-01 11:30 +0100
[PATCH net 6/6] net: mvneta: Fix race condition during stopping Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-01-29 17:30 +0100
[PATCH net 1/6] net: mvneta: Fix for_each_present_cpu usage Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-01-29 17:30 +0100
csiph-web