Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Apr 2020 04:52:59 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r359956 - stable/11/sys/compat/linuxkpi/common/include/linux
Message-ID:  <202004150452.03F4qx5E015068@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Apr 15 04:52:59 2020
New Revision: 359956
URL: https://svnweb.freebsd.org/changeset/base/359956

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

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/srcu.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/srcu.h
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/include/linux/srcu.h	Wed Apr 15 04:52:10 2020	(r359955)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/srcu.h	Wed Apr 15 04:52:59 2020	(r359956)
@@ -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 */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004150452.03F4qx5E015068>