Author: hselasky
Date: Wed Apr  8 16:07:57 2020
New Revision: 359726
URL: https://svnweb.freebsd.org/changeset/base/359726

Log:
  Some fixes for SRCU in the LinuxKPI.
  
  - Make sure to use READ_ONCE() when deferring variables.
  - Remove superfluous zero initializer.
  
  MFC after:    1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/srcu.h

Modified: head/sys/compat/linuxkpi/common/include/linux/srcu.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/srcu.h        Wed Apr  8 
14:11:54 2020        (r359725)
+++ head/sys/compat/linuxkpi/common/include/linux/srcu.h        Wed Apr  8 
16:07:57 2020        (r359726)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015-2017 Mellanox Technologies, Ltd.
+ * Copyright (c) 2015-2020 Mellanox Technologies, Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,13 +29,16 @@
 #ifndef        _LINUX_SRCU_H_
 #define        _LINUX_SRCU_H_
 
+#include <linux/compiler.h>
+
 struct srcu_struct {
 };
 
-#define        srcu_dereference(ptr,srcu)      ((__typeof(*(ptr)) *)(ptr))
+#define        srcu_dereference(p, srcu) \
+       ((__typeof(*(p)) *)READ_ONCE(p))
 
 #define        DEFINE_STATIC_SRCU(name) \
-       static struct srcu_struct name = {}
+       static struct srcu_struct name
 
 /* prototypes */
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to