Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d720c3e authored by Tejun Heo's avatar Tejun Heo Committed by David S. Miller
Browse files

percpu: add __percpu sparse annotations to net



Add __percpu sparse annotations to net.

These annotations are to make sparse consider percpu variables to be
in a different address space and warn if accessed without going
through percpu accessors.  This patch doesn't affect normal builds.

The macro and type tricks around snmp stats make things a bit
interesting.  DEFINE/DECLARE_SNMP_STAT() macros mark the target field
as __percpu and SNMP_UPD_PO_STATS() macro is updated accordingly.  All
snmp_mib_*() users which used to cast the argument to (void **) are
updated to cast it to (void __percpu **).

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2bb4646f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -174,9 +174,9 @@ extern struct ipv4_config ipv4_config;
#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)

extern unsigned long snmp_fold_field(void *mib[], int offt);
extern int snmp_mib_init(void *ptr[2], size_t mibsize);
extern void snmp_mib_free(void *ptr[2]);
extern unsigned long snmp_fold_field(void __percpu *mib[], int offt);
extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize);
extern void snmp_mib_free(void __percpu *ptr[2]);

extern struct local_ports {
	seqlock_t	lock;
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ struct crypto_comp;

struct ipcomp_data {
	u16 threshold;
	struct crypto_comp **tfms;
	struct crypto_comp * __percpu *tfms;
};

struct ip_comp_hdr;
+1 −1
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ struct neigh_table {
	rwlock_t		lock;
	unsigned long		last_rand;
	struct kmem_cache		*kmem_cachep;
	struct neigh_statistics	*stats;
	struct neigh_statistics	__percpu *stats;
	struct neighbour	**hash_buckets;
	unsigned int		hash_mask;
	__u32			hash_rnd;
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ struct netns_ct {
	struct hlist_head	*expect_hash;
	struct hlist_nulls_head	unconfirmed;
	struct hlist_nulls_head	dying;
	struct ip_conntrack_stat *stat;
	struct ip_conntrack_stat __percpu *stat;
	int			sysctl_events;
	unsigned int		sysctl_events_retry_timeout;
	int			sysctl_acct;
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ struct netns_core {

	int	sysctl_somaxconn;

	struct prot_inuse	*inuse;
	struct prot_inuse __percpu *inuse;
};

#endif
Loading