svn commit: r325841 - in head/sys: conf dev/mlx4 dev/mlx4/mlx4_core dev/mlx4/mlx4_en dev/mlx4/mlx4_ib modules/mlx4
Colin Percival
cperciva at tarsnap.com
Mon Dec 18 04:35:30 UTC 2017
On 11/15/17 03:14, Hans Petter Selasky wrote:
> Author: hselasky
> Date: Wed Nov 15 11:14:39 2017
> New Revision: 325841
> URL: https://svnweb.freebsd.org/changeset/base/325841
>
> Log:
> Update the mlx4 core and mlx4en(4) modules towards Linux v4.9.
sys/dev/mlx4/mlx4_core/mlx4_main.c, around line 1170:
> +static ssize_t set_port_type(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct mlx4_port_info *info = container_of(attr, struct mlx4_port_info,
> + port_attr);
> + struct mlx4_dev *mdev = info->dev;
> + enum mlx4_port_type port_type;
> + static DEFINE_MUTEX(set_port_type_mutex);
I'm not sure this is what you meant to do. In particular, DEFINE_MUTEX uses
SX_SYSINIT_FLAGS, which creates a SYSINIT and a SYSUNINIT to initialize and
destroy the mutex -- meaning that it's being accessed from outside of the
function scope. This seems to work because function-scope static variables
are compiled as if they have file scope, but I'm not at all convinced that
it's legal C.
Also, it breaks some work I have in progress for instrumenting SYSINITs.
Would you mind moving the DEFINE_MUTEX line to occur immediately prior to
the set_port_type function, rather than being placed inside it?
--
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
More information about the svn-src-all
mailing list