From owner-svn-src-all@freebsd.org Mon Dec 18 04:35:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7260AEA0D74 for ; Mon, 18 Dec 2017 04:35:30 +0000 (UTC) (envelope-from 0100016067e1fe89-1a2d8c5d-b7c3-4abd-80a2-e9fd781bc8c7-000000@amazonses.com) Received: from a8-176.smtp-out.amazonses.com (a8-176.smtp-out.amazonses.com [54.240.8.176]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37F066AD0C for ; Mon, 18 Dec 2017 04:35:29 +0000 (UTC) (envelope-from 0100016067e1fe89-1a2d8c5d-b7c3-4abd-80a2-e9fd781bc8c7-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ae7m2yrxjw65l2cqdpjxuucyrvy564tn; d=tarsnap.com; t=1513571352; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=+ky7GL9dEPmHF8PlCZwS2EH2JMtdsadhiwojK854jW0=; b=g47Q5SdhrXq6AciaPthqyi3d/gfp9ozz0wVHsiPWdgihSPyTFxbdfohJooUJBRZh KEVA6Li0iJc4fEk4nmsqMRjjwKdojGE1vyAc6P4mnSGB8VgZerIuZ/O+AGoEIznZ6W9 8twH0nqMJSDogEUYe2KeWGkzvArLLc5TsJdvSnhI= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1513571352; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=+ky7GL9dEPmHF8PlCZwS2EH2JMtdsadhiwojK854jW0=; b=Xm5eY3ftDcvNDpb999c+UKSN9SBbV6Ro/ps1Gxwf4+i7R9r4LKNkjx/Z9PR7xqnc FHF5fkKhr2G2APo1MZcrIuFjAhpT8xNBNFK6EXnw7hXGW8jFIXl/w64YPdOwywHPtbv cBQPuzylI7GpHxb29rGYQGQMu3erm2N5ndGm4mr4= Subject: Re: svn commit: r325841 - in head/sys: conf dev/mlx4 dev/mlx4/mlx4_core dev/mlx4/mlx4_en dev/mlx4/mlx4_ib modules/mlx4 To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201711151114.vAFBEeUb015030@repo.freebsd.org> From: Colin Percival Message-ID: <0100016067e1fe89-1a2d8c5d-b7c3-4abd-80a2-e9fd781bc8c7-000000@email.amazonses.com> Date: Mon, 18 Dec 2017 04:29:12 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <201711151114.vAFBEeUb015030@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SES-Outgoing: 2017.12.18-54.240.8.176 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Dec 2017 04:35:30 -0000 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