From owner-svn-src-head@freebsd.org Mon Dec 18 04:33:28 2017 Return-Path: Delivered-To: svn-src-head@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 E2947EA0CC6 for ; Mon, 18 Dec 2017 04:33:28 +0000 (UTC) (envelope-from 0100016067e1fa2d-5f2e80c5-5584-4d6f-821d-185c98cff9af-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 A922F6ACB0 for ; Mon, 18 Dec 2017 04:33:28 +0000 (UTC) (envelope-from 0100016067e1fa2d-5f2e80c5-5584-4d6f-821d-185c98cff9af-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ae7m2yrxjw65l2cqdpjxuucyrvy564tn; d=tarsnap.com; t=1513571351; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=+ky7GL9dEPmHF8PlCZwS2EH2JMtdsadhiwojK854jW0=; b=mDBNyHrLrMsgSgeu9gYItvSntQEUlJsvQ5pYa5pMarClZBn4K76F58l4sj9nc/JU LP6lrXjbvKpD90tbrNp1Pw4zgELcdFS0tAThqAnsU8xVwco5JKORtALuMNP8IamLY1k oww73Ryf0sJ1CqIqGXGFMbb5wJIcXEfGU8Yt4eQk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1513571351; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=+ky7GL9dEPmHF8PlCZwS2EH2JMtdsadhiwojK854jW0=; b=AYlKxURRV4sMouwzB0sg19H+fouvWrOkPEmo/+gTB9Fox6XqGa7AS3OTfW/JpyA1 cz5sTimZhpagWsVnNe/fty7Izpvn6OQ7fRwrijOImF6oRK+lDWTQq7d/pvUkPjqv87L mb6O02mioN8ZWF4iKgpT/fSBJ4tUq0iI334uDapM= 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: <0100016067e1fa2d-5f2e80c5-5584-4d6f-821d-185c98cff9af-000000@email.amazonses.com> Date: Mon, 18 Dec 2017 04:29:11 +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-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Dec 2017 04:33:29 -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