From owner-svn-src-head@FreeBSD.ORG Wed Feb 25 23:40:12 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 67C04B9C; Wed, 25 Feb 2015 23:40:12 +0000 (UTC) Received: from mail-we0-x22f.google.com (mail-we0-x22f.google.com [IPv6:2a00:1450:400c:c03::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA463D2B; Wed, 25 Feb 2015 23:40:11 +0000 (UTC) Received: by wevk48 with SMTP id k48so6812426wev.0; Wed, 25 Feb 2015 15:40:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=UZ3E0i432AND+5b8FeAbhkBmQU/miPf7FtSIW8VCnro=; b=DnZIrLI2hH+S8kIvAgxaakKPB1yNeVmX6VVWrYALbVfny1lb3SuKBVKvndkWJp6EGB CVdTWKNYPn9aY5F7PCvJwqd6EmRe41AUh2f0Y6Sta6QXOs3Uvd5s2e0HVYMqgYXuoWRx FAILILyl218/5KCb6TS+7A4i4oeE6SSkX0FEVAkGtziCrC3KaCcDlHQqf5RWfj+l46MC CjmP64lvZng44Mc/pbNE6xUQE93c9pKH0y8j6C37sDDnY9/QRUvDJG+rsdZdnDA94V0y Goh0DqVeNqUDnzk7o49z/0VumHvTz/BbqVgwc5i/gIN88WFNez9BIAXGkBjmgKnMOe5w 6XAA== X-Received: by 10.180.75.179 with SMTP id d19mr40070500wiw.0.1424907610357; Wed, 25 Feb 2015 15:40:10 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id m4sm179722wik.20.2015.02.25.15.40.08 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 25 Feb 2015 15:40:09 -0800 (PST) Date: Thu, 26 Feb 2015 00:40:06 +0100 From: Mateusz Guzik To: John Baldwin Subject: Re: svn commit: r278320 - in head: contrib/mdocml lib lib/libdevctl share/mk sys/dev/acpica sys/dev/pci sys/kern sys/sys usr.sbin usr.sbin/devctl Message-ID: <20150225234006.GB30998@dft-labs.eu> References: <201502061609.t16G92rn091851@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201502061609.t16G92rn091851@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 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: Wed, 25 Feb 2015 23:40:12 -0000 On Fri, Feb 06, 2015 at 04:09:02PM +0000, John Baldwin wrote: > Author: jhb > Date: Fri Feb 6 16:09:01 2015 > New Revision: 278320 > URL: https://svnweb.freebsd.org/changeset/base/278320 > > Log: > Add a new device control utility for new-bus devices called devctl. This > allows the user to request administrative changes to individual devices [..] > +static int > +devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, > + struct thread *td) > +{ > + struct devreq *req; > + device_t dev; > + int error, old; > + > + /* Locate the device to control. */ > + mtx_lock(&Giant); > + req = (struct devreq *)data; [..] > + switch (cmd) { [..] > + case DEV_SET_DRIVER: { > + devclass_t dc; > + char driver[128]; > + > + error = copyinstr(req->dr_data, driver, sizeof(driver), NULL); [..] > + if (!driver_exists(dev->parent, driver)) { > + error = ENOENT; > + break; > + } [..] > + } > + mtx_unlock(&Giant); > + return (error); > +} I only skimmed thourgh this, will not a page fault drop + reacquire Giant lock? iow, would not it be better to copy prior to taking the lock? -- Mateusz Guzik