Date: Fri, 21 Jun 2019 18:48:08 +0000 (UTC) From: Johannes Lundberg <johalun@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349277 - in head/sys: compat/linuxkpi/common/include/linux sys Message-ID: <201906211848.x5LIm8Sg024117@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: johalun Date: Fri Jun 21 18:48:07 2019 New Revision: 349277 URL: https://svnweb.freebsd.org/changeset/base/349277 Log: LinuxKPI: Additions to rcu list. - Add rcu list functions. - Make rcu hlist's foreach macro use rcu calls instead of the non-rcu macro. - Bump FreeBSD version so we have a checkpoint for the vboxvideo drm driver. Reviewed by: hps Approved by: imp (mentor), hps MFC after: 1 week Differential Revision: D20719 Modified: head/sys/compat/linuxkpi/common/include/linux/rculist.h head/sys/sys/param.h Modified: head/sys/compat/linuxkpi/common/include/linux/rculist.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rculist.h Fri Jun 21 16:43:16 2019 (r349276) +++ head/sys/compat/linuxkpi/common/include/linux/rculist.h Fri Jun 21 18:48:07 2019 (r349277) @@ -33,6 +33,25 @@ #include <linux/list.h> #include <linux/rcupdate.h> +#define list_entry_rcu(ptr, type, member) \ + container_of(READ_ONCE(ptr), type, member) + +#define list_next_rcu(head) (*((struct list_head **)(&(head)->next))) + +#define list_for_each_entry_rcu(pos, head, member) \ + for (pos = list_entry_rcu((head)->next, typeof(*(pos)), member); \ + &(pos)->member != (head); \ + pos = list_entry_rcu((pos)->member.next, typeof(*(pos)), member)) + +static inline void +list_add_rcu(struct list_head *new, struct list_head *prev) +{ + new->next = prev->next; + new->prev = prev; + rcu_assign_pointer(list_next_rcu(prev), new); + prev->prev = new; +} + #define hlist_first_rcu(head) (*((struct hlist_node **)(&(head)->first))) #define hlist_next_rcu(node) (*((struct hlist_node **)(&(node)->next))) #define hlist_pprev_rcu(node) (*((struct hlist_node **)((node)->pprev))) @@ -47,8 +66,12 @@ hlist_add_behind_rcu(struct hlist_node *n, struct hlis n->next->pprev = &n->next; } -#define hlist_for_each_entry_rcu(pos, head, member) \ - hlist_for_each_entry(pos, head, member) +#define hlist_for_each_entry_rcu(pos, head, member) \ + for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\ + typeof(*(pos)), member); \ + (pos); \ + pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \ + &(pos)->member)), typeof(*(pos)), member)) static inline void hlist_del_rcu(struct hlist_node *n) Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Fri Jun 21 16:43:16 2019 (r349276) +++ head/sys/sys/param.h Fri Jun 21 18:48:07 2019 (r349277) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300032 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300033 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906211848.x5LIm8Sg024117>