aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-14 02:30:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-14 02:30:30 -0500
commit5e30025a319910695f5010dc0fb53a23299da14d (patch)
tree4292bcf78de221c7de1774ccf5ad0ac5a9315c26 /net
parent7971e23a66c94f1b9bd2d64a3e86dfbfa8c60121 (diff)
parent90d3839b90fe379557dae4a44735a6af78f42885 (diff)
Merge branch 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core locking changes from Ingo Molnar: "The biggest changes: - add lockdep support for seqcount/seqlocks structures, this unearthed both bugs and required extra annotation. - move the various kernel locking primitives to the new kernel/locking/ directory" * 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (21 commits) block: Use u64_stats_init() to initialize seqcounts locking/lockdep: Mark __lockdep_count_forward_deps() as static lockdep/proc: Fix lock-time avg computation locking/doc: Update references to kernel/mutex.c ipv6: Fix possible ipv6 seqlock deadlock cpuset: Fix potential deadlock w/ set_mems_allowed seqcount: Add lockdep functionality to seqcount/seqlock structures net: Explicitly initialize u64_stats_sync structures for lockdep locking: Move the percpu-rwsem code to kernel/locking/ locking: Move the lglocks code to kernel/locking/ locking: Move the rwsem code to kernel/locking/ locking: Move the rtmutex code to kernel/locking/ locking: Move the semaphore core to kernel/locking/ locking: Move the spinlock code to kernel/locking/ locking: Move the lockdep code to kernel/locking/ locking: Move the mutex code to kernel/locking/ hung_task debugging: Add tracepoint to report the hang x86/locking/kconfig: Update paravirt spinlock Kconfig description lockstat: Report avg wait and hold times lockdep, x86/alternatives: Drop ancient lockdep fixup message ...
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan_dev.c9
-rw-r--r--net/bridge/br_device.c7
-rw-r--r--net/ipv4/af_inet.c14
-rw-r--r--net/ipv4/ip_tunnel.c8
-rw-r--r--net/ipv6/addrconf.c14
-rw-r--r--net/ipv6/af_inet6.c14
-rw-r--r--net/ipv6/ip6_gre.c15
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/ip6_tunnel.c7
-rw-r--r--net/ipv6/sit.c15
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c25
-rw-r--r--net/openvswitch/datapath.c6
-rw-r--r--net/openvswitch/vport.c8
13 files changed, 138 insertions, 6 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 8db1b985dbf1..762896ebfcf5 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -539,7 +539,7 @@ static const struct net_device_ops vlan_netdev_ops;
539static int vlan_dev_init(struct net_device *dev) 539static int vlan_dev_init(struct net_device *dev)
540{ 540{
541 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; 541 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
542 int subclass = 0; 542 int subclass = 0, i;
543 543
544 netif_carrier_off(dev); 544 netif_carrier_off(dev);
545 545
@@ -593,6 +593,13 @@ static int vlan_dev_init(struct net_device *dev)
593 if (!vlan_dev_priv(dev)->vlan_pcpu_stats) 593 if (!vlan_dev_priv(dev)->vlan_pcpu_stats)
594 return -ENOMEM; 594 return -ENOMEM;
595 595
596 for_each_possible_cpu(i) {
597 struct vlan_pcpu_stats *vlan_stat;
598 vlan_stat = per_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats, i);
599 u64_stats_init(&vlan_stat->syncp);
600 }
601
602
596 return 0; 603 return 0;
597} 604}
598 605
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index e6b7fecb3af1..f00cfd2a0143 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -88,11 +88,18 @@ out:
88static int br_dev_init(struct net_device *dev) 88static int br_dev_init(struct net_device *dev)
89{ 89{
90 struct net_bridge *br = netdev_priv(dev); 90 struct net_bridge *br = netdev_priv(dev);
91 int i;
91 92
92 br->stats = alloc_percpu(struct br_cpu_netstats); 93 br->stats = alloc_percpu(struct br_cpu_netstats);
93 if (!br->stats) 94 if (!br->stats)
94 return -ENOMEM; 95 return -ENOMEM;
95 96
97 for_each_possible_cpu(i) {
98 struct br_cpu_netstats *br_dev_stats;
99 br_dev_stats = per_cpu_ptr(br->stats, i);
100 u64_stats_init(&br_dev_stats->syncp);
101 }
102
96 return 0; 103 return 0;
97} 104}
98 105
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 68af9aac91d0..70011e029ac1 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1503,6 +1503,7 @@ int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align)
1503 ptr[0] = __alloc_percpu(mibsize, align); 1503 ptr[0] = __alloc_percpu(mibsize, align);
1504 if (!ptr[0]) 1504 if (!ptr[0])
1505 return -ENOMEM; 1505 return -ENOMEM;
1506
1506#if SNMP_ARRAY_SZ == 2 1507#if SNMP_ARRAY_SZ == 2
1507 ptr[1] = __alloc_percpu(mibsize, align); 1508 ptr[1] = __alloc_percpu(mibsize, align);
1508 if (!ptr[1]) { 1509 if (!ptr[1]) {
@@ -1547,6 +1548,8 @@ static const struct net_protocol icmp_protocol = {
1547 1548
1548static __net_init int ipv4_mib_init_net(struct net *net) 1549static __net_init int ipv4_mib_init_net(struct net *net)
1549{ 1550{
1551 int i;
1552
1550 if (snmp_mib_init((void __percpu **)net->mib.tcp_statistics, 1553 if (snmp_mib_init((void __percpu **)net->mib.tcp_statistics,
1551 sizeof(struct tcp_mib), 1554 sizeof(struct tcp_mib),
1552 __alignof__(struct tcp_mib)) < 0) 1555 __alignof__(struct tcp_mib)) < 0)
@@ -1555,6 +1558,17 @@ static __net_init int ipv4_mib_init_net(struct net *net)
1555 sizeof(struct ipstats_mib), 1558 sizeof(struct ipstats_mib),
1556 __alignof__(struct ipstats_mib)) < 0) 1559 __alignof__(struct ipstats_mib)) < 0)
1557 goto err_ip_mib; 1560 goto err_ip_mib;
1561
1562 for_each_possible_cpu(i) {
1563 struct ipstats_mib *af_inet_stats;
1564 af_inet_stats = per_cpu_ptr(net->mib.ip_statistics[0], i);
1565 u64_stats_init(&af_inet_stats->syncp);
1566#if SNMP_ARRAY_SZ == 2
1567 af_inet_stats = per_cpu_ptr(net->mib.ip_statistics[1], i);
1568 u64_stats_init(&af_inet_stats->syncp);
1569#endif
1570 }
1571
1558 if (snmp_mib_init((void __percpu **)net->mib.net_statistics, 1572 if (snmp_mib_init((void __percpu **)net->mib.net_statistics,
1559 sizeof(struct linux_mib), 1573 sizeof(struct linux_mib),
1560 __alignof__(struct linux_mib)) < 0) 1574 __alignof__(struct linux_mib)) < 0)
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 63a6d6d6b875..caf01176a5e4 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -976,13 +976,19 @@ int ip_tunnel_init(struct net_device *dev)
976{ 976{
977 struct ip_tunnel *tunnel = netdev_priv(dev); 977 struct ip_tunnel *tunnel = netdev_priv(dev);
978 struct iphdr *iph = &tunnel->parms.iph; 978 struct iphdr *iph = &tunnel->parms.iph;
979 int err; 979 int i, err;
980 980
981 dev->destructor = ip_tunnel_dev_free; 981 dev->destructor = ip_tunnel_dev_free;
982 dev->tstats = alloc_percpu(struct pcpu_tstats); 982 dev->tstats = alloc_percpu(struct pcpu_tstats);
983 if (!dev->tstats) 983 if (!dev->tstats)
984 return -ENOMEM; 984 return -ENOMEM;
985 985
986 for_each_possible_cpu(i) {
987 struct pcpu_tstats *ipt_stats;
988 ipt_stats = per_cpu_ptr(dev->tstats, i);
989 u64_stats_init(&ipt_stats->syncp);
990 }
991
986 err = gro_cells_init(&tunnel->gro_cells, dev); 992 err = gro_cells_init(&tunnel->gro_cells, dev);
987 if (err) { 993 if (err) {
988 free_percpu(dev->tstats); 994 free_percpu(dev->tstats);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 542d09561ed6..5658d9d51637 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -271,10 +271,24 @@ static void addrconf_mod_dad_timer(struct inet6_ifaddr *ifp,
271 271
272static int snmp6_alloc_dev(struct inet6_dev *idev) 272static int snmp6_alloc_dev(struct inet6_dev *idev)
273{ 273{
274 int i;
275
274 if (snmp_mib_init((void __percpu **)idev->stats.ipv6, 276 if (snmp_mib_init((void __percpu **)idev->stats.ipv6,
275 sizeof(struct ipstats_mib), 277 sizeof(struct ipstats_mib),
276 __alignof__(struct ipstats_mib)) < 0) 278 __alignof__(struct ipstats_mib)) < 0)
277 goto err_ip; 279 goto err_ip;
280
281 for_each_possible_cpu(i) {
282 struct ipstats_mib *addrconf_stats;
283 addrconf_stats = per_cpu_ptr(idev->stats.ipv6[0], i);
284 u64_stats_init(&addrconf_stats->syncp);
285#if SNMP_ARRAY_SZ == 2
286 addrconf_stats = per_cpu_ptr(idev->stats.ipv6[1], i);
287 u64_stats_init(&addrconf_stats->syncp);
288#endif
289 }
290
291
278 idev->stats.icmpv6dev = kzalloc(sizeof(struct icmpv6_mib_device), 292 idev->stats.icmpv6dev = kzalloc(sizeof(struct icmpv6_mib_device),
279 GFP_KERNEL); 293 GFP_KERNEL);
280 if (!idev->stats.icmpv6dev) 294 if (!idev->stats.icmpv6dev)
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 6468bda1f2b9..ff75313f27a8 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -714,6 +714,8 @@ static void ipv6_packet_cleanup(void)
714 714
715static int __net_init ipv6_init_mibs(struct net *net) 715static int __net_init ipv6_init_mibs(struct net *net)
716{ 716{
717 int i;
718
717 if (snmp_mib_init((void __percpu **)net->mib.udp_stats_in6, 719 if (snmp_mib_init((void __percpu **)net->mib.udp_stats_in6,
718 sizeof(struct udp_mib), 720 sizeof(struct udp_mib),
719 __alignof__(struct udp_mib)) < 0) 721 __alignof__(struct udp_mib)) < 0)
@@ -726,6 +728,18 @@ static int __net_init ipv6_init_mibs(struct net *net)
726 sizeof(struct ipstats_mib), 728 sizeof(struct ipstats_mib),
727 __alignof__(struct ipstats_mib)) < 0) 729 __alignof__(struct ipstats_mib)) < 0)
728 goto err_ip_mib; 730 goto err_ip_mib;
731
732 for_each_possible_cpu(i) {
733 struct ipstats_mib *af_inet6_stats;
734 af_inet6_stats = per_cpu_ptr(net->mib.ipv6_statistics[0], i);
735 u64_stats_init(&af_inet6_stats->syncp);
736#if SNMP_ARRAY_SZ == 2
737 af_inet6_stats = per_cpu_ptr(net->mib.ipv6_statistics[1], i);
738 u64_stats_init(&af_inet6_stats->syncp);
739#endif
740 }
741
742
729 if (snmp_mib_init((void __percpu **)net->mib.icmpv6_statistics, 743 if (snmp_mib_init((void __percpu **)net->mib.icmpv6_statistics,
730 sizeof(struct icmpv6_mib), 744 sizeof(struct icmpv6_mib),
731 __alignof__(struct icmpv6_mib)) < 0) 745 __alignof__(struct icmpv6_mib)) < 0)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index bf4a9a084de5..8acb28621f9c 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1252,6 +1252,7 @@ static void ip6gre_tunnel_setup(struct net_device *dev)
1252static int ip6gre_tunnel_init(struct net_device *dev) 1252static int ip6gre_tunnel_init(struct net_device *dev)
1253{ 1253{
1254 struct ip6_tnl *tunnel; 1254 struct ip6_tnl *tunnel;
1255 int i;
1255 1256
1256 tunnel = netdev_priv(dev); 1257 tunnel = netdev_priv(dev);
1257 1258
@@ -1269,6 +1270,13 @@ static int ip6gre_tunnel_init(struct net_device *dev)
1269 if (!dev->tstats) 1270 if (!dev->tstats)
1270 return -ENOMEM; 1271 return -ENOMEM;
1271 1272
1273 for_each_possible_cpu(i) {
1274 struct pcpu_tstats *ip6gre_tunnel_stats;
1275 ip6gre_tunnel_stats = per_cpu_ptr(dev->tstats, i);
1276 u64_stats_init(&ip6gre_tunnel_stats->syncp);
1277 }
1278
1279
1272 return 0; 1280 return 0;
1273} 1281}
1274 1282
@@ -1449,6 +1457,7 @@ static void ip6gre_netlink_parms(struct nlattr *data[],
1449static int ip6gre_tap_init(struct net_device *dev) 1457static int ip6gre_tap_init(struct net_device *dev)
1450{ 1458{
1451 struct ip6_tnl *tunnel; 1459 struct ip6_tnl *tunnel;
1460 int i;
1452 1461
1453 tunnel = netdev_priv(dev); 1462 tunnel = netdev_priv(dev);
1454 1463
@@ -1462,6 +1471,12 @@ static int ip6gre_tap_init(struct net_device *dev)
1462 if (!dev->tstats) 1471 if (!dev->tstats)
1463 return -ENOMEM; 1472 return -ENOMEM;
1464 1473
1474 for_each_possible_cpu(i) {
1475 struct pcpu_tstats *ip6gre_tap_stats;
1476 ip6gre_tap_stats = per_cpu_ptr(dev->tstats, i);
1477 u64_stats_init(&ip6gre_tap_stats->syncp);
1478 }
1479
1465 return 0; 1480 return 0;
1466} 1481}
1467 1482
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 5e31a909a2b0..59df872e2f4d 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -910,7 +910,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
910 910
911out_err_release: 911out_err_release:
912 if (err == -ENETUNREACH) 912 if (err == -ENETUNREACH)
913 IP6_INC_STATS_BH(net, NULL, IPSTATS_MIB_OUTNOROUTES); 913 IP6_INC_STATS(net, NULL, IPSTATS_MIB_OUTNOROUTES);
914 dst_release(*dst); 914 dst_release(*dst);
915 *dst = NULL; 915 *dst = NULL;
916 return err; 916 return err;
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 583b77e2f69b..df1fa58528c6 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1494,12 +1494,19 @@ static inline int
1494ip6_tnl_dev_init_gen(struct net_device *dev) 1494ip6_tnl_dev_init_gen(struct net_device *dev)
1495{ 1495{
1496 struct ip6_tnl *t = netdev_priv(dev); 1496 struct ip6_tnl *t = netdev_priv(dev);
1497 int i;
1497 1498
1498 t->dev = dev; 1499 t->dev = dev;
1499 t->net = dev_net(dev); 1500 t->net = dev_net(dev);
1500 dev->tstats = alloc_percpu(struct pcpu_tstats); 1501 dev->tstats = alloc_percpu(struct pcpu_tstats);
1501 if (!dev->tstats) 1502 if (!dev->tstats)
1502 return -ENOMEM; 1503 return -ENOMEM;
1504
1505 for_each_possible_cpu(i) {
1506 struct pcpu_tstats *ip6_tnl_stats;
1507 ip6_tnl_stats = per_cpu_ptr(dev->tstats, i);
1508 u64_stats_init(&ip6_tnl_stats->syncp);
1509 }
1503 return 0; 1510 return 0;
1504} 1511}
1505 1512
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 3a9038dd818d..bfc6fcea3841 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1320,6 +1320,7 @@ static void ipip6_tunnel_setup(struct net_device *dev)
1320static int ipip6_tunnel_init(struct net_device *dev) 1320static int ipip6_tunnel_init(struct net_device *dev)
1321{ 1321{
1322 struct ip_tunnel *tunnel = netdev_priv(dev); 1322 struct ip_tunnel *tunnel = netdev_priv(dev);
1323 int i;
1323 1324
1324 tunnel->dev = dev; 1325 tunnel->dev = dev;
1325 tunnel->net = dev_net(dev); 1326 tunnel->net = dev_net(dev);
@@ -1332,6 +1333,12 @@ static int ipip6_tunnel_init(struct net_device *dev)
1332 if (!dev->tstats) 1333 if (!dev->tstats)
1333 return -ENOMEM; 1334 return -ENOMEM;
1334 1335
1336 for_each_possible_cpu(i) {
1337 struct pcpu_tstats *ipip6_tunnel_stats;
1338 ipip6_tunnel_stats = per_cpu_ptr(dev->tstats, i);
1339 u64_stats_init(&ipip6_tunnel_stats->syncp);
1340 }
1341
1335 return 0; 1342 return 0;
1336} 1343}
1337 1344
@@ -1341,6 +1348,7 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
1341 struct iphdr *iph = &tunnel->parms.iph; 1348 struct iphdr *iph = &tunnel->parms.iph;
1342 struct net *net = dev_net(dev); 1349 struct net *net = dev_net(dev);
1343 struct sit_net *sitn = net_generic(net, sit_net_id); 1350 struct sit_net *sitn = net_generic(net, sit_net_id);
1351 int i;
1344 1352
1345 tunnel->dev = dev; 1353 tunnel->dev = dev;
1346 tunnel->net = dev_net(dev); 1354 tunnel->net = dev_net(dev);
@@ -1354,6 +1362,13 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
1354 dev->tstats = alloc_percpu(struct pcpu_tstats); 1362 dev->tstats = alloc_percpu(struct pcpu_tstats);
1355 if (!dev->tstats) 1363 if (!dev->tstats)
1356 return -ENOMEM; 1364 return -ENOMEM;
1365
1366 for_each_possible_cpu(i) {
1367 struct pcpu_tstats *ipip6_fb_stats;
1368 ipip6_fb_stats = per_cpu_ptr(dev->tstats, i);
1369 u64_stats_init(&ipip6_fb_stats->syncp);
1370 }
1371
1357 dev_hold(dev); 1372 dev_hold(dev);
1358 rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); 1373 rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);
1359 return 0; 1374 return 0;
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 62786a495cea..1ded5c6d268c 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -842,7 +842,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
842 struct ip_vs_dest **dest_p) 842 struct ip_vs_dest **dest_p)
843{ 843{
844 struct ip_vs_dest *dest; 844 struct ip_vs_dest *dest;
845 unsigned int atype; 845 unsigned int atype, i;
846 846
847 EnterFunction(2); 847 EnterFunction(2);
848 848
@@ -869,6 +869,12 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
869 if (!dest->stats.cpustats) 869 if (!dest->stats.cpustats)
870 goto err_alloc; 870 goto err_alloc;
871 871
872 for_each_possible_cpu(i) {
873 struct ip_vs_cpu_stats *ip_vs_dest_stats;
874 ip_vs_dest_stats = per_cpu_ptr(dest->stats.cpustats, i);
875 u64_stats_init(&ip_vs_dest_stats->syncp);
876 }
877
872 dest->af = svc->af; 878 dest->af = svc->af;
873 dest->protocol = svc->protocol; 879 dest->protocol = svc->protocol;
874 dest->vaddr = svc->addr; 880 dest->vaddr = svc->addr;
@@ -1134,7 +1140,7 @@ static int
1134ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u, 1140ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
1135 struct ip_vs_service **svc_p) 1141 struct ip_vs_service **svc_p)
1136{ 1142{
1137 int ret = 0; 1143 int ret = 0, i;
1138 struct ip_vs_scheduler *sched = NULL; 1144 struct ip_vs_scheduler *sched = NULL;
1139 struct ip_vs_pe *pe = NULL; 1145 struct ip_vs_pe *pe = NULL;
1140 struct ip_vs_service *svc = NULL; 1146 struct ip_vs_service *svc = NULL;
@@ -1184,6 +1190,13 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
1184 goto out_err; 1190 goto out_err;
1185 } 1191 }
1186 1192
1193 for_each_possible_cpu(i) {
1194 struct ip_vs_cpu_stats *ip_vs_stats;
1195 ip_vs_stats = per_cpu_ptr(svc->stats.cpustats, i);
1196 u64_stats_init(&ip_vs_stats->syncp);
1197 }
1198
1199
1187 /* I'm the first user of the service */ 1200 /* I'm the first user of the service */
1188 atomic_set(&svc->refcnt, 0); 1201 atomic_set(&svc->refcnt, 0);
1189 1202
@@ -3780,7 +3793,7 @@ static struct notifier_block ip_vs_dst_notifier = {
3780 3793
3781int __net_init ip_vs_control_net_init(struct net *net) 3794int __net_init ip_vs_control_net_init(struct net *net)
3782{ 3795{
3783 int idx; 3796 int i, idx;
3784 struct netns_ipvs *ipvs = net_ipvs(net); 3797 struct netns_ipvs *ipvs = net_ipvs(net);
3785 3798
3786 /* Initialize rs_table */ 3799 /* Initialize rs_table */
@@ -3799,6 +3812,12 @@ int __net_init ip_vs_control_net_init(struct net *net)
3799 if (!ipvs->tot_stats.cpustats) 3812 if (!ipvs->tot_stats.cpustats)
3800 return -ENOMEM; 3813 return -ENOMEM;
3801 3814
3815 for_each_possible_cpu(i) {
3816 struct ip_vs_cpu_stats *ipvs_tot_stats;
3817 ipvs_tot_stats = per_cpu_ptr(ipvs->tot_stats.cpustats, i);
3818 u64_stats_init(&ipvs_tot_stats->syncp);
3819 }
3820
3802 spin_lock_init(&ipvs->tot_stats.lock); 3821 spin_lock_init(&ipvs->tot_stats.lock);
3803 3822
3804 proc_create("ip_vs", 0, net->proc_net, &ip_vs_info_fops); 3823 proc_create("ip_vs", 0, net->proc_net, &ip_vs_info_fops);
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 1408adc2a2a7..449e0776a2c0 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1199,6 +1199,12 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
1199 goto err_destroy_table; 1199 goto err_destroy_table;
1200 } 1200 }
1201 1201
1202 for_each_possible_cpu(i) {
1203 struct dp_stats_percpu *dpath_stats;
1204 dpath_stats = per_cpu_ptr(dp->stats_percpu, i);
1205 u64_stats_init(&dpath_stats->sync);
1206 }
1207
1202 dp->ports = kmalloc(DP_VPORT_HASH_BUCKETS * sizeof(struct hlist_head), 1208 dp->ports = kmalloc(DP_VPORT_HASH_BUCKETS * sizeof(struct hlist_head),
1203 GFP_KERNEL); 1209 GFP_KERNEL);
1204 if (!dp->ports) { 1210 if (!dp->ports) {
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 6f65dbe13812..d830a95f03a4 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -118,6 +118,7 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
118{ 118{
119 struct vport *vport; 119 struct vport *vport;
120 size_t alloc_size; 120 size_t alloc_size;
121 int i;
121 122
122 alloc_size = sizeof(struct vport); 123 alloc_size = sizeof(struct vport);
123 if (priv_size) { 124 if (priv_size) {
@@ -141,6 +142,13 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
141 return ERR_PTR(-ENOMEM); 142 return ERR_PTR(-ENOMEM);
142 } 143 }
143 144
145 for_each_possible_cpu(i) {
146 struct pcpu_tstats *vport_stats;
147 vport_stats = per_cpu_ptr(vport->percpu_stats, i);
148 u64_stats_init(&vport_stats->syncp);
149 }
150
151
144 spin_lock_init(&vport->stats_lock); 152 spin_lock_init(&vport->stats_lock);
145 153
146 return vport; 154 return vport;