From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 00:02:45 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 14D0F889; Sun, 29 Dec 2013 00:02:45 +0000 (UTC) Received: from smtpauth4.wiscmail.wisc.edu (wmauth4.doit.wisc.edu [144.92.197.145]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D695915A8; Sun, 29 Dec 2013 00:02:44 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from avs-daemon.smtpauth4.wiscmail.wisc.edu by smtpauth4.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) id <0MYJ00C00JXLCG00@smtpauth4.wiscmail.wisc.edu>; Sat, 28 Dec 2013 18:02:36 -0600 (CST) X-Spam-PmxInfo: Server=avs-4, Version=6.0.3.2322014, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.12.28.235115, SenderIP=0.0.0.0 X-Spam-Report: AuthenticatedSender=yes, SenderIP=0.0.0.0 Received: from wanderer.tachypleus.net (unknown [70.42.157.34]) by smtpauth4.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) with ESMTPSA id <0MYJ00F76K49PW30@smtpauth4.wiscmail.wisc.edu>; Sat, 28 Dec 2013 18:02:36 -0600 (CST) Message-id: <52BF6699.1040006@freebsd.org> Date: Sat, 28 Dec 2013 19:02:33 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.0 To: Marcel Moolenaar , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r259908 - head/sys/vm References: <201312260546.rBQ5kAoJ009798@svn.freebsd.org> In-reply-to: <201312260546.rBQ5kAoJ009798@svn.freebsd.org> X-Enigmail-Version: 1.5.2 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 00:02:45 -0000 On 12/26/13 00:46, Marcel Moolenaar wrote: > Author: marcel > Date: Thu Dec 26 05:46:10 2013 > New Revision: 259908 > URL: http://svnweb.freebsd.org/changeset/base/259908 > > Log: > For ia64, use pmap_remove_pages() and not pmap_remove(). The problem is > that we don't have a good way (yet) to iterate over the mapped pages by > virtual address and simply try each page within the range. Given that we > call pmap_remove() over the entire 2^63 bytes of address space, it takes > a while for pmap_remove to have tried all 2^50 pages. > By using pmap_remove_pages() we use the PV list to find all mappings. > > Change derived from a patch by: alc > Why make this ia64-specific? It seems like a potentially useful general optimization and certainly shouldn't be harmful on other architectures. -Nathan From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 00:04:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 959429D9 for ; Sun, 29 Dec 2013 00:04:35 +0000 (UTC) Received: from mail-pb0-x22f.google.com (mail-pb0-x22f.google.com [IPv6:2607:f8b0:400e:c01::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 63A2615B3 for ; Sun, 29 Dec 2013 00:04:35 +0000 (UTC) Received: by mail-pb0-f47.google.com with SMTP id um1so10403068pbc.20 for ; Sat, 28 Dec 2013 16:04:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=LlaE0ZF7ZPoRJAWLYta87ZoxlyHwmYkcxBb13rjJlwE=; b=AnkxuoQX6sLSK5AXE4t+ijOisLvKEq8GNq0tXysv4k462p/B2AXcC/oqMyhszimmZc wd4WwKmJINtZOogt2Ttwl5v/y3X3OcM8mIAjK8KN5etISSF2vrO7X5lAgpV4ih5J1Rt4 GPyVQjrRfQTg5Bbwi/Lve8hrwU7pVYoGA+XiQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=LlaE0ZF7ZPoRJAWLYta87ZoxlyHwmYkcxBb13rjJlwE=; b=bcNXtII3gQojbX35edI/X+nwrbTEb2Ecz2AwAD2/qD+3oMqA7y7pg28OGHL9yPtV3d pfKYTubwxWAGDHeROwAHJR41tF69UNb3vl/wYsu9XbtmNE8EJJBXroCidl86cZCZ/6hi WA0AwGOAZkZwh7K+pThTSxtclg4F/uIsbcP2qhST+CV+QfzRtM2ztB0v7xrUCV/EffjX 4HDsdfM+IfNLeX5VFfRCPemJ7EAd/X+/PG1vGL+4BOsMOJ2fvib6oYWM32C7i+atDJZs Rp4OzzeO59oFC6mzM/bEG73eFHTGMQfetd8dyuiaFn2xH6oe5kTEEyouLEv8k+fVQLET v9nA== X-Gm-Message-State: ALoCoQl/dQ/GodYYeXg1z7I1uhnYaJuNMeCxLJOftZ/wh6pwWztkoa5oCfSas253dGWuW/0DLPtJ MIME-Version: 1.0 X-Received: by 10.66.25.36 with SMTP id z4mr60094964paf.101.1388275475029; Sat, 28 Dec 2013 16:04:35 -0800 (PST) Received: by 10.66.162.3 with HTTP; Sat, 28 Dec 2013 16:04:34 -0800 (PST) In-Reply-To: <201312282301.rBSN1wWP002326@svn.freebsd.org> References: <201312282301.rBSN1wWP002326@svn.freebsd.org> Date: Sat, 28 Dec 2013 16:04:34 -0800 Message-ID: Subject: Re: svn commit: r260022 - head/lib/libkvm From: Peter Wemm To: Marcel Moolenaar Content-Type: text/plain; charset=ISO-8859-1 Cc: "svn-src-head@freebsd.org" , svn-src-all , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 00:04:35 -0000 On Sat, Dec 28, 2013 at 3:01 PM, Marcel Moolenaar wrote: > Author: marcel > Date: Sat Dec 28 23:01:57 2013 > New Revision: 260022 > URL: http://svnweb.freebsd.org/changeset/base/260022 > > Log: > Allow building a cross libkvm by setting TARGET_ARCH. The library so > produced will be called libkvm-${ARCH} instead of libkvm. This allows > installing it alongside the native version. > For symbol lookups, use ps_pglobal_lookup() instead of __fdnlist() > when building a cross libkvm. It is assumed that the cross tool that > uses the cross libkvm also provides an implementation for this > proc_services function. > > Note that this commit does not change any of the architecture-specific > code for cross-compilation. Are you sure about this? I just got a brand new buildworld failure on an amd64 machine. The lib32 build code was trying to use 64 bit pmap definitions and failed miserably. I'm really sorry, I accidentally blew away the failure log. I'll have another in a few minutes. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV Yes, I know, gmail sucks now. If you see this then I forgot. Habits are hard to break. From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 00:40:33 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 75E8FE8 for ; Sun, 29 Dec 2013 00:40:33 +0000 (UTC) Received: from mail-pd0-x22b.google.com (mail-pd0-x22b.google.com [IPv6:2607:f8b0:400e:c02::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 43F4B17C1 for ; Sun, 29 Dec 2013 00:40:33 +0000 (UTC) Received: by mail-pd0-f171.google.com with SMTP id z10so10184212pdj.30 for ; Sat, 28 Dec 2013 16:40:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=2LrDuxz4Qy5swbfvslnDXc7wTjiovmHtF9+3qmU4dKY=; b=lGGMVKYeFQJu60i+2Ftdz3sRpf/SNVpA09kUy95EHm766a6dNKliGua3WnEI0j3uLv IEHiLjFxbKSLkuHd5F0y/YbwpDtMdS8fCanmYpBww8oNHHU7/2sXN0cQW+uWUfZTMK6Y DUpucI4DgQXA+2AHUqkaj57k0p3A8Z+IsOpC0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=2LrDuxz4Qy5swbfvslnDXc7wTjiovmHtF9+3qmU4dKY=; b=eAJEc/oE2yd/leWKvlfXeJc2uCTEDt8kydoCXJAnclpAWQOwbIoUqAG21xLZ37ODga w1Pe4gIhBqJpNJ/vD9deaH/sabWGfojeY7A9hYn7mmQc+rTfkdHqDj5r7pAYoWSC7Fla OTw6KY0PleS+15bkbnmVBkT7e/A0eFHkw8T4joW4hz5dTTrnzRA3EY7esebLbNnwMhHA RiL/ffjDHc+kVCO9wP2mQ7xJtf0APYI6ghCk5FVAOtNsyYBx1OUcKW7zXtT4RqZVw8df 3qaPOAbJEo3Xe6UhINnnktZBuTe6b1LnfTT6W36TYthvyIydE7UKzFrLVTX83Xt2vEC+ O5nw== X-Gm-Message-State: ALoCoQkyoqDXR95Du/rF50pUFX97psWfSgRU/nS/eux4tuScgP7ys7WX26EPJTUlxHmhbcs03iOH MIME-Version: 1.0 X-Received: by 10.66.137.109 with SMTP id qh13mr42969038pab.140.1388277632890; Sat, 28 Dec 2013 16:40:32 -0800 (PST) Received: by 10.66.162.3 with HTTP; Sat, 28 Dec 2013 16:40:32 -0800 (PST) In-Reply-To: References: <201312282301.rBSN1wWP002326@svn.freebsd.org> Date: Sat, 28 Dec 2013 16:40:32 -0800 Message-ID: Subject: Re: svn commit: r260022 - head/lib/libkvm From: Peter Wemm To: Marcel Moolenaar Content-Type: text/plain; charset=ISO-8859-1 Cc: "svn-src-head@freebsd.org" , svn-src-all , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 00:40:33 -0000 On Sat, Dec 28, 2013 at 4:04 PM, Peter Wemm wrote: > On Sat, Dec 28, 2013 at 3:01 PM, Marcel Moolenaar wrote: >> Author: marcel >> Date: Sat Dec 28 23:01:57 2013 >> New Revision: 260022 >> URL: http://svnweb.freebsd.org/changeset/base/260022 >> >> Log: >> Allow building a cross libkvm by setting TARGET_ARCH. The library so >> produced will be called libkvm-${ARCH} instead of libkvm. This allows >> installing it alongside the native version. >> For symbol lookups, use ps_pglobal_lookup() instead of __fdnlist() >> when building a cross libkvm. It is assumed that the cross tool that >> uses the cross libkvm also provides an implementation for this >> proc_services function. >> >> Note that this commit does not change any of the architecture-specific >> code for cross-compilation. > > Are you sure about this? I just got a brand new buildworld failure on > an amd64 machine. The lib32 build code was trying to use 64 bit pmap > definitions and failed miserably. > > I'm really sorry, I accidentally blew away the failure log. I'll have > another in a few minutes. This is from stage5.1, the lib32 build: /usr/src/lib/libkvm/kvm_amd64.c:78:2: error: unknown type name 'pml4_entry_t' pml4_entry_t *PML4; ^ /usr/src/lib/libkvm/kvm_amd64.c:153:2: error: use of undeclared identifier 'pml4_entry_t' pml4_entry_t *PML4; ^ /usr/src/lib/libkvm/kvm_amd64.c:153:16: error: use of undeclared identifier 'PML4' pml4_entry_t *PML4; ^ /usr/src/lib/libkvm/kvm_amd64.c:200:2: error: use of undeclared identifier 'PML4' PML4 = _kvm_malloc(kd, PAGE_SIZE); ^ /usr/src/lib/libkvm/kvm_amd64.c:201:23: error: use of undeclared identifier 'PML4' if (kvm_read(kd, pa, PML4, PAGE_SIZE) != PAGE_SIZE) { ^ /usr/src/lib/libkvm/kvm_amd64.c:205:19: error: use of undeclared identifier 'PML4' kd->vmst->PML4 = PML4; ^ /usr/src/lib/libkvm/kvm_amd64.c:217:2: error: use of undeclared identifier 'pml4_entry_t' pml4_entry_t pml4e; ^ /usr/src/lib/libkvm/kvm_amd64.c:218:2: error: unknown type name 'pdp_entry_t'; did you mean 'pd_entry_t'? pdp_entry_t pdpe; ^~~~~~~~~~~ pd_entry_t /usr/obj/usr/src/lib32/usr/include/machine/pmap.h:175:18: note: 'pd_entry_t' declared here typedef uint32_t pd_entry_t; ^ /usr/src/lib/libkvm/kvm_amd64.c:246:22: error: use of undeclared identifier 'PML4SHIFT' pml4eindex = (va >> PML4SHIFT) & (NPML4EPG - 1); ^ /usr/src/lib/libkvm/kvm_amd64.c:246:36: error: use of undeclared identifier 'NPML4EPG' pml4eindex = (va >> PML4SHIFT) & (NPML4EPG - 1); ^ /usr/src/lib/libkvm/kvm_amd64.c:247:2: error: use of undeclared identifier 'pml4e' pml4e = vm->PML4[pml4eindex]; ^ /usr/src/lib/libkvm/kvm_amd64.c:248:15: error: use of undeclared identifier 'pml4e' if (((u_long)pml4e & PG_V) == 0) { ^ /usr/src/lib/libkvm/kvm_amd64.c:253:21: error: use of undeclared identifier 'PDPSHIFT' pdpeindex = (va >> PDPSHIFT) & (NPDPEPG-1); ^ /usr/src/lib/libkvm/kvm_amd64.c:253:34: error: use of undeclared identifier 'NPDPEPG' pdpeindex = (va >> PDPSHIFT) & (NPDPEPG-1); ^ /usr/src/lib/libkvm/kvm_amd64.c:254:21: error: use of undeclared identifier 'pml4e' pdpe_pa = ((u_long)pml4e & PG_FRAME) + ^ /usr/src/lib/libkvm/kvm_amd64.c:255:26: error: use of undeclared identifier 'pdp_entry_t'; did you mean 'pd_entry_t'? (pdpeindex * sizeof(pdp_entry_t)); ^ 16 errors generated. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV Yes, I know, gmail sucks now. If you see this then I forgot. Habits are hard to break. From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 01:08:50 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9BAD843E; Sun, 29 Dec 2013 01:08:50 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 75E491902; Sun, 29 Dec 2013 01:08:50 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id rBT18nwo025778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 28 Dec 2013 17:08:49 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id rBT18niq025777; Sat, 28 Dec 2013 17:08:49 -0800 (PST) (envelope-from jmg) Date: Sat, 28 Dec 2013 17:08:48 -0800 From: John-Mark Gurney To: Marcel Moolenaar Subject: Re: svn commit: r260022 - head/lib/libkvm Message-ID: <20131229010848.GV99167@funkthat.com> References: <201312282301.rBSN1wWP002326@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201312282301.rBSN1wWP002326@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Sat, 28 Dec 2013 17:08:49 -0800 (PST) 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.17 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: Sun, 29 Dec 2013 01:08:50 -0000 Marcel Moolenaar wrote this message on Sat, Dec 28, 2013 at 23:01 +0000: > Author: marcel > Date: Sat Dec 28 23:01:57 2013 > New Revision: 260022 > URL: http://svnweb.freebsd.org/changeset/base/260022 > > Log: > Allow building a cross libkvm by setting TARGET_ARCH. The library so > produced will be called libkvm-${ARCH} instead of libkvm. This allows > installing it alongside the native version. > For symbol lookups, use ps_pglobal_lookup() instead of __fdnlist() > when building a cross libkvm. It is assumed that the cross tool that > uses the cross libkvm also provides an implementation for this > proc_services function. > > Note that this commit does not change any of the architecture-specific > code for cross-compilation. Shouldn't we be putting cross compiled libaries in another location than /lib? Kind of like the compat32 libs? -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 01:39:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2EC836E1; Sun, 29 Dec 2013 01:39:02 +0000 (UTC) Received: from pp1.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E1A5A1A6A; Sun, 29 Dec 2013 01:39:01 +0000 (UTC) Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.14.5/8.14.5) with SMTP id rBT0m7iO025641; Sat, 28 Dec 2013 18:49:27 -0600 Received: from mh11.mail.rice.edu (mh11.mail.rice.edu [128.42.199.30]) by pp1.rice.edu with ESMTP id 1gu5d43pbe-1; Sat, 28 Dec 2013 18:49:27 -0600 X-Virus-Scanned: by amavis-2.7.0 at mh11.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh11.mail.rice.edu (Postfix) with ESMTPSA id 521804C01BA; Sat, 28 Dec 2013 18:49:25 -0600 (CST) Message-ID: <52BF7195.2070606@rice.edu> Date: Sat, 28 Dec 2013 18:49:25 -0600 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Nathan Whitehorn , Marcel Moolenaar , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r259908 - head/sys/vm References: <201312260546.rBQ5kAoJ009798@svn.freebsd.org> <52BF6699.1040006@freebsd.org> In-Reply-To: <52BF6699.1040006@freebsd.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.608968239819442 urlsuspect_oldscore=0.00896823981944168 suspectscore=4 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=1 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 rbsscore=0.608968239819442 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1305240000 definitions=main-1312280206 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 01:39:02 -0000 On 12/28/2013 18:02, Nathan Whitehorn wrote: > On 12/26/13 00:46, Marcel Moolenaar wrote: >> Author: marcel >> Date: Thu Dec 26 05:46:10 2013 >> New Revision: 259908 >> URL: http://svnweb.freebsd.org/changeset/base/259908 >> >> Log: >> For ia64, use pmap_remove_pages() and not pmap_remove(). The problem is >> that we don't have a good way (yet) to iterate over the mapped pages by >> virtual address and simply try each page within the range. Given that we >> call pmap_remove() over the entire 2^63 bytes of address space, it takes >> a while for pmap_remove to have tried all 2^50 pages. >> By using pmap_remove_pages() we use the PV list to find all mappings. >> >> Change derived from a patch by: alc >> > Why make this ia64-specific? It seems like a potentially useful general > optimization and certainly shouldn't be harmful on other architectures. Some of the other implementations of pmap_remove_pages() have limitations that don't permit them to be used for this purpose, e.g., if (pmap != PCPU_GET(curpmap)) { printf("warning: pmap_remove_pages called with non-current pmap\n"); return; } Alan From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 02:31:41 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 51B30126; Sun, 29 Dec 2013 02:31:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3C4D31EDE; Sun, 29 Dec 2013 02:31:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBT2VffL003334; Sun, 29 Dec 2013 02:31:41 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBT2VfZm003333; Sun, 29 Dec 2013 02:31:41 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201312290231.rBT2VfZm003333@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 29 Dec 2013 02:31:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260028 - head/lib/libkvm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 02:31:41 -0000 Author: marcel Date: Sun Dec 29 02:31:40 2013 New Revision: 260028 URL: http://svnweb.freebsd.org/changeset/base/260028 Log: Add support for virtual cores (aka minidumps). To that end, refactor this file as follows: 1. Common ia64-specific support functions have the ia64_ prefix. 2. Functions that work on physical cores have the phys_ prefix. 3. Functions that work on virtual cores have the virt_ prefix. With that: 1. _kvm_kvatop() has been renamed to phys_kvatop() as it handles physical cores only. 2. The new _kvm_kvatop() is nothing but a wrapper that calls either phys_kvatop() or virt_kvatop() by virtue of the kvatop function pointer in the vmstate structure. 3. virt_kvatop() is nothing but a wrapper around virt_addr2off(). 4. virt_addr2off() iterates over the Phdrs to find the segment in which the address falls and return the file offset for it. Now it's up to the kernel to populate the core file appropriately. Modified: head/lib/libkvm/kvm_ia64.c Modified: head/lib/libkvm/kvm_ia64.c ============================================================================== --- head/lib/libkvm/kvm_ia64.c Sat Dec 28 23:31:22 2013 (r260027) +++ head/lib/libkvm/kvm_ia64.c Sun Dec 29 02:31:40 2013 (r260028) @@ -35,15 +35,18 @@ #ifndef CROSS_LIBKVM #include #include +#include #include #else #include "../../sys/ia64/include/atomic.h" #include "../../sys/ia64/include/bootinfo.h" +#include "../../sys/ia64/include/elf.h" #include "../../sys/ia64/include/pte.h" #endif #include #include +#include #include #include @@ -61,6 +64,8 @@ #define PBVM_BASE 0x9ffc000000000000UL #define PBVM_PGSZ (64 * 1024) +typedef size_t (a2p_f)(kvm_t *, uint64_t, off_t *); + struct vmstate { void *mmapbase; size_t mmapsize; @@ -68,6 +73,7 @@ struct vmstate { u_long kptdir; u_long *pbvm_pgtbl; u_int pbvm_pgtblsz; + a2p_f *kvatop; }; /* @@ -76,7 +82,7 @@ struct vmstate { * set of headers. */ static int -_kvm_maphdrs(kvm_t *kd, size_t sz) +ia64_maphdrs(kvm_t *kd, size_t sz) { struct vmstate *vm = kd->vmst; @@ -97,18 +103,22 @@ _kvm_maphdrs(kvm_t *kd, size_t sz) } /* - * Translate a physical memory address to a file-offset in the crash-dump. + * Physical core support. */ + static size_t -_kvm_pa2off(kvm_t *kd, uint64_t pa, off_t *ofs, size_t pgsz) +phys_addr2off(kvm_t *kd, uint64_t pa, off_t *ofs, size_t pgsz) { - Elf64_Ehdr *e = kd->vmst->mmapbase; - Elf64_Phdr *p = (Elf64_Phdr*)((char*)e + e->e_phoff); - int n = e->e_phnum; + Elf64_Ehdr *e; + Elf64_Phdr *p; + int n; if (pa != REGION_ADDR(pa)) goto fail; + e = (Elf64_Ehdr *)(kd->vmst->mmapbase); + n = e->e_phnum; + p = (Elf64_Phdr *)(void *)((uintptr_t)(void *)e + e->e_phoff); while (n && (pa < p->p_paddr || pa >= p->p_paddr + p->p_memsz)) p++, n--; if (n == 0) @@ -120,18 +130,76 @@ _kvm_pa2off(kvm_t *kd, uint64_t pa, off_ return (pgsz - ((size_t)pa & (pgsz - 1))); fail: - _kvm_err(kd, kd->program, "invalid physical address %#llx", - (unsigned long long)pa); + _kvm_err(kd, kd->program, "invalid physical address %#jx", + (uintmax_t)pa); + return (0); +} + +static size_t +phys_kvatop(kvm_t *kd, uint64_t va, off_t *ofs) +{ + struct ia64_lpte pte; + uint64_t pa, pgaddr, pt0addr, pt1addr; + size_t pgno, pgsz, pt0no, pt1no; + + if (va >= REGION_BASE(6)) { + /* Regions 6 and 7: direct mapped. */ + pa = REGION_ADDR(va); + return (phys_addr2off(kd, pa, ofs, 0)); + } else if (va >= REGION_BASE(5)) { + /* Region 5: Kernel Virtual Memory. */ + va = REGION_ADDR(va); + pgsz = kd->vmst->pagesize; + pt0no = KPTE_DIR0_INDEX(va, pgsz); + pt1no = KPTE_DIR1_INDEX(va, pgsz); + pgno = KPTE_PTE_INDEX(va, pgsz); + if (pt0no >= NKPTEDIR(pgsz)) + goto fail; + pt0addr = kd->vmst->kptdir + (pt0no << 3); + if (kvm_read(kd, pt0addr, &pt1addr, 8) != 8) + goto fail; + if (pt1addr == 0) + goto fail; + pt1addr += pt1no << 3; + if (kvm_read(kd, pt1addr, &pgaddr, 8) != 8) + goto fail; + if (pgaddr == 0) + goto fail; + pgaddr += pgno * sizeof(pte); + if (kvm_read(kd, pgaddr, &pte, sizeof(pte)) != sizeof(pte)) + goto fail; + if (!(pte.pte & PTE_PRESENT)) + goto fail; + pa = (pte.pte & PTE_PPN_MASK) + (va & (pgsz - 1)); + return (phys_addr2off(kd, pa, ofs, pgsz)); + } else if (va >= PBVM_BASE) { + /* Region 4: Pre-Boot Virtual Memory (PBVM). */ + va -= PBVM_BASE; + pgsz = PBVM_PGSZ; + pt0no = va / pgsz; + if (pt0no >= (kd->vmst->pbvm_pgtblsz >> 3)) + goto fail; + pt0addr = kd->vmst->pbvm_pgtbl[pt0no]; + if (!(pt0addr & PTE_PRESENT)) + goto fail; + pa = (pt0addr & PTE_PPN_MASK) + va % pgsz; + return (phys_addr2off(kd, pa, ofs, pgsz)); + } + + fail: + _kvm_err(kd, kd->program, "invalid kernel virtual address %#jx", + (uintmax_t)va); + *ofs = -1; return (0); } static ssize_t -_kvm_read_phys(kvm_t *kd, uint64_t pa, void *buf, size_t bufsz) +phys_read(kvm_t *kd, uint64_t pa, void *buf, size_t bufsz) { off_t ofs; size_t sz; - sz = _kvm_pa2off(kd, pa, &ofs, 0); + sz = phys_addr2off(kd, pa, &ofs, 0); if (sz < bufsz) return ((ssize_t)sz); @@ -140,6 +208,50 @@ _kvm_read_phys(kvm_t *kd, uint64_t pa, v return (read(kd->pmfd, buf, bufsz)); } +/* + * Virtual core support (aka minidump). + */ + +static size_t +virt_addr2off(kvm_t *kd, uint64_t va, off_t *ofs, size_t pgsz) +{ + Elf64_Ehdr *e; + Elf64_Phdr *p; + int n; + + if (va < REGION_BASE(4)) + goto fail; + + e = (Elf64_Ehdr *)(kd->vmst->mmapbase); + n = e->e_phnum; + p = (Elf64_Phdr *)(void *)((uintptr_t)(void *)e + e->e_phoff); + while (n && (va < p->p_vaddr || va >= p->p_vaddr + p->p_memsz)) + p++, n--; + if (n == 0) + goto fail; + + *ofs = (va - p->p_vaddr) + p->p_offset; + if (pgsz == 0) + return (p->p_memsz - (va - p->p_vaddr)); + return (pgsz - ((size_t)va & (pgsz - 1))); + + fail: + _kvm_err(kd, kd->program, "invalid virtual address %#jx", + (uintmax_t)va); + return (0); +} + +static size_t +virt_kvatop(kvm_t *kd, uint64_t va, off_t *ofs) +{ + + return (virt_addr2off(kd, va, ofs, kd->vmst->pagesize)); +} + +/* + * KVM architecture support functions. + */ + void _kvm_freevtop(kvm_t *kd) { @@ -175,25 +287,31 @@ _kvm_initvtop(kvm_t *kd) kd->vmst->pagesize = 8192; #endif - if (_kvm_maphdrs(kd, sizeof(Elf64_Ehdr)) == -1) + if (ia64_maphdrs(kd, sizeof(Elf64_Ehdr)) == -1) return (-1); ehdr = kd->vmst->mmapbase; hdrsz = ehdr->e_phoff + ehdr->e_phentsize * ehdr->e_phnum; - if (_kvm_maphdrs(kd, hdrsz) == -1) + if (ia64_maphdrs(kd, hdrsz) == -1) return (-1); + kd->vmst->kvatop = (ehdr->e_flags & EF_IA_64_ABSOLUTE) ? + phys_kvatop : virt_kvatop; + /* * Load the PBVM page table. We need this to resolve PBVM addresses. * The PBVM page table is obtained from the bootinfo structure, of - * which the physical address is given to us in e_entry. If e_entry - * is 0, then this is assumed to be a pre-PBVM kernel. + * which the address is given to us in e_entry. If e_entry is 0, then + * this is assumed to be a pre-PBVM kernel. + * Note that the address of the bootinfo structure is either physical + * or virtual, depending on whether the core is physical or virtual. */ - if (ehdr->e_entry != 0) { - sz = _kvm_read_phys(kd, ehdr->e_entry, &bi, sizeof(bi)); + if (ehdr->e_entry != 0 && (ehdr->e_flags & EF_IA_64_ABSOLUTE) != 0) { + sz = phys_read(kd, ehdr->e_entry, &bi, sizeof(bi)); if (sz != sizeof(bi)) { _kvm_err(kd, kd->program, - "cannot read bootinfo from PA %#lx", ehdr->e_entry); + "cannot read bootinfo at physical address %#jx", + (uintmax_t)ehdr->e_entry); return (-1); } if (bi.bi_magic != BOOTINFO_MAGIC) { @@ -206,12 +324,12 @@ _kvm_initvtop(kvm_t *kd) return (-1); } kd->vmst->pbvm_pgtblsz = bi.bi_pbvm_pgtblsz; - sz = _kvm_read_phys(kd, bi.bi_pbvm_pgtbl, kd->vmst->pbvm_pgtbl, + sz = phys_read(kd, bi.bi_pbvm_pgtbl, kd->vmst->pbvm_pgtbl, bi.bi_pbvm_pgtblsz); if (sz != bi.bi_pbvm_pgtblsz) { _kvm_err(kd, kd->program, - "cannot read page table from PA %#lx", - bi.bi_pbvm_pgtbl); + "cannot read page table at physical address %#jx", + (uintmax_t)bi.bi_pbvm_pgtbl); return (-1); } } else { @@ -250,57 +368,8 @@ _kvm_initvtop(kvm_t *kd) int _kvm_kvatop(kvm_t *kd, u_long va, off_t *ofs) { - struct ia64_lpte pte; - uint64_t pa, pgaddr, pt0addr, pt1addr; - size_t pgno, pgsz, pt0no, pt1no; - - if (va >= REGION_BASE(6)) { - /* Regions 6 and 7: direct mapped. */ - pa = REGION_ADDR(va); - return (_kvm_pa2off(kd, pa, ofs, 0)); - } else if (va >= REGION_BASE(5)) { - /* Region 5: Kernel Virtual Memory. */ - va = REGION_ADDR(va); - pgsz = kd->vmst->pagesize; - pt0no = KPTE_DIR0_INDEX(va, pgsz); - pt1no = KPTE_DIR1_INDEX(va, pgsz); - pgno = KPTE_PTE_INDEX(va, pgsz); - if (pt0no >= NKPTEDIR(pgsz)) - goto fail; - pt0addr = kd->vmst->kptdir + (pt0no << 3); - if (kvm_read(kd, pt0addr, &pt1addr, 8) != 8) - goto fail; - if (pt1addr == 0) - goto fail; - pt1addr += pt1no << 3; - if (kvm_read(kd, pt1addr, &pgaddr, 8) != 8) - goto fail; - if (pgaddr == 0) - goto fail; - pgaddr += pgno * sizeof(pte); - if (kvm_read(kd, pgaddr, &pte, sizeof(pte)) != sizeof(pte)) - goto fail; - if (!(pte.pte & PTE_PRESENT)) - goto fail; - pa = (pte.pte & PTE_PPN_MASK) + (va & (pgsz - 1)); - return (_kvm_pa2off(kd, pa, ofs, pgsz)); - } else if (va >= PBVM_BASE) { - /* Region 4: Pre-Boot Virtual Memory (PBVM). */ - va -= PBVM_BASE; - pgsz = PBVM_PGSZ; - pt0no = va / pgsz; - if (pt0no >= (kd->vmst->pbvm_pgtblsz >> 3)) - goto fail; - pt0addr = kd->vmst->pbvm_pgtbl[pt0no]; - if (!(pt0addr & PTE_PRESENT)) - goto fail; - pa = (pt0addr & PTE_PPN_MASK) + va % pgsz; - return (_kvm_pa2off(kd, pa, ofs, pgsz)); - } + size_t sz; - fail: - _kvm_err(kd, kd->program, "invalid kernel virtual address %#llx", - (unsigned long long)va); - *ofs = ~0UL; - return (0); + sz = kd->vmst->kvatop(kd, va, ofs); + return (sz); } From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 02:38:54 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2962317; Sun, 29 Dec 2013 02:38:53 +0000 (UTC) Received: from mail.xcllnt.net (mail.xcllnt.net [50.0.150.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A1E111F16; Sun, 29 Dec 2013 02:38:53 +0000 (UTC) Received: from [192.168.2.84] (50-0-150-213.dsl.static.sonic.net [50.0.150.213]) (authenticated bits=0) by mail.xcllnt.net (8.14.7/8.14.7) with ESMTP id rBT2cjDT009783 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 28 Dec 2013 18:38:46 -0800 (PST) (envelope-from marcel@xcllnt.net) Content-Type: multipart/signed; boundary="Apple-Mail=_97001C89-360F-484C-8ABD-E3955D2DC681"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r260022 - head/lib/libkvm From: Marcel Moolenaar In-Reply-To: Date: Sat, 28 Dec 2013 18:39:07 -0800 Message-Id: <28D86FF3-F13C-4EB1-AEED-4051F2944E27@xcllnt.net> References: <201312282301.rBSN1wWP002326@svn.freebsd.org> To: Peter Wemm X-Mailer: Apple Mail (2.1827) Cc: "svn-src-head@freebsd.org" , svn-src-all , Marcel Moolenaar , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 02:38:54 -0000 --Apple-Mail=_97001C89-360F-484C-8ABD-E3955D2DC681 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 On Dec 28, 2013, at 4:40 PM, Peter Wemm wrote: > On Sat, Dec 28, 2013 at 4:04 PM, Peter Wemm wrote: >> On Sat, Dec 28, 2013 at 3:01 PM, Marcel Moolenaar = wrote: >>> Author: marcel >>> Date: Sat Dec 28 23:01:57 2013 >>> New Revision: 260022 >>> URL: http://svnweb.freebsd.org/changeset/base/260022 >>>=20 >>> Log: >>> Allow building a cross libkvm by setting TARGET_ARCH. The library = so >>> produced will be called libkvm-${ARCH} instead of libkvm. This = allows >>> installing it alongside the native version. >>> For symbol lookups, use ps_pglobal_lookup() instead of __fdnlist() >>> when building a cross libkvm. It is assumed that the cross tool = that >>> uses the cross libkvm also provides an implementation for this >>> proc_services function. >>>=20 >>> Note that this commit does not change any of the = architecture-specific >>> code for cross-compilation. >>=20 >> Are you sure about this? I just got a brand new buildworld failure on >> an amd64 machine. The lib32 build code was trying to use 64 bit pmap >> definitions and failed miserably. >>=20 >> I'm really sorry, I accidentally blew away the failure log. I'll = have >> another in a few minutes. >=20 >=20 > This is from stage5.1, the lib32 build: >=20 > /usr/src/lib/libkvm/kvm_amd64.c:78:2: error: unknown type name = 'pml4_entry_t' > pml4_entry_t *PML4; > ^ Ugh. I'll probably revert... --=20 Marcel Moolenaar marcel@xcllnt.net --Apple-Mail=_97001C89-360F-484C-8ABD-E3955D2DC681 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlK/i0sACgkQpgWlLWHuifbbaQCePPMca7t+AePCEMPey5nbJhZ8 1OEAmgLfdb2HVHmK8EqAvhSQYKeQjqnX =NDxM -----END PGP SIGNATURE----- --Apple-Mail=_97001C89-360F-484C-8ABD-E3955D2DC681-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 02:41:34 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E9FF477; Sun, 29 Dec 2013 02:41:34 +0000 (UTC) Received: from smtpauth2.wiscmail.wisc.edu (wmauth2.doit.wisc.edu [144.92.197.222]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EC3041F74; Sun, 29 Dec 2013 02:41:33 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from avs-daemon.smtpauth2.wiscmail.wisc.edu by smtpauth2.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) id <0MYJ00600QJACC00@smtpauth2.wiscmail.wisc.edu>; Sat, 28 Dec 2013 20:41:25 -0600 (CST) X-Spam-PmxInfo: Server=avs-2, Version=6.0.3.2322014, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.12.29.23314, SenderIP=0.0.0.0 X-Spam-Report: AuthenticatedSender=yes, SenderIP=0.0.0.0 Received: from wanderer.tachypleus.net (unknown [70.42.157.34]) by smtpauth2.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) with ESMTPSA id <0MYJ00MVXRFZ8C00@smtpauth2.wiscmail.wisc.edu>; Sat, 28 Dec 2013 20:41:25 -0600 (CST) Message-id: <52BF8BAD.40503@freebsd.org> Date: Sat, 28 Dec 2013 21:40:45 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.0 To: Alan Cox , Marcel Moolenaar , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r259908 - head/sys/vm References: <201312260546.rBQ5kAoJ009798@svn.freebsd.org> <52BF6699.1040006@freebsd.org> <52BF7195.2070606@rice.edu> In-reply-to: <52BF7195.2070606@rice.edu> X-Enigmail-Version: 1.5.2 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 02:41:34 -0000 On 12/28/13 19:49, Alan Cox wrote: > On 12/28/2013 18:02, Nathan Whitehorn wrote: >> On 12/26/13 00:46, Marcel Moolenaar wrote: >>> Author: marcel >>> Date: Thu Dec 26 05:46:10 2013 >>> New Revision: 259908 >>> URL: http://svnweb.freebsd.org/changeset/base/259908 >>> >>> Log: >>> For ia64, use pmap_remove_pages() and not pmap_remove(). The problem is >>> that we don't have a good way (yet) to iterate over the mapped pages by >>> virtual address and simply try each page within the range. Given that we >>> call pmap_remove() over the entire 2^63 bytes of address space, it takes >>> a while for pmap_remove to have tried all 2^50 pages. >>> By using pmap_remove_pages() we use the PV list to find all mappings. >>> >>> Change derived from a patch by: alc >>> >> Why make this ia64-specific? It seems like a potentially useful general >> optimization and certainly shouldn't be harmful on other architectures. > Some of the other implementations of pmap_remove_pages() have > limitations that don't permit them to be used for this purpose, e.g., > > if (pmap != PCPU_GET(curpmap)) { > printf("warning: pmap_remove_pages called with > non-current pmap\n"); > return; > } > > Alan > Fair enough. Thanks for the explanation. -Nathan From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 02:44:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B23F55FE; Sun, 29 Dec 2013 02:44:51 +0000 (UTC) Received: from mail.xcllnt.net (mail.xcllnt.net [50.0.150.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6854F1F98; Sun, 29 Dec 2013 02:44:51 +0000 (UTC) Received: from [192.168.2.84] (50-0-150-213.dsl.static.sonic.net [50.0.150.213]) (authenticated bits=0) by mail.xcllnt.net (8.14.7/8.14.7) with ESMTP id rBT2inAM009816 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 28 Dec 2013 18:44:50 -0800 (PST) (envelope-from marcel@xcllnt.net) Content-Type: multipart/signed; boundary="Apple-Mail=_74A7F0B3-FBE7-45BE-9813-536FAE1F82CC"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r259908 - head/sys/vm From: Marcel Moolenaar In-Reply-To: <52BF6699.1040006@freebsd.org> Date: Sat, 28 Dec 2013 18:45:11 -0800 Message-Id: <14556BDB-35C3-49CE-896A-DEA8B1EB5B9C@xcllnt.net> References: <201312260546.rBQ5kAoJ009798@svn.freebsd.org> <52BF6699.1040006@freebsd.org> To: Nathan Whitehorn X-Mailer: Apple Mail (2.1827) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 02:44:51 -0000 --Apple-Mail=_74A7F0B3-FBE7-45BE-9813-536FAE1F82CC Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On Dec 28, 2013, at 4:02 PM, Nathan Whitehorn wrote: > On 12/26/13 00:46, Marcel Moolenaar wrote: >> Author: marcel >> Date: Thu Dec 26 05:46:10 2013 >> New Revision: 259908 >> URL: http://svnweb.freebsd.org/changeset/base/259908 >> >> Log: >> For ia64, use pmap_remove_pages() and not pmap_remove(). The problem is >> that we don't have a good way (yet) to iterate over the mapped pages by >> virtual address and simply try each page within the range. Given that we >> call pmap_remove() over the entire 2^63 bytes of address space, it takes >> a while for pmap_remove to have tried all 2^50 pages. >> By using pmap_remove_pages() we use the PV list to find all mappings. >> >> Change derived from a patch by: alc >> > > Why make this ia64-specific? It seems like a potentially useful general > optimization and certainly shouldn't be harmful on other architectures. What alc@ said. Making it generic requires a bit more work and it's not clear to me whether it's a good change. Basically, ia64 fails to handle the pmap_remove() interface. So, for now I see it as a quick fix. What happens next is open. We're thinking of using the new trie code to track PTEs per PMAP. This helps to support pmap_remove() efficiently and may have other advantages. -- Marcel Moolenaar marcel@xcllnt.net --Apple-Mail=_74A7F0B3-FBE7-45BE-9813-536FAE1F82CC Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlK/jLcACgkQpgWlLWHuifZwCACeKGw0BUH3uRFlN1ovJyHIwQdX MK0AmwZsBLfjxyaAaxKxRU75Jrmf6LCc =qidu -----END PGP SIGNATURE----- --Apple-Mail=_74A7F0B3-FBE7-45BE-9813-536FAE1F82CC-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 02:48:47 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6FD6A76D; Sun, 29 Dec 2013 02:48:47 +0000 (UTC) Received: from mail.xcllnt.net (mail.xcllnt.net [50.0.150.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 25F301FAF; Sun, 29 Dec 2013 02:48:46 +0000 (UTC) Received: from [192.168.2.84] (50-0-150-213.dsl.static.sonic.net [50.0.150.213]) (authenticated bits=0) by mail.xcllnt.net (8.14.7/8.14.7) with ESMTP id rBT2mjAk009829 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 28 Dec 2013 18:48:46 -0800 (PST) (envelope-from marcel@xcllnt.net) Content-Type: multipart/signed; boundary="Apple-Mail=_C64CA47F-5CF7-47E2-86C6-D8F3CB1A29DC"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r260022 - head/lib/libkvm From: Marcel Moolenaar In-Reply-To: <20131229010848.GV99167@funkthat.com> Date: Sat, 28 Dec 2013 18:49:07 -0800 Message-Id: <7F0C4872-DB2A-4E6B-A8B8-E366989312C5@xcllnt.net> References: <201312282301.rBSN1wWP002326@svn.freebsd.org> <20131229010848.GV99167@funkthat.com> To: John-Mark Gurney X-Mailer: Apple Mail (2.1827) Cc: "svn-src-head@freebsd.org" , svn-src-all , Marcel Moolenaar , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 02:48:47 -0000 --Apple-Mail=_C64CA47F-5CF7-47E2-86C6-D8F3CB1A29DC Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On Dec 28, 2013, at 5:08 PM, John-Mark Gurney wrote: > Marcel Moolenaar wrote this message on Sat, Dec 28, 2013 at 23:01 +0000: >> Author: marcel >> Date: Sat Dec 28 23:01:57 2013 >> New Revision: 260022 >> URL: http://svnweb.freebsd.org/changeset/base/260022 >> >> Log: >> Allow building a cross libkvm by setting TARGET_ARCH. The library so >> produced will be called libkvm-${ARCH} instead of libkvm. This allows >> installing it alongside the native version. >> For symbol lookups, use ps_pglobal_lookup() instead of __fdnlist() >> when building a cross libkvm. It is assumed that the cross tool that >> uses the cross libkvm also provides an implementation for this >> proc_services function. >> >> Note that this commit does not change any of the architecture-specific >> code for cross-compilation. > > Shouldn't we be putting cross compiled libaries in another location > than /lib? Kind of like the compat32 libs? I don't think we're there yet. libkvm is not ready for generic cross building and we don't really have the infrastructure for it either. For one, we really need to install CPU-specific headers on the host. We can manually cross-build a few things, like binutils and gdb and I see value to extend that to kgdb, but that's about it. -- Marcel Moolenaar marcel@xcllnt.net --Apple-Mail=_C64CA47F-5CF7-47E2-86C6-D8F3CB1A29DC Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlK/jaMACgkQpgWlLWHuifZdDgCeLxsYJ1HhI7Ot18t2JRXq06fj jCQAn32Bqm2sKc75cQ7OPFqHKnO5Ltg3 =+Wnk -----END PGP SIGNATURE----- --Apple-Mail=_C64CA47F-5CF7-47E2-86C6-D8F3CB1A29DC-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 03:15:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ECA89E8F; Sun, 29 Dec 2013 03:15:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D9816121D; Sun, 29 Dec 2013 03:15:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBT3FFTR017381; Sun, 29 Dec 2013 03:15:15 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBT3FFlx017380; Sun, 29 Dec 2013 03:15:15 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201312290315.rBT3FFlx017380@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 29 Dec 2013 03:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260030 - head/lib/libkvm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 03:15:16 -0000 Author: marcel Date: Sun Dec 29 03:15:15 2013 New Revision: 260030 URL: http://svnweb.freebsd.org/changeset/base/260030 Log: Revert part of r260022: LIB32 builds were broken by it. Modified: head/lib/libkvm/Makefile Modified: head/lib/libkvm/Makefile ============================================================================== --- head/lib/libkvm/Makefile Sun Dec 29 02:57:10 2013 (r260029) +++ head/lib/libkvm/Makefile Sun Dec 29 03:15:15 2013 (r260030) @@ -1,35 +1,23 @@ # @(#)Makefile 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -.if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} -.else -TARGET_ARCH=${MACHINE_ARCH} -TARGET_CPUARCH=${MACHINE_CPUARCH} -.endif - -.if ${TARGET_ARCH} != ${MACHINE_ARCH} -LIB= kvm-${TARGET_ARCH} -CFLAGS+=-DCROSS_LIBKVM -.else LIB= kvm -.endif - SHLIBDIR?= /lib SHLIB_MAJOR= 6 CFLAGS+=-DLIBC_SCCS -I${.CURDIR} -.if exists(${.CURDIR}/kvm_${TARGET_ARCH}.c) -KVM_ARCH=${TARGET_ARCH} +.if exists(${.CURDIR}/kvm_${MACHINE_ARCH}.c) +KVM_ARCH=${MACHINE_ARCH} .else -KVM_ARCH=${TARGET_CPUARCH} +KVM_ARCH=${MACHINE_CPUARCH} .endif WARNS?= 3 SRCS= kvm.c kvm_${KVM_ARCH}.c kvm_cptime.c kvm_file.c kvm_getloadavg.c \ kvm_getswapinfo.c kvm_pcpu.c kvm_proc.c kvm_vnet.c -.if exists(${.CURDIR}/kvm_minidump_${KVM_ARCH}.c) +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ + ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" SRCS+= kvm_minidump_${KVM_ARCH}.c .endif INCS= kvm.h From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 03:32:47 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3234C117; Sun, 29 Dec 2013 03:32:47 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E20E812FD; Sun, 29 Dec 2013 03:32:46 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id rBT3WjfB027631 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 28 Dec 2013 19:32:46 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id rBT3WjbT027630; Sat, 28 Dec 2013 19:32:45 -0800 (PST) (envelope-from jmg) Date: Sat, 28 Dec 2013 19:32:45 -0800 From: John-Mark Gurney To: Marcel Moolenaar Subject: Re: svn commit: r260022 - head/lib/libkvm Message-ID: <20131229033245.GY99167@funkthat.com> References: <201312282301.rBSN1wWP002326@svn.freebsd.org> <20131229010848.GV99167@funkthat.com> <7F0C4872-DB2A-4E6B-A8B8-E366989312C5@xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7F0C4872-DB2A-4E6B-A8B8-E366989312C5@xcllnt.net> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Sat, 28 Dec 2013 19:32:46 -0800 (PST) Cc: "svn-src-head@freebsd.org" , svn-src-all , Marcel Moolenaar , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 03:32:47 -0000 Marcel Moolenaar wrote this message on Sat, Dec 28, 2013 at 18:49 -0800: > > On Dec 28, 2013, at 5:08 PM, John-Mark Gurney wrote: > > > Marcel Moolenaar wrote this message on Sat, Dec 28, 2013 at 23:01 +0000: > >> Author: marcel > >> Date: Sat Dec 28 23:01:57 2013 > >> New Revision: 260022 > >> URL: http://svnweb.freebsd.org/changeset/base/260022 > >> > >> Log: > >> Allow building a cross libkvm by setting TARGET_ARCH. The library so > >> produced will be called libkvm-${ARCH} instead of libkvm. This allows > >> installing it alongside the native version. > >> For symbol lookups, use ps_pglobal_lookup() instead of __fdnlist() > >> when building a cross libkvm. It is assumed that the cross tool that > >> uses the cross libkvm also provides an implementation for this > >> proc_services function. > >> > >> Note that this commit does not change any of the architecture-specific > >> code for cross-compilation. > > > > Shouldn't we be putting cross compiled libaries in another location > > than /lib? Kind of like the compat32 libs? > > I don't think we're there yet. libkvm is not ready for generic > cross building and we don't really have the infrastructure for > it either. For one, we really need to install CPU-specific > headers on the host. > > We can manually cross-build a few things, like binutils and gdb > and I see value to extend that to kgdb, but that's about it. Then what was the goal of this commit? Was it to have an i386 compatible libkvm that links w/ amd64 binaries? or? -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 03:43:25 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E916240F; Sun, 29 Dec 2013 03:43:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D487C136E; Sun, 29 Dec 2013 03:43:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBT3hP1m026238; Sun, 29 Dec 2013 03:43:25 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBT3hPmZ026237; Sun, 29 Dec 2013 03:43:25 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201312290343.rBT3hPmZ026237@svn.freebsd.org> From: Alexander Motin Date: Sun, 29 Dec 2013 03:43:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260031 - head/sys/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 03:43:26 -0000 Author: mav Date: Sun Dec 29 03:43:25 2013 New Revision: 260031 URL: http://svnweb.freebsd.org/changeset/base/260031 Log: In addition to r259632 completely block receive upcalls if we have more data than we need. This reduces lock pressure from xprt_active() side. Modified: head/sys/rpc/svc_vc.c Modified: head/sys/rpc/svc_vc.c ============================================================================== --- head/sys/rpc/svc_vc.c Sun Dec 29 03:15:15 2013 (r260030) +++ head/sys/rpc/svc_vc.c Sun Dec 29 03:43:25 2013 (r260031) @@ -619,7 +619,15 @@ svc_vc_process_pending(SVCXPRT *xprt) } } - so->so_rcv.sb_lowat = imax(1, imin(cd->resid, so->so_rcv.sb_hiwat / 2)); + /* + * Block receive upcalls if we have more data pending, + * otherwise report our need. + */ + if (cd->mpending) + so->so_rcv.sb_lowat = INT_MAX; + else + so->so_rcv.sb_lowat = + imax(1, imin(cd->resid, so->so_rcv.sb_hiwat / 2)); return (TRUE); } From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 03:53:05 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F196D807; Sun, 29 Dec 2013 03:53:04 +0000 (UTC) Received: from mail.xcllnt.net (mail.xcllnt.net [50.0.150.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BE6B61439; Sun, 29 Dec 2013 03:53:04 +0000 (UTC) Received: from [192.168.2.84] (50-0-150-213.dsl.static.sonic.net [50.0.150.213]) (authenticated bits=0) by mail.xcllnt.net (8.14.7/8.14.7) with ESMTP id rBT3r2Af010254 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 28 Dec 2013 19:53:03 -0800 (PST) (envelope-from marcel@xcllnt.net) Content-Type: multipart/signed; boundary="Apple-Mail=_134EE2E7-477A-4012-85C1-097B83F89B11"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r260022 - head/lib/libkvm From: Marcel Moolenaar In-Reply-To: <20131229033245.GY99167@funkthat.com> Date: Sat, 28 Dec 2013 19:53:24 -0800 Message-Id: <5C67568C-389D-4023-9076-DC2E1608D187@xcllnt.net> References: <201312282301.rBSN1wWP002326@svn.freebsd.org> <20131229010848.GV99167@funkthat.com> <7F0C4872-DB2A-4E6B-A8B8-E366989312C5@xcllnt.net> <20131229033245.GY99167@funkthat.com> To: John-Mark Gurney X-Mailer: Apple Mail (2.1827) Cc: "svn-src-head@freebsd.org" , svn-src-all , Marcel Moolenaar , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 03:53:05 -0000 --Apple-Mail=_134EE2E7-477A-4012-85C1-097B83F89B11 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On Dec 28, 2013, at 7:32 PM, John-Mark Gurney wrote: > Marcel Moolenaar wrote this message on Sat, Dec 28, 2013 at 18:49 -0800: >> >> On Dec 28, 2013, at 5:08 PM, John-Mark Gurney wrote: >> >>> Marcel Moolenaar wrote this message on Sat, Dec 28, 2013 at 23:01 +0000: >>>> Author: marcel >>>> Date: Sat Dec 28 23:01:57 2013 >>>> New Revision: 260022 >>>> URL: http://svnweb.freebsd.org/changeset/base/260022 >>>> >>>> Log: >>>> Allow building a cross libkvm by setting TARGET_ARCH. The library so >>>> produced will be called libkvm-${ARCH} instead of libkvm. This allows >>>> installing it alongside the native version. >>>> For symbol lookups, use ps_pglobal_lookup() instead of __fdnlist() >>>> when building a cross libkvm. It is assumed that the cross tool that >>>> uses the cross libkvm also provides an implementation for this >>>> proc_services function. >>>> >>>> Note that this commit does not change any of the architecture-specific >>>> code for cross-compilation. >>> >>> Shouldn't we be putting cross compiled libaries in another location >>> than /lib? Kind of like the compat32 libs? >> >> I don't think we're there yet. libkvm is not ready for generic >> cross building and we don't really have the infrastructure for >> it either. For one, we really need to install CPU-specific >> headers on the host. >> >> We can manually cross-build a few things, like binutils and gdb >> and I see value to extend that to kgdb, but that's about it. > > Then what was the goal of this commit? Was it to have an i386 > compatible libkvm that links w/ amd64 binaries? or? The goal was to get a step closer to having useful cross-tools, including those that need libkvm. In this case it allowed me to make an ia64 cross-kgdb, useful for core analysis and/or remote debugging. -- Marcel Moolenaar marcel@xcllnt.net --Apple-Mail=_134EE2E7-477A-4012-85C1-097B83F89B11 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlK/nLQACgkQpgWlLWHuifZx7gCbBnY6wJFFR2GGJr78OY1MPZAK MlYAn3bQQ+q/HU4ZALegoluqaZiEMYGW =FkZa -----END PGP SIGNATURE----- --Apple-Mail=_134EE2E7-477A-4012-85C1-097B83F89B11-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 04:54:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5EFDFA0; Sun, 29 Dec 2013 04:54:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8ACA21778; Sun, 29 Dec 2013 04:54:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBT4sqSp049643; Sun, 29 Dec 2013 04:54:52 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBT4sq1U049642; Sun, 29 Dec 2013 04:54:52 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201312290454.rBT4sq1U049642@svn.freebsd.org> From: Alan Cox Date: Sun, 29 Dec 2013 04:54:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260032 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 04:54:52 -0000 Author: alc Date: Sun Dec 29 04:54:52 2013 New Revision: 260032 URL: http://svnweb.freebsd.org/changeset/base/260032 Log: Add "popmap" assertions: The page being freed isn't already free, and the page being allocated isn't already allocated. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_reserv.c Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Sun Dec 29 03:43:25 2013 (r260031) +++ head/sys/vm/vm_reserv.c Sun Dec 29 04:54:52 2013 (r260032) @@ -241,6 +241,9 @@ vm_reserv_depopulate(vm_reserv_t rv, int mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); KASSERT(rv->object != NULL, ("vm_reserv_depopulate: reserv %p is free", rv)); + KASSERT(isset(rv->popmap, index), + ("vm_reserv_depopulate: reserv %p's popmap[%d] is clear", rv, + index)); KASSERT(rv->popcnt > 0, ("vm_reserv_depopulate: reserv %p's popcnt is corrupted", rv)); if (rv->inpartpopq) { @@ -294,6 +297,9 @@ vm_reserv_populate(vm_reserv_t rv, int i mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); KASSERT(rv->object != NULL, ("vm_reserv_populate: reserv %p is free", rv)); + KASSERT(isclr(rv->popmap, index), + ("vm_reserv_populate: reserv %p's popmap[%d] is set", rv, + index)); KASSERT(rv->popcnt < VM_LEVEL_0_NPAGES, ("vm_reserv_populate: reserv %p is already full", rv)); if (rv->inpartpopq) { From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 09:01:05 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 524A8BA1; Sun, 29 Dec 2013 09:01:05 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E55F814B0; Sun, 29 Dec 2013 09:01:04 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id rBT90sMY073910; Sun, 29 Dec 2013 11:00:54 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua rBT90sMY073910 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id rBT90rL8073909; Sun, 29 Dec 2013 11:00:53 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 29 Dec 2013 11:00:53 +0200 From: Konstantin Belousov To: Alan Cox Subject: Re: svn commit: r259908 - head/sys/vm Message-ID: <20131229090053.GU59496@kib.kiev.ua> References: <201312260546.rBQ5kAoJ009798@svn.freebsd.org> <52BF6699.1040006@freebsd.org> <52BF7195.2070606@rice.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HrQ/+whymLRZ6Agu" Content-Disposition: inline In-Reply-To: <52BF7195.2070606@rice.edu> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org, Nathan Whitehorn X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 09:01:05 -0000 --HrQ/+whymLRZ6Agu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 28, 2013 at 06:49:25PM -0600, Alan Cox wrote: > On 12/28/2013 18:02, Nathan Whitehorn wrote: > > On 12/26/13 00:46, Marcel Moolenaar wrote: > >> Author: marcel > >> Date: Thu Dec 26 05:46:10 2013 > >> New Revision: 259908 > >> URL: http://svnweb.freebsd.org/changeset/base/259908 > >> > >> Log: > >> For ia64, use pmap_remove_pages() and not pmap_remove(). The problem= is > >> that we don't have a good way (yet) to iterate over the mapped pages= by > >> virtual address and simply try each page within the range. Given tha= t we > >> call pmap_remove() over the entire 2^63 bytes of address space, it t= akes > >> a while for pmap_remove to have tried all 2^50 pages. > >> By using pmap_remove_pages() we use the PV list to find all mappings. > >> =20 > >> Change derived from a patch by: alc > >> > > Why make this ia64-specific? It seems like a potentially useful general > > optimization and certainly shouldn't be harmful on other architectures. >=20 > Some of the other implementations of pmap_remove_pages() have > limitations that don't permit them to be used for this purpose, e.g., >=20 > if (pmap !=3D PCPU_GET(curpmap)) { > printf("warning: pmap_remove_pages called with > non-current pmap\n"); > return; > } BTW, I do not easily see why the current amd64 implementation needs the pmap being current. I do not see accesses to recursive page table mappings in the code. --HrQ/+whymLRZ6Agu Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSv+TFAAoJEJDCuSvBvK1BjDMP/R260PGrKF685fgY8O/3T/TX iSFJor7IsJ7p+dZn3HN/RRIhezOrSI6YstklcvU+XYfGAjRLpdkY7xAB8ugzddmv CRnGRtPrzizL3uMsPWWAvM47/hjV4w3nrE/AKuOJnLM2pPGx7VnRXTPrO66r6kS5 JigLu/PBHoQQ64EOn6V8w/+h0AI4HmFTIKNv3VD66Yfxlcyu55G5Kjxr2V+mqU6f EYLLinCUF5qbVVFTGOpHTClE563DIpTH/dM6B36ZiaEjPswWRbwUAJafkiWB7WYt AV9vO9/hb3lpPDHo44uXS2hAuVQ9HGxgYrwdbzR2HBFUZ9eS/lJDXhzHqeyUC/LY ZjB+qBy5cuYNWXGqks8Wbe21FCRkTy3lQv7aYyTLw52i/wixq5eKC5XrYmgP2/G4 RDBj9wavXoGP7lDAVWXX1KUMtEdzt47nSL/cAce3q7CVSA8+O/5QgXSj0XswPk5v 5je4Sdpv/X89oa3jn9dOxOzsTBhx3DYhuVGhKskbX7SoJPqvYO5Ke2P/2X+Somw9 GSBKfjqUhV5i9yJd4MJbSDaxy+PrKGrfTKeJfU4Y2dSLT3IKRvNP4TJEIOSBlWSo e9ciQ+W1gwIhB1Uc/+1PkeHAfgy5lCtKGZM+Sh+SN1yBo+DP7beebpImdHKth2pL zHBtXzbrFL3XY1YgR5bD =rj+C -----END PGP SIGNATURE----- --HrQ/+whymLRZ6Agu-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 09:03:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8DD8ED22; Sun, 29 Dec 2013 09:03:45 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2CB1D1512; Sun, 29 Dec 2013 09:03:45 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id rBT93edP073998; Sun, 29 Dec 2013 11:03:40 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua rBT93edP073998 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id rBT93ceo073997; Sun, 29 Dec 2013 11:03:38 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 29 Dec 2013 11:03:38 +0200 From: Konstantin Belousov To: Marcel Moolenaar Subject: Re: svn commit: r260022 - head/lib/libkvm Message-ID: <20131229090338.GV59496@kib.kiev.ua> References: <201312282301.rBSN1wWP002326@svn.freebsd.org> <28D86FF3-F13C-4EB1-AEED-4051F2944E27@xcllnt.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YREkK/99wwX4Ls8o" Content-Disposition: inline In-Reply-To: <28D86FF3-F13C-4EB1-AEED-4051F2944E27@xcllnt.net> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: "svn-src-head@freebsd.org" , svn-src-all , Marcel Moolenaar , "src-committers@freebsd.org" , Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 09:03:45 -0000 --YREkK/99wwX4Ls8o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 28, 2013 at 06:39:07PM -0800, Marcel Moolenaar wrote: >=20 > On Dec 28, 2013, at 4:40 PM, Peter Wemm wrote: >=20 > > On Sat, Dec 28, 2013 at 4:04 PM, Peter Wemm wrote: > >> On Sat, Dec 28, 2013 at 3:01 PM, Marcel Moolenaar = wrote: > >>> Author: marcel > >>> Date: Sat Dec 28 23:01:57 2013 > >>> New Revision: 260022 > >>> URL: http://svnweb.freebsd.org/changeset/base/260022 > >>>=20 > >>> Log: > >>> Allow building a cross libkvm by setting TARGET_ARCH. The library so > >>> produced will be called libkvm-${ARCH} instead of libkvm. This allows > >>> installing it alongside the native version. > >>> For symbol lookups, use ps_pglobal_lookup() instead of __fdnlist() > >>> when building a cross libkvm. It is assumed that the cross tool that > >>> uses the cross libkvm also provides an implementation for this > >>> proc_services function. > >>>=20 > >>> Note that this commit does not change any of the architecture-specif= ic > >>> code for cross-compilation. > >>=20 > >> Are you sure about this? I just got a brand new buildworld failure on > >> an amd64 machine. The lib32 build code was trying to use 64 bit pmap > >> definitions and failed miserably. > >>=20 > >> I'm really sorry, I accidentally blew away the failure log. I'll have > >> another in a few minutes. > >=20 > >=20 > > This is from stage5.1, the lib32 build: > >=20 > > /usr/src/lib/libkvm/kvm_amd64.c:78:2: error: unknown type name 'pml4_en= try_t' > > pml4_entry_t *PML4; > > ^ >=20 > Ugh. I'll probably revert... Might be, it makes more sense to disable libkvm compat32 build ? The library does not have any chance of functioning on host anyway. The only compelling argument to keep it is to satisfy the linkage for binaries which do not use the library. --YREkK/99wwX4Ls8o Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSv+VpAAoJEJDCuSvBvK1B1+gQAKmbAEkjE8NMJRAVP5vDR1lW yYwOnSuGRJ+IjxXdwJ51nyIGQ1+A6fUnBWwld//w6qskAHiTRrC+Y49K2ydd0Ksr G8SYJJVSPusJwqwCkZ0jHBIHCbpYcE32oxYqdB/A022Yrn33T0/Ywvr126J0bPdh eoYRt0qEyn5U618tB99jQOF9tucbOFoVBjw+ApUHSR7A2vPkUtPvK7mavhI+D4Sb 0sfC0qwRFoc0cBErjW1dZZqLvEC0pCusgye+TvdBbblNR195LKpXCL7Q53AfkiLq 4SCk4ULxiE1JXksYBxzuebhawG0w7QAqJcmdWJi9rE9/TV8jEnToro+mfJFzhbFZ uzaf0BRPFwNrXJkQwW+aLCkJmZyv2r5VQBL0dzjVZaQehslua0BNCajK2zAUDBkR av7TG5/kjMmGFsbhMAn1ZTNWOSre3UvPmAFStYOjIaa1LPdDIVHOD7jP52Q82yqP 3Pii0bD3DD8Ghtyr8Jl2f6AZ2VupoByLVBbnfWB8Iv0W/iZumhNBJNC+6XRXZaAH by0xSIbdYbXZ1ZG9v6MjAnh8ShkHoMy7MP91vBVJLqNdUHPnxkTkoaPe2QpHZ758 I3tp4v/XKdMixVYiMgoU2ZfmDjSNPT3bdmheQHhXq9QQsezxEr9PbUYg1/A5dV9C flko9Hfpxd1zaetifOYw =ORDw -----END PGP SIGNATURE----- --YREkK/99wwX4Ls8o-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 11:19:10 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D5DEE33F; Sun, 29 Dec 2013 11:19:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C20B31CEE; Sun, 29 Dec 2013 11:19:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTBJA0I093149; Sun, 29 Dec 2013 11:19:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTBJ9wA093144; Sun, 29 Dec 2013 11:19:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201312291119.rBTBJ9wA093144@svn.freebsd.org> From: Alexander Motin Date: Sun, 29 Dec 2013 11:19:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260036 - head/sys/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 11:19:10 -0000 Author: mav Date: Sun Dec 29 11:19:09 2013 New Revision: 260036 URL: http://svnweb.freebsd.org/changeset/base/260036 Log: Introduce xprt_inactive_self() -- variant for use when sure that port is assigned to thread. For example, withing receive handlers. In that case the function reduces to single assignment and can avoid locking. Modified: head/sys/rpc/svc.c head/sys/rpc/svc.h head/sys/rpc/svc_dg.c head/sys/rpc/svc_vc.c Modified: head/sys/rpc/svc.c ============================================================================== --- head/sys/rpc/svc.c Sun Dec 29 09:17:43 2013 (r260035) +++ head/sys/rpc/svc.c Sun Dec 29 11:19:09 2013 (r260036) @@ -406,6 +406,19 @@ xprt_inactive(SVCXPRT *xprt) } /* + * Variant of xprt_inactive() for use only when sure that port is + * assigned to thread. For example, withing receive handlers. + */ +void +xprt_inactive_self(SVCXPRT *xprt) +{ + + KASSERT(xprt->xp_thread != NULL, + ("xprt_inactive_self(%p) with NULL xp_thread", xprt)); + xprt->xp_active = FALSE; +} + +/* * Add a service program to the callout list. * The dispatch routine will be called when a rpc request for this * program number comes in. Modified: head/sys/rpc/svc.h ============================================================================== --- head/sys/rpc/svc.h Sun Dec 29 09:17:43 2013 (r260035) +++ head/sys/rpc/svc.h Sun Dec 29 11:19:09 2013 (r260036) @@ -523,6 +523,7 @@ __BEGIN_DECLS extern void xprt_active(SVCXPRT *); extern void xprt_inactive(SVCXPRT *); extern void xprt_inactive_locked(SVCXPRT *); +extern void xprt_inactive_self(SVCXPRT *); __END_DECLS #endif Modified: head/sys/rpc/svc_dg.c ============================================================================== --- head/sys/rpc/svc_dg.c Sun Dec 29 09:17:43 2013 (r260035) +++ head/sys/rpc/svc_dg.c Sun Dec 29 11:19:09 2013 (r260036) @@ -196,10 +196,10 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms * from racing the upcall after our soreadable() call * returns false. */ - mtx_lock(&xprt->xp_pool->sp_lock); + SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); if (!soreadable(xprt->xp_socket)) - xprt_inactive_locked(xprt); - mtx_unlock(&xprt->xp_pool->sp_lock); + xprt_inactive_self(xprt); + SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); sx_xunlock(&xprt->xp_lock); return (FALSE); } @@ -208,7 +208,7 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); soupcall_clear(xprt->xp_socket, SO_RCV); SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); - xprt_inactive(xprt); + xprt_inactive_self(xprt); sx_xunlock(&xprt->xp_lock); return (FALSE); } Modified: head/sys/rpc/svc_vc.c ============================================================================== --- head/sys/rpc/svc_vc.c Sun Dec 29 09:17:43 2013 (r260035) +++ head/sys/rpc/svc_vc.c Sun Dec 29 11:19:09 2013 (r260036) @@ -385,7 +385,7 @@ svc_vc_rendezvous_recv(SVCXPRT *xprt, st */ ACCEPT_LOCK(); if (TAILQ_EMPTY(&xprt->xp_socket->so_comp)) - xprt_inactive(xprt); + xprt_inactive_self(xprt); ACCEPT_UNLOCK(); sx_xunlock(&xprt->xp_lock); return (FALSE); @@ -398,7 +398,7 @@ svc_vc_rendezvous_recv(SVCXPRT *xprt, st soupcall_clear(xprt->xp_socket, SO_RCV); } SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); - xprt_inactive(xprt); + xprt_inactive_self(xprt); sx_xunlock(&xprt->xp_lock); return (FALSE); } @@ -667,7 +667,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms if (cd->mreq == NULL || cd->resid != 0) { SOCKBUF_LOCK(&so->so_rcv); if (!soreadable(so)) - xprt_inactive(xprt); + xprt_inactive_self(xprt); SOCKBUF_UNLOCK(&so->so_rcv); } @@ -709,7 +709,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms */ SOCKBUF_LOCK(&so->so_rcv); if (!soreadable(so)) - xprt_inactive(xprt); + xprt_inactive_self(xprt); SOCKBUF_UNLOCK(&so->so_rcv); sx_xunlock(&xprt->xp_lock); return (FALSE); @@ -722,7 +722,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms soupcall_clear(so, SO_RCV); } SOCKBUF_UNLOCK(&so->so_rcv); - xprt_inactive(xprt); + xprt_inactive_self(xprt); cd->strm_stat = XPRT_DIED; sx_xunlock(&xprt->xp_lock); return (FALSE); @@ -732,7 +732,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms /* * EOF - the other end has closed the socket. */ - xprt_inactive(xprt); + xprt_inactive_self(xprt); cd->strm_stat = XPRT_DIED; sx_xunlock(&xprt->xp_lock); return (FALSE); @@ -763,7 +763,7 @@ svc_vc_backchannel_recv(SVCXPRT *xprt, s mtx_lock(&ct->ct_lock); m = cd->mreq; if (m == NULL) { - xprt_inactive(xprt); + xprt_inactive_self(xprt); mtx_unlock(&ct->ct_lock); sx_xunlock(&xprt->xp_lock); return (FALSE); From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 14:19:15 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DE20D546; Sun, 29 Dec 2013 14:19:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CA0CE173B; Sun, 29 Dec 2013 14:19:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTEJF4X061902; Sun, 29 Dec 2013 14:19:15 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTEJF1n061901; Sun, 29 Dec 2013 14:19:15 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312291419.rBTEJF1n061901@svn.freebsd.org> From: Dimitry Andric Date: Sun, 29 Dec 2013 14:19:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260038 - head/sys/dev/en X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 14:19:15 -0000 Author: dim Date: Sun Dec 29 14:19:15 2013 New Revision: 260038 URL: http://svnweb.freebsd.org/changeset/base/260038 Log: In sys/dev/en/midway.c, #if 0 an unused static function. MFC after: 3 days Modified: head/sys/dev/en/midway.c Modified: head/sys/dev/en/midway.c ============================================================================== --- head/sys/dev/en/midway.c Sun Dec 29 12:30:06 2013 (r260037) +++ head/sys/dev/en/midway.c Sun Dec 29 14:19:15 2013 (r260038) @@ -344,6 +344,7 @@ en_k2sz(int k) } #define en_log2(X) en_k2sz(X) +#if 0 /* * en_b2sz: convert a DMA burst code to its byte size */ @@ -365,6 +366,7 @@ en_b2sz(int b) } return (0); } +#endif /* * en_sz2b: convert a burst size (bytes) to DMA burst code From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 14:21:55 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D70C8774; Sun, 29 Dec 2013 14:21:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B87DD1795; Sun, 29 Dec 2013 14:21:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTELtuN064787; Sun, 29 Dec 2013 14:21:55 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTELtWe064785; Sun, 29 Dec 2013 14:21:55 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312291421.rBTELtWe064785@svn.freebsd.org> From: Dimitry Andric Date: Sun, 29 Dec 2013 14:21:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260039 - in head/sys: conf modules/ipfilter X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 14:21:55 -0000 Author: dim Date: Sun Dec 29 14:21:55 2013 New Revision: 260039 URL: http://svnweb.freebsd.org/changeset/base/260039 Log: Turn off warnings about unused variables for a bunch of files under contrib/ipfilter. MFC after: 3 days Modified: head/sys/conf/files head/sys/modules/ipfilter/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Dec 29 14:19:15 2013 (r260038) +++ head/sys/conf/files Sun Dec 29 14:21:55 2013 (r260039) @@ -456,39 +456,39 @@ contrib/dev/acpica/components/utilities/ contrib/dev/acpica/components/utilities/utxfinit.c optional acpi #contrib/dev/acpica/components/utilities/utxfmutex.c optional acpi contrib/ipfilter/netinet/fil.c optional ipfilter inet \ - compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_auth.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_fil_freebsd.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_frag.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_log.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_nat.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_proxy.c optional ipfilter inet \ - compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_state.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_lookup.c optional ipfilter inet \ - compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -Wno-error -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -Wno-unused -Wno-error -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_pool.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_htable.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_sync.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/mlfk_ipl.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_nat6.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_rules.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_scan.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_dstlist.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter" contrib/ipfilter/netinet/radix_ipf.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/libfdt/fdt.c optional fdt Modified: head/sys/modules/ipfilter/Makefile ============================================================================== --- head/sys/modules/ipfilter/Makefile Sun Dec 29 14:19:15 2013 (r260038) +++ head/sys/modules/ipfilter/Makefile Sun Dec 29 14:21:55 2013 (r260039) @@ -28,7 +28,18 @@ CFLAGS+= -DIPFILTER=1 -DIPFILTER_LKM -DI .include -CWARNFLAGS.fil.c= ${NO_WSELF_ASSIGN} -CWARNFLAGS.ip_proxy.c= ${NO_WSELF_ASSIGN} -CWARNFLAGS.ip_lookup.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS.fil.c= ${NO_WSELF_ASSIGN} -Wno-unused +CWARNFLAGS.ip_auth.c= -Wno-unused +CWARNFLAGS.ip_fil_freebsd.c= -Wno-unused +CWARNFLAGS.ip_frag.c= -Wno-unused +CWARNFLAGS.ip_htable.c= -Wno-unused +CWARNFLAGS.ip_dstlist.c= -Wno-unused +CWARNFLAGS.ip_lookup.c= ${NO_WSELF_ASSIGN} -Wno-unused +CWARNFLAGS.ip_nat.c= -Wno-unused +CWARNFLAGS.ip_nat6.c= -Wno-unused +CWARNFLAGS.ip_pool.c= -Wno-unused +CWARNFLAGS.ip_proxy.c= ${NO_WSELF_ASSIGN} -Wno-unused +CWARNFLAGS.ip_scan.c= -Wno-unused +CWARNFLAGS.ip_state.c= -Wno-unused +CWARNFLAGS.ip_sync.c= -Wno-unused CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 16:28:38 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 415EC68B; Sun, 29 Dec 2013 16:28:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2D1CB1057; Sun, 29 Dec 2013 16:28:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTGSc32012662; Sun, 29 Dec 2013 16:28:38 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTGScou012661; Sun, 29 Dec 2013 16:28:38 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312291628.rBTGScou012661@svn.freebsd.org> From: Dimitry Andric Date: Sun, 29 Dec 2013 16:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260040 - head/sys/dev/mcd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 16:28:38 -0000 Author: dim Date: Sun Dec 29 16:28:37 2013 New Revision: 260040 URL: http://svnweb.freebsd.org/changeset/base/260040 Log: In sys/dev/mcd/mcd.c, mark the static const COPYRIGHT string as __used, so it ends up in the object file, and no warnings are emitted about it being actually unused. MFC after: 3 days Modified: head/sys/dev/mcd/mcd.c Modified: head/sys/dev/mcd/mcd.c ============================================================================== --- head/sys/dev/mcd/mcd.c Sun Dec 29 14:21:55 2013 (r260039) +++ head/sys/dev/mcd/mcd.c Sun Dec 29 16:28:37 2013 (r260040) @@ -44,7 +44,7 @@ #include __FBSDID("$FreeBSD$"); -static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; +static const char __used COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; #include #include From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 16:43:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F347B47; Sun, 29 Dec 2013 16:43:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2224A115C; Sun, 29 Dec 2013 16:43:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTGhZAa019627; Sun, 29 Dec 2013 16:43:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTGhZdZ019625; Sun, 29 Dec 2013 16:43:35 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201312291643.rBTGhZdZ019625@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Dec 2013 16:43:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260041 - head/usr.sbin/makefs/cd9660 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 16:43:36 -0000 Author: marius Date: Sun Dec 29 16:43:35 2013 New Revision: 260041 URL: http://svnweb.freebsd.org/changeset/base/260041 Log: Record the IEEE P1282 Rock Ridge version 1.12 POSIX File Serial Number, i. e. the POSIX:5.6.1 st_ino field, which can be used to detect hard links in the file system. This is also the default in mkisofs(8) and according to its man page, no system only being able to cope with Rock Ridge version 1.10 is known to exist. PR: 185138 Submitted by: Kurt Lidl MFC after: 1 week Modified: head/usr.sbin/makefs/cd9660/iso9660_rrip.c head/usr.sbin/makefs/cd9660/iso9660_rrip.h Modified: head/usr.sbin/makefs/cd9660/iso9660_rrip.c ============================================================================== --- head/usr.sbin/makefs/cd9660/iso9660_rrip.c Sun Dec 29 16:28:37 2013 (r260040) +++ head/usr.sbin/makefs/cd9660/iso9660_rrip.c Sun Dec 29 16:43:35 2013 (r260041) @@ -634,7 +634,7 @@ cd9660_createSL(cd9660node *node) int cd9660node_rrip_px(struct ISO_SUSP_ATTRIBUTES *v, fsnode *pxinfo) { - v->attr.rr_entry.PX.h.length[0] = 36; + v->attr.rr_entry.PX.h.length[0] = 44; v->attr.rr_entry.PX.h.version[0] = 1; cd9660_bothendian_dword(pxinfo->inode->st.st_mode, v->attr.rr_entry.PX.mode); @@ -644,8 +644,9 @@ cd9660node_rrip_px(struct ISO_SUSP_ATTRI v->attr.rr_entry.PX.uid); cd9660_bothendian_dword(pxinfo->inode->st.st_gid, v->attr.rr_entry.PX.gid); + cd9660_bothendian_dword(pxinfo->inode->st.st_ino, + v->attr.rr_entry.PX.serial); - /* Ignoring the serial number for now */ return 1; } Modified: head/usr.sbin/makefs/cd9660/iso9660_rrip.h ============================================================================== --- head/usr.sbin/makefs/cd9660/iso9660_rrip.h Sun Dec 29 16:28:37 2013 (r260040) +++ head/usr.sbin/makefs/cd9660/iso9660_rrip.h Sun Dec 29 16:43:35 2013 (r260041) @@ -103,7 +103,7 @@ typedef struct { u_char links [ISODCL(13,20)]; u_char uid [ISODCL(21,28)]; u_char gid [ISODCL(29,36)]; - u_char serial [ISODCL(37,44)];/* Not used */ + u_char serial [ISODCL(37,44)]; } ISO_RRIP_PX; typedef struct { From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 17:03:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1D8C1EDC; Sun, 29 Dec 2013 17:03:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 09ADB128B; Sun, 29 Dec 2013 17:03:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTH3j4Y027121; Sun, 29 Dec 2013 17:03:45 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTH3jdR027120; Sun, 29 Dec 2013 17:03:45 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312291703.rBTH3jdR027120@svn.freebsd.org> From: Dimitry Andric Date: Sun, 29 Dec 2013 17:03:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260042 - head/sys/dev/my X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 17:03:46 -0000 Author: dim Date: Sun Dec 29 17:03:45 2013 New Revision: 260042 URL: http://svnweb.freebsd.org/changeset/base/260042 Log: Remove superfluous old-style rcsid[] from if_my.c. There is already an __FBSDID() at the top of the file. MFC after: 3 days Modified: head/sys/dev/my/if_my.c Modified: head/sys/dev/my/if_my.c ============================================================================== --- head/sys/dev/my/if_my.c Sun Dec 29 16:43:35 2013 (r260041) +++ head/sys/dev/my/if_my.c Sun Dec 29 17:03:45 2013 (r260042) @@ -81,11 +81,6 @@ static int MY_USEIOSPACE = 1; #include -#ifndef lint -static const char rcsid[] = -"$Id: if_my.c,v 1.16 2003/04/15 06:37:25 mdodd Exp $"; -#endif - /* * Various supported device vendors/types and their names. */ From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 17:08:31 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0A29FE3; Sun, 29 Dec 2013 17:08:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EA1EE1299; Sun, 29 Dec 2013 17:08:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTH8Ujx028084; Sun, 29 Dec 2013 17:08:30 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTH8UUx028083; Sun, 29 Dec 2013 17:08:30 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201312291708.rBTH8UUx028083@svn.freebsd.org> From: Mark Johnston Date: Sun, 29 Dec 2013 17:08:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260043 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 17:08:31 -0000 Author: markj Date: Sun Dec 29 17:08:30 2013 New Revision: 260043 URL: http://svnweb.freebsd.org/changeset/base/260043 Log: The arguments to sched:::off-cpu are the thread and associated process of the thread selected to run, not the currently running thread. This fix has already been made for ULE in r252070. PR: 177706 MFC after: 1 week Modified: head/sys/kern/sched_4bsd.c Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Sun Dec 29 17:03:45 2013 (r260042) +++ head/sys/kern/sched_4bsd.c Sun Dec 29 17:08:30 2013 (r260043) @@ -1032,7 +1032,7 @@ sched_switch(struct thread *td, struct t PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); #endif - SDT_PROBE2(sched, , , off__cpu, td, td->td_proc); + SDT_PROBE2(sched, , , off__cpu, newtd, newtd->td_proc); /* I feel sleepy */ lock_profile_release_lock(&sched_lock.lock_object); From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 17:16:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F0A55F7; Sun, 29 Dec 2013 17:16:35 +0000 (UTC) Received: from mail.xcllnt.net (mail.xcllnt.net [50.0.150.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5E1C11333; Sun, 29 Dec 2013 17:16:35 +0000 (UTC) Received: from [192.168.2.84] (50-0-150-213.dsl.static.sonic.net [50.0.150.213]) (authenticated bits=0) by mail.xcllnt.net (8.14.7/8.14.7) with ESMTP id rBTHGWYE012847 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 29 Dec 2013 09:16:33 -0800 (PST) (envelope-from marcel@xcllnt.net) Content-Type: multipart/signed; boundary="Apple-Mail=_5D11B954-878F-403B-9B49-184339F30D08"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r260022 - head/lib/libkvm From: Marcel Moolenaar In-Reply-To: <20131229090338.GV59496@kib.kiev.ua> Date: Sun, 29 Dec 2013 09:17:00 -0800 Message-Id: <4A5D5324-6F51-4328-BC52-851F5BB4B33D@xcllnt.net> References: <201312282301.rBSN1wWP002326@svn.freebsd.org> <28D86FF3-F13C-4EB1-AEED-4051F2944E27@xcllnt.net> <20131229090338.GV59496@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.1827) Cc: "svn-src-head@freebsd.org" , svn-src-all , Marcel Moolenaar , "src-committers@freebsd.org" , Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 17:16:35 -0000 --Apple-Mail=_5D11B954-878F-403B-9B49-184339F30D08 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Dec 29, 2013, at 1:03 AM, Konstantin Belousov = wrote: > On Sat, Dec 28, 2013 at 06:39:07PM -0800, Marcel Moolenaar wrote: >>=20 >> On Dec 28, 2013, at 4:40 PM, Peter Wemm wrote: >>=20 >>> On Sat, Dec 28, 2013 at 4:04 PM, Peter Wemm wrote: >>>> On Sat, Dec 28, 2013 at 3:01 PM, Marcel Moolenaar = wrote: >>>>> Author: marcel >>>>> Date: Sat Dec 28 23:01:57 2013 >>>>> New Revision: 260022 >>>>> URL: http://svnweb.freebsd.org/changeset/base/260022 >>>>>=20 >>>>> Log: >>>>> Allow building a cross libkvm by setting TARGET_ARCH. The library = so >>>>> produced will be called libkvm-${ARCH} instead of libkvm. This = allows >>>>> installing it alongside the native version. >>>>> For symbol lookups, use ps_pglobal_lookup() instead of __fdnlist() >>>>> when building a cross libkvm. It is assumed that the cross tool = that >>>>> uses the cross libkvm also provides an implementation for this >>>>> proc_services function. >>>>>=20 >>>>> Note that this commit does not change any of the = architecture-specific >>>>> code for cross-compilation. >>>>=20 >>>> Are you sure about this? I just got a brand new buildworld failure = on >>>> an amd64 machine. The lib32 build code was trying to use 64 bit = pmap >>>> definitions and failed miserably. >>>>=20 >>>> I'm really sorry, I accidentally blew away the failure log. I'll = have >>>> another in a few minutes. >>>=20 >>>=20 >>> This is from stage5.1, the lib32 build: >>>=20 >>> /usr/src/lib/libkvm/kvm_amd64.c:78:2: error: unknown type name = 'pml4_entry_t' >>> pml4_entry_t *PML4; >>> ^ >>=20 >> Ugh. I'll probably revert... >=20 > Might be, it makes more sense to disable libkvm compat32 build ? Possibly. I would not do it because of the changes I made. While we don't have a lot of libraries with cross-utility, I also don't think libkvm is the only one. So, it's better to fix the Makefile and keep it included in build32 as it's sets an example. Independently of the above: if we agree that the use case of building 32-bit libs changed over the years from providing 32-bit compat to apps that can't be recompiled to providing an ILP32 runtime environment on a 64-bit host and that we have ports for the compat case, then we can indeed ask the question whether or not to build libkvm. I think it's perfectly fair to declare certain libs or utilities as inherently "native" and as such not provide 32-bit variants for them. That said: cross-development has different requirements and for libkvm it can be seen that the need for a non-native variant is tied to the need for a non-native kgdb (for example). And as a developer, I do like our tools to be inherently "cross". This would argue for keeping libkvm in build32 for the purpose of building a cross-libkvm. --=20 Marcel Moolenaar marcel@xcllnt.net --Apple-Mail=_5D11B954-878F-403B-9B49-184339F30D08 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlLAWQwACgkQpgWlLWHuifYpWQCfczY+FVK++35YPDSRLGqbyatZ OUIAnieVysPV7dOy7i810j6bYzfpUO7v =mtWG -----END PGP SIGNATURE----- --Apple-Mail=_5D11B954-878F-403B-9B49-184339F30D08-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 17:37:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E023B7F; Sun, 29 Dec 2013 17:37:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 89A6414F7; Sun, 29 Dec 2013 17:37:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTHbX6Y039132; Sun, 29 Dec 2013 17:37:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTHbXg3039131; Sun, 29 Dec 2013 17:37:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201312291737.rBTHbXg3039131@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Dec 2013 17:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260044 - head/sys/dev/aac X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 17:37:33 -0000 Author: marius Date: Sun Dec 29 17:37:32 2013 New Revision: 260044 URL: http://svnweb.freebsd.org/changeset/base/260044 Log: Free the MSI again on detach if allocated. Arguably, this code would be better off living in aac_pci.c, but it doesn't seem worth creating a aac_pci_detach() and it's also not the first PCI-specific bit in aac.c MFC after: 3 days Modified: head/sys/dev/aac/aac.c Modified: head/sys/dev/aac/aac.c ============================================================================== --- head/sys/dev/aac/aac.c Sun Dec 29 17:08:30 2013 (r260043) +++ head/sys/dev/aac/aac.c Sun Dec 29 17:37:32 2013 (r260044) @@ -631,9 +631,11 @@ aac_free(struct aac_softc *sc) /* disconnect the interrupt handler */ if (sc->aac_intr) bus_teardown_intr(sc->aac_dev, sc->aac_irq, sc->aac_intr); - if (sc->aac_irq != NULL) + if (sc->aac_irq != NULL) { bus_release_resource(sc->aac_dev, SYS_RES_IRQ, rman_get_rid(sc->aac_irq), sc->aac_irq); + pci_release_msi(sc->aac_dev); + } /* destroy data-transfer DMA tag */ if (sc->aac_buffer_dmat) From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 17:43:38 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5854D6C; Sun, 29 Dec 2013 17:43:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2A939159B; Sun, 29 Dec 2013 17:43:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTHhcrq042519; Sun, 29 Dec 2013 17:43:38 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTHhcvi042518; Sun, 29 Dec 2013 17:43:38 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201312291743.rBTHhcvi042518@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Dec 2013 17:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260045 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 17:43:38 -0000 Author: marius Date: Sun Dec 29 17:43:37 2013 New Revision: 260045 URL: http://svnweb.freebsd.org/changeset/base/260045 Log: - Simplify MSI allocation and release. For a single one, we don't need to fiddle with the MSI count and pci_release_msi(9) is smart enough to just do nothing in case of INTx. - Don't allocate MSI as RF_SHAREABLE. MFC after: 1 week Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Sun Dec 29 17:37:32 2013 (r260044) +++ head/sys/dev/bge/if_bge.c Sun Dec 29 17:43:37 2013 (r260045) @@ -3302,7 +3302,7 @@ bge_attach(device_t dev) struct bge_softc *sc; uint32_t hwcfg = 0, misccfg, pcistate; u_char eaddr[ETHER_ADDR_LEN]; - int capmask, error, msicount, reg, rid, trys; + int capmask, error, reg, rid, trys; sc = device_get_softc(dev); sc->bge_dev = dev; @@ -3311,11 +3311,11 @@ bge_attach(device_t dev) TASK_INIT(&sc->bge_intr_task, 0, bge_intr_task, sc); callout_init_mtx(&sc->bge_stat_ch, &sc->bge_mtx, 0); - /* - * Map control/status registers. - */ pci_enable_busmaster(dev); + /* + * Allocate control/status registers. + */ rid = PCIR_BAR(0); sc->bge_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -3625,13 +3625,8 @@ bge_attach(device_t dev) rid = 0; if (pci_find_cap(sc->bge_dev, PCIY_MSI, ®) == 0) { sc->bge_msicap = reg; - if (bge_can_use_msi(sc)) { - msicount = pci_msi_count(dev); - if (msicount > 1) - msicount = 1; - } else - msicount = 0; - if (msicount == 1 && pci_alloc_msi(dev, &msicount) == 0) { + reg = 1; + if (bge_can_use_msi(sc) && pci_alloc_msi(dev, ®) == 0) { rid = 1; sc->bge_flags |= BGE_FLAG_MSI; } @@ -3648,7 +3643,7 @@ bge_attach(device_t dev) #endif sc->bge_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_SHAREABLE | RF_ACTIVE); + RF_ACTIVE | (rid != 0 ? 0 : RF_SHAREABLE)); if (sc->bge_irq == NULL) { device_printf(sc->bge_dev, "couldn't map interrupt\n"); @@ -3991,20 +3986,19 @@ bge_release_resources(struct bge_softc * if (sc->bge_intrhand != NULL) bus_teardown_intr(dev, sc->bge_irq, sc->bge_intrhand); - if (sc->bge_irq != NULL) + if (sc->bge_irq != NULL) { bus_release_resource(dev, SYS_RES_IRQ, - sc->bge_flags & BGE_FLAG_MSI ? 1 : 0, sc->bge_irq); - - if (sc->bge_flags & BGE_FLAG_MSI) + rman_get_rid(sc->bge_irq), sc->bge_irq); pci_release_msi(dev); + } if (sc->bge_res != NULL) bus_release_resource(dev, SYS_RES_MEMORY, - PCIR_BAR(0), sc->bge_res); + rman_get_rid(sc->bge_res), sc->bge_res); if (sc->bge_res2 != NULL) bus_release_resource(dev, SYS_RES_MEMORY, - PCIR_BAR(2), sc->bge_res2); + rman_get_rid(sc->bge_res2), sc->bge_res2); if (sc->bge_ifp != NULL) if_free(sc->bge_ifp); From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 18:34:29 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B413483D; Sun, 29 Dec 2013 18:34:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A04C8188F; Sun, 29 Dec 2013 18:34:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTIYTdo061166; Sun, 29 Dec 2013 18:34:29 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTIYTpo061165; Sun, 29 Dec 2013 18:34:29 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201312291834.rBTIYTpo061165@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 29 Dec 2013 18:34:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260046 - head/sys/netgraph X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 18:34:29 -0000 Author: glebius Date: Sun Dec 29 18:34:29 2013 New Revision: 260046 URL: http://svnweb.freebsd.org/changeset/base/260046 Log: Fix the parse type for NGM_LISTTYPES. Actually, text versions of generic commands are not used, since ngctl(8) uses binary messages for them. And to request a text command one needs a working ngctl(8). That's why the bug was never discovered. I'm pondering on removing the text support for generic commands. Found by: dim with clang 3.4 Modified: head/sys/netgraph/ng_base.c Modified: head/sys/netgraph/ng_base.c ============================================================================== --- head/sys/netgraph/ng_base.c Sun Dec 29 17:43:37 2013 (r260045) +++ head/sys/netgraph/ng_base.c Sun Dec 29 18:34:29 2013 (r260046) @@ -473,7 +473,7 @@ static const struct ng_parse_type ng_gen &ng_generic_linkinfo_array_type_info }; -DEFINE_PARSE_STRUCT_TYPE(typelist, TYPELIST, (&ng_generic_nodeinfoarray_type)); +DEFINE_PARSE_STRUCT_TYPE(typelist, TYPELIST, (&ng_generic_typeinfoarray_type)); DEFINE_PARSE_STRUCT_TYPE(hooklist, HOOKLIST, (&ng_generic_nodeinfo_type, &ng_generic_linkinfo_array_type)); DEFINE_PARSE_STRUCT_TYPE(listnodes, LISTNODES, @@ -549,7 +549,7 @@ static const struct ng_cmdlist ng_generi NGM_LISTTYPES, "listtypes", NULL, - &ng_generic_typeinfo_type + &ng_generic_typelist_type }, { NGM_GENERIC_COOKIE, From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 18:44:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B45999C4; Sun, 29 Dec 2013 18:44:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8691C1906; Sun, 29 Dec 2013 18:44:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTIiDAh064742; Sun, 29 Dec 2013 18:44:13 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTIiDRZ064740; Sun, 29 Dec 2013 18:44:13 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201312291844.rBTIiDRZ064740@svn.freebsd.org> From: Ed Maste Date: Sun, 29 Dec 2013 18:44:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260047 - head/sys/dev/fb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 18:44:13 -0000 Author: emaste Date: Sun Dec 29 18:44:12 2013 New Revision: 260047 URL: http://svnweb.freebsd.org/changeset/base/260047 Log: Clean up license text - Renumber Regents clauses - Remove clause 3 and 4 from TNF license, following upstream change Modified: head/sys/dev/fb/boot_font.c head/sys/dev/fb/gallant12x22.c Modified: head/sys/dev/fb/boot_font.c ============================================================================== --- head/sys/dev/fb/boot_font.c Sun Dec 29 18:34:29 2013 (r260046) +++ head/sys/dev/fb/boot_font.c Sun Dec 29 18:44:12 2013 (r260047) @@ -13,13 +13,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED Modified: head/sys/dev/fb/gallant12x22.c ============================================================================== --- head/sys/dev/fb/gallant12x22.c Sun Dec 29 18:34:29 2013 (r260046) +++ head/sys/dev/fb/gallant12x22.c Sun Dec 29 18:44:12 2013 (r260047) @@ -17,7 +17,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 18:53:46 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4FD26B2D; Sun, 29 Dec 2013 18:53:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 32202105B; Sun, 29 Dec 2013 18:53:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTIrk6t068246; Sun, 29 Dec 2013 18:53:46 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTIrjcJ068243; Sun, 29 Dec 2013 18:53:45 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312291853.rBTIrjcJ068243@svn.freebsd.org> From: Dimitry Andric Date: Sun, 29 Dec 2013 18:53:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260048 - head/sys/netgraph/netflow X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 18:53:46 -0000 Author: dim Date: Sun Dec 29 18:53:45 2013 New Revision: 260048 URL: http://svnweb.freebsd.org/changeset/base/260048 Log: In sys/netgraph/netflow, use __FBSDID() instead of old-style rcs_id[]. MFC after: 3 days Modified: head/sys/netgraph/netflow/netflow.c head/sys/netgraph/netflow/netflow_v9.c head/sys/netgraph/netflow/ng_netflow.c Modified: head/sys/netgraph/netflow/netflow.c ============================================================================== --- head/sys/netgraph/netflow/netflow.c Sun Dec 29 18:44:12 2013 (r260047) +++ head/sys/netgraph/netflow/netflow.c Sun Dec 29 18:53:45 2013 (r260048) @@ -28,8 +28,8 @@ * $SourceForge: netflow.c,v 1.41 2004/09/05 11:41:10 glebius Exp $ */ -static const char rcs_id[] = - "@(#) $FreeBSD$"; +#include +__FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_route.h" Modified: head/sys/netgraph/netflow/netflow_v9.c ============================================================================== --- head/sys/netgraph/netflow/netflow_v9.c Sun Dec 29 18:44:12 2013 (r260047) +++ head/sys/netgraph/netflow/netflow_v9.c Sun Dec 29 18:53:45 2013 (r260048) @@ -26,8 +26,8 @@ * $FreeBSD$ */ -static const char rcs_id[] = - "@(#) $FreeBSD$"; +#include +__FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_route.h" Modified: head/sys/netgraph/netflow/ng_netflow.c ============================================================================== --- head/sys/netgraph/netflow/ng_netflow.c Sun Dec 29 18:44:12 2013 (r260047) +++ head/sys/netgraph/netflow/ng_netflow.c Sun Dec 29 18:53:45 2013 (r260048) @@ -28,8 +28,8 @@ * $SourceForge: ng_netflow.c,v 1.30 2004/09/05 11:37:43 glebius Exp $ */ -static const char rcs_id[] = - "@(#) $FreeBSD$"; +#include +__FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_route.h" From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 19:02:35 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 01586DCF; Sun, 29 Dec 2013 19:02:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D56DA112A; Sun, 29 Dec 2013 19:02:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTJ2YsO072119; Sun, 29 Dec 2013 19:02:34 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTJ2YtS072116; Sun, 29 Dec 2013 19:02:34 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201312291902.rBTJ2YtS072116@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 29 Dec 2013 19:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260049 - head/usr.sbin/bsnmpd/modules/snmp_hast X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 19:02:35 -0000 Author: trociny Date: Sun Dec 29 19:02:33 2013 New Revision: 260049 URL: http://svnweb.freebsd.org/changeset/base/260049 Log: Add mibs for hastd(1) queue stats. MFC after: 1 week Modified: head/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt head/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c head/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def Modified: head/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt Sun Dec 29 18:53:45 2013 (r260048) +++ head/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt Sun Dec 29 19:02:33 2013 (r260049) @@ -60,6 +60,11 @@ begemotHast MODULE-IDENTITY REVISION "201307010000Z" DESCRIPTION "Added hastResourceWorkerPid." + REVISION "201312290000Z" + DESCRIPTION + "Added hastResourceLocalQueue, hastResourceSendQueue, + hastResourceRecvQueue, hastResourceDoneQueue, + hastResourceIdleQueue." ::= { begemot 220 } begemotHastObjects OBJECT IDENTIFIER ::= { begemotHast 1 } @@ -120,7 +125,12 @@ HastResourceEntry ::= SEQUENCE { hastResourceWriteErrors Counter64, hastResourceDeleteErrors Counter64, hastResourceFlushErrors Counter64, - hastResourceWorkerPid INTEGER + hastResourceWorkerPid INTEGER, + hastResourceLocalQueue UNSIGNED32, + hastResourceSendQueue UNSIGNED32, + hastResourceRecvQueue UNSIGNED32, + hastResourceDoneQueue UNSIGNED32, + hastResourceIdleQueue UNSIGNED32 } hastResourceIndex OBJECT-TYPE @@ -307,4 +317,46 @@ hastResourceWorkerPid OBJECT-TYPE "Worker process ID." ::= { hastResourceEntry 22 } +hastResourceLocalQueue OBJECT-TYPE + SYNTAX UNSIGNED32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of outstanding I/O requests to the local component." + ::= { hastResourceEntry 23 } + +hastResourceSendQueue OBJECT-TYPE + SYNTAX UNSIGNED32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of outstanding I/O requests to send to the remote + component." + ::= { hastResourceEntry 24 } + +hastResourceRecvQueue OBJECT-TYPE + SYNTAX UNSIGNED32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of outstanding I/O requests waiting for response + from the remote component." + ::= { hastResourceEntry 25 } + +hastResourceDoneQueue OBJECT-TYPE + SYNTAX UNSIGNED32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of processed I/O requests to return to the kernel." + ::= { hastResourceEntry 26 } + +hastResourceIdleQueue OBJECT-TYPE + SYNTAX UNSIGNED32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of request objects in the free bucket." + ::= { hastResourceEntry 27 } + END Modified: head/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c Sun Dec 29 18:53:45 2013 (r260048) +++ head/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c Sun Dec 29 19:02:33 2013 (r260049) @@ -79,6 +79,11 @@ struct hast_snmp_resource { uint64_t delete_errors; uint64_t flush_errors; pid_t workerpid; + uint32_t local_queue; + uint32_t send_queue; + uint32_t recv_queue; + uint32_t done_queue; + uint32_t idle_queue; }; static TAILQ_HEAD(, hast_snmp_resource) resources = @@ -345,6 +350,16 @@ update_resources(void) res->flush_errors = nv_get_uint64(nvout, "stat_flush_error%u", i); res->workerpid = nv_get_int32(nvout, "workerpid%u", i); + res->local_queue = + nv_get_uint64(nvout, "local_queue_size%u", i); + res->send_queue = + nv_get_uint64(nvout, "send_queue_size%u", i); + res->recv_queue = + nv_get_uint64(nvout, "recv_queue_size%u", i); + res->done_queue = + nv_get_uint64(nvout, "done_queue_size%u", i); + res->idle_queue = + nv_get_uint64(nvout, "idle_queue_size%u", i); TAILQ_INSERT_TAIL(&resources, res, link); } nv_free(nvout); @@ -503,6 +518,21 @@ op_hastResourceTable(struct snmp_context case LEAF_hastResourceWorkerPid: value->v.integer = res->workerpid; break; + case LEAF_hastResourceLocalQueue: + value->v.uint32 = res->local_queue; + break; + case LEAF_hastResourceSendQueue: + value->v.uint32 = res->send_queue; + break; + case LEAF_hastResourceRecvQueue: + value->v.uint32 = res->recv_queue; + break; + case LEAF_hastResourceDoneQueue: + value->v.uint32 = res->done_queue; + break; + case LEAF_hastResourceIdleQueue: + value->v.uint32 = res->idle_queue; + break; default: ret = SNMP_ERR_RES_UNAVAIL; break; Modified: head/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def Sun Dec 29 18:53:45 2013 (r260048) +++ head/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def Sun Dec 29 19:02:33 2013 (r260049) @@ -60,6 +60,11 @@ (20 hastResourceDeleteErrors COUNTER64 GET) (21 hastResourceFlushErrors COUNTER64 GET) (22 hastResourceWorkerPid INTEGER GET) + (23 hastResourceLocalQueue UNSIGNED32 GET) + (24 hastResourceSendQueue UNSIGNED32 GET) + (25 hastResourceRecvQueue UNSIGNED32 GET) + (26 hastResourceDoneQueue UNSIGNED32 GET) + (27 hastResourceIdleQueue UNSIGNED32 GET) ) ) ) From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 19:22:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0DFFE463; Sun, 29 Dec 2013 19:22:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EDDF91238; Sun, 29 Dec 2013 19:22:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTJM0We077669; Sun, 29 Dec 2013 19:22:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTJLxEL077611; Sun, 29 Dec 2013 19:21:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201312291921.rBTJLxEL077611@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Dec 2013 19:21:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260050 - head/sys/dev/ed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 19:22:01 -0000 Author: marius Date: Sun Dec 29 19:21:59 2013 New Revision: 260050 URL: http://svnweb.freebsd.org/changeset/base/260050 Log: - Switch to using the common MII bitbang'ing code instead of duplicating it. - Based on lessons learnt with dc(4) (see r185750), add bus space barriers to the MII bitbang read and write functions as well as to instances of page switching. - Add missing locking to ed_ifmedia_{upd,sts}(). - Canonicalize some messages. - Based on actual functionality, ED_TC5299J_MII_DIROUT should be rather named ED_TC5299J_MII_DIRIN. - Remove unused headers. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. MFC after: 1 week Modified: head/sys/dev/ed/if_ed.c head/sys/dev/ed/if_ed_3c503.c head/sys/dev/ed/if_ed_pccard.c head/sys/dev/ed/if_ed_rtl80x9.c head/sys/dev/ed/if_edreg.h head/sys/dev/ed/if_edvar.h head/sys/dev/ed/tc5299jreg.h Modified: head/sys/dev/ed/if_ed.c ============================================================================== --- head/sys/dev/ed/if_ed.c Sun Dec 29 19:02:33 2013 (r260049) +++ head/sys/dev/ed/if_ed.c Sun Dec 29 19:21:59 2013 (r260050) @@ -591,7 +591,11 @@ ed_init_locked(struct ed_softc *sc) /* * Program Command Register for page 1 */ + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STP); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); /* * Copy out our station address @@ -801,7 +805,11 @@ ed_rint(struct ed_softc *sc) /* * Set NIC to page 1 registers to get 'current' pointer */ + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STA); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); /* * 'sc->next_packet' is the logical beginning of the ring-buffer - @@ -912,7 +920,11 @@ ed_rint(struct ed_softc *sc) * Set NIC to page 1 registers before looping to top (prepare * to get 'CURR' current pointer) */ + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STA); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } } @@ -1556,7 +1568,11 @@ ed_setrcr(struct ed_softc *sc) reg1 = 0x00; /* set page 1 registers */ + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STP); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); if (ifp->if_flags & IFF_PROMISC) { Modified: head/sys/dev/ed/if_ed_3c503.c ============================================================================== --- head/sys/dev/ed/if_ed_3c503.c Sun Dec 29 19:02:33 2013 (r260049) +++ head/sys/dev/ed/if_ed_3c503.c Sun Dec 29 19:21:59 2013 (r260050) @@ -217,7 +217,11 @@ ed_probe_3Com(device_t dev, int port_rid /* * select page 0 registers */ - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + ed_nic_outb(sc, ED_P0_CR, ED_CR_PAGE_0 | ED_CR_RD2 | ED_CR_STP); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); /* * Attempt to clear WTS bit. If it doesn't clear, then this is a 16bit @@ -228,7 +232,11 @@ ed_probe_3Com(device_t dev, int port_rid /* * select page 2 registers */ + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); ed_nic_outb(sc, ED_P0_CR, ED_CR_PAGE_2 | ED_CR_RD2 | ED_CR_STP); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); /* * The 3c503 forces the WTS bit to a one if this is a 16bit board Modified: head/sys/dev/ed/if_ed_pccard.c ============================================================================== --- head/sys/dev/ed/if_ed_pccard.c Sun Dec 29 19:02:33 2013 (r260049) +++ head/sys/dev/ed/if_ed_pccard.c Sun Dec 29 19:21:59 2013 (r260050) @@ -75,9 +75,6 @@ #include #include #include -#include -#include - #include #include #include @@ -247,6 +244,54 @@ static const struct ed_product { }; /* + * MII bit-bang glue + */ +static uint32_t ed_pccard_dl100xx_mii_bitbang_read(device_t dev); +static void ed_pccard_dl100xx_mii_bitbang_write(device_t dev, uint32_t val); + +static const struct mii_bitbang_ops ed_pccard_dl100xx_mii_bitbang_ops = { + ed_pccard_dl100xx_mii_bitbang_read, + ed_pccard_dl100xx_mii_bitbang_write, + { + ED_DL100XX_MII_DATAOUT, /* MII_BIT_MDO */ + ED_DL100XX_MII_DATAIN, /* MII_BIT_MDI */ + ED_DL100XX_MII_CLK, /* MII_BIT_MDC */ + ED_DL100XX_MII_DIROUT, /* MII_BIT_DIR_HOST_PHY */ + 0 /* MII_BIT_DIR_PHY_HOST */ + } +}; + +static uint32_t ed_pccard_ax88x90_mii_bitbang_read(device_t dev); +static void ed_pccard_ax88x90_mii_bitbang_write(device_t dev, uint32_t val); + +static const struct mii_bitbang_ops ed_pccard_ax88x90_mii_bitbang_ops = { + ed_pccard_ax88x90_mii_bitbang_read, + ed_pccard_ax88x90_mii_bitbang_write, + { + ED_AX88X90_MII_DATAOUT, /* MII_BIT_MDO */ + ED_AX88X90_MII_DATAIN, /* MII_BIT_MDI */ + ED_AX88X90_MII_CLK, /* MII_BIT_MDC */ + 0, /* MII_BIT_DIR_HOST_PHY */ + ED_AX88X90_MII_DIRIN /* MII_BIT_DIR_PHY_HOST */ + } +}; + +static uint32_t ed_pccard_tc5299j_mii_bitbang_read(device_t dev); +static void ed_pccard_tc5299j_mii_bitbang_write(device_t dev, uint32_t val); + +static const struct mii_bitbang_ops ed_pccard_tc5299j_mii_bitbang_ops = { + ed_pccard_tc5299j_mii_bitbang_read, + ed_pccard_tc5299j_mii_bitbang_write, + { + ED_TC5299J_MII_DATAOUT, /* MII_BIT_MDO */ + ED_TC5299J_MII_DATAIN, /* MII_BIT_MDI */ + ED_TC5299J_MII_CLK, /* MII_BIT_MDC */ + 0, /* MII_BIT_DIR_HOST_PHY */ + ED_AX88X90_MII_DIRIN /* MII_BIT_DIR_PHY_HOST */ + } +}; + +/* * PC Card (PCMCIA) specific code. */ static int ed_pccard_probe(device_t); @@ -255,23 +300,14 @@ static void ed_pccard_tick(struct ed_sof static int ed_pccard_dl100xx(device_t dev, const struct ed_product *); static void ed_pccard_dl100xx_mii_reset(struct ed_softc *sc); -static u_int ed_pccard_dl100xx_mii_readbits(struct ed_softc *sc, int nbits); -static void ed_pccard_dl100xx_mii_writebits(struct ed_softc *sc, u_int val, - int nbits); static int ed_pccard_ax88x90(device_t dev, const struct ed_product *); -static u_int ed_pccard_ax88x90_mii_readbits(struct ed_softc *sc, int nbits); -static void ed_pccard_ax88x90_mii_writebits(struct ed_softc *sc, u_int val, - int nbits); static int ed_miibus_readreg(device_t dev, int phy, int reg); static int ed_ifmedia_upd(struct ifnet *); static void ed_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int ed_pccard_tc5299j(device_t dev, const struct ed_product *); -static u_int ed_pccard_tc5299j_mii_readbits(struct ed_softc *sc, int nbits); -static void ed_pccard_tc5299j_mii_writebits(struct ed_softc *sc, u_int val, - int nbits); static void ed_pccard_print_entry(const struct ed_product *pp) @@ -502,7 +538,7 @@ ed_pccard_attach(device_t dev) error = ed_pccard_tc5299j(dev, pp); if (error != 0) { error = ed_probe_Novell_generic(dev, flags); - printf("Novell probe generic %d\n", error); + printf("Novell generic probe failed: %d\n", error); } if (error != 0 && (pp->flags & NE2000DVF_TOSHIBA)) { flags |= ED_FLAGS_TOSH_ETHER; @@ -627,7 +663,7 @@ ed_pccard_dl100xx(device_t dev, const st if (!(pp->flags & NE2000DVF_DL100XX)) return (ENXIO); if (bootverbose) - device_printf(dev, "Trying DL100xx probing\n"); + device_printf(dev, "Trying DL100xx\n"); error = ed_probe_Novell_generic(dev, device_get_flags(dev)); if (bootverbose && error) device_printf(dev, "Novell generic probe failed: %d\n", error); @@ -678,16 +714,11 @@ ed_pccard_dl100xx(device_t dev, const st sc->chip_type = (id & 0x90) == 0x90 ? ED_CHIP_TYPE_DL10022 : ED_CHIP_TYPE_DL10019; sc->type_str = ((id & 0x90) == 0x90) ? "DL10022" : "DL10019"; - sc->mii_readbits = ed_pccard_dl100xx_mii_readbits; - sc->mii_writebits = ed_pccard_dl100xx_mii_writebits; + sc->mii_bitbang_ops = &ed_pccard_dl100xx_mii_bitbang_ops; return (0); } /* MII bit-twiddling routines for cards using Dlink chipset */ -#define DL100XX_MIISET(sc, x) ed_asic_outb(sc, ED_DL100XX_MIIBUS, \ - ed_asic_inb(sc, ED_DL100XX_MIIBUS) | (x)) -#define DL100XX_MIICLR(sc, x) ed_asic_outb(sc, ED_DL100XX_MIIBUS, \ - ed_asic_inb(sc, ED_DL100XX_MIIBUS) & ~(x)) static void ed_pccard_dl100xx_mii_reset(struct ed_softc *sc) @@ -709,36 +740,29 @@ ed_pccard_dl100xx_mii_reset(struct ed_so } static void -ed_pccard_dl100xx_mii_writebits(struct ed_softc *sc, u_int val, int nbits) +ed_pccard_dl100xx_mii_bitbang_write(device_t dev, uint32_t val) { - int i; + struct ed_softc *sc; - DL100XX_MIISET(sc, ED_DL100XX_MII_DIROUT); - for (i = nbits - 1; i >= 0; i--) { - if ((val >> i) & 1) - DL100XX_MIISET(sc, ED_DL100XX_MII_DATAOUT); - else - DL100XX_MIICLR(sc, ED_DL100XX_MII_DATAOUT); - DL100XX_MIISET(sc, ED_DL100XX_MII_CLK); - DL100XX_MIICLR(sc, ED_DL100XX_MII_CLK); - } + sc = device_get_softc(dev); + + ed_asic_outb(sc, ED_DL100XX_MIIBUS, val); + ed_asic_barrier(sc, ED_DL100XX_MIIBUS, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } -static u_int -ed_pccard_dl100xx_mii_readbits(struct ed_softc *sc, int nbits) +static uint32_t +ed_pccard_dl100xx_mii_bitbang_read(device_t dev) { - int i; - u_int val = 0; + struct ed_softc *sc; + uint32_t val; - DL100XX_MIICLR(sc, ED_DL100XX_MII_DIROUT); - for (i = nbits - 1; i >= 0; i--) { - DL100XX_MIISET(sc, ED_DL100XX_MII_CLK); - val <<= 1; - if (ed_asic_inb(sc, ED_DL100XX_MIIBUS) & ED_DL100XX_MII_DATAIN) - val++; - DL100XX_MIICLR(sc, ED_DL100XX_MII_CLK); - } - return val; + sc = device_get_softc(dev); + + val = ed_asic_inb(sc, ED_DL100XX_MIIBUS); + ed_asic_barrier(sc, ED_DL100XX_MIIBUS, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + return (val); } static void @@ -747,7 +771,11 @@ ed_pccard_ax88x90_reset(struct ed_softc int i; /* Reset Card */ + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP | ED_CR_PAGE_0); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); ed_asic_outb(sc, ED_NOVELL_RESET, ed_asic_inb(sc, ED_NOVELL_RESET)); /* Wait for the RST bit to assert, but cap it at 10ms */ @@ -880,7 +908,6 @@ ed_pccard_ax88x90_check_mii(device_t dev if (i == 32) return (ENXIO); return (0); - } /* @@ -910,18 +937,17 @@ ed_pccard_ax88x90(device_t dev, const st pccard_ccr_write_1(dev, PCCARD_CCR_IOBASE0, iobase & 0xff); pccard_ccr_write_1(dev, PCCARD_CCR_IOBASE1, (iobase >> 8) & 0xff); - sc->mii_readbits = ed_pccard_ax88x90_mii_readbits; - sc->mii_writebits = ed_pccard_ax88x90_mii_writebits; error = ed_probe_ax88x90_generic(dev, device_get_flags(dev)); if (error) { if (bootverbose) device_printf(dev, "probe ax88x90 failed %d\n", error); - goto fail; + return (error); } + sc->mii_bitbang_ops = &ed_pccard_ax88x90_mii_bitbang_ops; error = ed_pccard_ax88x90_check_mii(dev, sc); if (error) - goto fail; + return (error); sc->vendor = ED_VENDOR_NOVELL; sc->type = ED_TYPE_NE2000; if (sc->chip_type == ED_CHIP_TYPE_AX88190) @@ -929,40 +955,32 @@ ed_pccard_ax88x90(device_t dev, const st else sc->type_str = "AX88790"; return (0); -fail:; - sc->mii_readbits = 0; - sc->mii_writebits = 0; - return (error); } static void -ed_pccard_ax88x90_mii_writebits(struct ed_softc *sc, u_int val, int nbits) +ed_pccard_ax88x90_mii_bitbang_write(device_t dev, uint32_t val) { - int i, data; + struct ed_softc *sc; - for (i = nbits - 1; i >= 0; i--) { - data = (val >> i) & 1 ? ED_AX88X90_MII_DATAOUT : 0; - ed_asic_outb(sc, ED_AX88X90_MIIBUS, data); - ed_asic_outb(sc, ED_AX88X90_MIIBUS, data | ED_AX88X90_MII_CLK); - } + sc = device_get_softc(dev); + + ed_asic_outb(sc, ED_AX88X90_MIIBUS, val); + ed_asic_barrier(sc, ED_AX88X90_MIIBUS, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } -static u_int -ed_pccard_ax88x90_mii_readbits(struct ed_softc *sc, int nbits) +static uint32_t +ed_pccard_ax88x90_mii_bitbang_read(device_t dev) { - int i; - u_int val = 0; - uint8_t mdio; + struct ed_softc *sc; + uint32_t val; - mdio = ED_AX88X90_MII_DIRIN; - for (i = nbits - 1; i >= 0; i--) { - ed_asic_outb(sc, ED_AX88X90_MIIBUS, mdio); - val <<= 1; - if (ed_asic_inb(sc, ED_AX88X90_MIIBUS) & ED_AX88X90_MII_DATAIN) - val++; - ed_asic_outb(sc, ED_AX88X90_MIIBUS, mdio | ED_AX88X90_MII_CLK); - } - return val; + sc = device_get_softc(dev); + + val = ed_asic_inb(sc, ED_AX88X90_MIIBUS); + ed_asic_barrier(sc, ED_AX88X90_MIIBUS, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + return (val); } /* @@ -983,7 +1001,7 @@ ed_pccard_tc5299j(device_t dev, const st error = ed_probe_Novell_generic(dev, device_get_flags(dev)); if (bootverbose) - device_printf(dev, "probe novel returns %d\n", error); + device_printf(dev, "Novell generic probe failed: %d\n", error); if (error != 0) return (error); @@ -992,24 +1010,17 @@ ed_pccard_tc5299j(device_t dev, const st * devices have MII and a PHY, so we use this to weed out chips that * would otherwise make it through the tests we have after this point. */ - sc->mii_readbits = ed_pccard_tc5299j_mii_readbits; - sc->mii_writebits = ed_pccard_tc5299j_mii_writebits; + sc->mii_bitbang_ops = &ed_pccard_tc5299j_mii_bitbang_ops; for (i = 0; i < 32; i++) { id = ed_miibus_readreg(dev, i, MII_PHYIDR1); if (id != 0 && id != 0xffff) break; } - if (i == 32) { - sc->mii_readbits = 0; - sc->mii_writebits = 0; + if (i == 32) return (ENXIO); - } ts = "TC5299J"; - if (ed_pccard_rom_mac(dev, sc->enaddr) == 0) { - sc->mii_readbits = 0; - sc->mii_writebits = 0; + if (ed_pccard_rom_mac(dev, sc->enaddr) == 0) return (ENXIO); - } sc->vendor = ED_VENDOR_NOVELL; sc->type = ED_TYPE_NE2000; sc->chip_type = ED_CHIP_TYPE_TC5299J; @@ -1018,50 +1029,31 @@ ed_pccard_tc5299j(device_t dev, const st } static void -ed_pccard_tc5299j_mii_writebits(struct ed_softc *sc, u_int val, int nbits) +ed_pccard_tc5299j_mii_bitbang_write(device_t dev, uint32_t val) { - int i; - uint8_t cr, data; + struct ed_softc *sc; - /* Select page 3 */ - cr = ed_nic_inb(sc, ED_P0_CR); - ed_nic_outb(sc, ED_P0_CR, cr | ED_CR_PAGE_3); - - for (i = nbits - 1; i >= 0; i--) { - data = (val >> i) & 1 ? ED_TC5299J_MII_DATAOUT : 0; - ed_nic_outb(sc, ED_TC5299J_MIIBUS, data); - ed_nic_outb(sc, ED_TC5299J_MIIBUS, data | ED_TC5299J_MII_CLK); - } - ed_nic_outb(sc, ED_TC5299J_MIIBUS, 0); - - /* Restore prior page */ - ed_nic_outb(sc, ED_P0_CR, cr); + sc = device_get_softc(dev); + + /* We are already on page 3. */ + ed_nic_outb(sc, ED_TC5299J_MIIBUS, val); + ed_nic_barrier(sc, ED_TC5299J_MIIBUS, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } -static u_int -ed_pccard_tc5299j_mii_readbits(struct ed_softc *sc, int nbits) +static uint32_t +ed_pccard_tc5299j_mii_bitbang_read(device_t dev) { - int i; - u_int val = 0; - uint8_t cr; + struct ed_softc *sc; + uint32_t val; + + sc = device_get_softc(dev); - /* Select page 3 */ - cr = ed_nic_inb(sc, ED_P0_CR); - ed_nic_outb(sc, ED_P0_CR, cr | ED_CR_PAGE_3); - - ed_asic_outb(sc, ED_TC5299J_MIIBUS, ED_TC5299J_MII_DIROUT); - for (i = nbits - 1; i >= 0; i--) { - ed_nic_outb(sc, ED_TC5299J_MIIBUS, - ED_TC5299J_MII_CLK | ED_TC5299J_MII_DIROUT); - val <<= 1; - if (ed_nic_inb(sc, ED_TC5299J_MIIBUS) & ED_TC5299J_MII_DATAIN) - val++; - ed_nic_outb(sc, ED_TC5299J_MIIBUS, ED_TC5299J_MII_DIROUT); - } - - /* Restore prior page */ - ed_nic_outb(sc, ED_P0_CR, cr); - return val; + /* We are already on page 3. */ + val = ed_asic_inb(sc, ED_TC5299J_MIIBUS); + ed_nic_barrier(sc, ED_TC5299J_MIIBUS, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + return (val); } /* @@ -1071,7 +1063,8 @@ static int ed_miibus_readreg(device_t dev, int phy, int reg) { struct ed_softc *sc; - int failed, val; + int val; + uint8_t cr = 0; sc = device_get_softc(dev); /* @@ -1085,10 +1078,6 @@ ed_miibus_readreg(device_t dev, int phy, * Also, PHYs above 16 appear to be phantoms on some cards, but not * others. Registers read for this are often the same as prior values * read. Filter all register requests to 17-31. - * - * I can't explain it, since I don't have the DL100xx data sheets, but - * the DL100xx chips do 13-bits before the 'ACK' but, but the AX88x90 - * chips have 14. The linux pcnet and axnet drivers confirm this. */ if (sc->chip_type == ED_CHIP_TYPE_AX88790) { if (phy > 0x10) @@ -1098,29 +1087,33 @@ ed_miibus_readreg(device_t dev, int phy, ED_AX88X90_GPIO_INT_PHY); else ed_asic_outb(sc, ED_AX88X90_GPIO, 0); + ed_asic_barrier(sc, ED_AX88X90_GPIO, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + } else if (sc->chip_type == ED_CHIP_TYPE_TC5299J) { + /* Select page 3. */ + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + cr = ed_nic_inb(sc, ED_P0_CR); + ed_nic_outb(sc, ED_P0_CR, cr | ED_CR_PAGE_3); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + } + val = mii_bitbang_readreg(dev, sc->mii_bitbang_ops, phy, reg); + if (sc->chip_type == ED_CHIP_TYPE_TC5299J) { + /* Restore prior page. */ + ed_nic_outb(sc, ED_P0_CR, cr); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } - - (*sc->mii_writebits)(sc, 0xffffffff, 32); - (*sc->mii_writebits)(sc, ED_MII_STARTDELIM, ED_MII_STARTDELIM_BITS); - (*sc->mii_writebits)(sc, ED_MII_READOP, ED_MII_OP_BITS); - (*sc->mii_writebits)(sc, phy, ED_MII_PHY_BITS); - (*sc->mii_writebits)(sc, reg, ED_MII_REG_BITS); - if (sc->chip_type == ED_CHIP_TYPE_AX88790 || - sc->chip_type == ED_CHIP_TYPE_AX88190) - (*sc->mii_readbits)(sc, ED_MII_ACK_BITS); - failed = (*sc->mii_readbits)(sc, ED_MII_ACK_BITS); - val = (*sc->mii_readbits)(sc, ED_MII_DATA_BITS); - (*sc->mii_writebits)(sc, ED_MII_IDLE, ED_MII_IDLE_BITS); -/* printf("Reading phy %d reg %#x returning %#x (valid %d)\n", phy, reg, val, !failed); */ - return (failed ? 0 : val); + return (val); } static int ed_miibus_writereg(device_t dev, int phy, int reg, int data) { struct ed_softc *sc; + uint8_t cr = 0; -/* printf("Writing phy %d reg %#x data %#x\n", phy, reg, data); */ sc = device_get_softc(dev); /* See ed_miibus_readreg for details */ if (sc->chip_type == ED_CHIP_TYPE_AX88790) { @@ -1131,15 +1124,24 @@ ed_miibus_writereg(device_t dev, int phy ED_AX88X90_GPIO_INT_PHY); else ed_asic_outb(sc, ED_AX88X90_GPIO, 0); + ed_asic_barrier(sc, ED_AX88X90_GPIO, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + } else if (sc->chip_type == ED_CHIP_TYPE_TC5299J) { + /* Select page 3. */ + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + cr = ed_nic_inb(sc, ED_P0_CR); + ed_nic_outb(sc, ED_P0_CR, cr | ED_CR_PAGE_3); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + } + mii_bitbang_writereg(dev, sc->mii_bitbang_ops, phy, reg, data); + if (sc->chip_type == ED_CHIP_TYPE_TC5299J) { + /* Restore prior page. */ + ed_nic_outb(sc, ED_P0_CR, cr); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } - (*sc->mii_writebits)(sc, 0xffffffff, 32); - (*sc->mii_writebits)(sc, ED_MII_STARTDELIM, ED_MII_STARTDELIM_BITS); - (*sc->mii_writebits)(sc, ED_MII_WRITEOP, ED_MII_OP_BITS); - (*sc->mii_writebits)(sc, phy, ED_MII_PHY_BITS); - (*sc->mii_writebits)(sc, reg, ED_MII_REG_BITS); - (*sc->mii_writebits)(sc, ED_MII_TURNAROUND, ED_MII_TURNAROUND_BITS); - (*sc->mii_writebits)(sc, data, ED_MII_DATA_BITS); - (*sc->mii_writebits)(sc, ED_MII_IDLE, ED_MII_IDLE_BITS); return (0); } @@ -1150,9 +1152,12 @@ ed_ifmedia_upd(struct ifnet *ifp) int error; sc = ifp->if_softc; - if (sc->miibus == NULL) - return (ENXIO); ED_LOCK(sc); + if (sc->miibus == NULL) { + ED_UNLOCK(sc); + return (ENXIO); + } + error = ed_pccard_kick_phy(sc); ED_UNLOCK(sc); return (error); @@ -1165,13 +1170,17 @@ ed_ifmedia_sts(struct ifnet *ifp, struct struct mii_data *mii; sc = ifp->if_softc; - if (sc->miibus == NULL) + ED_LOCK(sc); + if (sc->miibus == NULL) { return; + ED_UNLOCK(sc); + } mii = device_get_softc(sc->miibus); mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; + ED_UNLOCK(sc); } static void @@ -1226,7 +1235,7 @@ static device_method_t ed_pccard_methods DEVMETHOD(miibus_readreg, ed_miibus_readreg), DEVMETHOD(miibus_writereg, ed_miibus_writereg), - { 0, 0 } + DEVMETHOD_END }; static driver_t ed_pccard_driver = { @@ -1235,7 +1244,7 @@ static driver_t ed_pccard_driver = { sizeof(struct ed_softc) }; -DRIVER_MODULE(ed, pccard, ed_pccard_driver, ed_devclass, 0, 0); -DRIVER_MODULE(miibus, ed, miibus_driver, miibus_devclass, 0, 0); +DRIVER_MODULE(ed, pccard, ed_pccard_driver, ed_devclass, 0, NULL); +DRIVER_MODULE(miibus, ed, miibus_driver, miibus_devclass, 0, NULL); MODULE_DEPEND(ed, miibus, 1, 1, 1); MODULE_DEPEND(ed, ether, 1, 1, 1); Modified: head/sys/dev/ed/if_ed_rtl80x9.c ============================================================================== --- head/sys/dev/ed/if_ed_rtl80x9.c Sun Dec 29 19:02:33 2013 (r260049) +++ head/sys/dev/ed/if_ed_rtl80x9.c Sun Dec 29 19:21:59 2013 (r260050) @@ -117,7 +117,11 @@ ed_probe_RTL80x9(device_t dev, int port_ ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_10_5, 0, 0); ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_AUTO, 0, 0); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_PAGE_3 | ED_CR_STP); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch (ed_nic_inb(sc, ED_RTL80X9_CONFIG2) & ED_RTL80X9_CF2_MEDIA) { case ED_RTL80X9_CF2_AUTO: @@ -145,8 +149,12 @@ ed_rtl_set_media(struct ifnet *ifp) sc = ifp->if_softc; ED_LOCK(sc); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_3 | (ed_nic_inb(sc, ED_P0_CR) & (ED_CR_STA | ED_CR_STP))); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch(IFM_SUBTYPE(sc->ifmedia.ifm_cur->ifm_media)) { case IFM_10_T: @@ -190,8 +198,12 @@ ed_rtl_get_media(struct ifnet *ifp, stru if (IFM_SUBTYPE(imr->ifm_active) == IFM_AUTO) { ED_LOCK(sc); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_3 | (ed_nic_inb(sc, ED_P0_CR) & (ED_CR_STA | ED_CR_STP))); + ed_nic_barrier(sc, ED_P0_CR, 1, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch (ed_nic_inb(sc, ED_RTL80X9_CONFIG0) & (sc->chip_type == ED_CHIP_TYPE_RTL8029 ? ED_RTL80X9_CF0_BNC Modified: head/sys/dev/ed/if_edreg.h ============================================================================== --- head/sys/dev/ed/if_edreg.h Sun Dec 29 19:02:33 2013 (r260049) +++ head/sys/dev/ed/if_edreg.h Sun Dec 29 19:21:59 2013 (r260050) @@ -1079,22 +1079,3 @@ struct ed_ring { #define ED_CHIP_TYPE_TC5299J 10 #define ED_CHIP_TYPE_W89C926 11 #define ED_CHIP_TYPE_WD790 12 - -/* - * MII bus definitions. These are common to both DL100xx and AX88x90 - * MII definitions, because they are standards based. - */ -#define ED_MII_STARTDELIM 0x01 -#define ED_MII_WRITEOP 0x01 -#define ED_MII_READOP 0x02 -#define ED_MII_TURNAROUND 0x02 -#define ED_MII_IDLE 0x01 - -#define ED_MII_STARTDELIM_BITS 2 -#define ED_MII_OP_BITS 2 -#define ED_MII_PHY_BITS 5 -#define ED_MII_REG_BITS 5 -#define ED_MII_TURNAROUND_BITS 2 -#define ED_MII_ACK_BITS 1 -#define ED_MII_DATA_BITS 16 -#define ED_MII_IDLE_BITS 1 Modified: head/sys/dev/ed/if_edvar.h ============================================================================== --- head/sys/dev/ed/if_edvar.h Sun Dec 29 19:02:33 2013 (r260049) +++ head/sys/dev/ed/if_edvar.h Sun Dec 29 19:21:59 2013 (r260050) @@ -28,7 +28,10 @@ */ #ifndef SYS_DEV_ED_IF_EDVAR_H -#define SYS_DEV_ED_IF_EDVAR_H +#define SYS_DEV_ED_IF_EDVAR_H + +#include + /* * ed_softc: per line info and status */ @@ -62,8 +65,7 @@ struct ed_softc { u_long command); void (*sc_mediachg)(struct ed_softc *); device_t miibus; /* MII bus for cards with MII. */ - void (*mii_writebits)(struct ed_softc *, u_int, int); - u_int (*mii_readbits)(struct ed_softc *, int); + mii_bitbang_ops_t mii_bitbang_ops; struct callout tick_ch; void (*sc_tick)(struct ed_softc *); void (*readmem)(struct ed_softc *sc, bus_size_t src, uint8_t *dst, @@ -109,6 +111,10 @@ struct ed_softc { struct ifmib_iso_8802_3 mibdata; /* stuff for network mgmt */ }; +#define ed_nic_barrier(sc, port, length, flags) \ + bus_space_barrier(sc->port_bst, sc->port_bsh, \ + (sc)->nic_offset + (port), (length), (flags)) + #define ed_nic_inb(sc, port) \ bus_space_read_1(sc->port_bst, sc->port_bsh, (sc)->nic_offset + (port)) @@ -147,6 +153,10 @@ struct ed_softc { bus_space_write_multi_4(sc->port_bst, sc->port_bsh, \ (sc)->nic_offset + (port), (uint32_t *)(addr), (count)) +#define ed_asic_barrier(sc, port, length, flags) \ + bus_space_barrier(sc->port_bst, sc->port_bsh, \ + (sc)->asic_offset + (port), (length), (flags)) + #define ed_asic_inb(sc, port) \ bus_space_read_1(sc->port_bst, sc->port_bsh, \ (sc)->asic_offset + (port)) Modified: head/sys/dev/ed/tc5299jreg.h ============================================================================== --- head/sys/dev/ed/tc5299jreg.h Sun Dec 29 19:02:33 2013 (r260049) +++ head/sys/dev/ed/tc5299jreg.h Sun Dec 29 19:21:59 2013 (r260050) @@ -34,5 +34,5 @@ #define ED_TC5299J_MII_CLK 0x01 #define ED_TC5299J_MII_DATAOUT 0x02 -#define ED_TC5299J_MII_DIROUT 0x04 +#define ED_TC5299J_MII_DIRIN 0x04 #define ED_TC5299J_MII_DATAIN 0x08 From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 19:25:48 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 797695C2; Sun, 29 Dec 2013 19:25:48 +0000 (UTC) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 369881249; Sun, 29 Dec 2013 19:25:47 +0000 (UTC) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.14.5/8.14.5) with SMTP id rBTJDDGf024770; Sun, 29 Dec 2013 13:15:25 -0600 Received: from mh3.mail.rice.edu (mh3.mail.rice.edu [128.42.199.10]) by pp2.rice.edu with ESMTP id 1h2e2503n5-1; Sun, 29 Dec 2013 13:15:25 -0600 X-Virus-Scanned: by amavis-2.7.0 at mh3.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh3.mail.rice.edu (Postfix) with ESMTPSA id A95A340134; Sun, 29 Dec 2013 13:15:24 -0600 (CST) Message-ID: <52C074CA.4040208@rice.edu> Date: Sun, 29 Dec 2013 13:15:22 -0600 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Konstantin Belousov Subject: Re: svn commit: r259908 - head/sys/vm References: <201312260546.rBQ5kAoJ009798@svn.freebsd.org> <52BF6699.1040006@freebsd.org> <52BF7195.2070606@rice.edu> <20131229090053.GU59496@kib.kiev.ua> In-Reply-To: <20131229090053.GU59496@kib.kiev.ua> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.629899992726084 urlsuspect_oldscore=0.0298999927260837 suspectscore=4 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=9.48027711888955e-10 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=498 rbsscore=0.629899992726084 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1305240000 definitions=main-1312290139 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org, Nathan Whitehorn X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 19:25:48 -0000 On 12/29/2013 03:00, Konstantin Belousov wrote: > On Sat, Dec 28, 2013 at 06:49:25PM -0600, Alan Cox wrote: >> On 12/28/2013 18:02, Nathan Whitehorn wrote: >>> On 12/26/13 00:46, Marcel Moolenaar wrote: >>>> Author: marcel >>>> Date: Thu Dec 26 05:46:10 2013 >>>> New Revision: 259908 >>>> URL: http://svnweb.freebsd.org/changeset/base/259908 >>>> >>>> Log: >>>> For ia64, use pmap_remove_pages() and not pmap_remove(). The problem is >>>> that we don't have a good way (yet) to iterate over the mapped pages by >>>> virtual address and simply try each page within the range. Given that we >>>> call pmap_remove() over the entire 2^63 bytes of address space, it takes >>>> a while for pmap_remove to have tried all 2^50 pages. >>>> By using pmap_remove_pages() we use the PV list to find all mappings. >>>> >>>> Change derived from a patch by: alc >>>> >>> Why make this ia64-specific? It seems like a potentially useful general >>> optimization and certainly shouldn't be harmful on other architectures. >> Some of the other implementations of pmap_remove_pages() have >> limitations that don't permit them to be used for this purpose, e.g., >> >> if (pmap != PCPU_GET(curpmap)) { >> printf("warning: pmap_remove_pages called with >> non-current pmap\n"); >> return; >> } > BTW, I do not easily see why the current amd64 implementation needs > the pmap being current. I do not see accesses to recursive page table > mappings in the code. The amd64 implementation doesn't load and clear the PTEs atomically, so the dirty bit could be set by another processor after the PTE was loaded but before it was cleared. Alan From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 19:27:32 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ED92A711; Sun, 29 Dec 2013 19:27:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D9A1A1254; Sun, 29 Dec 2013 19:27:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTJRWW1078257; Sun, 29 Dec 2013 19:27:32 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTJRWYj078256; Sun, 29 Dec 2013 19:27:32 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201312291927.rBTJRWYj078256@svn.freebsd.org> From: Mark Johnston Date: Sun, 29 Dec 2013 19:27:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260051 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 19:27:33 -0000 Author: markj Date: Sun Dec 29 19:27:32 2013 New Revision: 260051 URL: http://svnweb.freebsd.org/changeset/base/260051 Log: When clearing relocations to __dtrace* symbols, handle both SHT_REL and SHT_RELA sections properly instead of assuming that the relocation section is of type SHT_REL. Submitted by: Prashanth Kumar (original version) MFC after: 1 month Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Sun Dec 29 19:21:59 2013 (r260050) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Sun Dec 29 19:27:32 2013 (r260051) @@ -1620,10 +1620,17 @@ process_obj(dtrace_hdl_t *dtp, const cha * the executable file as the symbol is going to be * change from UND to ABS. */ - rela.r_offset = 0; - rela.r_info = 0; - rela.r_addend = 0; - (void) gelf_update_rela(data_rel, i, &rela); + if (shdr_rel.sh_type == SHT_RELA) { + rela.r_offset = 0; + rela.r_info = 0; + rela.r_addend = 0; + (void) gelf_update_rela(data_rel, i, &rela); + } else { + GElf_Rel rel; + rel.r_offset = 0; + rel.r_info = 0; + (void) gelf_update_rel(data_rel, i, &rel); + } #endif mod = 1; From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 19:31:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9318A8D7; Sun, 29 Dec 2013 19:31:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7F15112C6; Sun, 29 Dec 2013 19:31:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTJVnZG081278; Sun, 29 Dec 2013 19:31:49 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTJVnmb081277; Sun, 29 Dec 2013 19:31:49 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201312291931.rBTJVnmb081277@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 29 Dec 2013 19:31:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260052 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 19:31:49 -0000 Author: glebius Date: Sun Dec 29 19:31:49 2013 New Revision: 260052 URL: http://svnweb.freebsd.org/changeset/base/260052 Log: Claim copyright since I've almost rewritten this file in r256512. Modified: head/usr.bin/netstat/if.c Modified: head/usr.bin/netstat/if.c ============================================================================== --- head/usr.bin/netstat/if.c Sun Dec 29 19:27:32 2013 (r260051) +++ head/usr.bin/netstat/if.c Sun Dec 29 19:31:49 2013 (r260052) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2013 Gleb Smirnoff * Copyright (c) 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. * From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 19:32:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B3D6A10; Sun, 29 Dec 2013 19:32:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2717D12C8; Sun, 29 Dec 2013 19:32:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTJWSwG081398; Sun, 29 Dec 2013 19:32:28 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTJWR0H081396; Sun, 29 Dec 2013 19:32:27 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201312291932.rBTJWR0H081396@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Dec 2013 19:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260053 - head/sys/dev/iwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 19:32:28 -0000 Author: marius Date: Sun Dec 29 19:32:27 2013 New Revision: 260053 URL: http://svnweb.freebsd.org/changeset/base/260053 Log: - There's no need to keep track of resource IDs. - Simplify MSI allocation and release. For a single one, we don't need to fiddle with the MSI count and pci_release_msi(9) is smart enough to just do nothing in case of INTx. - Don't allocate MSI as RF_SHAREABLE. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. MFC after: 1 week Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnvar.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun Dec 29 19:31:49 2013 (r260052) +++ head/sys/dev/iwn/if_iwn.c Sun Dec 29 19:32:27 2013 (r260053) @@ -352,7 +352,8 @@ static device_method_t iwn_methods[] = { DEVMETHOD(device_shutdown, iwn_shutdown), DEVMETHOD(device_suspend, iwn_suspend), DEVMETHOD(device_resume, iwn_resume), - { 0, 0 } + + DEVMETHOD_END }; static driver_t iwn_driver = { @@ -362,7 +363,7 @@ static driver_t iwn_driver = { }; static devclass_t iwn_devclass; -DRIVER_MODULE(iwn, pci, iwn_driver, iwn_devclass, 0, 0); +DRIVER_MODULE(iwn, pci, iwn_driver, iwn_devclass, NULL, NULL); MODULE_VERSION(iwn, 1); @@ -392,7 +393,7 @@ iwn_attach(device_t dev) struct ieee80211com *ic; struct ifnet *ifp; uint32_t reg; - int i, error, result; + int i, error, rid; uint8_t macaddr[IEEE80211_ADDR_LEN]; sc->sc_dev = dev; @@ -433,8 +434,8 @@ iwn_attach(device_t dev) /* Enable bus-mastering. */ pci_enable_busmaster(dev); - sc->mem_rid = PCIR_BAR(0); - sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, + rid = PCIR_BAR(0); + sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->mem == NULL) { device_printf(dev, "can't map mem space\n"); @@ -444,13 +445,13 @@ iwn_attach(device_t dev) sc->sc_st = rman_get_bustag(sc->mem); sc->sc_sh = rman_get_bushandle(sc->mem); - sc->irq_rid = 0; - if ((result = pci_msi_count(dev)) == 1 && - pci_alloc_msi(dev, &result) == 0) - sc->irq_rid = 1; + i = 1; + rid = 0; + if (pci_alloc_msi(dev, &i) == 0) + rid = 1; /* Install interrupt handler. */ - sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, - RF_ACTIVE | RF_SHAREABLE); + sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | + (rid != 0 ? 0 : RF_SHAREABLE)); if (sc->irq == NULL) { device_printf(dev, "can't map interrupt\n"); error = ENOMEM; @@ -1319,9 +1320,9 @@ iwn_detach(device_t dev) /* Uninstall interrupt handler. */ if (sc->irq != NULL) { bus_teardown_intr(dev, sc->irq, sc->sc_ih); - bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq); - if (sc->irq_rid == 1) - pci_release_msi(dev); + bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq), + sc->irq); + pci_release_msi(dev); } /* Free DMA resources. */ @@ -1335,7 +1336,8 @@ iwn_detach(device_t dev) iwn_free_fwmem(sc); if (sc->mem != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, sc->mem); + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->mem), sc->mem); if (ifp != NULL) if_free(ifp); Modified: head/sys/dev/iwn/if_iwnvar.h ============================================================================== --- head/sys/dev/iwn/if_iwnvar.h Sun Dec 29 19:31:49 2013 (r260052) +++ head/sys/dev/iwn/if_iwnvar.h Sun Dec 29 19:32:27 2013 (r260053) @@ -296,11 +296,9 @@ struct iwn_softc { struct iwn_tx_ring txq[IWN5000_NTXQUEUES]; struct iwn_rx_ring rxq; - int mem_rid; struct resource *mem; bus_space_tag_t sc_st; bus_space_handle_t sc_sh; - int irq_rid; struct resource *irq; void *sc_ih; bus_size_t sc_sz; From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 19:55:07 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4E09DD52; Sun, 29 Dec 2013 19:55:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3A6421432; Sun, 29 Dec 2013 19:55:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTJt7ng089753; Sun, 29 Dec 2013 19:55:07 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTJt7r9089752; Sun, 29 Dec 2013 19:55:07 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312291955.rBTJt7r9089752@svn.freebsd.org> From: Dimitry Andric Date: Sun, 29 Dec 2013 19:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260054 - head/sys/dev/tpm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 19:55:07 -0000 Author: dim Date: Sun Dec 29 19:55:06 2013 New Revision: 260054 URL: http://svnweb.freebsd.org/changeset/base/260054 Log: In sys/dev/tpm/tpm.c, #if 0 an unused static function. MFC after: 3 days Modified: head/sys/dev/tpm/tpm.c Modified: head/sys/dev/tpm/tpm.c ============================================================================== --- head/sys/dev/tpm/tpm.c Sun Dec 29 19:32:27 2013 (r260053) +++ head/sys/dev/tpm/tpm.c Sun Dec 29 19:55:06 2013 (r260054) @@ -1138,6 +1138,7 @@ tpm_legacy_in(bus_space_tag_t iot, bus_s return bus_space_read_1(iot, ioh, 1); } +#if 0 /* Write single byte using legacy interface. */ static inline void tpm_legacy_out(bus_space_tag_t iot, bus_space_handle_t ioh, int reg, u_int8_t v) @@ -1145,6 +1146,7 @@ tpm_legacy_out(bus_space_tag_t iot, bus_ bus_space_write_1(iot, ioh, 0, reg); bus_space_write_1(iot, ioh, 1, v); } +#endif /* Probe for TPM using legacy interface. */ int From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 20:05:49 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 40F5EEEC; Sun, 29 Dec 2013 20:05:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2CF6514C9; Sun, 29 Dec 2013 20:05:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTK5ncf093799; Sun, 29 Dec 2013 20:05:49 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTK5nja093798; Sun, 29 Dec 2013 20:05:49 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312292005.rBTK5nja093798@svn.freebsd.org> From: Dimitry Andric Date: Sun, 29 Dec 2013 20:05:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260055 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 20:05:49 -0000 Author: dim Date: Sun Dec 29 20:05:48 2013 New Revision: 260055 URL: http://svnweb.freebsd.org/changeset/base/260055 Log: In sys/dev/usb/wlan/if_urtw.c, #if 0 a static const variable, which has been unused since r198194. MFC after: 3 days Modified: head/sys/dev/usb/wlan/if_urtw.c Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Sun Dec 29 19:55:06 2013 (r260054) +++ head/sys/dev/usb/wlan/if_urtw.c Sun Dec 29 20:05:48 2013 (r260055) @@ -478,6 +478,7 @@ static struct urtw_pair urtw_ratetable[] { 96, 10 }, { 108, 11 } }; +#if 0 static const uint8_t urtw_8187b_reg_table[][3] = { { 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 }, { 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 }, @@ -511,6 +512,7 @@ static const uint8_t urtw_8187b_reg_tabl { 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 }, { 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 } }; +#endif static usb_callback_t urtw_bulk_rx_callback; static usb_callback_t urtw_bulk_tx_callback; From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 20:13:21 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE89A1BC; Sun, 29 Dec 2013 20:13:21 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 388781547; Sun, 29 Dec 2013 20:13:21 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id rBTKDFrS015559; Sun, 29 Dec 2013 22:13:15 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua rBTKDFrS015559 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id rBTKDFXY015558; Sun, 29 Dec 2013 22:13:15 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 29 Dec 2013 22:13:15 +0200 From: Konstantin Belousov To: Alan Cox Subject: Re: svn commit: r259908 - head/sys/vm Message-ID: <20131229201315.GW59496@kib.kiev.ua> References: <201312260546.rBQ5kAoJ009798@svn.freebsd.org> <52BF6699.1040006@freebsd.org> <52BF7195.2070606@rice.edu> <20131229090053.GU59496@kib.kiev.ua> <52C074CA.4040208@rice.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oBzgnH5Lm+6YPTsS" Content-Disposition: inline In-Reply-To: <52C074CA.4040208@rice.edu> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org, Nathan Whitehorn X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 20:13:21 -0000 --oBzgnH5Lm+6YPTsS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 29, 2013 at 01:15:22PM -0600, Alan Cox wrote: > On 12/29/2013 03:00, Konstantin Belousov wrote: > > BTW, I do not easily see why the current amd64 implementation needs > > the pmap being current. I do not see accesses to recursive page table > > mappings in the code. >=20 > The amd64 implementation doesn't load and clear the PTEs atomically, so > the dirty bit could be set by another processor after the PTE was loaded > but before it was cleared. But then, the check at the start of the function is not sufficient. Other thread in the process or rforked child could still operate on the address space. I think it is mostly enough since pmap_remove_pages() is (was) only called for the last reference on the vmspace going away, so accidentally the check is good enough. But IMO it definitely does not reflect the cause for the restriction. --oBzgnH5Lm+6YPTsS Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSwIJaAAoJEJDCuSvBvK1Bt1cP/3zyVhLdCsmgNqETjYiyRs0o WmHTAfK7pbIIDtbXceShy5c0QBrDAAhaSo+iSLso95xMdLw2nxosC17HmUiw3q4W KF8HZnQFM3xzw+NX88HEY7j8n73g++FhrWCC8cIfwEJR1j6Z1MTxIX1B11MjHXNl a3LjBKpI+gXR5O+h4tsSi7eYBYjazR1ZRfVocqUnKtpG3HkDcao6p2w9tgN+G9Oc yNsI056WvZ5SxGkTBqJ9qtTh0WWYmc9JWPx2W/ENzoTHlhnrkTNnZ6Glc7ZpVvXf uspAC1tOT4klLG44bjBmSAkTXaTQYNukHwagu3SwFS5OXiHxJn+9Dqvx9UjncU/e aLyEfdVbC1VKYotvgIGQUiM+1mv/ROCfCQzPgvOpTWbYx0YFtNpSMzc+vSRfzR+D CjdCBq/3Tv77V7935uyMKtHGs6eSTk7Lh6wZ2H5G39eOuDwrc1azHkNZrIN2DCLe PN6FMOzKQrmYWShMMk+f99Ef6OOAGBs74RtTYiguJet/d6pMbPyuiYnbAjlaAEiK CoYLE0nByhmAeCEA3Ejikvlr/IFJznxOcP9NOjKXsRXo4RndSeQrg90rC20pA+An D+exNYAp+WZGQxS5eDiS0cF8HH6ZTXFiUbsKF8k+erlx+SetJvuRsbK/XGpGAz/1 68zShwO67C/Eaajivc+2 =+AUq -----END PGP SIGNATURE----- --oBzgnH5Lm+6YPTsS-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 20:16:13 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 50B51301; Sun, 29 Dec 2013 20:16:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3A8BB1554; Sun, 29 Dec 2013 20:16:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTKGDIS097890; Sun, 29 Dec 2013 20:16:13 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTKGDe8097889; Sun, 29 Dec 2013 20:16:13 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312292016.rBTKGDe8097889@svn.freebsd.org> From: Dimitry Andric Date: Sun, 29 Dec 2013 20:16:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260056 - head/sys/dev/vxge/vxgehal X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 20:16:13 -0000 Author: dim Date: Sun Dec 29 20:16:12 2013 New Revision: 260056 URL: http://svnweb.freebsd.org/changeset/base/260056 Log: In sys/dev/vxge/vxgehal/vxgehal-ring.c, #if 0 an unused static function. MFC after: 3 days Modified: head/sys/dev/vxge/vxgehal/vxgehal-ring.c Modified: head/sys/dev/vxge/vxgehal/vxgehal-ring.c ============================================================================== --- head/sys/dev/vxge/vxgehal/vxgehal-ring.c Sun Dec 29 20:05:48 2013 (r260055) +++ head/sys/dev/vxge/vxgehal/vxgehal-ring.c Sun Dec 29 20:16:12 2013 (r260056) @@ -62,6 +62,7 @@ __hal_ring_block_memblock_idx_set( VXGE_HAL_RING_MEMBLOCK_IDX_OFFSET))) = memblock_idx; } +#if 0 /* * __hal_ring_block_next_pointer - Returns the dma address of next block * @block: RxD block @@ -76,6 +77,7 @@ __hal_ring_block_next_pointer( return (dma_addr_t)*((u64 *) ((void *)((u8 *) block + VXGE_HAL_RING_NEXT_BLOCK_POINTER_OFFSET))); } +#endif /* * __hal_ring_block_next_pointer_set - Sets the next block pointer in RxD block From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 20:23:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1CABD57C; Sun, 29 Dec 2013 20:23:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0978D15E2; Sun, 29 Dec 2013 20:23:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTKN8RZ001273; Sun, 29 Dec 2013 20:23:08 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTKN8r2001272; Sun, 29 Dec 2013 20:23:08 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312292023.rBTKN8r2001272@svn.freebsd.org> From: Dimitry Andric Date: Sun, 29 Dec 2013 20:23:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260057 - head/sys/dev/scc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 20:23:09 -0000 Author: dim Date: Sun Dec 29 20:23:08 2013 New Revision: 260057 URL: http://svnweb.freebsd.org/changeset/base/260057 Log: In sys/dev/scc, remove unused static function scc_setmreg(). While here, invoke scc_getmreg() in two more places where it can be used. Reviewed by: marcel MFC after: 3 days Modified: head/sys/dev/scc/scc_dev_z8530.c Modified: head/sys/dev/scc/scc_dev_z8530.c ============================================================================== --- head/sys/dev/scc/scc_dev_z8530.c Sun Dec 29 20:16:12 2013 (r260056) +++ head/sys/dev/scc/scc_dev_z8530.c Sun Dec 29 20:23:08 2013 (r260057) @@ -66,15 +66,6 @@ struct scc_class scc_z8530_class = { }; /* Multiplexed I/O. */ -static __inline void -scc_setmreg(struct scc_bas *bas, int ch, int reg, int val) -{ - - scc_setreg(bas, ch + REG_CTRL, reg); - scc_barrier(bas); - scc_setreg(bas, ch + REG_CTRL, val); -} - static __inline uint8_t scc_getmreg(struct scc_bas *bas, int ch, int reg) { @@ -146,9 +137,7 @@ z8530_bfe_ipend(struct scc_softc *sc) if (ip & IP_TIB) ch[1]->ch_ipend |= SER_INT_TXIDLE; if (ip & IP_SIA) { - scc_setreg(bas, CHAN_A + REG_CTRL, CR_RSTXSI); - scc_barrier(bas); - bes = scc_getreg(bas, CHAN_A + REG_CTRL); + bes = scc_getmreg(bas, CHAN_A, CR_RSTXSI); if (bes & BES_BRK) ch[0]->ch_ipend |= SER_INT_BREAK; sig = ch[0]->ch_hwsig; @@ -164,9 +153,7 @@ z8530_bfe_ipend(struct scc_softc *sc) ch[0]->ch_ipend |= SER_INT_OVERRUN; } if (ip & IP_SIB) { - scc_setreg(bas, CHAN_B + REG_CTRL, CR_RSTXSI); - scc_barrier(bas); - bes = scc_getreg(bas, CHAN_B + REG_CTRL); + bes = scc_getmreg(bas, CHAN_B, CR_RSTXSI); if (bes & BES_BRK) ch[1]->ch_ipend |= SER_INT_BREAK; sig = ch[1]->ch_hwsig; From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 20:41:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78B209D4; Sun, 29 Dec 2013 20:41:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 63D2016D4; Sun, 29 Dec 2013 20:41:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTKfXMD008543; Sun, 29 Dec 2013 20:41:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTKfWtG008538; Sun, 29 Dec 2013 20:41:32 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201312292041.rBTKfWtG008538@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Dec 2013 20:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260058 - head/sys/dev/mpt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 20:41:33 -0000 Author: marius Date: Sun Dec 29 20:41:32 2013 New Revision: 260058 URL: http://svnweb.freebsd.org/changeset/base/260058 Log: - Remove a redundant variable in mpt_pci_attach(). - #if 0 the currently unused paired port linking and unlinking of dual adapters. - Simplify MSI/MSI-X allocation and release. For a single one, we don't need to fiddle with the MSI/MSI-X count and pci_release_msi(9) is smart enough to just do nothing in case of INTx. - Canonicalize actions taken on attach failure and detach. - Remove the remainder of incomplete support for older FreeBSD versions. MFC after: 1 week Modified: head/sys/dev/mpt/mpt.h head/sys/dev/mpt/mpt_cam.c head/sys/dev/mpt/mpt_pci.c head/sys/dev/mpt/mpt_raid.c Modified: head/sys/dev/mpt/mpt.h ============================================================================== --- head/sys/dev/mpt/mpt.h Sun Dec 29 20:23:08 2013 (r260057) +++ head/sys/dev/mpt/mpt.h Sun Dec 29 20:41:32 2013 (r260058) @@ -220,9 +220,6 @@ int mpt_modevent(module_t, int, void *); #define bus_dmamap_sync_range(dma_tag, dmamap, offset, len, op) \ bus_dmamap_sync(dma_tag, dmamap, op) -#if __FreeBSD_version < 600000 -#define bus_get_dma_tag(x) NULL -#endif #define mpt_dma_tag_create(mpt, parent_tag, alignment, boundary, \ lowaddr, highaddr, filter, filterarg, \ maxsize, nsegments, maxsegsz, flags, \ @@ -239,34 +236,6 @@ struct mpt_map_info { }; void mpt_map_rquest(void *, bus_dma_segment_t *, int, int); -/* **************************** NewBUS interrupt Crock ************************/ -#if __FreeBSD_version < 700031 -#define mpt_setup_intr(d, i, f, U, if, ifa, hp) \ - bus_setup_intr(d, i, f, if, ifa, hp) -#else -#define mpt_setup_intr bus_setup_intr -#endif - -/* **************************** NewBUS CAM Support ****************************/ -#if __FreeBSD_version < 700049 -#define mpt_xpt_bus_register(sim, parent, bus) \ - xpt_bus_register(sim, bus) -#else -#define mpt_xpt_bus_register xpt_bus_register -#endif - -/**************************** Kernel Thread Support ***************************/ -#if __FreeBSD_version > 800001 -#define mpt_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ - kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) -#define mpt_kthread_exit(status) \ - kproc_exit(status) -#else -#define mpt_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ - kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) -#define mpt_kthread_exit(status) \ - kthread_exit(status) -#endif /********************************** Endianess *********************************/ #define MPT_2_HOST64(ptr, tag) ptr->tag = le64toh(ptr->tag) @@ -671,7 +640,6 @@ struct mpt_softc { /* * PCI Hardware info */ - int pci_msi_count; struct resource * pci_irq; /* Interrupt map for chip */ void * ih; /* Interrupt handle */ #if 0 @@ -754,9 +722,10 @@ struct mpt_softc { uint16_t sequence; /* Sequence Number */ uint16_t pad3; - +#if 0 /* Paired port in some dual adapters configurations */ struct mpt_softc * mpt2; +#endif /* FW Image management */ uint32_t fw_image_size; Modified: head/sys/dev/mpt/mpt_cam.c ============================================================================== --- head/sys/dev/mpt/mpt_cam.c Sun Dec 29 20:23:08 2013 (r260057) +++ head/sys/dev/mpt/mpt_cam.c Sun Dec 29 20:41:32 2013 (r260058) @@ -110,12 +110,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if __FreeBSD_version >= 700025 -#ifndef CAM_NEW_TRAN_CODE -#define CAM_NEW_TRAN_CODE 1 -#endif -#endif - static void mpt_poll(struct cam_sim *); static timeout_t mpt_timeout; static void mpt_action(struct cam_sim *, union ccb *); @@ -344,7 +338,7 @@ mpt_cam_attach(struct mpt_softc *mpt) * Register exactly this bus. */ MPT_LOCK(mpt); - if (mpt_xpt_bus_register(mpt->sim, mpt->dev, 0) != CAM_SUCCESS) { + if (xpt_bus_register(mpt->sim, mpt->dev, 0) != CAM_SUCCESS) { mpt_prt(mpt, "Bus registration Failed!\n"); error = ENOMEM; MPT_UNLOCK(mpt); @@ -383,7 +377,7 @@ mpt_cam_attach(struct mpt_softc *mpt) * Register this bus. */ MPT_LOCK(mpt); - if (mpt_xpt_bus_register(mpt->phydisk_sim, mpt->dev, 1) != + if (xpt_bus_register(mpt->phydisk_sim, mpt->dev, 1) != CAM_SUCCESS) { mpt_prt(mpt, "Physical Disk Bus registration Failed!\n"); error = ENOMEM; @@ -2338,7 +2332,6 @@ mpt_cam_event(struct mpt_softc *mpt, req break; case MPI_EVENT_RESCAN: -#if __FreeBSD_version >= 600000 { union ccb *ccb; uint32_t pathid; @@ -2373,10 +2366,7 @@ mpt_cam_event(struct mpt_softc *mpt, req xpt_rescan(ccb); break; } -#else - mpt_prt(mpt, "Rescan Port: %d\n", (data0 >> 8) & 0xff); - break; -#endif + case MPI_EVENT_LINK_STATUS_CHANGE: mpt_prt(mpt, "Port %d: LinkState: %s\n", (data1 >> 8) & 0xff, @@ -3324,11 +3314,8 @@ mpt_action(struct cam_sim *sim, union cc break; } -#ifdef CAM_NEW_TRAN_CODE #define IS_CURRENT_SETTINGS(c) ((c)->type == CTS_TYPE_CURRENT_SETTINGS) -#else -#define IS_CURRENT_SETTINGS(c) ((c)->flags & CCB_TRANS_CURRENT_SETTINGS) -#endif + #define DP_DISC_ENABLE 0x1 #define DP_DISC_DISABL 0x2 #define DP_DISC (DP_DISC_ENABLE|DP_DISC_DISABL) @@ -3345,10 +3332,8 @@ mpt_action(struct cam_sim *sim, union cc case XPT_SET_TRAN_SETTINGS: /* Nexus Settings */ { -#ifdef CAM_NEW_TRAN_CODE struct ccb_trans_settings_scsi *scsi; struct ccb_trans_settings_spi *spi; -#endif uint8_t dval; u_int period; u_int offset; @@ -3361,7 +3346,6 @@ mpt_action(struct cam_sim *sim, union cc break; } -#ifdef CAM_NEW_TRAN_CODE scsi = &cts->proto_specific.scsi; spi = &cts->xport_specific.spi; @@ -3372,7 +3356,6 @@ mpt_action(struct cam_sim *sim, union cc mpt_set_ccb_status(ccb, CAM_REQ_CMP); break; } -#endif /* * Skip attempting settings on RAID volume disks. @@ -3402,28 +3385,6 @@ mpt_action(struct cam_sim *sim, union cc period = 0; offset = 0; -#ifndef CAM_NEW_TRAN_CODE - if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) { - dval |= (cts->flags & CCB_TRANS_DISC_ENB) ? - DP_DISC_ENABLE : DP_DISC_DISABL; - } - - if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) { - dval |= (cts->flags & CCB_TRANS_TAG_ENB) ? - DP_TQING_ENABLE : DP_TQING_DISABL; - } - - if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) { - dval |= cts->bus_width ? DP_WIDE : DP_NARROW; - } - - if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) && - (cts->valid & CCB_TRANS_SYNC_OFFSET_VALID)) { - dval |= DP_SYNC; - period = cts->sync_period; - offset = cts->sync_offset; - } -#else if ((spi->valid & CTS_SPI_VALID_DISC) != 0) { dval |= ((spi->flags & CTS_SPI_FLAGS_DISC_ENB) != 0) ? DP_DISC_ENABLE : DP_DISC_DISABL; @@ -3459,7 +3420,7 @@ mpt_action(struct cam_sim *sim, union cc period &= MPI_SCSIDEVPAGE1_RP_MIN_SYNC_PERIOD_MASK; period >>= MPI_SCSIDEVPAGE1_RP_SHIFT_MIN_SYNC_PERIOD; } -#endif + if (dval & DP_DISC_ENABLE) { mpt->mpt_disc_enable |= (1 << tgt); } else if (dval & DP_DISC_DISABL) { @@ -3492,7 +3453,6 @@ mpt_action(struct cam_sim *sim, union cc } case XPT_GET_TRAN_SETTINGS: { -#ifdef CAM_NEW_TRAN_CODE struct ccb_trans_settings_scsi *scsi; cts = &ccb->cts; cts->protocol = PROTO_SCSI; @@ -3524,21 +3484,6 @@ mpt_action(struct cam_sim *sim, union cc scsi = &cts->proto_specific.scsi; scsi->valid = CTS_SCSI_VALID_TQ; scsi->flags = CTS_SCSI_FLAGS_TAG_ENB; -#else - cts = &ccb->cts; - if (mpt->is_fc) { - cts->flags = CCB_TRANS_TAG_ENB | CCB_TRANS_DISC_ENB; - cts->valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID; - cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT; - } else if (mpt->is_sas) { - cts->flags = CCB_TRANS_TAG_ENB | CCB_TRANS_DISC_ENB; - cts->valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID; - cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT; - } else if (mpt_get_spi_settings(mpt, cts) != 0) { - mpt_set_ccb_status(ccb, CAM_REQ_CMP_ERR); - break; - } -#endif mpt_set_ccb_status(ccb, CAM_REQ_CMP); break; } @@ -3592,7 +3537,6 @@ mpt_action(struct cam_sim *sim, union cc /* * The base speed is the speed of the underlying connection. */ -#ifdef CAM_NEW_TRAN_CODE cpi->protocol = PROTO_SCSI; if (mpt->is_fc) { cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED; @@ -3616,21 +3560,6 @@ mpt_action(struct cam_sim *sim, union cc cpi->transport_version = 2; cpi->protocol_version = SCSI_REV_2; } -#else - if (mpt->is_fc) { - cpi->hba_misc = PIM_NOBUSRESET; - cpi->base_transfer_speed = 100000; - cpi->hba_inquiry = PI_TAG_ABLE; - } else if (mpt->is_sas) { - cpi->hba_misc = PIM_NOBUSRESET; - cpi->base_transfer_speed = 300000; - cpi->hba_inquiry = PI_TAG_ABLE; - } else { - cpi->hba_misc = PIM_SEQSCAN; - cpi->base_transfer_speed = 3300; - cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16; - } -#endif /* * We give our fake RAID passhtru bus a width that is MaxVolumes @@ -3726,10 +3655,8 @@ mpt_action(struct cam_sim *sim, union cc static int mpt_get_spi_settings(struct mpt_softc *mpt, struct ccb_trans_settings *cts) { -#ifdef CAM_NEW_TRAN_CODE struct ccb_trans_settings_scsi *scsi = &cts->proto_specific.scsi; struct ccb_trans_settings_spi *spi = &cts->xport_specific.spi; -#endif target_id_t tgt; uint32_t dval, pval, oval; int rv; @@ -3790,29 +3717,6 @@ mpt_get_spi_settings(struct mpt_softc *m pval = MPI_SCSIPORTPAGE0_CAP_GET_MIN_SYNC_PERIOD(pval); } -#ifndef CAM_NEW_TRAN_CODE - cts->flags &= ~(CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB); - cts->valid = 0; - cts->sync_period = pval; - cts->sync_offset = oval; - cts->valid |= CCB_TRANS_SYNC_RATE_VALID; - cts->valid |= CCB_TRANS_SYNC_OFFSET_VALID; - cts->valid |= CCB_TRANS_BUS_WIDTH_VALID; - if (dval & DP_WIDE) { - cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT; - } else { - cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT; - } - if (cts->ccb_h.target_lun != CAM_LUN_WILDCARD) { - cts->valid |= CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID; - if (dval & DP_DISC_ENABLE) { - cts->flags |= CCB_TRANS_DISC_ENB; - } - if (dval & DP_TQING_ENABLE) { - cts->flags |= CCB_TRANS_TAG_ENB; - } - } -#else spi->valid = 0; scsi->valid = 0; spi->flags = 0; @@ -3837,10 +3741,10 @@ mpt_get_spi_settings(struct mpt_softc *m spi->flags |= CTS_SPI_FLAGS_DISC_ENB; } } -#endif + mpt_lprt(mpt, MPT_PRT_NEGOTIATION, "mpt_get_spi_settings[%d]: %s flags 0x%x per 0x%x off=%d\n", tgt, - IS_CURRENT_SETTINGS(cts)? "ACTIVE" : "NVRAM ", dval, pval, oval); + IS_CURRENT_SETTINGS(cts) ? "ACTIVE" : "NVRAM ", dval, pval, oval); return (0); } @@ -3910,7 +3814,7 @@ mpt_spawn_recovery_thread(struct mpt_sof { int error; - error = mpt_kthread_create(mpt_recovery_thread, mpt, + error = kproc_create(mpt_recovery_thread, mpt, &mpt->recovery_thread, /*flags*/0, /*altstack*/0, "mpt_recovery%d", mpt->unit); return (error); @@ -3953,7 +3857,7 @@ mpt_recovery_thread(void *arg) mpt->recovery_thread = NULL; wakeup(&mpt->recovery_thread); MPT_UNLOCK(mpt); - mpt_kthread_exit(0); + kproc_exit(0); } static int Modified: head/sys/dev/mpt/mpt_pci.c ============================================================================== --- head/sys/dev/mpt/mpt_pci.c Sun Dec 29 20:23:08 2013 (r260057) +++ head/sys/dev/mpt/mpt_pci.c Sun Dec 29 20:41:32 2013 (r260058) @@ -105,14 +105,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if __FreeBSD_version < 700000 -#define pci_msix_count(x) 0 -#define pci_msi_count(x) 0 -#define pci_alloc_msi(x, y) 1 -#define pci_alloc_msix(x, y) 1 -#define pci_release_msi(x) do { ; } while (0) -#endif - /* * XXX it seems no other MPT driver knows about the following chips. */ @@ -149,10 +141,6 @@ __FBSDID("$FreeBSD$"); #define MPI_MANUFACTPAGE_DEVID_SAS1078DE_FB 0x007C #endif -#ifndef PCIM_CMD_SERRESPEN -#define PCIM_CMD_SERRESPEN 0x0100 -#endif - static int mpt_pci_probe(device_t); static int mpt_pci_attach(device_t); static void mpt_free_bus_resources(struct mpt_softc *mpt); @@ -178,6 +166,7 @@ static device_method_t mpt_methods[] = { static driver_t mpt_driver = { "mpt", mpt_methods, sizeof(struct mpt_softc) }; + static devclass_t mpt_devclass; DRIVER_MODULE(mpt, pci, mpt_driver, mpt_devclass, NULL, NULL); MODULE_DEPEND(mpt, pci, 1, 1, 1); @@ -288,6 +277,7 @@ mpt_set_options(struct mpt_softc *mpt) } } +#if 0 static void mpt_link_peer(struct mpt_softc *mpt) { @@ -326,13 +316,14 @@ mpt_unlink_peer(struct mpt_softc *mpt) mpt->mpt2->mpt2 = NULL; } } +#endif static int mpt_pci_attach(device_t dev) { struct mpt_softc *mpt; int iqd; - uint32_t data, cmd; + uint32_t val; int mpt_io_bar, mpt_mem_bar; mpt = (struct mpt_softc*)device_get_softc(dev); @@ -393,19 +384,19 @@ mpt_pci_attach(device_t dev) /* * Make sure that SERR, PERR, WRITE INVALIDATE and BUSMASTER are set. */ - cmd = pci_read_config(dev, PCIR_COMMAND, 2); - cmd |= - PCIM_CMD_SERRESPEN | PCIM_CMD_PERRESPEN | + val = pci_read_config(dev, PCIR_COMMAND, 2); + val |= PCIM_CMD_SERRESPEN | PCIM_CMD_PERRESPEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN; - pci_write_config(dev, PCIR_COMMAND, cmd, 2); + pci_write_config(dev, PCIR_COMMAND, val, 2); /* * Make sure we've disabled the ROM. */ - data = pci_read_config(dev, PCIR_BIOS, 4); - data &= ~PCIM_BIOS_ENABLE; - pci_write_config(dev, PCIR_BIOS, data, 4); + val = pci_read_config(dev, PCIR_BIOS, 4); + val &= ~PCIM_BIOS_ENABLE; + pci_write_config(dev, PCIR_BIOS, val, 4); +#if 0 /* * Is this part a dual? * If so, link with our partner (around yet) @@ -422,12 +413,13 @@ mpt_pci_attach(device_t dev) default: break; } +#endif /* * Figure out which are the I/O and MEM Bars */ - data = pci_read_config(dev, PCIR_BAR(0), 4); - if (PCI_BAR_IO(data)) { + val = pci_read_config(dev, PCIR_BAR(0), 4); + if (PCI_BAR_IO(val)) { /* BAR0 is IO, BAR1 is memory */ mpt_io_bar = 0; mpt_mem_bar = 1; @@ -484,25 +476,15 @@ mpt_pci_attach(device_t dev) * First try to alloc an MSI-X message. If that * fails, then try to alloc an MSI message instead. */ - if (pci_msix_count(dev) == 1) { - mpt->pci_msi_count = 1; - if (pci_alloc_msix(dev, &mpt->pci_msi_count) == 0) { - iqd = 1; - } else { - mpt->pci_msi_count = 0; - } - } - if (iqd == 0 && pci_msi_count(dev) == 1) { - mpt->pci_msi_count = 1; - if (pci_alloc_msi(dev, &mpt->pci_msi_count) == 0) { - iqd = 1; - } else { - mpt->pci_msi_count = 0; - } - } + val = 1; + if (pci_alloc_msix(dev, &val) == 0) + iqd = 1; + val = 1; + if (iqd == 0 && pci_alloc_msi(dev, &val) == 0) + iqd = 1; } mpt->pci_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd, - RF_ACTIVE | (mpt->pci_msi_count ? 0 : RF_SHAREABLE)); + RF_ACTIVE | (iqd != 0 ? 0 : RF_SHAREABLE)); if (mpt->pci_irq == NULL) { device_printf(dev, "could not allocate interrupt\n"); goto bad; @@ -514,7 +496,7 @@ mpt_pci_attach(device_t dev) mpt_disable_ints(mpt); /* Register the interrupt handler */ - if (mpt_setup_intr(dev, mpt->pci_irq, MPT_IFLAGS, NULL, mpt_pci_intr, + if (bus_setup_intr(dev, mpt->pci_irq, MPT_IFLAGS, NULL, mpt_pci_intr, mpt, &mpt->ih)) { device_printf(dev, "could not setup interrupt\n"); goto bad; @@ -562,7 +544,10 @@ mpt_pci_attach(device_t dev) if (mpt->eh == NULL) { mpt_prt(mpt, "shutdown event registration failed\n"); + mpt_disable_ints(mpt); (void) mpt_detach(mpt); + mpt_reset(mpt, /*reinit*/FALSE); + mpt_raid_free_mem(mpt); goto bad; } return (0); @@ -570,7 +555,9 @@ mpt_pci_attach(device_t dev) bad: mpt_dma_mem_free(mpt); mpt_free_bus_resources(mpt); +#if 0 mpt_unlink_peer(mpt); +#endif MPT_LOCK_DESTROY(mpt); @@ -595,25 +582,21 @@ mpt_free_bus_resources(struct mpt_softc if (mpt->pci_irq) { bus_release_resource(mpt->dev, SYS_RES_IRQ, rman_get_rid(mpt->pci_irq), mpt->pci_irq); + pci_release_msi(mpt->dev); mpt->pci_irq = NULL; } - if (mpt->pci_msi_count) { - pci_release_msi(mpt->dev); - mpt->pci_msi_count = 0; - } - if (mpt->pci_pio_reg) { bus_release_resource(mpt->dev, SYS_RES_IOPORT, rman_get_rid(mpt->pci_pio_reg), mpt->pci_pio_reg); mpt->pci_pio_reg = NULL; } + if (mpt->pci_reg) { bus_release_resource(mpt->dev, SYS_RES_MEMORY, rman_get_rid(mpt->pci_reg), mpt->pci_reg); mpt->pci_reg = NULL; } - MPT_LOCK_DESTROY(mpt); } /* @@ -630,12 +613,16 @@ mpt_pci_detach(device_t dev) mpt_disable_ints(mpt); mpt_detach(mpt); mpt_reset(mpt, /*reinit*/FALSE); + mpt_raid_free_mem(mpt); mpt_dma_mem_free(mpt); mpt_free_bus_resources(mpt); - mpt_raid_free_mem(mpt); +#if 0 + mpt_unlink_peer(mpt); +#endif if (mpt->eh != NULL) { EVENTHANDLER_DEREGISTER(shutdown_post_sync, mpt->eh); } + MPT_LOCK_DESTROY(mpt); } return(0); } @@ -649,11 +636,8 @@ mpt_pci_shutdown(device_t dev) struct mpt_softc *mpt; mpt = (struct mpt_softc *)device_get_softc(dev); - if (mpt) { - int r; - r = mpt_shutdown(mpt); - return (r); - } + if (mpt) + return (mpt_shutdown(mpt)); return(0); } @@ -669,20 +653,11 @@ mpt_dma_mem_alloc(struct mpt_softc *mpt) } len = sizeof (request_t) * MPT_MAX_REQUESTS(mpt); -#ifdef RELENG_4 - mpt->request_pool = (request_t *)malloc(len, M_DEVBUF, M_WAITOK); - if (mpt->request_pool == NULL) { - mpt_prt(mpt, "cannot allocate request pool\n"); - return (1); - } - memset(mpt->request_pool, 0, len); -#else mpt->request_pool = (request_t *)malloc(len, M_DEVBUF, M_WAITOK|M_ZERO); if (mpt->request_pool == NULL) { mpt_prt(mpt, "cannot allocate request pool\n"); return (1); } -#endif /* * Create a parent dma tag for this device. Modified: head/sys/dev/mpt/mpt_raid.c ============================================================================== --- head/sys/dev/mpt/mpt_raid.c Sun Dec 29 20:23:08 2013 (r260057) +++ head/sys/dev/mpt/mpt_raid.c Sun Dec 29 20:41:32 2013 (r260058) @@ -636,7 +636,7 @@ mpt_spawn_raid_thread(struct mpt_softc * MPT_LOCK(mpt); xpt_freeze_simq(mpt->phydisk_sim, 1); MPT_UNLOCK(mpt); - error = mpt_kthread_create(mpt_raid_thread, mpt, + error = kproc_create(mpt_raid_thread, mpt, &mpt->raid_thread, /*flags*/0, /*altstack*/0, "mpt_raid%d", mpt->unit); if (error != 0) { @@ -719,7 +719,7 @@ mpt_raid_thread(void *arg) mpt->raid_thread = NULL; wakeup(&mpt->raid_thread); MPT_UNLOCK(mpt); - mpt_kthread_exit(0); + kproc_exit(0); } #if 0 From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 20:48:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 305DCCF6; Sun, 29 Dec 2013 20:48:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1BB3316F9; Sun, 29 Dec 2013 20:48:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTKmlb9009471; Sun, 29 Dec 2013 20:48:47 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTKmlIu009469; Sun, 29 Dec 2013 20:48:47 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201312292048.rBTKmlIu009469@svn.freebsd.org> From: Scott Long Date: Sun, 29 Dec 2013 20:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260059 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 20:48:48 -0000 Author: scottl Date: Sun Dec 29 20:48:47 2013 New Revision: 260059 URL: http://svnweb.freebsd.org/changeset/base/260059 Log: Add the '-b' flag to 'camcontrol devlist'. This prints only the existing buses and their parent sims, useful for creating a sim->bus->device map. Obtained from: Netflix MFC after: 3 days Modified: head/sbin/camcontrol/camcontrol.8 head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.8 ============================================================================== --- head/sbin/camcontrol/camcontrol.8 Sun Dec 29 20:41:32 2013 (r260058) +++ head/sbin/camcontrol/camcontrol.8 Sun Dec 29 20:48:47 2013 (r260059) @@ -41,6 +41,7 @@ .Op command args .Nm .Ic devlist +.Op Fl b .Op Fl v .Nm .Ic periphlist @@ -361,6 +362,10 @@ With the .Fl v argument, SCSI bus number, adapter name and unit numbers are printed as well. +On the other hand, with the +.Fl b +argument, only the bus adapter, and unit information will be printed, and +device information will be omitted. .It Ic periphlist List all peripheral drivers attached to a given physical device (logical unit). Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Sun Dec 29 20:41:32 2013 (r260058) +++ head/sbin/camcontrol/camcontrol.c Sun Dec 29 20:48:47 2013 (r260059) @@ -202,7 +202,7 @@ static struct camcontrol_opts option_tab {"defects", CAM_CMD_READ_DEFECTS, CAM_ARG_NONE, readdefect_opts}, {"defectlist", CAM_CMD_READ_DEFECTS, CAM_ARG_NONE, readdefect_opts}, #endif /* MINIMALISTIC */ - {"devlist", CAM_CMD_DEVTREE, CAM_ARG_NONE, NULL}, + {"devlist", CAM_CMD_DEVTREE, CAM_ARG_NONE, "-b"}, #ifndef MINIMALISTIC {"periphlist", CAM_CMD_DEVLIST, CAM_ARG_NONE, NULL}, {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "bdelm:P:"}, @@ -254,7 +254,7 @@ camcontrol_optret getoption(struct camco #ifndef MINIMALISTIC static int getdevlist(struct cam_device *device); #endif /* MINIMALISTIC */ -static int getdevtree(void); +static int getdevtree(int argc, char **argv, char *combinedopt); #ifndef MINIMALISTIC static int testunitready(struct cam_device *device, int retry_count, int timeout, int quiet); @@ -411,7 +411,7 @@ getdevlist(struct cam_device *device) #endif /* MINIMALISTIC */ static int -getdevtree(void) +getdevtree(int argc, char **argv, char *combinedopt) { union ccb ccb; int bufsize, fd; @@ -419,6 +419,19 @@ getdevtree(void) int need_close = 0; int error = 0; int skip_device = 0; + int busonly = 0; + char c; + + while ((c = getopt(argc, argv, combinedopt)) != -1) { + switch(c) { + case 'b': + if ((arglist & CAM_ARG_VERBOSE) == 0) + busonly = 1; + break; + default: + break; + } + } if ((fd = open(XPT_DEVICE, O_RDWR)) == -1) { warn("couldn't open %s", XPT_DEVICE); @@ -478,7 +491,8 @@ getdevtree(void) * Only print the bus information if the * user turns on the verbose flag. */ - if ((arglist & CAM_ARG_VERBOSE) == 0) + if ((busonly == 0) && + (arglist & CAM_ARG_VERBOSE) == 0) break; bus_result = @@ -489,11 +503,12 @@ getdevtree(void) need_close = 0; } - fprintf(stdout, "scbus%d on %s%d bus %d:\n", + fprintf(stdout, "scbus%d on %s%d bus %d%s\n", bus_result->path_id, bus_result->dev_name, bus_result->unit_number, - bus_result->bus_id); + bus_result->bus_id, + (busonly ? "" : ":")); break; } case DEV_MATCH_DEVICE: { @@ -501,6 +516,9 @@ getdevtree(void) char vendor[16], product[48], revision[16]; char fw[5], tmpstr[256]; + if (busonly == 1) + break; + dev_result = &ccb.cdm.matches[i].result.device_result; @@ -582,7 +600,7 @@ getdevtree(void) periph_result = &ccb.cdm.matches[i].result.periph_result; - if (skip_device != 0) + if (busonly || skip_device != 0) break; if (need_close > 1) @@ -8178,7 +8196,7 @@ main(int argc, char **argv) break; #endif /* MINIMALISTIC */ case CAM_CMD_DEVTREE: - error = getdevtree(); + error = getdevtree(argc, argv, combinedopt); break; #ifndef MINIMALISTIC case CAM_CMD_TUR: From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 20:51:41 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 22EC4E57 for ; Sun, 29 Dec 2013 20:51:41 +0000 (UTC) Received: from nm20.bullet.mail.bf1.yahoo.com (nm20.bullet.mail.bf1.yahoo.com [98.139.212.179]) by mx1.freebsd.org (Postfix) with SMTP id B4711175C for ; Sun, 29 Dec 2013 20:51:40 +0000 (UTC) Received: from [98.139.215.140] by nm20.bullet.mail.bf1.yahoo.com with NNFMP; 29 Dec 2013 20:51:33 -0000 Received: from [98.139.211.199] by tm11.bullet.mail.bf1.yahoo.com with NNFMP; 29 Dec 2013 20:51:33 -0000 Received: from [127.0.0.1] by smtp208.mail.bf1.yahoo.com with NNFMP; 29 Dec 2013 20:51:33 -0000 X-Yahoo-Newman-Id: 819451.83151.bm@smtp208.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: XY9J7r0VM1miGbQWyKRGKEzhVdGk63.9oMBdnkF9SSK5lY4 U7bzLJzLcx3lem8VMMihySLNyfN3w5NEewhTyfRqwm0C4OBokKrT4dDtZ5E2 zAvFjgR29Pm1FooPOHF6VVxgprcoyp2RaOFSuTYl3DRUXcWiZ5aPNY5hyMro ujHJNdOaM_hoTYPndn0LlV8b3aS_X9j8_KlJItxYYFGN4VVr7zrTxzaop6aY zAKZgMtzZe7UH1avK63_xgYzwuwh_5Yllccv7y0a.zaUzEr.qLdS2.eXs.G6 PEr3DpOcpiPgCakLYi.xzLrpz_RIr8MZnQKItCo2pMit0kReZDV0Ij7NgLz7 Q2VD_NsNrSJ0ZMSIWXXuA0XNQ0Ji3NS.DpZcq1PBzTEXdrYZaQwEIlRn1GjQ 0I0bekE5Wlv0IZLpKInIiUypDR2YuY.HuG4_LQZnU5l4zXmDKHSxevp.h9qk qprvxQMp15lNPuoTZPhEfbkvBrSGfZJEBWvqZFHClZDEolLC.Z5LAL3jyKpw Pto0pO1btbNFJv5LHLgiyXB3rA9fPuaZPcuS.ICZVnr4m2WkMtZAhClg- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.102] (pfg@190.157.126.109 with plain [98.138.105.21]) by smtp208.mail.bf1.yahoo.com with SMTP; 29 Dec 2013 12:51:33 -0800 PST Message-ID: <52C08B47.70106@FreeBSD.org> Date: Sun, 29 Dec 2013 15:51:19 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Dimitry Andric , Adrian Chadd Subject: Re: svn commit: r259896 - head/sys/dev/cxgb/common References: <201312252245.rBPMjX5J046556@svn.freebsd.org> <76C5CECF-1A27-4245-B5D1-335C46B253E7@FreeBSD.org> In-Reply-To: <76C5CECF-1A27-4245-B5D1-335C46B253E7@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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.17 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: Sun, 29 Dec 2013 20:51:41 -0000 On 26.12.2013 06:13, Dimitry Andric wrote: > On 26 Dec 2013, at 02:51, Adrian Chadd wrote: >> I'd prefer you didn't remove unused code in drivers like this. If you >> must, #if 0 them out. > I don't mind either way, but some other people are very much opposed to > littering code with #if 0'd sections. So, how do to determine what is > right in each situation? :-) > FWIW, I am also in favor of removing instead of #if 0. If we really need the code back, we have subversion for that. I guess an exception would be on contributed code, where one still wants to keep things similar. Just my 0.02$, no strong feelings about either way. Pedro. From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 21:28:27 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 04345618; Sun, 29 Dec 2013 21:28:27 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B06AE1939; Sun, 29 Dec 2013 21:28:26 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id rBTLSPu6041071 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 29 Dec 2013 13:28:26 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id rBTLSPfI041070; Sun, 29 Dec 2013 13:28:25 -0800 (PST) (envelope-from jmg) Date: Sun, 29 Dec 2013 13:28:25 -0800 From: John-Mark Gurney To: Pedro Giffuni Subject: Re: svn commit: r259896 - head/sys/dev/cxgb/common Message-ID: <20131229212825.GE99167@funkthat.com> References: <201312252245.rBPMjX5J046556@svn.freebsd.org> <76C5CECF-1A27-4245-B5D1-335C46B253E7@FreeBSD.org> <52C08B47.70106@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52C08B47.70106@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Sun, 29 Dec 2013 13:28:26 -0800 (PST) Cc: "svn-src-head@freebsd.org" , Adrian Chadd , "src-committers@freebsd.org" , Dimitry Andric , "svn-src-all@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 21:28:27 -0000 Pedro Giffuni wrote this message on Sun, Dec 29, 2013 at 15:51 -0500: > On 26.12.2013 06:13, Dimitry Andric wrote: > >On 26 Dec 2013, at 02:51, Adrian Chadd wrote: > >>I'd prefer you didn't remove unused code in drivers like this. If you > >>must, #if 0 them out. > >I don't mind either way, but some other people are very much opposed to > >littering code with #if 0'd sections. So, how do to determine what is > >right in each situation? :-) > > > > FWIW, I am also in favor of removing instead of #if 0. > If we really need the code back, we have subversion for that. > > I guess an exception would be on contributed code, where one > still wants to keep things similar. > > Just my 0.02$, no strong feelings about either way. My vote for code like this to #if 0 it out.. The reason being is that this is generic hardware register access, and it's likely that if it is removed and someone needs it, they'll write their own instead of dig it out of history, since they might not even realize that it even existed... Though can't we annotate it as unused? Since it is static inline, the compiler should end up not including it in the object. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 22:20:07 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7490638D; Sun, 29 Dec 2013 22:20:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 611C91D40; Sun, 29 Dec 2013 22:20:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTMK796043714; Sun, 29 Dec 2013 22:20:07 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTMK7ls043713; Sun, 29 Dec 2013 22:20:07 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201312292220.rBTMK7ls043713@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 29 Dec 2013 22:20:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260060 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 22:20:07 -0000 Author: glebius Date: Sun Dec 29 22:20:06 2013 New Revision: 260060 URL: http://svnweb.freebsd.org/changeset/base/260060 Log: Fix couple of bugs from r257692 related to scan of address list on an interface: - in in_control() skip over not AF_INET addresses. - in in_aifaddr_ioctl() and in_difaddr_ioctl() do correct check of address family, w/o accessing memory beyond struct ifaddr. Sponsored by: Nginx, Inc. Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sun Dec 29 20:48:47 2013 (r260059) +++ head/sys/netinet/in.c Sun Dec 29 22:20:06 2013 (r260060) @@ -247,6 +247,8 @@ in_control(struct socket *so, u_long cmd */ IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family != AF_INET) + continue; ia = (struct in_ifaddr *)ifa; if (cmd == SIOCGIFADDR || addr->sin_addr.s_addr == INADDR_ANY) break; @@ -338,11 +340,12 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat ia = NULL; IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - struct in_ifaddr *it = ifatoia(ifa); + struct in_ifaddr *it; - if (it->ia_addr.sin_family != AF_INET) + if (ifa->ifa_addr->sa_family != AF_INET) continue; + it = (struct in_ifaddr *)ifa; iaIsFirst = false; if (it->ia_addr.sin_addr.s_addr == addr->sin_addr.s_addr && prison_check_ip4(td->td_ucred, &addr->sin_addr) == 0) @@ -530,11 +533,12 @@ in_difaddr_ioctl(caddr_t data, struct if ia = NULL; IF_ADDR_WLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - struct in_ifaddr *it = ifatoia(ifa); + struct in_ifaddr *it; - if (it->ia_addr.sin_family != AF_INET) + if (ifa->ifa_addr->sa_family != AF_INET) continue; + it = (struct in_ifaddr *)ifa; if (deleteAny && ia == NULL && (td == NULL || prison_check_ip4(td->td_ucred, &it->ia_addr.sin_addr) == 0)) ia = it; From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 22:43:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D330F82A; Sun, 29 Dec 2013 22:43:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BE19C1ED6; Sun, 29 Dec 2013 22:43:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTMhF5b004660; Sun, 29 Dec 2013 22:43:15 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTMhFRD004659; Sun, 29 Dec 2013 22:43:15 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201312292243.rBTMhFRD004659@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Dec 2013 22:43:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260061 - head/sys/dev/ral X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 22:43:15 -0000 Author: marius Date: Sun Dec 29 22:43:14 2013 New Revision: 260061 URL: http://svnweb.freebsd.org/changeset/base/260061 Log: - Add support for using MSI instead of INTx, controllable via the tunable hw.ral.msi_disable (defaulting to using MSI). - Probe with BUS_PROBE_DEFAULT instead of 0. - Nuke code setting PCI_POWERSTATE_D0; pci(4) already does that for type 0 devices. - Use PCIR_BAR instead of a homegrown macro. - There's no need to keep track of resource IDs. - Release resources again in case attaching fails. - Quiesce the interrupt before detaching. - Sprinkle const. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. - Trim headers. - Nuke dupe $FreeBSD$. MFC after: 1 week Modified: head/sys/dev/ral/if_ral_pci.c Modified: head/sys/dev/ral/if_ral_pci.c ============================================================================== --- head/sys/dev/ral/if_ral_pci.c Sun Dec 29 22:20:06 2013 (r260060) +++ head/sys/dev/ral/if_ral_pci.c Sun Dec 29 22:43:14 2013 (r260061) @@ -1,5 +1,3 @@ -/* $FreeBSD$ */ - /*- * Copyright (c) 2005, 2006 * Damien Bergamini @@ -25,32 +23,26 @@ __FBSDID("$FreeBSD$"); */ #include -#include -#include -#include -#include -#include #include +#include +#include +#include #include #include -#include -#include +#include +#include +#include #include #include -#include -#include -#include -#include #include -#include +#include #include -#include +#include #include #include -#include #include #include @@ -64,6 +56,9 @@ MODULE_DEPEND(ral, firmware, 1, 1, 1); MODULE_DEPEND(ral, wlan, 1, 1, 1); MODULE_DEPEND(ral, wlan_amrr, 1, 1, 1); +static int ral_msi_disable; +TUNABLE_INT("hw.ral.msi_disable", &ral_msi_disable); + struct ral_pci_ident { uint16_t vendor; uint16_t device; @@ -105,7 +100,7 @@ static const struct ral_pci_ident ral_pc { 0, 0, NULL } }; -static struct ral_opns { +static const struct ral_opns { int (*attach)(device_t, int); int (*detach)(void *); void (*shutdown)(void *); @@ -144,9 +139,7 @@ struct ral_pci_softc { struct rt2860_softc sc_rt2860; } u; - struct ral_opns *sc_opns; - int irq_rid; - int mem_rid; + const struct ral_opns *sc_opns; struct resource *irq; struct resource *mem; void *sc_ih; @@ -168,7 +161,7 @@ static device_method_t ral_pci_methods[] DEVMETHOD(device_suspend, ral_pci_suspend), DEVMETHOD(device_resume, ral_pci_resume), - { 0, 0 } + DEVMETHOD_END }; static driver_t ral_pci_driver = { @@ -179,7 +172,7 @@ static driver_t ral_pci_driver = { static devclass_t ral_devclass; -DRIVER_MODULE(ral, pci, ral_pci_driver, ral_devclass, 0, 0); +DRIVER_MODULE(ral, pci, ral_pci_driver, ral_devclass, NULL, NULL); static int ral_pci_probe(device_t dev) @@ -190,29 +183,19 @@ ral_pci_probe(device_t dev) if (pci_get_vendor(dev) == ident->vendor && pci_get_device(dev) == ident->device) { device_set_desc(dev, ident->name); - return 0; + return (BUS_PROBE_DEFAULT); } } return ENXIO; } -/* Base Address Register */ -#define RAL_PCI_BAR0 0x10 - static int ral_pci_attach(device_t dev) { struct ral_pci_softc *psc = device_get_softc(dev); struct rt2560_softc *sc = &psc->u.sc_rt2560; - int error; - - if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { - device_printf(dev, "chip is in D%d power mode " - "-- setting to D0\n", pci_get_powerstate(dev)); - pci_set_powerstate(dev, PCI_POWERSTATE_D0); - } + int count, error, rid; - /* enable bus-mastering */ pci_enable_busmaster(dev); switch (pci_get_device(dev)) { @@ -229,8 +212,8 @@ ral_pci_attach(device_t dev) break; } - psc->mem_rid = RAL_PCI_BAR0; - psc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &psc->mem_rid, + rid = PCIR_BAR(0); + psc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (psc->mem == NULL) { device_printf(dev, "could not allocate memory resource\n"); @@ -241,17 +224,27 @@ ral_pci_attach(device_t dev) sc->sc_sh = rman_get_bushandle(psc->mem); sc->sc_invalid = 1; - psc->irq_rid = 0; - psc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &psc->irq_rid, - RF_ACTIVE | RF_SHAREABLE); + rid = 0; + if (ral_msi_disable == 0) { + count = 1; + if (pci_alloc_msi(dev, &count) == 0) + rid = 1; + } + psc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | + (rid != 0 ? 0 : RF_SHAREABLE)); if (psc->irq == NULL) { device_printf(dev, "could not allocate interrupt resource\n"); + pci_release_msi(dev); + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(psc->mem), psc->mem); return ENXIO; } error = (*psc->sc_opns->attach)(dev, pci_get_device(dev)); - if (error != 0) + if (error != 0) { + (void)ral_pci_detach(dev); return error; + } /* * Hook our interrupt after all initialization is complete. @@ -260,6 +253,7 @@ ral_pci_attach(device_t dev) NULL, psc->sc_opns->intr, psc, &psc->sc_ih); if (error != 0) { device_printf(dev, "could not set up interrupt\n"); + (void)ral_pci_detach(dev); return error; } sc->sc_invalid = 0; @@ -275,14 +269,18 @@ ral_pci_detach(device_t dev) /* check if device was removed */ sc->sc_invalid = !bus_child_present(dev); - + + if (psc->sc_ih != NULL) + bus_teardown_intr(dev, psc->irq, psc->sc_ih); (*psc->sc_opns->detach)(psc); bus_generic_detach(dev); - bus_teardown_intr(dev, psc->irq, psc->sc_ih); - bus_release_resource(dev, SYS_RES_IRQ, psc->irq_rid, psc->irq); + bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(psc->irq), + psc->irq); + pci_release_msi(dev); - bus_release_resource(dev, SYS_RES_MEMORY, psc->mem_rid, psc->mem); + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(psc->mem), + psc->mem); return 0; } From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 22:56:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 70CF7A66; Sun, 29 Dec 2013 22:56:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5C5711F5C; Sun, 29 Dec 2013 22:56:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTMu61E008608; Sun, 29 Dec 2013 22:56:06 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTMu532008606; Sun, 29 Dec 2013 22:56:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201312292256.rBTMu532008606@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Dec 2013 22:56:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260062 - head/sys/dev/ipw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 22:56:06 -0000 Author: marius Date: Sun Dec 29 22:56:05 2013 New Revision: 260062 URL: http://svnweb.freebsd.org/changeset/base/260062 Log: - Probe with BUS_PROBE_DEFAULT instead of 0. - Nuke code setting PCI_POWERSTATE_D0; pci(4) already does that for type 0 devices. - Use PCIR_BAR instead of a homegrown macro. - There's no need to keep track of resource IDs. - Quiesce the interrupt before actually detaching. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. - Nuke dupe $FreeBSD$. MFC after: 1 week Modified: head/sys/dev/ipw/if_ipw.c head/sys/dev/ipw/if_ipwvar.h Modified: head/sys/dev/ipw/if_ipw.c ============================================================================== --- head/sys/dev/ipw/if_ipw.c Sun Dec 29 22:43:14 2013 (r260061) +++ head/sys/dev/ipw/if_ipw.c Sun Dec 29 22:56:05 2013 (r260062) @@ -1,5 +1,3 @@ -/* $FreeBSD$ */ - /*- * Copyright (c) 2004-2006 * Damien Bergamini . All rights reserved. @@ -187,7 +185,7 @@ static device_method_t ipw_methods[] = { DEVMETHOD(device_suspend, ipw_suspend), DEVMETHOD(device_resume, ipw_resume), - { 0, 0 } + DEVMETHOD_END }; static driver_t ipw_driver = { @@ -198,7 +196,7 @@ static driver_t ipw_driver = { static devclass_t ipw_devclass; -DRIVER_MODULE(ipw, pci, ipw_driver, ipw_devclass, 0, 0); +DRIVER_MODULE(ipw, pci, ipw_driver, ipw_devclass, NULL, NULL); MODULE_VERSION(ipw, 1); @@ -211,15 +209,13 @@ ipw_probe(device_t dev) if (pci_get_vendor(dev) == ident->vendor && pci_get_device(dev) == ident->device) { device_set_desc(dev, ident->name); - return 0; + return (BUS_PROBE_DEFAULT); } } return ENXIO; } /* Base Address Register */ -#define IPW_PCI_BAR0 0x10 - static int ipw_attach(device_t dev) { @@ -239,20 +235,13 @@ ipw_attach(device_t dev) TASK_INIT(&sc->sc_init_task, 0, ipw_init_task, sc); callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0); - if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { - device_printf(dev, "chip is in D%d power mode " - "-- setting to D0\n", pci_get_powerstate(dev)); - pci_set_powerstate(dev, PCI_POWERSTATE_D0); - } - pci_write_config(dev, 0x41, 0, 1); /* enable bus-mastering */ pci_enable_busmaster(dev); - sc->mem_rid = IPW_PCI_BAR0; - sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, - RF_ACTIVE); + i = PCIR_BAR(0); + sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i, RF_ACTIVE); if (sc->mem == NULL) { device_printf(dev, "could not allocate memory resource\n"); goto fail; @@ -261,8 +250,8 @@ ipw_attach(device_t dev) sc->sc_st = rman_get_bustag(sc->mem); sc->sc_sh = rman_get_bushandle(sc->mem); - sc->irq_rid = 0; - sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, + i = 0; + sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, RF_ACTIVE | RF_SHAREABLE); if (sc->irq == NULL) { device_printf(dev, "could not allocate interrupt resource\n"); @@ -387,9 +376,10 @@ fail4: fail3: ipw_release(sc); fail2: - bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq); + bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq), sc->irq); fail1: - bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, sc->mem); + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(sc->mem), + sc->mem); fail: mtx_destroy(&sc->sc_mtx); return ENXIO; @@ -402,6 +392,8 @@ ipw_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; + bus_teardown_intr(dev, sc->irq, sc->sc_ih); + ieee80211_draintask(ic, &sc->sc_init_task); ipw_stop(sc); @@ -411,10 +403,10 @@ ipw_detach(device_t dev) ipw_release(sc); - bus_teardown_intr(dev, sc->irq, sc->sc_ih); - bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq); + bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq), sc->irq); - bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, sc->mem); + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(sc->mem), + sc->mem); if_free(ifp); Modified: head/sys/dev/ipw/if_ipwvar.h ============================================================================== --- head/sys/dev/ipw/if_ipwvar.h Sun Dec 29 22:43:14 2013 (r260061) +++ head/sys/dev/ipw/if_ipwvar.h Sun Dec 29 22:56:05 2013 (r260062) @@ -105,8 +105,6 @@ struct ipw_softc { #define IPW_FLAG_ASSOCIATING 0x0080 #define IPW_FLAG_ASSOCIATED 0x0100 - int irq_rid; - int mem_rid; struct resource *irq; struct resource *mem; bus_space_tag_t sc_st; From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 23:05:01 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CEDF2D02; Sun, 29 Dec 2013 23:05:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BA6C31FE9; Sun, 29 Dec 2013 23:05:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTN511W012575; Sun, 29 Dec 2013 23:05:01 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTN512P012572; Sun, 29 Dec 2013 23:05:01 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201312292305.rBTN512P012572@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Dec 2013 23:05:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260063 - head/sys/dev/iwi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 23:05:02 -0000 Author: marius Date: Sun Dec 29 23:05:01 2013 New Revision: 260063 URL: http://svnweb.freebsd.org/changeset/base/260063 Log: - Probe with BUS_PROBE_DEFAULT instead of 0. - Nuke code setting PCI_POWERSTATE_D0; pci(4) already does that for type 0 devices. - Use PCIR_BAR instead of a homegrown macro. - There's no need to keep track of resource IDs. - Quiesce the interrupt before actually detaching. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. MFC after: 1 week Modified: head/sys/dev/iwi/if_iwi.c head/sys/dev/iwi/if_iwivar.h Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Sun Dec 29 22:56:05 2013 (r260062) +++ head/sys/dev/iwi/if_iwi.c Sun Dec 29 23:05:01 2013 (r260063) @@ -220,7 +220,7 @@ static device_method_t iwi_methods[] = { DEVMETHOD(device_suspend, iwi_suspend), DEVMETHOD(device_resume, iwi_resume), - { 0, 0 } + DEVMETHOD_END }; static driver_t iwi_driver = { @@ -231,7 +231,7 @@ static driver_t iwi_driver = { static devclass_t iwi_devclass; -DRIVER_MODULE(iwi, pci, iwi_driver, iwi_devclass, 0, 0); +DRIVER_MODULE(iwi, pci, iwi_driver, iwi_devclass, NULL, NULL); MODULE_VERSION(iwi, 1); @@ -258,15 +258,12 @@ iwi_probe(device_t dev) if (pci_get_vendor(dev) == ident->vendor && pci_get_device(dev) == ident->device) { device_set_desc(dev, ident->name); - return 0; + return (BUS_PROBE_DEFAULT); } } return ENXIO; } -/* Base Address Register */ -#define IWI_PCI_BAR0 0x10 - static int iwi_attach(device_t dev) { @@ -301,20 +298,13 @@ iwi_attach(device_t dev) callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0); callout_init_mtx(&sc->sc_rftimer, &sc->sc_mtx, 0); - if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { - device_printf(dev, "chip is in D%d power mode " - "-- setting to D0\n", pci_get_powerstate(dev)); - pci_set_powerstate(dev, PCI_POWERSTATE_D0); - } - pci_write_config(dev, 0x41, 0, 1); /* enable bus-mastering */ pci_enable_busmaster(dev); - sc->mem_rid = IWI_PCI_BAR0; - sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, - RF_ACTIVE); + i = PCIR_BAR(0); + sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i, RF_ACTIVE); if (sc->mem == NULL) { device_printf(dev, "could not allocate memory resource\n"); goto fail; @@ -323,8 +313,8 @@ iwi_attach(device_t dev) sc->sc_st = rman_get_bustag(sc->mem); sc->sc_sh = rman_get_bushandle(sc->mem); - sc->irq_rid = 0; - sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, + i = 0; + sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &i, RF_ACTIVE | RF_SHAREABLE); if (sc->irq == NULL) { device_printf(dev, "could not allocate interrupt resource\n"); @@ -460,6 +450,8 @@ iwi_detach(device_t dev) struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; + bus_teardown_intr(dev, sc->irq, sc->sc_ih); + /* NB: do early to drain any pending tasks */ ieee80211_draintask(ic, &sc->sc_radiontask); ieee80211_draintask(ic, &sc->sc_radiofftask); @@ -481,10 +473,10 @@ iwi_detach(device_t dev) iwi_free_tx_ring(sc, &sc->txq[3]); iwi_free_rx_ring(sc, &sc->rxq); - bus_teardown_intr(dev, sc->irq, sc->sc_ih); - bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq); + bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq), sc->irq); - bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, sc->mem); + bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(sc->mem), + sc->mem); delete_unrhdr(sc->sc_unr); Modified: head/sys/dev/iwi/if_iwivar.h ============================================================================== --- head/sys/dev/iwi/if_iwivar.h Sun Dec 29 22:56:05 2013 (r260062) +++ head/sys/dev/iwi/if_iwivar.h Sun Dec 29 23:05:01 2013 (r260063) @@ -153,8 +153,6 @@ struct iwi_softc { bus_space_tag_t sc_st; bus_space_handle_t sc_sh; void *sc_ih; - int mem_rid; - int irq_rid; /* * The card needs external firmware images to work, which is made of a From owner-svn-src-head@FreeBSD.ORG Sun Dec 29 23:47:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 795C638B; Sun, 29 Dec 2013 23:47:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 594731251; Sun, 29 Dec 2013 23:47:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBTNl01f027369; Sun, 29 Dec 2013 23:47:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBTNkxSC027361; Sun, 29 Dec 2013 23:46:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201312292346.rBTNkxSC027361@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Dec 2013 23:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260064 - head/sys/dev/wpi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Sun, 29 Dec 2013 23:47:00 -0000 Author: marius Date: Sun Dec 29 23:46:59 2013 New Revision: 260064 URL: http://svnweb.freebsd.org/changeset/base/260064 Log: - Probe with BUS_PROBE_DEFAULT instead of 0. - Nuke code setting PCI_POWERSTATE_D0; pci(4) already does that for type 0 devices. - There's no need to keep track of resource IDs. - Quiesce the interrupt before actually detaching. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. MFC after: 1 week Modified: head/sys/dev/wpi/if_wpi.c head/sys/dev/wpi/if_wpivar.h Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sun Dec 29 23:05:01 2013 (r260063) +++ head/sys/dev/wpi/if_wpi.c Sun Dec 29 23:46:59 2013 (r260064) @@ -253,7 +253,6 @@ static int wpi_shutdown(device_t); static int wpi_suspend(device_t); static int wpi_resume(device_t); - static device_method_t wpi_methods[] = { /* Device interface */ DEVMETHOD(device_probe, wpi_probe), @@ -263,7 +262,7 @@ static device_method_t wpi_methods[] = { DEVMETHOD(device_suspend, wpi_suspend), DEVMETHOD(device_resume, wpi_resume), - { 0, 0 } + DEVMETHOD_END }; static driver_t wpi_driver = { @@ -274,7 +273,7 @@ static driver_t wpi_driver = { static devclass_t wpi_devclass; -DRIVER_MODULE(wpi, pci, wpi_driver, wpi_devclass, 0, 0); +DRIVER_MODULE(wpi, pci, wpi_driver, wpi_devclass, NULL, NULL); MODULE_VERSION(wpi, 1); @@ -285,12 +284,12 @@ static const uint8_t wpi_ridx_to_plcp[] /* CCK: device-dependent */ 10, 20, 55, 110 }; + static const uint8_t wpi_ridx_to_rate[] = { 12, 18, 24, 36, 48, 72, 96, 108, /* OFDM */ 2, 4, 11, 22 /*CCK */ }; - static int wpi_probe(device_t dev) { @@ -300,7 +299,7 @@ wpi_probe(device_t dev) if (pci_get_vendor(dev) == ident->vendor && pci_get_device(dev) == ident->device) { device_set_desc(dev, ident->name); - return 0; + return (BUS_PROBE_DEFAULT); } } return ENXIO; @@ -493,7 +492,7 @@ wpi_attach(device_t dev) struct wpi_softc *sc = device_get_softc(dev); struct ifnet *ifp; struct ieee80211com *ic; - int ac, error, supportsa = 1; + int ac, error, rid, supportsa = 1; uint32_t tmp; const struct wpi_ident *ident; uint8_t macaddr[IEEE80211_ADDR_LEN]; @@ -525,20 +524,14 @@ wpi_attach(device_t dev) callout_init_mtx(&sc->calib_to, &sc->sc_mtx, 0); callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0); - if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { - device_printf(dev, "chip is in D%d power mode " - "-- setting to D0\n", pci_get_powerstate(dev)); - pci_set_powerstate(dev, PCI_POWERSTATE_D0); - } - /* disable the retry timeout register */ pci_write_config(dev, 0x41, 0, 1); /* enable bus-mastering */ pci_enable_busmaster(dev); - sc->mem_rid = PCIR_BAR(0); - sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, + rid = PCIR_BAR(0); + sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->mem == NULL) { device_printf(dev, "could not allocate memory resource\n"); @@ -549,8 +542,8 @@ wpi_attach(device_t dev) sc->sc_st = rman_get_bustag(sc->mem); sc->sc_sh = rman_get_bushandle(sc->mem); - sc->irq_rid = 0; - sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, + rid = 0; + sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | RF_SHAREABLE); if (sc->irq == NULL) { device_printf(dev, "could not allocate interrupt resource\n"); @@ -717,6 +710,9 @@ wpi_detach(device_t dev) struct ieee80211com *ic; int ac; + if (sc->irq != NULL) + bus_teardown_intr(dev, sc->irq, sc->sc_ih); + if (ifp != NULL) { ic = ifp->if_l2com; @@ -746,13 +742,12 @@ wpi_detach(device_t dev) wpi_free_fwmem(sc); WPI_UNLOCK(sc); - if (sc->irq != NULL) { - bus_teardown_intr(dev, sc->irq, sc->sc_ih); - bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq); - } - + if (sc->irq != NULL) + bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq), + sc->irq); if (sc->mem != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, sc->mem); + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->mem), sc->mem); if (ifp != NULL) if_free(ifp); @@ -3192,7 +3187,6 @@ wpi_stop_locked(struct wpi_softc *sc) callout_stop(&sc->watchdog_to); callout_stop(&sc->calib_to); - /* disable interrupts */ WPI_WRITE(sc, WPI_MASK, 0); WPI_WRITE(sc, WPI_INTR, WPI_INTR_MASK); Modified: head/sys/dev/wpi/if_wpivar.h ============================================================================== --- head/sys/dev/wpi/if_wpivar.h Sun Dec 29 23:05:01 2013 (r260063) +++ head/sys/dev/wpi/if_wpivar.h Sun Dec 29 23:46:59 2013 (r260064) @@ -162,8 +162,6 @@ struct wpi_softc { bus_space_tag_t sc_st; bus_space_handle_t sc_sh; void *sc_ih; - int mem_rid; - int irq_rid; struct wpi_config config; int temp; From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 00:51:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2FA89B3E; Mon, 30 Dec 2013 00:51:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1882A164E; Mon, 30 Dec 2013 00:51:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBU0pQeN053152; Mon, 30 Dec 2013 00:51:26 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBU0pPbh053148; Mon, 30 Dec 2013 00:51:25 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201312300051.rBU0pPbh053148@svn.freebsd.org> From: Steve Kargl Date: Mon, 30 Dec 2013 00:51:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260066 - in head/lib/msun: ld128 ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 00:51:26 -0000 Author: kargl Date: Mon Dec 30 00:51:25 2013 New Revision: 260066 URL: http://svnweb.freebsd.org/changeset/base/260066 Log: * ld80/k_expl.h: * ld128/k_expl.h: . Split out a computational kernel,__k_expl(x, &hi, &lo, &k) from expl(x). x must be finite and not tiny or huge. The kernel returns hi and lo values for extra precision and an exponent k for a 2**k scale factor. . Define additional kernels k_hexpl() and hexpl() that include a 1/2 scaling and are used by the hyperbolic functions. * ld80/s_expl.c: * ld128/s_expl.c: . Use the __k_expl() kernel. Obtained from: bde Added: head/lib/msun/ld128/k_expl.h (contents, props changed) head/lib/msun/ld80/k_expl.h (contents, props changed) Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Added: head/lib/msun/ld128/k_expl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/ld128/k_expl.h Mon Dec 30 00:51:25 2013 (r260066) @@ -0,0 +1,328 @@ +/* from: FreeBSD: head/lib/msun/ld128/s_expl.c 251345 2013-06-03 20:09:22Z kargl */ + +/*- + * Copyright (c) 2009-2013 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Optimized by Bruce D. Evans. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * ld128 version of k_expl.h. See ../ld80/s_expl.c for most comments. + * + * See ../src/e_exp.c and ../src/k_exp.h for precision-independent comments + * about the secondary kernels. + */ + +#define INTERVALS 128 +#define LOG2_INTERVALS 7 +#define BIAS (LDBL_MAX_EXP - 1) + +static const double +/* + * ln2/INTERVALS = L1+L2 (hi+lo decomposition for multiplication). L1 must + * have at least 22 (= log2(|LDBL_MIN_EXP-extras|) + log2(INTERVALS)) lowest + * bits zero so that multiplication of it by n is exact. + */ +INV_L = 1.8466496523378731e+2, /* 0x171547652b82fe.0p-45 */ +L2 = -1.0253670638894731e-29; /* -0x1.9ff0342542fc3p-97 */ +static const long double +/* 0x1.62e42fefa39ef35793c768000000p-8 */ +L1 = 5.41521234812457272982212595914567508e-3L; + +/* + * XXX values in hex in comments have been lost (or were never present) + * from here. + */ +static const long double +/* + * Domain [-0.002708, 0.002708], range ~[-2.4021e-38, 2.4234e-38]: + * |exp(x) - p(x)| < 2**-124.9 + * (0.002708 is ln2/(2*INTERVALS) rounded up a little). + * + * XXX the coeffs aren't very carefully rounded, and I get 3.6 more bits. + */ +A2 = 0.5, +A3 = 1.66666666666666666666666666651085500e-1L, +A4 = 4.16666666666666666666666666425885320e-2L, +A5 = 8.33333333333333333334522877160175842e-3L, +A6 = 1.38888888888888888889971139751596836e-3L; + +static const double +A7 = 1.9841269841269470e-4, /* 0x1.a01a01a019f91p-13 */ +A8 = 2.4801587301585286e-5, /* 0x1.71de3ec75a967p-19 */ +A9 = 2.7557324277411235e-6, /* 0x1.71de3ec75a967p-19 */ +A10 = 2.7557333722375069e-7; /* 0x1.27e505ab56259p-22 */ + +static const struct { + /* + * hi must be rounded to at most 106 bits so that multiplication + * by r1 in expm1l() is exact, but it is rounded to 88 bits due to + * historical accidents. + * + * XXX it is wasteful to use long double for both hi and lo. ld128 + * exp2l() uses only float for lo (in a very differently organized + * table; ld80 exp2l() is different again. It uses 2 doubles in a + * table organized like this one. 1 double and 1 float would + * suffice). There are different packing/locality/alignment/caching + * problems with these methods. + * + * XXX C's bad %a format makes the bits unreadable. They happen + * to all line up for the hi values 1 before the point and 88 + * in 22 nybbles, but for the low values the nybbles are shifted + * randomly. + */ + long double hi; + long double lo; +} tbl[INTERVALS] = { + 0x1p0L, 0x0p0L, + 0x1.0163da9fb33356d84a66aep0L, 0x3.36dcdfa4003ec04c360be2404078p-92L, + 0x1.02c9a3e778060ee6f7cacap0L, 0x4.f7a29bde93d70a2cabc5cb89ba10p-92L, + 0x1.04315e86e7f84bd738f9a2p0L, 0xd.a47e6ed040bb4bfc05af6455e9b8p-96L, + 0x1.059b0d31585743ae7c548ep0L, 0xb.68ca417fe53e3495f7df4baf84a0p-92L, + 0x1.0706b29ddf6ddc6dc403a8p0L, 0x1.d87b27ed07cb8b092ac75e311753p-88L, + 0x1.0874518759bc808c35f25cp0L, 0x1.9427fa2b041b2d6829d8993a0d01p-88L, + 0x1.09e3ecac6f3834521e060cp0L, 0x5.84d6b74ba2e023da730e7fccb758p-92L, + 0x1.0b5586cf9890f6298b92b6p0L, 0x1.1842a98364291408b3ceb0a2a2bbp-88L, + 0x1.0cc922b7247f7407b705b8p0L, 0x9.3dc5e8aac564e6fe2ef1d431fd98p-92L, + 0x1.0e3ec32d3d1a2020742e4ep0L, 0x1.8af6a552ac4b358b1129e9f966a4p-88L, + 0x1.0fb66affed31af232091dcp0L, 0x1.8a1426514e0b627bda694a400a27p-88L, + 0x1.11301d0125b50a4ebbf1aep0L, 0xd.9318ceac5cc47ab166ee57427178p-92L, + 0x1.12abdc06c31cbfb92bad32p0L, 0x4.d68e2f7270bdf7cedf94eb1cb818p-92L, + 0x1.1429aaea92ddfb34101942p0L, 0x1.b2586d01844b389bea7aedd221d4p-88L, + 0x1.15a98c8a58e512480d573cp0L, 0x1.d5613bf92a2b618ee31b376c2689p-88L, + 0x1.172b83c7d517adcdf7c8c4p0L, 0x1.0eb14a792035509ff7d758693f24p-88L, + 0x1.18af9388c8de9bbbf70b9ap0L, 0x3.c2505c97c0102e5f1211941d2840p-92L, + 0x1.1a35beb6fcb753cb698f68p0L, 0x1.2d1c835a6c30724d5cfae31b84e5p-88L, + 0x1.1bbe084045cd39ab1e72b4p0L, 0x4.27e35f9acb57e473915519a1b448p-92L, + 0x1.1d4873168b9aa7805b8028p0L, 0x9.90f07a98b42206e46166cf051d70p-92L, + 0x1.1ed5022fcd91cb8819ff60p0L, 0x1.121d1e504d36c47474c9b7de6067p-88L, + 0x1.2063b88628cd63b8eeb028p0L, 0x1.50929d0fc487d21c2b84004264dep-88L, + 0x1.21f49917ddc962552fd292p0L, 0x9.4bdb4b61ea62477caa1dce823ba0p-92L, + 0x1.2387a6e75623866c1fadb0p0L, 0x1.c15cb593b0328566902df69e4de2p-88L, + 0x1.251ce4fb2a63f3582ab7dep0L, 0x9.e94811a9c8afdcf796934bc652d0p-92L, + 0x1.26b4565e27cdd257a67328p0L, 0x1.d3b249dce4e9186ddd5ff44e6b08p-92L, + 0x1.284dfe1f5638096cf15cf0p0L, 0x3.ca0967fdaa2e52d7c8106f2e262cp-92L, + 0x1.29e9df51fdee12c25d15f4p0L, 0x1.a24aa3bca890ac08d203fed80a07p-88L, + 0x1.2b87fd0dad98ffddea4652p0L, 0x1.8fcab88442fdc3cb6de4519165edp-88L, + 0x1.2d285a6e4030b40091d536p0L, 0xd.075384589c1cd1b3e4018a6b1348p-92L, + 0x1.2ecafa93e2f5611ca0f45cp0L, 0x1.523833af611bdcda253c554cf278p-88L, + 0x1.306fe0a31b7152de8d5a46p0L, 0x3.05c85edecbc27343629f502f1af2p-92L, + 0x1.32170fc4cd8313539cf1c2p0L, 0x1.008f86dde3220ae17a005b6412bep-88L, + 0x1.33c08b26416ff4c9c8610cp0L, 0x1.96696bf95d1593039539d94d662bp-88L, + 0x1.356c55f929ff0c94623476p0L, 0x3.73af38d6d8d6f9506c9bbc93cbc0p-92L, + 0x1.371a7373aa9caa7145502ep0L, 0x1.4547987e3e12516bf9c699be432fp-88L, + 0x1.38cae6d05d86585a9cb0d8p0L, 0x1.bed0c853bd30a02790931eb2e8f0p-88L, + 0x1.3a7db34e59ff6ea1bc9298p0L, 0x1.e0a1d336163fe2f852ceeb134067p-88L, + 0x1.3c32dc313a8e484001f228p0L, 0xb.58f3775e06ab66353001fae9fca0p-92L, + 0x1.3dea64c12342235b41223ep0L, 0x1.3d773fba2cb82b8244267c54443fp-92L, + 0x1.3fa4504ac801ba0bf701aap0L, 0x4.1832fb8c1c8dbdff2c49909e6c60p-92L, + 0x1.4160a21f72e29f84325b8ep0L, 0x1.3db61fb352f0540e6ba05634413ep-88L, + 0x1.431f5d950a896dc7044394p0L, 0x1.0ccec81e24b0caff7581ef4127f7p-92L, + 0x1.44e086061892d03136f408p0L, 0x1.df019fbd4f3b48709b78591d5cb5p-88L, + 0x1.46a41ed1d005772512f458p0L, 0x1.229d97df404ff21f39c1b594d3a8p-88L, + 0x1.486a2b5c13cd013c1a3b68p0L, 0x1.062f03c3dd75ce8757f780e6ec99p-88L, + 0x1.4a32af0d7d3de672d8bcf4p0L, 0x6.f9586461db1d878b1d148bd3ccb8p-92L, + 0x1.4bfdad5362a271d4397afep0L, 0xc.42e20e0363ba2e159c579f82e4b0p-92L, + 0x1.4dcb299fddd0d63b36ef1ap0L, 0x9.e0cc484b25a5566d0bd5f58ad238p-92L, + 0x1.4f9b2769d2ca6ad33d8b68p0L, 0x1.aa073ee55e028497a329a7333dbap-88L, + 0x1.516daa2cf6641c112f52c8p0L, 0x4.d822190e718226177d7608d20038p-92L, + 0x1.5342b569d4f81df0a83c48p0L, 0x1.d86a63f4e672a3e429805b049465p-88L, + 0x1.551a4ca5d920ec52ec6202p0L, 0x4.34ca672645dc6c124d6619a87574p-92L, + 0x1.56f4736b527da66ecb0046p0L, 0x1.64eb3c00f2f5ab3d801d7cc7272dp-88L, + 0x1.58d12d497c7fd252bc2b72p0L, 0x1.43bcf2ec936a970d9cc266f0072fp-88L, + 0x1.5ab07dd48542958c930150p0L, 0x1.91eb345d88d7c81280e069fbdb63p-88L, + 0x1.5c9268a5946b701c4b1b80p0L, 0x1.6986a203d84e6a4a92f179e71889p-88L, + 0x1.5e76f15ad21486e9be4c20p0L, 0x3.99766a06548a05829e853bdb2b52p-92L, + 0x1.605e1b976dc08b076f592ap0L, 0x4.86e3b34ead1b4769df867b9c89ccp-92L, + 0x1.6247eb03a5584b1f0fa06ep0L, 0x1.d2da42bb1ceaf9f732275b8aef30p-88L, + 0x1.6434634ccc31fc76f8714cp0L, 0x4.ed9a4e41000307103a18cf7a6e08p-92L, + 0x1.66238825522249127d9e28p0L, 0x1.b8f314a337f4dc0a3adf1787ff74p-88L, + 0x1.68155d44ca973081c57226p0L, 0x1.b9f32706bfe4e627d809a85dcc66p-88L, + 0x1.6a09e667f3bcc908b2fb12p0L, 0x1.66ea957d3e3adec17512775099dap-88L, + 0x1.6c012750bdabeed76a9980p0L, 0xf.4f33fdeb8b0ecd831106f57b3d00p-96L, + 0x1.6dfb23c651a2ef220e2cbep0L, 0x1.bbaa834b3f11577ceefbe6c1c411p-92L, + 0x1.6ff7df9519483cf87e1b4ep0L, 0x1.3e213bff9b702d5aa477c12523cep-88L, + 0x1.71f75e8ec5f73dd2370f2ep0L, 0xf.0acd6cb434b562d9e8a20adda648p-92L, + 0x1.73f9a48a58173bd5c9a4e6p0L, 0x8.ab1182ae217f3a7681759553e840p-92L, + 0x1.75feb564267c8bf6e9aa32p0L, 0x1.a48b27071805e61a17b954a2dad8p-88L, + 0x1.780694fde5d3f619ae0280p0L, 0x8.58b2bb2bdcf86cd08e35fb04c0f0p-92L, + 0x1.7a11473eb0186d7d51023ep0L, 0x1.6cda1f5ef42b66977960531e821bp-88L, + 0x1.7c1ed0130c1327c4933444p0L, 0x1.937562b2dc933d44fc828efd4c9cp-88L, + 0x1.7e2f336cf4e62105d02ba0p0L, 0x1.5797e170a1427f8fcdf5f3906108p-88L, + 0x1.80427543e1a11b60de6764p0L, 0x9.a354ea706b8e4d8b718a672bf7c8p-92L, + 0x1.82589994cce128acf88afap0L, 0xb.34a010f6ad65cbbac0f532d39be0p-92L, + 0x1.8471a4623c7acce52f6b96p0L, 0x1.c64095370f51f48817914dd78665p-88L, + 0x1.868d99b4492ec80e41d90ap0L, 0xc.251707484d73f136fb5779656b70p-92L, + 0x1.88ac7d98a669966530bcdep0L, 0x1.2d4e9d61283ef385de170ab20f96p-88L, + 0x1.8ace5422aa0db5ba7c55a0p0L, 0x1.92c9bb3e6ed61f2733304a346d8fp-88L, + 0x1.8cf3216b5448bef2aa1cd0p0L, 0x1.61c55d84a9848f8c453b3ca8c946p-88L, + 0x1.8f1ae991577362b982745cp0L, 0x7.2ed804efc9b4ae1458ae946099d4p-92L, + 0x1.9145b0b91ffc588a61b468p0L, 0x1.f6b70e01c2a90229a4c4309ea719p-88L, + 0x1.93737b0cdc5e4f4501c3f2p0L, 0x5.40a22d2fc4af581b63e8326efe9cp-92L, + 0x1.95a44cbc8520ee9b483694p0L, 0x1.a0fc6f7c7d61b2b3a22a0eab2cadp-88L, + 0x1.97d829fde4e4f8b9e920f8p0L, 0x1.1e8bd7edb9d7144b6f6818084cc7p-88L, + 0x1.9a0f170ca07b9ba3109b8cp0L, 0x4.6737beb19e1eada6825d3c557428p-92L, + 0x1.9c49182a3f0901c7c46b06p0L, 0x1.1f2be58ddade50c217186c90b457p-88L, + 0x1.9e86319e323231824ca78ep0L, 0x6.4c6e010f92c082bbadfaf605cfd4p-92L, + 0x1.a0c667b5de564b29ada8b8p0L, 0xc.ab349aa0422a8da7d4512edac548p-92L, + 0x1.a309bec4a2d3358c171f76p0L, 0x1.0daad547fa22c26d168ea762d854p-88L, + 0x1.a5503b23e255c8b424491cp0L, 0xa.f87bc8050a405381703ef7caff50p-92L, + 0x1.a799e1330b3586f2dfb2b0p0L, 0x1.58f1a98796ce8908ae852236ca94p-88L, + 0x1.a9e6b5579fdbf43eb243bcp0L, 0x1.ff4c4c58b571cf465caf07b4b9f5p-88L, + 0x1.ac36bbfd3f379c0db966a2p0L, 0x1.1265fc73e480712d20f8597a8e7bp-88L, + 0x1.ae89f995ad3ad5e8734d16p0L, 0x1.73205a7fbc3ae675ea440b162d6cp-88L, + 0x1.b0e07298db66590842acdep0L, 0x1.c6f6ca0e5dcae2aafffa7a0554cbp-88L, + 0x1.b33a2b84f15faf6bfd0e7ap0L, 0x1.d947c2575781dbb49b1237c87b6ep-88L, + 0x1.b59728de559398e3881110p0L, 0x1.64873c7171fefc410416be0a6525p-88L, + 0x1.b7f76f2fb5e46eaa7b081ap0L, 0xb.53c5354c8903c356e4b625aacc28p-92L, + 0x1.ba5b030a10649840cb3c6ap0L, 0xf.5b47f297203757e1cc6eadc8bad0p-92L, + 0x1.bcc1e904bc1d2247ba0f44p0L, 0x1.b3d08cd0b20287092bd59be4ad98p-88L, + 0x1.bf2c25bd71e088408d7024p0L, 0x1.18e3449fa073b356766dfb568ff4p-88L, + 0x1.c199bdd85529c2220cb12ap0L, 0x9.1ba6679444964a36661240043970p-96L, + 0x1.c40ab5fffd07a6d14df820p0L, 0xf.1828a5366fd387a7bdd54cdf7300p-92L, + 0x1.c67f12e57d14b4a2137fd2p0L, 0xf.2b301dd9e6b151a6d1f9d5d5f520p-96L, + 0x1.c8f6d9406e7b511acbc488p0L, 0x5.c442ddb55820171f319d9e5076a8p-96L, + 0x1.cb720dcef90691503cbd1ep0L, 0x9.49db761d9559ac0cb6dd3ed599e0p-92L, + 0x1.cdf0b555dc3f9c44f8958ep0L, 0x1.ac51be515f8c58bdfb6f5740a3a4p-88L, + 0x1.d072d4a07897b8d0f22f20p0L, 0x1.a158e18fbbfc625f09f4cca40874p-88L, + 0x1.d2f87080d89f18ade12398p0L, 0x9.ea2025b4c56553f5cdee4c924728p-92L, + 0x1.d5818dcfba48725da05aeap0L, 0x1.66e0dca9f589f559c0876ff23830p-88L, + 0x1.d80e316c98397bb84f9d04p0L, 0x8.805f84bec614de269900ddf98d28p-92L, + 0x1.da9e603db3285708c01a5ap0L, 0x1.6d4c97f6246f0ec614ec95c99392p-88L, + 0x1.dd321f301b4604b695de3cp0L, 0x6.30a393215299e30d4fb73503c348p-96L, + 0x1.dfc97337b9b5eb968cac38p0L, 0x1.ed291b7225a944efd5bb5524b927p-88L, + 0x1.e264614f5a128a12761fa0p0L, 0x1.7ada6467e77f73bf65e04c95e29dp-88L, + 0x1.e502ee78b3ff6273d13014p0L, 0x1.3991e8f49659e1693be17ae1d2f9p-88L, + 0x1.e7a51fbc74c834b548b282p0L, 0x1.23786758a84f4956354634a416cep-88L, + 0x1.ea4afa2a490d9858f73a18p0L, 0xf.5db301f86dea20610ceee13eb7b8p-92L, + 0x1.ecf482d8e67f08db0312fap0L, 0x1.949cef462010bb4bc4ce72a900dfp-88L, + 0x1.efa1bee615a27771fd21a8p0L, 0x1.2dac1f6dd5d229ff68e46f27e3dfp-88L, + 0x1.f252b376bba974e8696fc2p0L, 0x1.6390d4c6ad5476b5162f40e1d9a9p-88L, + 0x1.f50765b6e4540674f84b76p0L, 0x2.862baff99000dfc4352ba29b8908p-92L, + 0x1.f7bfdad9cbe138913b4bfep0L, 0x7.2bd95c5ce7280fa4d2344a3f5618p-92L, + 0x1.fa7c1819e90d82e90a7e74p0L, 0xb.263c1dc060c36f7650b4c0f233a8p-92L, + 0x1.fd3c22b8f71f10975ba4b2p0L, 0x1.2bcf3a5e12d269d8ad7c1a4a8875p-88L +}; + +/* + * Kernel for expl(x). x must be finite and not tiny or huge. + * "tiny" is anything that would make us underflow (|A6*x^6| < ~LDBL_MIN). + * "huge" is anything that would make fn*L1 inexact (|x| > ~2**17*ln2). + */ +static inline void +__k_expl(long double x, long double *hip, long double *lop, int *kp) +{ + long double q, r, r1, t; + double dr, fn, r2; + int n, n2; + + /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ + /* Use a specialized rint() to get fn. Assume round-to-nearest. */ + /* XXX assume no extra precision for the additions, as for trig fns. */ + /* XXX this set of comments is now quadruplicated. */ + /* XXX but see ../src/e_exp.c for a fix using double_t. */ + fn = (double)x * INV_L + 0x1.8p52 - 0x1.8p52; +#if defined(HAVE_EFFICIENT_IRINT) + n = irint(fn); +#else + n = (int)fn; +#endif + n2 = (unsigned)n % INTERVALS; + /* Depend on the sign bit being propagated: */ + *kp = n >> LOG2_INTERVALS; + r1 = x - fn * L1; + r2 = fn * -L2; + r = r1 + r2; + + /* Evaluate expl(endpoint[n2] + r1 + r2) = tbl[n2] * expl(r1 + r2). */ + dr = r; + q = r2 + r * r * (A2 + r * (A3 + r * (A4 + r * (A5 + r * (A6 + + dr * (A7 + dr * (A8 + dr * (A9 + dr * A10)))))))); + t = tbl[n2].lo + tbl[n2].hi; + *hip = tbl[n2].hi; + *lop = tbl[n2].lo + t * (q + r1); +} + +/* + * XXX: the rest of the functions are identical for ld80 and ld128. + * However, we should use scalbnl() for ld128, since long double + * multiplication is very slow on the only supported ld128 arch (sparc64). + */ + +static inline void +k_hexpl(long double x, long double *hip, long double *lop) +{ + float twopkm1; + int k; + + __k_expl(x, hip, lop, &k); + SET_FLOAT_WORD(twopkm1, 0x3f800000 + ((k - 1) << 23)); + *hip *= twopkm1; + *lop *= twopkm1; +} + +static inline long double +hexpl(long double x) +{ + long double hi, lo, twopkm2; + int k; + + twopkm2 = 1; + __k_expl(x, &hi, &lo, &k); + SET_LDBL_EXPSIGN(twopkm2, BIAS + k - 2); + return (lo + hi) * 2 * twopkm2; +} + +#ifdef _COMPLEX_H +/* + * See ../src/k_exp.c for details. + */ +static inline long double complex +__ldexp_cexpl(long double complex z, int expt) +{ + long double exp_x, hi, lo; + long double x, y, scale1, scale2; + int half_expt, k; + + x = creall(z); + y = cimagl(z); + __k_expl(x, &hi, &lo, &k); + + exp_x = (lo + hi) * 0x1p16382; + expt += k - 16382; + + scale1 = 1; + half_expt = expt / 2; + SET_LDBL_EXPSIGN(scale1, BIAS + half_expt); + scale2 = 1; + SET_LDBL_EXPSIGN(scale1, BIAS + expt - half_expt); + + return (cpackl(cos(y) * exp_x * scale1 * scale2, + sinl(y) * exp_x * scale1 * scale2)); +} +#endif /* _COMPLEX_H */ Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Dec 30 00:43:24 2013 (r260065) +++ head/lib/msun/ld128/s_expl.c Mon Dec 30 00:51:25 2013 (r260066) @@ -38,16 +38,15 @@ __FBSDID("$FreeBSD$"); #include "fpmath.h" #include "math.h" #include "math_private.h" +#include "k_expl.h" -#define INTERVALS 128 -#define LOG2_INTERVALS 7 -#define BIAS (LDBL_MAX_EXP - 1) +/* XXX Prevent compilers from erroneously constant folding these: */ +static const volatile long double +huge = 0x1p10000L, +tiny = 0x1p-10000L; static const long double -huge = 0x1p10000L, twom10000 = 0x1p-10000L; -/* XXX Prevent gcc from erroneously constant folding this: */ -static volatile const long double tiny = 0x1p-10000L; static const long double /* log(2**16384 - 0.5) rounded towards zero: */ @@ -56,184 +55,16 @@ o_threshold = 11356.5234062941439494919 /* log(2**(-16381-64-1)) rounded towards zero: */ u_threshold = -11433.462743336297878837243843452621503L; -static const double -/* - * ln2/INTERVALS = L1+L2 (hi+lo decomposition for multiplication). L1 must - * have at least 22 (= log2(|LDBL_MIN_EXP-extras|) + log2(INTERVALS)) lowest - * bits zero so that multiplication of it by n is exact. - */ -INV_L = 1.8466496523378731e+2, /* 0x171547652b82fe.0p-45 */ -L2 = -1.0253670638894731e-29; /* -0x1.9ff0342542fc3p-97 */ -static const long double -/* 0x1.62e42fefa39ef35793c768000000p-8 */ -L1 = 5.41521234812457272982212595914567508e-3L; - -static const long double -/* - * Domain [-0.002708, 0.002708], range ~[-2.4021e-38, 2.4234e-38]: - * |exp(x) - p(x)| < 2**-124.9 - * (0.002708 is ln2/(2*INTERVALS) rounded up a little). - */ -A2 = 0.5, -A3 = 1.66666666666666666666666666651085500e-1L, -A4 = 4.16666666666666666666666666425885320e-2L, -A5 = 8.33333333333333333334522877160175842e-3L, -A6 = 1.38888888888888888889971139751596836e-3L; - -static const double -A7 = 1.9841269841269471e-4, -A8 = 2.4801587301585284e-5, -A9 = 2.7557324277411234e-6, -A10 = 2.7557333722375072e-7; - -static const struct { - /* - * hi must be rounded to at most 106 bits so that multiplication - * by r1 in expm1l() is exact, but it is rounded to 88 bits due to - * historical accidents. - */ - long double hi; - long double lo; -} tbl[INTERVALS] = { - 0x1p0L, 0x0p0L, - 0x1.0163da9fb33356d84a66aep0L, 0x3.36dcdfa4003ec04c360be2404078p-92L, - 0x1.02c9a3e778060ee6f7cacap0L, 0x4.f7a29bde93d70a2cabc5cb89ba10p-92L, - 0x1.04315e86e7f84bd738f9a2p0L, 0xd.a47e6ed040bb4bfc05af6455e9b8p-96L, - 0x1.059b0d31585743ae7c548ep0L, 0xb.68ca417fe53e3495f7df4baf84a0p-92L, - 0x1.0706b29ddf6ddc6dc403a8p0L, 0x1.d87b27ed07cb8b092ac75e311753p-88L, - 0x1.0874518759bc808c35f25cp0L, 0x1.9427fa2b041b2d6829d8993a0d01p-88L, - 0x1.09e3ecac6f3834521e060cp0L, 0x5.84d6b74ba2e023da730e7fccb758p-92L, - 0x1.0b5586cf9890f6298b92b6p0L, 0x1.1842a98364291408b3ceb0a2a2bbp-88L, - 0x1.0cc922b7247f7407b705b8p0L, 0x9.3dc5e8aac564e6fe2ef1d431fd98p-92L, - 0x1.0e3ec32d3d1a2020742e4ep0L, 0x1.8af6a552ac4b358b1129e9f966a4p-88L, - 0x1.0fb66affed31af232091dcp0L, 0x1.8a1426514e0b627bda694a400a27p-88L, - 0x1.11301d0125b50a4ebbf1aep0L, 0xd.9318ceac5cc47ab166ee57427178p-92L, - 0x1.12abdc06c31cbfb92bad32p0L, 0x4.d68e2f7270bdf7cedf94eb1cb818p-92L, - 0x1.1429aaea92ddfb34101942p0L, 0x1.b2586d01844b389bea7aedd221d4p-88L, - 0x1.15a98c8a58e512480d573cp0L, 0x1.d5613bf92a2b618ee31b376c2689p-88L, - 0x1.172b83c7d517adcdf7c8c4p0L, 0x1.0eb14a792035509ff7d758693f24p-88L, - 0x1.18af9388c8de9bbbf70b9ap0L, 0x3.c2505c97c0102e5f1211941d2840p-92L, - 0x1.1a35beb6fcb753cb698f68p0L, 0x1.2d1c835a6c30724d5cfae31b84e5p-88L, - 0x1.1bbe084045cd39ab1e72b4p0L, 0x4.27e35f9acb57e473915519a1b448p-92L, - 0x1.1d4873168b9aa7805b8028p0L, 0x9.90f07a98b42206e46166cf051d70p-92L, - 0x1.1ed5022fcd91cb8819ff60p0L, 0x1.121d1e504d36c47474c9b7de6067p-88L, - 0x1.2063b88628cd63b8eeb028p0L, 0x1.50929d0fc487d21c2b84004264dep-88L, - 0x1.21f49917ddc962552fd292p0L, 0x9.4bdb4b61ea62477caa1dce823ba0p-92L, - 0x1.2387a6e75623866c1fadb0p0L, 0x1.c15cb593b0328566902df69e4de2p-88L, - 0x1.251ce4fb2a63f3582ab7dep0L, 0x9.e94811a9c8afdcf796934bc652d0p-92L, - 0x1.26b4565e27cdd257a67328p0L, 0x1.d3b249dce4e9186ddd5ff44e6b08p-92L, - 0x1.284dfe1f5638096cf15cf0p0L, 0x3.ca0967fdaa2e52d7c8106f2e262cp-92L, - 0x1.29e9df51fdee12c25d15f4p0L, 0x1.a24aa3bca890ac08d203fed80a07p-88L, - 0x1.2b87fd0dad98ffddea4652p0L, 0x1.8fcab88442fdc3cb6de4519165edp-88L, - 0x1.2d285a6e4030b40091d536p0L, 0xd.075384589c1cd1b3e4018a6b1348p-92L, - 0x1.2ecafa93e2f5611ca0f45cp0L, 0x1.523833af611bdcda253c554cf278p-88L, - 0x1.306fe0a31b7152de8d5a46p0L, 0x3.05c85edecbc27343629f502f1af2p-92L, - 0x1.32170fc4cd8313539cf1c2p0L, 0x1.008f86dde3220ae17a005b6412bep-88L, - 0x1.33c08b26416ff4c9c8610cp0L, 0x1.96696bf95d1593039539d94d662bp-88L, - 0x1.356c55f929ff0c94623476p0L, 0x3.73af38d6d8d6f9506c9bbc93cbc0p-92L, - 0x1.371a7373aa9caa7145502ep0L, 0x1.4547987e3e12516bf9c699be432fp-88L, - 0x1.38cae6d05d86585a9cb0d8p0L, 0x1.bed0c853bd30a02790931eb2e8f0p-88L, - 0x1.3a7db34e59ff6ea1bc9298p0L, 0x1.e0a1d336163fe2f852ceeb134067p-88L, - 0x1.3c32dc313a8e484001f228p0L, 0xb.58f3775e06ab66353001fae9fca0p-92L, - 0x1.3dea64c12342235b41223ep0L, 0x1.3d773fba2cb82b8244267c54443fp-92L, - 0x1.3fa4504ac801ba0bf701aap0L, 0x4.1832fb8c1c8dbdff2c49909e6c60p-92L, - 0x1.4160a21f72e29f84325b8ep0L, 0x1.3db61fb352f0540e6ba05634413ep-88L, - 0x1.431f5d950a896dc7044394p0L, 0x1.0ccec81e24b0caff7581ef4127f7p-92L, - 0x1.44e086061892d03136f408p0L, 0x1.df019fbd4f3b48709b78591d5cb5p-88L, - 0x1.46a41ed1d005772512f458p0L, 0x1.229d97df404ff21f39c1b594d3a8p-88L, - 0x1.486a2b5c13cd013c1a3b68p0L, 0x1.062f03c3dd75ce8757f780e6ec99p-88L, - 0x1.4a32af0d7d3de672d8bcf4p0L, 0x6.f9586461db1d878b1d148bd3ccb8p-92L, - 0x1.4bfdad5362a271d4397afep0L, 0xc.42e20e0363ba2e159c579f82e4b0p-92L, - 0x1.4dcb299fddd0d63b36ef1ap0L, 0x9.e0cc484b25a5566d0bd5f58ad238p-92L, - 0x1.4f9b2769d2ca6ad33d8b68p0L, 0x1.aa073ee55e028497a329a7333dbap-88L, - 0x1.516daa2cf6641c112f52c8p0L, 0x4.d822190e718226177d7608d20038p-92L, - 0x1.5342b569d4f81df0a83c48p0L, 0x1.d86a63f4e672a3e429805b049465p-88L, - 0x1.551a4ca5d920ec52ec6202p0L, 0x4.34ca672645dc6c124d6619a87574p-92L, - 0x1.56f4736b527da66ecb0046p0L, 0x1.64eb3c00f2f5ab3d801d7cc7272dp-88L, - 0x1.58d12d497c7fd252bc2b72p0L, 0x1.43bcf2ec936a970d9cc266f0072fp-88L, - 0x1.5ab07dd48542958c930150p0L, 0x1.91eb345d88d7c81280e069fbdb63p-88L, - 0x1.5c9268a5946b701c4b1b80p0L, 0x1.6986a203d84e6a4a92f179e71889p-88L, - 0x1.5e76f15ad21486e9be4c20p0L, 0x3.99766a06548a05829e853bdb2b52p-92L, - 0x1.605e1b976dc08b076f592ap0L, 0x4.86e3b34ead1b4769df867b9c89ccp-92L, - 0x1.6247eb03a5584b1f0fa06ep0L, 0x1.d2da42bb1ceaf9f732275b8aef30p-88L, - 0x1.6434634ccc31fc76f8714cp0L, 0x4.ed9a4e41000307103a18cf7a6e08p-92L, - 0x1.66238825522249127d9e28p0L, 0x1.b8f314a337f4dc0a3adf1787ff74p-88L, - 0x1.68155d44ca973081c57226p0L, 0x1.b9f32706bfe4e627d809a85dcc66p-88L, - 0x1.6a09e667f3bcc908b2fb12p0L, 0x1.66ea957d3e3adec17512775099dap-88L, - 0x1.6c012750bdabeed76a9980p0L, 0xf.4f33fdeb8b0ecd831106f57b3d00p-96L, - 0x1.6dfb23c651a2ef220e2cbep0L, 0x1.bbaa834b3f11577ceefbe6c1c411p-92L, - 0x1.6ff7df9519483cf87e1b4ep0L, 0x1.3e213bff9b702d5aa477c12523cep-88L, - 0x1.71f75e8ec5f73dd2370f2ep0L, 0xf.0acd6cb434b562d9e8a20adda648p-92L, - 0x1.73f9a48a58173bd5c9a4e6p0L, 0x8.ab1182ae217f3a7681759553e840p-92L, - 0x1.75feb564267c8bf6e9aa32p0L, 0x1.a48b27071805e61a17b954a2dad8p-88L, - 0x1.780694fde5d3f619ae0280p0L, 0x8.58b2bb2bdcf86cd08e35fb04c0f0p-92L, - 0x1.7a11473eb0186d7d51023ep0L, 0x1.6cda1f5ef42b66977960531e821bp-88L, - 0x1.7c1ed0130c1327c4933444p0L, 0x1.937562b2dc933d44fc828efd4c9cp-88L, - 0x1.7e2f336cf4e62105d02ba0p0L, 0x1.5797e170a1427f8fcdf5f3906108p-88L, - 0x1.80427543e1a11b60de6764p0L, 0x9.a354ea706b8e4d8b718a672bf7c8p-92L, - 0x1.82589994cce128acf88afap0L, 0xb.34a010f6ad65cbbac0f532d39be0p-92L, - 0x1.8471a4623c7acce52f6b96p0L, 0x1.c64095370f51f48817914dd78665p-88L, - 0x1.868d99b4492ec80e41d90ap0L, 0xc.251707484d73f136fb5779656b70p-92L, - 0x1.88ac7d98a669966530bcdep0L, 0x1.2d4e9d61283ef385de170ab20f96p-88L, - 0x1.8ace5422aa0db5ba7c55a0p0L, 0x1.92c9bb3e6ed61f2733304a346d8fp-88L, - 0x1.8cf3216b5448bef2aa1cd0p0L, 0x1.61c55d84a9848f8c453b3ca8c946p-88L, - 0x1.8f1ae991577362b982745cp0L, 0x7.2ed804efc9b4ae1458ae946099d4p-92L, - 0x1.9145b0b91ffc588a61b468p0L, 0x1.f6b70e01c2a90229a4c4309ea719p-88L, - 0x1.93737b0cdc5e4f4501c3f2p0L, 0x5.40a22d2fc4af581b63e8326efe9cp-92L, - 0x1.95a44cbc8520ee9b483694p0L, 0x1.a0fc6f7c7d61b2b3a22a0eab2cadp-88L, - 0x1.97d829fde4e4f8b9e920f8p0L, 0x1.1e8bd7edb9d7144b6f6818084cc7p-88L, - 0x1.9a0f170ca07b9ba3109b8cp0L, 0x4.6737beb19e1eada6825d3c557428p-92L, - 0x1.9c49182a3f0901c7c46b06p0L, 0x1.1f2be58ddade50c217186c90b457p-88L, - 0x1.9e86319e323231824ca78ep0L, 0x6.4c6e010f92c082bbadfaf605cfd4p-92L, - 0x1.a0c667b5de564b29ada8b8p0L, 0xc.ab349aa0422a8da7d4512edac548p-92L, - 0x1.a309bec4a2d3358c171f76p0L, 0x1.0daad547fa22c26d168ea762d854p-88L, - 0x1.a5503b23e255c8b424491cp0L, 0xa.f87bc8050a405381703ef7caff50p-92L, - 0x1.a799e1330b3586f2dfb2b0p0L, 0x1.58f1a98796ce8908ae852236ca94p-88L, - 0x1.a9e6b5579fdbf43eb243bcp0L, 0x1.ff4c4c58b571cf465caf07b4b9f5p-88L, - 0x1.ac36bbfd3f379c0db966a2p0L, 0x1.1265fc73e480712d20f8597a8e7bp-88L, - 0x1.ae89f995ad3ad5e8734d16p0L, 0x1.73205a7fbc3ae675ea440b162d6cp-88L, - 0x1.b0e07298db66590842acdep0L, 0x1.c6f6ca0e5dcae2aafffa7a0554cbp-88L, - 0x1.b33a2b84f15faf6bfd0e7ap0L, 0x1.d947c2575781dbb49b1237c87b6ep-88L, - 0x1.b59728de559398e3881110p0L, 0x1.64873c7171fefc410416be0a6525p-88L, - 0x1.b7f76f2fb5e46eaa7b081ap0L, 0xb.53c5354c8903c356e4b625aacc28p-92L, - 0x1.ba5b030a10649840cb3c6ap0L, 0xf.5b47f297203757e1cc6eadc8bad0p-92L, - 0x1.bcc1e904bc1d2247ba0f44p0L, 0x1.b3d08cd0b20287092bd59be4ad98p-88L, - 0x1.bf2c25bd71e088408d7024p0L, 0x1.18e3449fa073b356766dfb568ff4p-88L, - 0x1.c199bdd85529c2220cb12ap0L, 0x9.1ba6679444964a36661240043970p-96L, - 0x1.c40ab5fffd07a6d14df820p0L, 0xf.1828a5366fd387a7bdd54cdf7300p-92L, - 0x1.c67f12e57d14b4a2137fd2p0L, 0xf.2b301dd9e6b151a6d1f9d5d5f520p-96L, - 0x1.c8f6d9406e7b511acbc488p0L, 0x5.c442ddb55820171f319d9e5076a8p-96L, - 0x1.cb720dcef90691503cbd1ep0L, 0x9.49db761d9559ac0cb6dd3ed599e0p-92L, - 0x1.cdf0b555dc3f9c44f8958ep0L, 0x1.ac51be515f8c58bdfb6f5740a3a4p-88L, - 0x1.d072d4a07897b8d0f22f20p0L, 0x1.a158e18fbbfc625f09f4cca40874p-88L, - 0x1.d2f87080d89f18ade12398p0L, 0x9.ea2025b4c56553f5cdee4c924728p-92L, - 0x1.d5818dcfba48725da05aeap0L, 0x1.66e0dca9f589f559c0876ff23830p-88L, - 0x1.d80e316c98397bb84f9d04p0L, 0x8.805f84bec614de269900ddf98d28p-92L, - 0x1.da9e603db3285708c01a5ap0L, 0x1.6d4c97f6246f0ec614ec95c99392p-88L, - 0x1.dd321f301b4604b695de3cp0L, 0x6.30a393215299e30d4fb73503c348p-96L, - 0x1.dfc97337b9b5eb968cac38p0L, 0x1.ed291b7225a944efd5bb5524b927p-88L, - 0x1.e264614f5a128a12761fa0p0L, 0x1.7ada6467e77f73bf65e04c95e29dp-88L, - 0x1.e502ee78b3ff6273d13014p0L, 0x1.3991e8f49659e1693be17ae1d2f9p-88L, - 0x1.e7a51fbc74c834b548b282p0L, 0x1.23786758a84f4956354634a416cep-88L, - 0x1.ea4afa2a490d9858f73a18p0L, 0xf.5db301f86dea20610ceee13eb7b8p-92L, - 0x1.ecf482d8e67f08db0312fap0L, 0x1.949cef462010bb4bc4ce72a900dfp-88L, - 0x1.efa1bee615a27771fd21a8p0L, 0x1.2dac1f6dd5d229ff68e46f27e3dfp-88L, - 0x1.f252b376bba974e8696fc2p0L, 0x1.6390d4c6ad5476b5162f40e1d9a9p-88L, - 0x1.f50765b6e4540674f84b76p0L, 0x2.862baff99000dfc4352ba29b8908p-92L, - 0x1.f7bfdad9cbe138913b4bfep0L, 0x7.2bd95c5ce7280fa4d2344a3f5618p-92L, - 0x1.fa7c1819e90d82e90a7e74p0L, 0xb.263c1dc060c36f7650b4c0f233a8p-92L, - 0x1.fd3c22b8f71f10975ba4b2p0L, 0x1.2bcf3a5e12d269d8ad7c1a4a8875p-88L -}; - long double expl(long double x) { - union IEEEl2bits u, v; - long double q, r, r1, t, twopk, twopkp10000; - double dr, fn, r2; - int k, n, n2; + union IEEEl2bits u; + long double hi, lo, t, twopk; + int k; uint16_t hx, ix; + DOPRINT_START(&x); + /* Filter out exceptional cases. */ u.e = x; hx = u.xbits.expsign; @@ -241,60 +72,33 @@ expl(long double x) if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { if (hx & 0x8000) /* x is -Inf or -NaN */ - return (-1 / x); - return (x + x); /* x is +Inf or +NaN */ + RETURNP(-1 / x); + RETURNP(x + x); /* x is +Inf or +NaN */ } if (x > o_threshold) - return (huge * huge); + RETURNP(huge * huge); if (x < u_threshold) - return (tiny * tiny); + RETURNP(tiny * tiny); } else if (ix < BIAS - 114) { /* |x| < 0x1p-114 */ - return (1 + x); /* 1 with inexact iff x != 0 */ + RETURN2P(1, x); /* 1 with inexact iff x != 0 */ } ENTERI(); - /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ - /* Use a specialized rint() to get fn. Assume round-to-nearest. */ - /* XXX assume no extra precision for the additions, as for trig fns. */ - /* XXX this set of comments is now quadruplicated. */ - fn = (double)x * INV_L + 0x1.8p52 - 0x1.8p52; -#if defined(HAVE_EFFICIENT_IRINT) - n = irint(fn); -#else - n = (int)fn; -#endif - n2 = (unsigned)n % INTERVALS; - k = n >> LOG2_INTERVALS; - r1 = x - fn * L1; - r2 = fn * -L2; - r = r1 + r2; - - /* Prepare scale factors. */ - /* XXX sparc64 multiplication is so slow that scalbnl() is faster. */ - v.e = 1; - if (k >= LDBL_MIN_EXP) { - v.xbits.expsign = BIAS + k; - twopk = v.e; - } else { - v.xbits.expsign = BIAS + k + 10000; - twopkp10000 = v.e; - } - - /* Evaluate expl(endpoint[n2] + r1 + r2) = tbl[n2] * expl(r1 + r2). */ - dr = r; - q = r2 + r * r * (A2 + r * (A3 + r * (A4 + r * (A5 + r * (A6 + - dr * (A7 + dr * (A8 + dr * (A9 + dr * A10)))))))); - t = tbl[n2].lo + tbl[n2].hi; - t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; + twopk = 1; + __k_expl(x, &hi, &lo, &k); + t = SUM2P(hi, lo); /* Scale by 2**k. */ + /* XXX sparc64 multiplication is so slow that scalbnl() is faster. */ if (k >= LDBL_MIN_EXP) { if (k == LDBL_MAX_EXP) RETURNI(t * 2 * 0x1p16383L); + SET_LDBL_EXPSIGN(twopk, BIAS + k); RETURNI(t * twopk); } else { - RETURNI(t * twopkp10000 * twom10000); + SET_LDBL_EXPSIGN(twopk, BIAS + k + 10000); + RETURNI(t * twopk * twom10000); } } @@ -312,6 +116,12 @@ expl(long double x) * Setting T3 to 0 would require the |x| < 0x1p-113 condition to appear * in both subintervals, so set T3 = 2**-5, which places the condition * into the [T1, T3] interval. + * + * XXX we now do this more to (partially) balance the number of terms + * in the C and D polys than to avoid checking the condition in both + * intervals. + * + * XXX these micro-optimizations are excessive. */ static const double T1 = -0.1659, /* ~-30.625/128 * log(2) */ @@ -321,6 +131,12 @@ T3 = 0.03125; /* * Domain [-0.1659, 0.03125], range ~[2.9134e-44, 1.8404e-37]: * |(exp(x)-1-x-x**2/2)/x - p(x)| < 2**-122.03 +/* + * XXX none of the long double C or D coeffs except C10 is correctly printed. + * If you re-print their values in %.35Le format, the result is always + * different. For example, the last 2 digits in C3 should be 59, not 67. + * 67 is apparently from rounding an extra-precision value to 36 decimal + * places. */ static const long double C3 = 1.66666666666666666666666666666666667e-1L, @@ -335,6 +151,13 @@ C11 = 2.5052108385441720361903196015125 C12 = 2.08767569878679576457272282566520649e-9L, C13 = 1.60590438367252471783548748824255707e-10L; +/* + * XXX this has 1 more coeff than needed. + * XXX can start the double coeffs but not the double mults at C10. + * With my coeffs (C10-C17 double; s = best_s): + * Domain [-0.1659, 0.03125], range ~[-1.1976e-37, 1.1976e-37]: + * |(exp(x)-1-x-x**2/2)/x - p(x)| ~< 2**-122.65 + */ static const double C14 = 1.1470745580491932e-11, /* 0x1.93974a81dae30p-37 */ C15 = 7.6471620181090468e-13, /* 0x1.ae7f3820adab1p-41 */ @@ -359,6 +182,13 @@ D11 = 2.5052108385508457004648045093526 D12 = 2.08767569819738524488686318024854942e-9L, D13 = 1.60590442297008495301927448122499313e-10L; +/* + * XXX this has 1 more coeff than needed. + * XXX can start the double coeffs but not the double mults at D11. + * With my coeffs (D11-D16 double): + * Domain [0.03125, 0.1659], range ~[-1.1980e-37, 1.1980e-37]: + * |(exp(x)-1-x-x**2/2)/x - p(x)| ~< 2**-122.65 + */ static const double D14 = 1.1470726176204336e-11, /* 0x1.93971dc395d9ep-37 */ D15 = 7.6478532249581686e-13, /* 0x1.ae892e3D16fcep-41 */ @@ -375,6 +205,8 @@ expm1l(long double x) int k, n, n2; uint16_t hx, ix; + DOPRINT_START(&x); + /* Filter out exceptional cases. */ u.e = x; hx = u.xbits.expsign; @@ -382,11 +214,11 @@ expm1l(long double x) if (ix >= BIAS + 7) { /* |x| >= 128 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { if (hx & 0x8000) /* x is -Inf or -NaN */ - return (-1 / x - 1); - return (x + x); /* x is +Inf or +NaN */ + RETURNP(-1 / x - 1); + RETURNP(x + x); /* x is +Inf or +NaN */ } if (x > o_threshold) - return (huge * huge); + RETURNP(huge * huge); /* * expm1l() never underflows, but it must avoid * unrepresentable large negative exponents. We used a @@ -395,7 +227,7 @@ expm1l(long double x) * in the same way as large ones here. */ if (hx & 0x8000) /* x <= -128 */ - return (tiny - 1); /* good for x < -114ln2 - eps */ + RETURN2P(tiny, -1); /* good for x < -114ln2 - eps */ } ENTERI(); @@ -407,7 +239,7 @@ expm1l(long double x) if (x < T3) { if (ix < BIAS - 113) { /* |x| < 0x1p-113 */ /* x (rounded) with inexact if x != 0: */ - RETURNI(x == 0 ? x : + RETURNPI(x == 0 ? x : (0x1p200 * x + fabsl(x)) * 0x1p-200); } q = x * x2 * C3 + x2 * x2 * (C4 + x * (C5 + x * (C6 + @@ -428,9 +260,9 @@ expm1l(long double x) hx2_hi = x_hi * x_hi / 2; hx2_lo = x_lo * (x + x_hi) / 2; if (ix >= BIAS - 7) - RETURNI(hx2_lo + x_lo + q + (hx2_hi + x_hi)); + RETURN2PI(hx2_hi + x_hi, hx2_lo + x_lo + q); else - RETURNI(hx2_lo + q + hx2_hi + x); + RETURN2PI(x, hx2_lo + q + hx2_hi); } /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ @@ -463,21 +295,21 @@ expm1l(long double x) t = tbl[n2].lo + tbl[n2].hi; if (k == 0) { - t = tbl[n2].lo * (r1 + 1) + t * q + tbl[n2].hi * r1 + - (tbl[n2].hi - 1); + t = SUM2P(tbl[n2].hi - 1, tbl[n2].lo * (r1 + 1) + t * q + + tbl[n2].hi * r1); RETURNI(t); } if (k == -1) { - t = tbl[n2].lo * (r1 + 1) + t * q + tbl[n2].hi * r1 + - (tbl[n2].hi - 2); + t = SUM2P(tbl[n2].hi - 2, tbl[n2].lo * (r1 + 1) + t * q + + tbl[n2].hi * r1); RETURNI(t / 2); } if (k < -7) { - t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; + t = SUM2P(tbl[n2].hi, tbl[n2].lo + t * (q + r1)); RETURNI(t * twopk - 1); } if (k > 2 * LDBL_MANT_DIG - 1) { - t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; + t = SUM2P(tbl[n2].hi, tbl[n2].lo + t * (q + r1)); if (k == LDBL_MAX_EXP) RETURNI(t * 2 * 0x1p16383L - 1); RETURNI(t * twopk - 1); @@ -487,8 +319,8 @@ expm1l(long double x) twomk = v.e; if (k > LDBL_MANT_DIG - 1) - t = tbl[n2].lo - twomk + t * (q + r1) + tbl[n2].hi; + t = SUM2P(tbl[n2].hi, tbl[n2].lo - twomk + t * (q + r1)); else - t = tbl[n2].lo + t * (q + r1) + (tbl[n2].hi - twomk); + t = SUM2P(tbl[n2].hi - twomk, tbl[n2].lo + t * (q + r1)); RETURNI(t * twopk); } Added: head/lib/msun/ld80/k_expl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/ld80/k_expl.h Mon Dec 30 00:51:25 2013 (r260066) @@ -0,0 +1,305 @@ +/* from: FreeBSD: head/lib/msun/ld80/s_expl.c 251343 2013-06-03 19:51:32Z kargl */ + +/*- + * Copyright (c) 2009-2013 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Optimized by Bruce D. Evans. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * See s_expl.c for more comments about __k_expl(). + * + * See ../src/e_exp.c and ../src/k_exp.h for precision-independent comments + * about the secondary kernels. + */ + +#define INTERVALS 128 +#define LOG2_INTERVALS 7 +#define BIAS (LDBL_MAX_EXP - 1) + +static const double +/* + * ln2/INTERVALS = L1+L2 (hi+lo decomposition for multiplication). L1 must + * have at least 22 (= log2(|LDBL_MIN_EXP-extras|) + log2(INTERVALS)) lowest + * bits zero so that multiplication of it by n is exact. + */ +INV_L = 1.8466496523378731e+2, /* 0x171547652b82fe.0p-45 */ +L1 = 5.4152123484527692e-3, /* 0x162e42ff000000.0p-60 */ +L2 = -3.2819649005320973e-13, /* -0x1718432a1b0e26.0p-94 */ +/* + * Domain [-0.002708, 0.002708], range ~[-5.7136e-24, 5.7110e-24]: + * |exp(x) - p(x)| < 2**-77.2 + * (0.002708 is ln2/(2*INTERVALS) rounded up a little). + */ +A2 = 0.5, +A3 = 1.6666666666666119e-1, /* 0x15555555555490.0p-55 */ +A4 = 4.1666666666665887e-2, /* 0x155555555554e5.0p-57 */ +A5 = 8.3333354987869413e-3, /* 0x1111115b789919.0p-59 */ +A6 = 1.3888891738560272e-3; /* 0x16c16c651633ae.0p-62 */ + +/* + * 2^(i/INTERVALS) for i in [0,INTERVALS] is represented by two values where + * the first 53 bits of the significand are stored in hi and the next 53 + * bits are in lo. Tang's paper states that the trailing 6 bits of hi must + * be zero for his algorithm in both single and double precision, because + * the table is re-used in the implementation of expm1() where a floating + * point addition involving hi must be exact. Here hi is double, so + * converting it to long double gives 11 trailing zero bits. + */ +static const struct { + double hi; + double lo; +} tbl[INTERVALS] = { + 0x1p+0, 0x0p+0, + /* + * XXX hi is rounded down, and the formatting is not quite normal. + * But I rather like both. The 0x1.*p format is good for 4N+1 + * mantissa bits. Rounding down makes the lo terms positive, + * so that the columnar formatting can be simpler. + */ + 0x1.0163da9fb3335p+0, 0x1.b61299ab8cdb7p-54, + 0x1.02c9a3e778060p+0, 0x1.dcdef95949ef4p-53, + 0x1.04315e86e7f84p+0, 0x1.7ae71f3441b49p-53, + 0x1.059b0d3158574p+0, 0x1.d73e2a475b465p-55, + 0x1.0706b29ddf6ddp+0, 0x1.8db880753b0f6p-53, + 0x1.0874518759bc8p+0, 0x1.186be4bb284ffp-57, + 0x1.09e3ecac6f383p+0, 0x1.1487818316136p-54, + 0x1.0b5586cf9890fp+0, 0x1.8a62e4adc610bp-54, + 0x1.0cc922b7247f7p+0, 0x1.01edc16e24f71p-54, + 0x1.0e3ec32d3d1a2p+0, 0x1.03a1727c57b53p-59, + 0x1.0fb66affed31ap+0, 0x1.e464123bb1428p-53, + 0x1.11301d0125b50p+0, 0x1.49d77e35db263p-53, + 0x1.12abdc06c31cbp+0, 0x1.f72575a649ad2p-53, + 0x1.1429aaea92ddfp+0, 0x1.66820328764b1p-53, + 0x1.15a98c8a58e51p+0, 0x1.2406ab9eeab0ap-55, + 0x1.172b83c7d517ap+0, 0x1.b9bef918a1d63p-53, + 0x1.18af9388c8de9p+0, 0x1.777ee1734784ap-53, + 0x1.1a35beb6fcb75p+0, 0x1.e5b4c7b4968e4p-55, + 0x1.1bbe084045cd3p+0, 0x1.3563ce56884fcp-53, + 0x1.1d4873168b9aap+0, 0x1.e016e00a2643cp-54, + 0x1.1ed5022fcd91cp+0, 0x1.71033fec2243ap-53, + 0x1.2063b88628cd6p+0, 0x1.dc775814a8495p-55, + 0x1.21f49917ddc96p+0, 0x1.2a97e9494a5eep-55, + 0x1.2387a6e756238p+0, 0x1.9b07eb6c70573p-54, + 0x1.251ce4fb2a63fp+0, 0x1.ac155bef4f4a4p-55, + 0x1.26b4565e27cddp+0, 0x1.2bd339940e9d9p-55, + 0x1.284dfe1f56380p+0, 0x1.2d9e2b9e07941p-53, + 0x1.29e9df51fdee1p+0, 0x1.612e8afad1255p-55, + 0x1.2b87fd0dad98fp+0, 0x1.fbbd48ca71f95p-53, + 0x1.2d285a6e4030bp+0, 0x1.0024754db41d5p-54, + 0x1.2ecafa93e2f56p+0, 0x1.1ca0f45d52383p-56, + 0x1.306fe0a31b715p+0, 0x1.6f46ad23182e4p-55, + 0x1.32170fc4cd831p+0, 0x1.a9ce78e18047cp-55, + 0x1.33c08b26416ffp+0, 0x1.32721843659a6p-54, + 0x1.356c55f929ff0p+0, 0x1.928c468ec6e76p-53, + 0x1.371a7373aa9cap+0, 0x1.4e28aa05e8a8fp-53, + 0x1.38cae6d05d865p+0, 0x1.0b53961b37da2p-53, + 0x1.3a7db34e59ff6p+0, 0x1.d43792533c144p-53, + 0x1.3c32dc313a8e4p+0, 0x1.08003e4516b1ep-53, + 0x1.3dea64c123422p+0, 0x1.ada0911f09ebcp-55, + 0x1.3fa4504ac801bp+0, 0x1.417ee03548306p-53, + 0x1.4160a21f72e29p+0, 0x1.f0864b71e7b6cp-53, + 0x1.431f5d950a896p+0, 0x1.b8e088728219ap-53, + 0x1.44e086061892dp+0, 0x1.89b7a04ef80d0p-59, + 0x1.46a41ed1d0057p+0, 0x1.c944bd1648a76p-54, + 0x1.486a2b5c13cd0p+0, 0x1.3c1a3b69062f0p-56, + 0x1.4a32af0d7d3dep+0, 0x1.9cb62f3d1be56p-54, + 0x1.4bfdad5362a27p+0, 0x1.d4397afec42e2p-56, + 0x1.4dcb299fddd0dp+0, 0x1.8ecdbbc6a7833p-54, + 0x1.4f9b2769d2ca6p+0, 0x1.5a67b16d3540ep-53, + 0x1.516daa2cf6641p+0, 0x1.8225ea5909b04p-53, + 0x1.5342b569d4f81p+0, 0x1.be1507893b0d5p-53, + 0x1.551a4ca5d920ep+0, 0x1.8a5d8c4048699p-53, + 0x1.56f4736b527dap+0, 0x1.9bb2c011d93adp-54, + 0x1.58d12d497c7fdp+0, 0x1.295e15b9a1de8p-55, + 0x1.5ab07dd485429p+0, 0x1.6324c054647adp-54, + 0x1.5c9268a5946b7p+0, 0x1.c4b1b816986a2p-60, + 0x1.5e76f15ad2148p+0, 0x1.ba6f93080e65ep-54, + 0x1.605e1b976dc08p+0, 0x1.60edeb25490dcp-53, + 0x1.6247eb03a5584p+0, 0x1.63e1f40dfa5b5p-53, + 0x1.6434634ccc31fp+0, 0x1.8edf0e2989db3p-53, + 0x1.6623882552224p+0, 0x1.224fb3c5371e6p-53, + 0x1.68155d44ca973p+0, 0x1.038ae44f73e65p-57, + 0x1.6a09e667f3bccp+0, 0x1.21165f626cdd5p-53, + 0x1.6c012750bdabep+0, 0x1.daed533001e9ep-53, + 0x1.6dfb23c651a2ep+0, 0x1.e441c597c3775p-53, + 0x1.6ff7df9519483p+0, 0x1.9f0fc369e7c42p-53, + 0x1.71f75e8ec5f73p+0, 0x1.ba46e1e5de15ap-53, + 0x1.73f9a48a58173p+0, 0x1.7ab9349cd1562p-53, + 0x1.75feb564267c8p+0, 0x1.7edd354674916p-53, + 0x1.780694fde5d3fp+0, 0x1.866b80a02162dp-54, + 0x1.7a11473eb0186p+0, 0x1.afaa2047ed9b4p-53, + 0x1.7c1ed0130c132p+0, 0x1.f124cd1164dd6p-54, + 0x1.7e2f336cf4e62p+0, 0x1.05d02ba15797ep-56, + 0x1.80427543e1a11p+0, 0x1.6c1bccec9346bp-53, + 0x1.82589994cce12p+0, 0x1.159f115f56694p-53, + 0x1.8471a4623c7acp+0, 0x1.9ca5ed72f8c81p-53, + 0x1.868d99b4492ecp+0, 0x1.01c83b21584a3p-53, + 0x1.88ac7d98a6699p+0, 0x1.994c2f37cb53ap-54, + 0x1.8ace5422aa0dbp+0, 0x1.6e9f156864b27p-54, + 0x1.8cf3216b5448bp+0, 0x1.de55439a2c38bp-53, + 0x1.8f1ae99157736p+0, 0x1.5cc13a2e3976cp-55, + 0x1.9145b0b91ffc5p+0, 0x1.114c368d3ed6ep-53, + 0x1.93737b0cdc5e4p+0, 0x1.e8a0387e4a814p-53, + 0x1.95a44cbc8520ep+0, 0x1.d36906d2b41f9p-53, + 0x1.97d829fde4e4fp+0, 0x1.173d241f23d18p-53, + 0x1.9a0f170ca07b9p+0, 0x1.7462137188ce7p-53, + 0x1.9c49182a3f090p+0, 0x1.c7c46b071f2bep-56, + 0x1.9e86319e32323p+0, 0x1.824ca78e64c6ep-56, + 0x1.a0c667b5de564p+0, 0x1.6535b51719567p-53, + 0x1.a309bec4a2d33p+0, 0x1.6305c7ddc36abp-54, + 0x1.a5503b23e255cp+0, 0x1.1684892395f0fp-53, + 0x1.a799e1330b358p+0, 0x1.bcb7ecac563c7p-54, + 0x1.a9e6b5579fdbfp+0, 0x1.0fac90ef7fd31p-54, + 0x1.ac36bbfd3f379p+0, 0x1.81b72cd4624ccp-53, + 0x1.ae89f995ad3adp+0, 0x1.7a1cd345dcc81p-54, + 0x1.b0e07298db665p+0, 0x1.2108559bf8deep-53, + 0x1.b33a2b84f15fap+0, 0x1.ed7fa1cf7b290p-53, + 0x1.b59728de55939p+0, 0x1.1c7102222c90ep-53, + 0x1.b7f76f2fb5e46p+0, 0x1.d54f610356a79p-53, + 0x1.ba5b030a10649p+0, 0x1.0819678d5eb69p-53, + 0x1.bcc1e904bc1d2p+0, 0x1.23dd07a2d9e84p-55, + 0x1.bf2c25bd71e08p+0, 0x1.0811ae04a31c7p-53, + 0x1.c199bdd85529cp+0, 0x1.11065895048ddp-55, + 0x1.c40ab5fffd07ap+0, 0x1.b4537e083c60ap-54, + 0x1.c67f12e57d14bp+0, 0x1.2884dff483cadp-54, + 0x1.c8f6d9406e7b5p+0, 0x1.1acbc48805c44p-56, + 0x1.cb720dcef9069p+0, 0x1.503cbd1e949dbp-56, + 0x1.cdf0b555dc3f9p+0, 0x1.889f12b1f58a3p-53, + 0x1.d072d4a07897bp+0, 0x1.1a1e45e4342b2p-53, + 0x1.d2f87080d89f1p+0, 0x1.15bc247313d44p-53, + 0x1.d5818dcfba487p+0, 0x1.2ed02d75b3707p-55, + 0x1.d80e316c98397p+0, 0x1.7709f3a09100cp-53, + 0x1.da9e603db3285p+0, 0x1.c2300696db532p-54, + 0x1.dd321f301b460p+0, 0x1.2da5778f018c3p-54, + 0x1.dfc97337b9b5ep+0, 0x1.72d195873da52p-53, + 0x1.e264614f5a128p+0, 0x1.424ec3f42f5b5p-53, + 0x1.e502ee78b3ff6p+0, 0x1.39e8980a9cc8fp-55, + 0x1.e7a51fbc74c83p+0, 0x1.2d522ca0c8de2p-54, + 0x1.ea4afa2a490d9p+0, 0x1.0b1ee7431ebb6p-53, + 0x1.ecf482d8e67f0p+0, 0x1.1b60625f7293ap-53, + 0x1.efa1bee615a27p+0, 0x1.dc7f486a4b6b0p-54, + 0x1.f252b376bba97p+0, 0x1.3a1a5bf0d8e43p-54, + 0x1.f50765b6e4540p+0, 0x1.9d3e12dd8a18bp-54, + 0x1.f7bfdad9cbe13p+0, 0x1.1227697fce57bp-53, + 0x1.fa7c1819e90d8p+0, 0x1.74853f3a5931ep-55, + 0x1.fd3c22b8f71f1p+0, 0x1.2eb74966579e7p-57 +}; + +/* + * Kernel for expl(x). x must be finite and not tiny or huge. + * "tiny" is anything that would make us underflow (|A6*x^6| < ~LDBL_MIN). + * "huge" is anything that would make fn*L1 inexact (|x| > ~2**17*ln2). + */ +static inline void +__k_expl(long double x, long double *hip, long double *lop, int *kp) +{ + long double fn, q, r, r1, r2, t, z; + int n, n2; + + /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ + /* Use a specialized rint() to get fn. Assume round-to-nearest. */ + fn = x * INV_L + 0x1.8p63 - 0x1.8p63; + r = x - fn * L1 - fn * L2; /* r = r1 + r2 done independently. */ +#if defined(HAVE_EFFICIENT_IRINTL) + n = irintl(fn); +#elif defined(HAVE_EFFICIENT_IRINT) + n = irint(fn); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 01:06:24 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9BC9CDDF; Mon, 30 Dec 2013 01:06:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 83E6D16E5; Mon, 30 Dec 2013 01:06:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBU16OAu058168; Mon, 30 Dec 2013 01:06:24 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBU16L6x058148; Mon, 30 Dec 2013 01:06:21 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201312300106.rBU16L6x058148@svn.freebsd.org> From: Steve Kargl Date: Mon, 30 Dec 2013 01:06:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260067 - in head/lib/msun: . man src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 01:06:24 -0000 Author: kargl Date: Mon Dec 30 01:06:21 2013 New Revision: 260067 URL: http://svnweb.freebsd.org/changeset/base/260067 Log: * Makefile: . Hook coshl, sinhl, and tanhl into libm. . Create symbolic links for corresponding manpages. . While here remove a nearby extraneous space. * Symbol.map: * src/math.h: . Move coshl, sinhl, and tanhl to their proper locations. * man/cosh.3: * man/sinh.3: * man/tanh.3: . Update the manpages. * src/e_cosh.c: * src/e_sinh.c: * src/s_tanh.c: . Add weak reference for LBDL_MANT_DIG==53 targets. * src/imprecise.c: . Remove the coshl, sinhl, and tanhl kludge. * src/e_coshl.c: . ld80 and ld128 implementation of coshl(). * src/e_sinhl.c: . ld80 and ld128 implementation of sinhl(). * src/s_tanhl.c: . ld80 and ld128 implementation of tanhl(). Obtained from: bde (mostly), das and kargl Added: head/lib/msun/src/e_coshl.c (contents, props changed) head/lib/msun/src/e_sinhl.c (contents, props changed) head/lib/msun/src/s_tanhl.c (contents, props changed) Modified: head/lib/msun/Makefile head/lib/msun/Symbol.map head/lib/msun/man/cosh.3 head/lib/msun/man/sinh.3 head/lib/msun/man/tanh.3 head/lib/msun/src/e_cosh.c head/lib/msun/src/e_sinh.c head/lib/msun/src/imprecise.c head/lib/msun/src/math.h head/lib/msun/src/s_tanh.c Modified: head/lib/msun/Makefile ============================================================================== --- head/lib/msun/Makefile Mon Dec 30 00:51:25 2013 (r260066) +++ head/lib/msun/Makefile Mon Dec 30 01:06:21 2013 (r260067) @@ -96,13 +96,14 @@ COMMON_SRCS+= s_copysignl.c s_fabsl.c s_ .if ${LDBL_PREC} != 53 # If long double != double use these; otherwise, we alias the double versions. COMMON_SRCS+= e_acoshl.c e_acosl.c e_asinl.c e_atan2l.c e_atanhl.c \ - e_fmodl.c e_hypotl.c e_remainderl.c e_sqrtl.c \ + e_coshl.c e_fmodl.c e_hypotl.c \ + e_remainderl.c e_sinhl.c e_sqrtl.c \ invtrig.c k_cosl.c k_sinl.c k_tanl.c \ s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c s_cosl.c s_cprojl.c \ s_csqrtl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \ s_frexpl.c s_logbl.c s_logl.c s_nanl.c s_nextafterl.c \ - s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c s_scalbnl.c \ - s_sinl.c s_tanl.c s_truncl.c w_cabsl.c + s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c s_scalbnl.c \ + s_sinl.c s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c .endif # C99 complex functions @@ -160,7 +161,7 @@ MLINKS+=cimag.3 cimagf.3 cimag.3 cimagl. cimag.3 creal.3 cimag.3 crealf.3 cimag.3 creall.3 MLINKS+=copysign.3 copysignf.3 copysign.3 copysignl.3 MLINKS+=cos.3 cosf.3 cos.3 cosl.3 -MLINKS+=cosh.3 coshf.3 +MLINKS+=cosh.3 coshf.3 cosh.3 coshl.3 MLINKS+=csqrt.3 csqrtf.3 csqrt.3 csqrtl.3 MLINKS+=erf.3 erfc.3 erf.3 erff.3 erf.3 erfcf.3 MLINKS+=exp.3 expm1.3 exp.3 expm1f.3 exp.3 expm1l.3 exp.3 pow.3 exp.3 powf.3 \ @@ -208,11 +209,11 @@ MLINKS+=round.3 roundf.3 round.3 roundl. MLINKS+=scalbn.3 scalbln.3 scalbn.3 scalblnf.3 scalbn.3 scalblnl.3 MLINKS+=scalbn.3 scalbnf.3 scalbn.3 scalbnl.3 MLINKS+=sin.3 sinf.3 sin.3 sinl.3 -MLINKS+=sinh.3 sinhf.3 +MLINKS+=sinh.3 sinhf.3 sinh.3 sinhl.3 MLINKS+=sqrt.3 cbrt.3 sqrt.3 cbrtf.3 sqrt.3 cbrtl.3 sqrt.3 sqrtf.3 \ sqrt.3 sqrtl.3 MLINKS+=tan.3 tanf.3 tan.3 tanl.3 -MLINKS+=tanh.3 tanhf.3 +MLINKS+=tanh.3 tanhf.3 tanh.3 tanhl.3 MLINKS+=trunc.3 truncf.3 trunc.3 truncl.3 .include Modified: head/lib/msun/Symbol.map ============================================================================== --- head/lib/msun/Symbol.map Mon Dec 30 00:51:25 2013 (r260066) +++ head/lib/msun/Symbol.map Mon Dec 30 01:06:21 2013 (r260067) @@ -260,6 +260,7 @@ FBSD_1.3 { ccosf; ccosh; ccoshf; + coshl; ctan; ctanf; ctanh; @@ -270,13 +271,12 @@ FBSD_1.3 { log1pl; log2l; logl; + sinhl; + tanhl; /* Implemented as weak aliases for imprecise versions */ - coshl; erfcl; erfl; lgammal; powl; - sinhl; - tanhl; tgammal; }; Modified: head/lib/msun/man/cosh.3 ============================================================================== --- head/lib/msun/man/cosh.3 Mon Dec 30 00:51:25 2013 (r260066) +++ head/lib/msun/man/cosh.3 Mon Dec 30 01:06:21 2013 (r260067) @@ -28,12 +28,13 @@ .\" from: @(#)cosh.3 5.1 (Berkeley) 5/2/91 .\" $FreeBSD$ .\" -.Dd January 14, 2005 +.Dd August 17, 2013 .Dt COSH 3 .Os .Sh NAME .Nm cosh , -.Nm coshf +.Nm coshf , +.Nm coshl .Nd hyperbolic cosine functions .Sh LIBRARY .Lb libm @@ -43,11 +44,14 @@ .Fn cosh "double x" .Ft float .Fn coshf "float x" +.Ft long double +.Fn coshl "long double x" .Sh DESCRIPTION The -.Fn cosh +.Fn cosh , +.Fn coshf , and the -.Fn coshf +.Fn coshl functions compute the hyperbolic cosine of .Fa x . .Sh SEE ALSO Modified: head/lib/msun/man/sinh.3 ============================================================================== --- head/lib/msun/man/sinh.3 Mon Dec 30 00:51:25 2013 (r260066) +++ head/lib/msun/man/sinh.3 Mon Dec 30 01:06:21 2013 (r260067) @@ -42,11 +42,14 @@ .Fn sinh "double x" .Ft float .Fn sinhf "float x" +.Ft long double +.Fn sinhl "long double x" .Sh DESCRIPTION The -.Fn sinh +.Fn sinh , +.Fn sinhf , and the -.Fn sinhf +.Fn sinhl functions compute the hyperbolic sine of .Fa x . .Sh SEE ALSO Modified: head/lib/msun/man/tanh.3 ============================================================================== --- head/lib/msun/man/tanh.3 Mon Dec 30 00:51:25 2013 (r260066) +++ head/lib/msun/man/tanh.3 Mon Dec 30 01:06:21 2013 (r260067) @@ -28,12 +28,13 @@ .\" from: @(#)tanh.3 5.1 (Berkeley) 5/2/91 .\" $FreeBSD$ .\" -.Dd May 2, 1991 +.Dd August 17, 2013 .Dt TANH 3 .Os .Sh NAME .Nm tanh , -.Nm tanhf +.Nm tanhf , +.Nm tanhl .Nd hyperbolic tangent functions .Sh LIBRARY .Lb libm @@ -43,20 +44,24 @@ .Fn tanh "double x" .Ft float .Fn tanhf "float x" +.Ft long double +.Fn tanhl "long double x" .Sh DESCRIPTION The -.Fn tanh +.Fn tanh , +.Fn tanhf , and the -.Fn tanhf +.Fn tanhl functions compute the hyperbolic tangent of .Fa x . For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES The -.Fn tanh +.Fn tanh , +.Fn tanhf , and the -.Fn tanhf +.Fn tanhl functions return the hyperbolic tangent value. .Sh SEE ALSO .Xr acos 3 , Modified: head/lib/msun/src/e_cosh.c ============================================================================== --- head/lib/msun/src/e_cosh.c Mon Dec 30 00:51:25 2013 (r260066) +++ head/lib/msun/src/e_cosh.c Mon Dec 30 01:06:21 2013 (r260067) @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); * only cosh(0)=1 is exact for finite x. */ +#include + #include "math.h" #include "math_private.h" @@ -77,3 +79,7 @@ __ieee754_cosh(double x) /* |x| > overflowthresold, cosh(x) overflow */ return huge*huge; } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(cosh, coshl); +#endif Added: head/lib/msun/src/e_coshl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/src/e_coshl.c Mon Dec 30 01:06:21 2013 (r260067) @@ -0,0 +1,130 @@ +/* from: FreeBSD: head/lib/msun/src/e_coshl.c XXX */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * See e_cosh.c for complete comments. + * + * Converted to long double by Bruce D. Evans. + */ + +#include +#ifdef __i386__ +#include +#endif + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" +#include "k_expl.h" + +#if LDBL_MAX_EXP != 0x4000 +/* We also require the usual expsign encoding. */ +#error "Unsupported long double format" +#endif + +#define BIAS (LDBL_MAX_EXP - 1) + +static const volatile long double huge = 0x1p10000L, tiny = 0x1p-10000L; +#if LDBL_MANT_DIG == 64 +/* + * Domain [-1, 1], range ~[-1.8211e-21, 1.8211e-21]: + * |cosh(x) - c(x)| < 2**-68.8 + */ +static const union IEEEl2bits +C4u = LD80C(0xaaaaaaaaaaaaac78, -5, 4.16666666666666682297e-2L); +#define C4 C4u.e +static const double +C2 = 0.5, +C6 = 1.3888888888888616e-3, /* 0x16c16c16c16b99.0p-62 */ +C8 = 2.4801587301767953e-5, /* 0x1a01a01a027061.0p-68 */ +C10 = 2.7557319163300398e-7, /* 0x127e4fb6c9b55f.0p-74 */ +C12 = 2.0876768371393075e-9, /* 0x11eed99406a3f4.0p-81 */ +C14 = 1.1469537039374480e-11, /* 0x1938c67cd18c48.0p-89 */ +C16 = 4.8473490896852041e-14; /* 0x1b49c429701e45.0p-97 */ +#elif LDBL_MANT_DIG == 113 +/* + * Domain [-1, 1], range ~[-2.3194e-37, 2.3194e-37]: + * |cosh(x) - c(x)| < 2**-121.69 + */ +static const long double +C4 = 4.16666666666666666666666666666666225e-2L, /* 0x1555555555555555555555555554e.0p-117L */ +C6 = 1.38888888888888888888888888889434831e-3L, /* 0x16c16c16c16c16c16c16c16c1dd7a.0p-122L */ +C8 = 2.48015873015873015873015871870962089e-5L, /* 0x1a01a01a01a01a01a01a017af2756.0p-128L */ +C10 = 2.75573192239858906525574318600800201e-7L, /* 0x127e4fb7789f5c72ef01c8a040640.0p-134L */ +C12 = 2.08767569878680989791444691755468269e-9L, /* 0x11eed8eff8d897b543d0679607399.0p-141L */ +C14= 1.14707455977297247387801189650495351e-11L, /* 0x193974a8c07c9d24ae169a7fa9b54.0p-149L */ +C16 = 4.77947733238737883626416876486279985e-14L; /* 0x1ae7f3e733b814d4e1b90f5727fe4.0p-157L */ +static const double +C2 = 0.5, +C18 = 1.5619206968597871e-16, /* 0x16827863b9900b.0p-105 */ +C20 = 4.1103176218528049e-19, /* 0x1e542ba3d3c269.0p-114 */ +C22 = 8.8967926401641701e-22, /* 0x10ce399542a014.0p-122 */ +C24 = 1.6116681626523904e-24, /* 0x1f2c981d1f0cb7.0p-132 */ +C26 = 2.5022374732804632e-27; /* 0x18c7ecf8b2c4a0.0p-141 */ +#else +#error "Unsupported long double format" +#endif /* LDBL_MANT_DIG == 64 */ + +/* log(2**16385 - 0.5) rounded towards up: */ +static const float +o_threshold = 1.13572168e4; /* 0xb174de.0p-10 */ + +long double +coshl(long double x) +{ + long double hi,lo,x2,x4; + double dx2; + uint16_t ix; + + GET_LDBL_EXPSIGN(ix,x); + ix &= 0x7fff; + + /* x is INF or NaN */ + if(ix>=0x7fff) return x*x; + + ENTERI(); + + /* |x| < 1, return 1 or c(x) */ + if(ix<0x3fff) { + if (ix o_threshold, cosh(x) overflow */ + RETURNI(huge*huge); +} Modified: head/lib/msun/src/e_sinh.c ============================================================================== --- head/lib/msun/src/e_sinh.c Mon Dec 30 00:51:25 2013 (r260066) +++ head/lib/msun/src/e_sinh.c Mon Dec 30 01:06:21 2013 (r260067) @@ -32,6 +32,8 @@ __FBSDID("$FreeBSD$"); * only sinh(0)=0 is exact for finite x. */ +#include + #include "math.h" #include "math_private.h" @@ -71,3 +73,7 @@ __ieee754_sinh(double x) /* |x| > overflowthresold, sinh(x) overflow */ return x*shuge; } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(sinh, sinhl); +#endif Added: head/lib/msun/src/e_sinhl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/src/e_sinhl.c Mon Dec 30 01:06:21 2013 (r260067) @@ -0,0 +1,131 @@ +/* from: FreeBSD: head/lib/msun/src/e_sinhl.c XXX */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * See e_sinh.c for complete comments. + * + * Converted to long double by Bruce D. Evans. + */ + +#include +#ifdef __i386__ +#include +#endif + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" +#include "k_expl.h" + +#if LDBL_MAX_EXP != 0x4000 +/* We also require the usual expsign encoding. */ +#error "Unsupported long double format" +#endif + +#define BIAS (LDBL_MAX_EXP - 1) + +static const long double shuge = 0x1p16383L; +#if LDBL_MANT_DIG == 64 +/* + * Domain [-1, 1], range ~[-6.6749e-22, 6.6749e-22]: + * |sinh(x)/x - s(x)| < 2**-70.3 + */ +static const union IEEEl2bits +S3u = LD80C(0xaaaaaaaaaaaaaaaa, -3, 1.66666666666666666658e-1L); +#define S3 S3u.e +static const double +S5 = 8.3333333333333332e-3, /* 0x11111111111111.0p-59 */ +S7 = 1.9841269841270074e-4, /* 0x1a01a01a01a070.0p-65 */ +S9 = 2.7557319223873889e-6, /* 0x171de3a5565fe6.0p-71 */ +S11 = 2.5052108406704084e-8, /* 0x1ae6456857530f.0p-78 */ +S13 = 1.6059042748655297e-10, /* 0x161245fa910697.0p-85 */ +S15 = 7.6470006914396920e-13, /* 0x1ae7ce4eff2792.0p-93 */ +S17 = 2.8346142308424267e-15; /* 0x19882ce789ffc6.0p-101 */ +#elif LDBL_MANT_DIG == 113 +/* + * Domain [-1, 1], range ~[-2.9673e-36, 2.9673e-36]: + * |sinh(x)/x - s(x)| < 2**-118.0 + */ +static const long double +S3 = 1.66666666666666666666666666666666033e-1L, /* 0x1555555555555555555555555553b.0p-115L */ +S5 = 8.33333333333333333333333333337643193e-3L, /* 0x111111111111111111111111180f5.0p-119L */ +S7 = 1.98412698412698412698412697391263199e-4L, /* 0x1a01a01a01a01a01a01a0176aad11.0p-125L */ +S9 = 2.75573192239858906525574406205464218e-6L, /* 0x171de3a556c7338faac243aaa9592.0p-131L */ +S11 = 2.50521083854417187749675637460977997e-8L, /* 0x1ae64567f544e38fe59b3380d7413.0p-138L */ +S13 = 1.60590438368216146368737762431552702e-10L, /* 0x16124613a86d098059c7620850fc2.0p-145L */ +S15 = 7.64716373181980539786802470969096440e-13L, /* 0x1ae7f3e733b814193af09ce723043.0p-153L */ +S17 = 2.81145725434775409870584280722701574e-15L; /* 0x1952c77030c36898c3fd0b6dfc562.0p-161L */ +static const double +S19= 8.2206352435411005e-18, /* 0x12f49b4662b86d.0p-109 */ +S21= 1.9572943931418891e-20, /* 0x171b8f2fab9628.0p-118 */ +S23 = 3.8679983530666939e-23, /* 0x17617002b73afc.0p-127 */ +S25 = 6.5067867911512749e-26; /* 0x1423352626048a.0p-136 */ +#else +#error "Unsupported long double format" +#endif /* LDBL_MANT_DIG == 64 */ + +/* log(2**16385 - 0.5) rounded towards up: */ +static const float +o_threshold = 1.13572168e4; /* 0xb174de.0p-10 */ + +long double +sinhl(long double x) +{ + long double hi,lo,x2,x4; + double dx2,s; + int16_t ix,jx; + + GET_LDBL_EXPSIGN(jx,x); + ix = jx&0x7fff; + + /* x is INF or NaN */ + if(ix>=0x7fff) return x+x; + + ENTERI(); + + s = 1; + if (jx<0) s = -1; + + /* |x| < 64, return x, s(x), or accurate s*(exp(|x|)/2-1/exp(|x|)/2) */ + if (ix<0x4005) { /* |x|<64 */ + if (ix1) RETURNI(x); /* sinh(tiny) = tiny with inexact */ + if (ix<0x3fff) { /* |x|<1 */ + x2 = x*x; +#if LDBL_MANT_DIG == 64 + x4 = x2*x2; + RETURNI(((S17*x2 + S15)*x4 + (S13*x2 + S11))*(x2*x*x4*x4) + + ((S9*x2 + S7)*x2 + S5)*(x2*x*x2) + S3*(x2*x) + x); +#elif LDBL_MANT_DIG == 113 + dx2 = x2; + RETURNI(((((((((((S25*dx2 + S23)*dx2 + + S21)*x2 + S19)*x2 + + S17)*x2 + S15)*x2 + S13)*x2 + S11)*x2 + S9)*x2 + S7)*x2 + + S5)* (x2*x*x2) + + S3*(x2*x) + x); +#endif + } + k_hexpl(fabsl(x), &hi, &lo); + RETURNI(s*(lo - 0.25/(hi + lo) + hi)); + } + + /* |x| in [64, o_threshold], return correctly-overflowing s*exp(|x|)/2 */ + if (fabsl(x) <= o_threshold) + RETURNI(s*hexpl(fabsl(x))); + + /* |x| > o_threshold, sinh(x) overflow */ + return x*shuge; +} Modified: head/lib/msun/src/imprecise.c ============================================================================== --- head/lib/msun/src/imprecise.c Mon Dec 30 00:51:25 2013 (r260066) +++ head/lib/msun/src/imprecise.c Mon Dec 30 01:06:21 2013 (r260067) @@ -60,10 +60,7 @@ DECLARE_WEAK(powl); long double imprecise_ ## f ## l(long double v) { return f(v); }\ DECLARE_WEAK(f ## l) -DECLARE_IMPRECISE(cosh); DECLARE_IMPRECISE(erfc); DECLARE_IMPRECISE(erf); DECLARE_IMPRECISE(lgamma); -DECLARE_IMPRECISE(sinh); -DECLARE_IMPRECISE(tanh); DECLARE_IMPRECISE(tgamma); Modified: head/lib/msun/src/math.h ============================================================================== --- head/lib/msun/src/math.h Mon Dec 30 00:51:25 2013 (r260066) +++ head/lib/msun/src/math.h Mon Dec 30 01:06:21 2013 (r260067) @@ -451,6 +451,7 @@ long double atanl(long double); long double cbrtl(long double); long double ceill(long double); long double copysignl(long double, long double) __pure2; +long double coshl(long double); long double cosl(long double); long double exp2l(long double); long double expl(long double); @@ -488,8 +489,10 @@ long double rintl(long double); long double roundl(long double); long double scalblnl(long double, long); long double scalbnl(long double, int); +long double sinhl(long double); long double sinl(long double); long double sqrtl(long double); +long double tanhl(long double); long double tanl(long double); long double truncl(long double); @@ -510,13 +513,10 @@ __END_DECLS */ __BEGIN_DECLS -long double coshl(long double); long double erfcl(long double); long double erfl(long double); long double lgammal(long double); long double powl(long double, long double); -long double sinhl(long double); -long double tanhl(long double); long double tgammal(long double); __END_DECLS Modified: head/lib/msun/src/s_tanh.c ============================================================================== --- head/lib/msun/src/s_tanh.c Mon Dec 30 00:51:25 2013 (r260066) +++ head/lib/msun/src/s_tanh.c Mon Dec 30 01:06:21 2013 (r260067) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); * only tanh(0)=0 is exact for finite argument. */ +#include + #include "math.h" #include "math_private.h" @@ -75,3 +77,7 @@ tanh(double x) } return (jx>=0)? z: -z; } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(tanh, tanhl); +#endif Added: head/lib/msun/src/s_tanhl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/src/s_tanhl.c Mon Dec 30 01:06:21 2013 (r260067) @@ -0,0 +1,164 @@ +/* from: FreeBSD: head/lib/msun/src/s_tanhl.c XXX */ + +/* @(#)s_tanh.c 5.1 93/09/24 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * See s_tanh.c for complete comments. + * + * Converted to long double by Bruce D. Evans. + */ + +#include +#ifdef __i386__ +#include +#endif + +#include "math.h" +#include "math_private.h" +#include "fpmath.h" +#include "k_expl.h" + +#if LDBL_MAX_EXP != 0x4000 +/* We also require the usual expsign encoding. */ +#error "Unsupported long double format" +#endif + +#define BIAS (LDBL_MAX_EXP - 1) + +static const volatile double tiny = 1.0e-300; +static const double one = 1.0; +#if LDBL_MANT_DIG == 64 +/* + * Domain [-0.25, 0.25], range ~[-1.6304e-22, 1.6304e-22]: + * |tanh(x)/x - t(x)| < 2**-72.3 + */ +static const union IEEEl2bits +T3u = LD80C(0xaaaaaaaaaaaaaa9f, -2, -3.33333333333333333017e-1L); +#define T3 T3u.e +static const double +T5 = 1.3333333333333314e-1, /* 0x1111111111110a.0p-55 */ +T7 = -5.3968253968210485e-2, /* -0x1ba1ba1ba1a1a1.0p-57 */ +T9 = 2.1869488531393817e-2, /* 0x1664f488172022.0p-58 */ +T11 = -8.8632352345964591e-3, /* -0x1226e34bc138d5.0p-59 */ +T13 = 3.5921169709993771e-3, /* 0x1d6d371d3e400f.0p-61 */ +T15 = -1.4555786415756001e-3, /* -0x17d923aa63814d.0p-62 */ +T17 = 5.8645267876296793e-4, /* 0x13378589b85aa7.0p-63 */ +T19 = -2.1121033571392224e-4; /* -0x1baf0af80c4090.0p-65 */ +#elif LDBL_MANT_DIG == 113 +/* + * Domain [-0.25, 0.25], range ~[-2.4211e-37, 2.4211e-37]: + * |tanh(x)/x - t(x)| < 2**121.6 + */ +static const long double +T3 = -3.33333333333333333333333333333332980e-1L, /* -0x1555555555555555555555555554e.0p-114L */ +T5 = 1.33333333333333333333333333332707260e-1L, /* 0x1111111111111111111111110ab7b.0p-115L */ +T7 = -5.39682539682539682539682535723482314e-2L, /* -0x1ba1ba1ba1ba1ba1ba1ba17b5fc98.0p-117L */ +T9 = 2.18694885361552028218693591149061717e-2L, /* 0x1664f4882c10f9f32d6b1a12a25e5.0p-118L */ +T11 = -8.86323552990219656883762347736381851e-3L, /* -0x1226e355e6c23c8f5a5a0f386cb4d.0p-119L */ +T13 = 3.59212803657248101358314398220822722e-3L, /* 0x1d6d3d0e157ddfb403ad3637442c6.0p-121L */ +T15 = -1.45583438705131796512568010348874662e-3L; /* -0x17da36452b75e150c44cc34253b34.0p-122L */ +static const double +T17 = 5.9002744094556621e-4, /* 0x1355824803668e.0p-63 */ +T19 = -2.3912911424260516e-4, /* -0x1f57d7734c8dde.0p-65 */ +T21 = 9.6915379535512898e-5, /* 0x1967e18ad6a6ca.0p-66 */ +T23 = -3.9278322983156353e-5, /* -0x1497d8e6b75729.0p-67 */ +T25 = 1.5918887220143869e-5, /* 0x10b1319998cafa.0p-68 */ +T27 = -6.4514295231630956e-6, /* -0x1b0f2b71b218eb.0p-70 */ +T29 = 2.6120754043964365e-6, /* 0x15e963a3cf3a39.0p-71 */ +T31 = -1.0407567231003314e-6, /* -0x1176041e656869.0p-72 */ +T33 = 3.4744117554063574e-7; /* 0x1750fe732cab9c.0p-74 */ +#endif /* LDBL_MANT_DIG == 64 */ + +static inline long double +divl(long double a, long double b, long double c, long double d, + long double e, long double f) +{ + long double inv, r, w; + float fr, fw; + uint32_t hx; + + _2sumF(a, c); + b = b + c; + _2sumF(d, f); + e = e + f; + + inv = 1 / (d + e); + + r = (a + b) * inv; + fr = r; + r = fr; + + fw = d + e; + e = d - fw + e; + d = fw; + + r = r + (a - d * r + b - e * r) * inv; + + return r; +} + +long double +tanhl(long double x) +{ + long double hi,lo,s,x2,x4,z; + double dx2; + int16_t jx,ix; + + GET_LDBL_EXPSIGN(jx,x); + ix = jx&0x7fff; + + /* x is INF or NaN */ + if(ix>=0x7fff) { + if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ + else return one/x-one; /* tanh(NaN) = NaN */ + } + + ENTERI(); + + if (fabsl(x) < 40) { /* |x|<40 */ + if (__predict_false(ix= 40, return +-1 */ + } else { + z = one - tiny; /* raise inexact flag */ + } + s = 1; + if (jx<0) s = -1; + RETURNI(s*z); +} From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 01:16:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A19B5F5B; Mon, 30 Dec 2013 01:16:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 826411755; Mon, 30 Dec 2013 01:16:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBU1GAhG062101; Mon, 30 Dec 2013 01:16:10 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBU1G84X062090; Mon, 30 Dec 2013 01:16:08 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201312300116.rBU1G84X062090@svn.freebsd.org> From: Scott Long Date: Mon, 30 Dec 2013 01:16:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260068 - head/sbin/fsck_ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 01:16:10 -0000 Author: scottl Date: Mon Dec 30 01:16:08 2013 New Revision: 260068 URL: http://svnweb.freebsd.org/changeset/base/260068 Log: Add the -R option to allow fsck_ffs to restart itself when too many critical errors have been detected in a particular run. Clean up the global state variables so that a restart can happen correctly. Separate the global variables in fsck_ffs and fsdb to their own file. This fixes header sharing with fscd. Correctly initialize, static-ize, and remove global variables as needed in dir.c. This fixes a problem with lost+found directories that was causing a segfault. Correctly initialize, static-ize, and remove global variables as needed in suj.c. Initialize the suj globals before allocating the disk object, not after. Also ensure that 'preen' mode doesn't conflict with 'restart' mode Submitted by: scottl, max Reviewed by: max, mckusick (earlier version) Obtained from: Netflix MFC after: 3 days Modified: head/sbin/fsck_ffs/Makefile head/sbin/fsck_ffs/dir.c head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsck_ffs.8 head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/main.c head/sbin/fsck_ffs/pass1.c head/sbin/fsck_ffs/pass1b.c head/sbin/fsck_ffs/suj.c head/sbin/fsck_ffs/utilities.c Modified: head/sbin/fsck_ffs/Makefile ============================================================================== --- head/sbin/fsck_ffs/Makefile Mon Dec 30 01:06:21 2013 (r260067) +++ head/sbin/fsck_ffs/Makefile Mon Dec 30 01:16:08 2013 (r260068) @@ -7,7 +7,8 @@ LINKS+= ${BINDIR}/fsck_ffs ${BINDIR}/fsc MAN= fsck_ffs.8 MLINKS= fsck_ffs.8 fsck_ufs.8 fsck_ffs.8 fsck_4.2bsd.8 SRCS= dir.c ea.c fsutil.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c \ - pass4.c pass5.c setup.c suj.c utilities.c gjournal.c getmntopts.c + pass4.c pass5.c setup.c suj.c utilities.c gjournal.c getmntopts.c \ + globs.c DPADD= ${LIBUFS} LDADD= -lufs WARNS?= 2 Modified: head/sbin/fsck_ffs/dir.c ============================================================================== --- head/sbin/fsck_ffs/dir.c Mon Dec 30 01:06:21 2013 (r260067) +++ head/sbin/fsck_ffs/dir.c Mon Dec 30 01:16:08 2013 (r260068) @@ -48,20 +48,14 @@ __FBSDID("$FreeBSD$"); #include "fsck.h" -const char *lfname = "lost+found"; -int lfmode = 0700; -struct dirtemplate emptydir = { +static struct dirtemplate emptydir = { 0, DIRBLKSIZ, DT_UNKNOWN, 0, "", 0, 0, DT_UNKNOWN, 0, "" }; -struct dirtemplate dirhead = { +static struct dirtemplate dirhead = { 0, 12, DT_DIR, 1, ".", 0, DIRBLKSIZ - 12, DT_DIR, 2, ".." }; -struct odirtemplate odirhead = { - 0, 12, 1, ".", - 0, DIRBLKSIZ - 12, 2, ".." -}; static int chgino(struct inodesc *); static int dircheck(struct inodesc *, struct direct *); @@ -133,6 +127,7 @@ dirscan(struct inodesc *idesc) (size_t)dsize); dirty(bp); sbdirty(); + rerun = 1; } if (n & STOP) return (n); Modified: head/sbin/fsck_ffs/fsck.h ============================================================================== --- head/sbin/fsck_ffs/fsck.h Mon Dec 30 01:06:21 2013 (r260067) +++ head/sbin/fsck_ffs/fsck.h Mon Dec 30 01:16:08 2013 (r260068) @@ -192,15 +192,15 @@ struct bufarea { "Inode Block", \ "Directory Contents", \ "User Data" } -long readcnt[BT_NUMBUFTYPES]; -long totalreadcnt[BT_NUMBUFTYPES]; -struct timespec readtime[BT_NUMBUFTYPES]; -struct timespec totalreadtime[BT_NUMBUFTYPES]; -struct timespec startprog; - -struct bufarea sblk; /* file system superblock */ -struct bufarea *pdirbp; /* current directory contents */ -struct bufarea *pbp; /* current inode block */ +extern long readcnt[BT_NUMBUFTYPES]; +extern long totalreadcnt[BT_NUMBUFTYPES]; +extern struct timespec readtime[BT_NUMBUFTYPES]; +extern struct timespec totalreadtime[BT_NUMBUFTYPES]; +extern struct timespec startprog; + +extern struct bufarea sblk; /* file system superblock */ +extern struct bufarea *pdirbp; /* current directory contents */ +extern struct bufarea *pbp; /* current inode block */ #define dirty(bp) do { \ if (fswritefd < 0) \ @@ -219,7 +219,7 @@ struct bufarea *pbp; /* current inode b #define sblock (*sblk.b_un.b_fs) enum fixstate {DONTKNOW, NOFIX, FIX, IGNORE}; -ino_t cursnapshot; +extern ino_t cursnapshot; struct inodesc { enum fixstate id_fix; /* policy on fixing errors */ @@ -282,63 +282,64 @@ struct inoinfo { u_int i_numblks; /* size of block array in bytes */ ufs2_daddr_t i_blks[1]; /* actually longer */ } **inphead, **inpsort; -long numdirs, dirhash, listmax, inplast; -long countdirs; /* number of directories we actually found */ +extern long numdirs, dirhash, listmax, inplast; +extern long countdirs; /* number of directories we actually found */ #define MIBSIZE 3 /* size of fsck sysctl MIBs */ -int adjrefcnt[MIBSIZE]; /* MIB command to adjust inode reference cnt */ -int adjblkcnt[MIBSIZE]; /* MIB command to adjust inode block count */ -int adjndir[MIBSIZE]; /* MIB command to adjust number of directories */ -int adjnbfree[MIBSIZE]; /* MIB command to adjust number of free blocks */ -int adjnifree[MIBSIZE]; /* MIB command to adjust number of free inodes */ -int adjnffree[MIBSIZE]; /* MIB command to adjust number of free frags */ -int adjnumclusters[MIBSIZE]; /* MIB command to adjust number of free clusters */ -int freefiles[MIBSIZE]; /* MIB command to free a set of files */ -int freedirs[MIBSIZE]; /* MIB command to free a set of directories */ -int freeblks[MIBSIZE]; /* MIB command to free a set of data blocks */ -struct fsck_cmd cmd; /* sysctl file system update commands */ -char snapname[BUFSIZ]; /* when doing snapshots, the name of the file */ -char *cdevname; /* name of device being checked */ -long dev_bsize; /* computed value of DEV_BSIZE */ -long secsize; /* actual disk sector size */ -u_int real_dev_bsize; /* actual disk sector size, not overriden */ -char nflag; /* assume a no response */ -char yflag; /* assume a yes response */ -int bkgrdflag; /* use a snapshot to run on an active system */ -int bflag; /* location of alternate super block */ -int debug; /* output debugging info */ -int Eflag; /* delete empty data blocks */ -int Zflag; /* zero empty data blocks */ -int inoopt; /* trim out unused inodes */ -char ckclean; /* only do work if not cleanly unmounted */ -int cvtlevel; /* convert to newer file system format */ -int bkgrdcheck; /* determine if background check is possible */ -int bkgrdsumadj; /* whether the kernel have ability to adjust superblock summary */ -char usedsoftdep; /* just fix soft dependency inconsistencies */ -char preen; /* just fix normal inconsistencies */ -char rerun; /* rerun fsck. Only used in non-preen mode */ -int returntosingle; /* 1 => return to single user mode on exit */ -char resolved; /* cleared if unresolved changes => not clean */ -char havesb; /* superblock has been read */ -char skipclean; /* skip clean file systems if preening */ -int fsmodified; /* 1 => write done to file system */ -int fsreadfd; /* file descriptor for reading file system */ -int fswritefd; /* file descriptor for writing file system */ -int surrender; /* Give up if reads fail */ - -ufs2_daddr_t maxfsblock; /* number of blocks in the file system */ -char *blockmap; /* ptr to primary blk allocation map */ -ino_t maxino; /* number of inodes in file system */ - -ino_t lfdir; /* lost & found directory inode number */ -const char *lfname; /* lost & found directory name */ -int lfmode; /* lost & found directory creation mode */ +extern int adjrefcnt[MIBSIZE]; /* MIB command to adjust inode reference cnt */ +extern int adjblkcnt[MIBSIZE]; /* MIB command to adjust inode block count */ +extern int adjndir[MIBSIZE]; /* MIB command to adjust number of directories */ +extern int adjnbfree[MIBSIZE]; /* MIB command to adjust number of free blocks */ +extern int adjnifree[MIBSIZE]; /* MIB command to adjust number of free inodes */ +extern int adjnffree[MIBSIZE]; /* MIB command to adjust number of free frags */ +extern int adjnumclusters[MIBSIZE]; /* MIB command to adjust number of free clusters */ +extern int freefiles[MIBSIZE]; /* MIB command to free a set of files */ +extern int freedirs[MIBSIZE]; /* MIB command to free a set of directories */ +extern int freeblks[MIBSIZE]; /* MIB command to free a set of data blocks */ +extern struct fsck_cmd cmd; /* sysctl file system update commands */ +extern char snapname[BUFSIZ]; /* when doing snapshots, the name of the file */ +extern char *cdevname; /* name of device being checked */ +extern long dev_bsize; /* computed value of DEV_BSIZE */ +extern long secsize; /* actual disk sector size */ +extern u_int real_dev_bsize; /* actual disk sector size, not overriden */ +extern char nflag; /* assume a no response */ +extern char yflag; /* assume a yes response */ +extern int bkgrdflag; /* use a snapshot to run on an active system */ +extern int bflag; /* location of alternate super block */ +extern int debug; /* output debugging info */ +extern int Eflag; /* delete empty data blocks */ +extern int Zflag; /* zero empty data blocks */ +extern int inoopt; /* trim out unused inodes */ +extern char ckclean; /* only do work if not cleanly unmounted */ +extern int cvtlevel; /* convert to newer file system format */ +extern int bkgrdcheck; /* determine if background check is possible */ +extern int bkgrdsumadj; /* whether the kernel have ability to adjust superblock summary */ +extern char usedsoftdep; /* just fix soft dependency inconsistencies */ +extern char preen; /* just fix normal inconsistencies */ +extern char rerun; /* rerun fsck. Only used in non-preen mode */ +extern int returntosingle; /* 1 => return to single user mode on exit */ +extern char resolved; /* cleared if unresolved changes => not clean */ +extern char havesb; /* superblock has been read */ +extern char skipclean; /* skip clean file systems if preening */ +extern int fsmodified; /* 1 => write done to file system */ +extern int fsreadfd; /* file descriptor for reading file system */ +extern int fswritefd; /* file descriptor for writing file system */ +extern int surrender; /* Give up if reads fail */ +extern int wantrestart; /* Restart fsck on early termination */ + +extern ufs2_daddr_t maxfsblock; /* number of blocks in the file system */ +extern char *blockmap; /* ptr to primary blk allocation map */ +extern ino_t maxino; /* number of inodes in file system */ + +extern ino_t lfdir; /* lost & found directory inode number */ +extern const char *lfname; /* lost & found directory name */ +extern int lfmode; /* lost & found directory creation mode */ -ufs2_daddr_t n_blks; /* number of blocks in use */ -ino_t n_files; /* number of files in use */ +extern ufs2_daddr_t n_blks; /* number of blocks in use */ +extern ino_t n_files; /* number of files in use */ -volatile sig_atomic_t got_siginfo; /* received a SIGINFO */ -volatile sig_atomic_t got_sigalarm; /* received a SIGALRM */ +extern volatile sig_atomic_t got_siginfo; /* received a SIGINFO */ +extern volatile sig_atomic_t got_sigalarm; /* received a SIGALRM */ #define clearinode(dp) \ if (sblock.fs_magic == FS_UFS1_MAGIC) { \ @@ -346,8 +347,8 @@ volatile sig_atomic_t got_sigalarm; /* r } else { \ (dp)->dp2 = ufs2_zino; \ } -struct ufs1_dinode ufs1_zino; -struct ufs2_dinode ufs2_zino; +extern struct ufs1_dinode ufs1_zino; +extern struct ufs2_dinode ufs2_zino; #define setbmap(blkno) setbit(blockmap, blkno) #define testbmap(blkno) isset(blockmap, blkno) @@ -360,6 +361,7 @@ struct ufs2_dinode ufs2_zino; #define FOUND 0x10 #define EEXIT 8 /* Standard error exit. */ +#define ERESTART -1 int flushentry(void); /* @@ -428,6 +430,7 @@ void flush(int fd, struct bufarea *bp); void freeblk(ufs2_daddr_t blkno, long frags); void freeino(ino_t ino); void freeinodebuf(void); +void fsutilinit(void); int ftypeok(union dinode *dp); void getblk(struct bufarea *bp, ufs2_daddr_t blk, long size); struct bufarea *cgget(int cg); @@ -466,5 +469,6 @@ int setup(char *dev); void gjournal_check(const char *filesys); int suj_check(const char *filesys); void update_maps(struct cg *, struct cg*, int); +void fsckinit(void); #endif /* !_FSCK_H_ */ Modified: head/sbin/fsck_ffs/fsck_ffs.8 ============================================================================== --- head/sbin/fsck_ffs/fsck_ffs.8 Mon Dec 30 01:06:21 2013 (r260067) +++ head/sbin/fsck_ffs/fsck_ffs.8 Mon Dec 30 01:16:08 2013 (r260068) @@ -38,7 +38,7 @@ .Nd file system consistency check and interactive repair .Sh SYNOPSIS .Nm -.Op Fl BEFfnpryZ +.Op Fl BEFfnpRryZ .Op Fl b Ar block .Op Fl c Ar level .Op Fl m Ar mode @@ -266,6 +266,11 @@ which is assumed to be affirmative; do not open the file system for writing. .It Fl p Preen file systems (see above). +.It Fl R +Instruct fsck_ffs to restart itself if it encounters certain errors that +warrant another run. It will limit itself to a maximum of 10 restarts +in a given run in order to avoid an endless loop with extremely corrupted +filesystems. .It Fl r Free up excess unused inodes. Decreasing the number of preallocated inodes reduces the Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Mon Dec 30 01:06:21 2013 (r260067) +++ head/sbin/fsck_ffs/fsutil.c Mon Dec 30 01:16:08 2013 (r260068) @@ -74,6 +74,25 @@ static struct bufarea cgblk; /* backup b static TAILQ_HEAD(buflist, bufarea) bufhead; /* head of buffer cache list */ static int numbufs; /* size of buffer cache */ static char *buftype[BT_NUMBUFTYPES] = BT_NAMES; +static struct bufarea *cgbufs; /* header for cylinder group cache */ +static int flushtries; /* number of tries to reclaim memory */ + +void +fsutilinit(void) +{ + diskreads = totaldiskreads = totalreads = 0; + bzero(&startpass, sizeof(struct timespec)); + bzero(&finishpass, sizeof(struct timespec)); + bzero(&slowio_starttime, sizeof(struct timeval)); + slowio_delay_usec = 10000; + slowio_pollcnt = 0; + bzero(&cgblk, sizeof(struct bufarea)); + TAILQ_INIT(&bufhead); + numbufs = 0; + /* buftype ? */ + cgbufs = NULL; + flushtries = 0; +} int ftypeok(union dinode *dp) Modified: head/sbin/fsck_ffs/main.c ============================================================================== --- head/sbin/fsck_ffs/main.c Mon Dec 30 01:06:21 2013 (r260067) +++ head/sbin/fsck_ffs/main.c Mon Dec 30 01:16:08 2013 (r260068) @@ -65,6 +65,8 @@ __FBSDID("$FreeBSD$"); #include "fsck.h" +int restarts; + static void usage(void) __dead2; static int argtoi(int flag, const char *req, const char *str, int base); static int checkfilesys(char *filesys); @@ -82,7 +84,7 @@ main(int argc, char *argv[]) sync(); skipclean = 1; inoopt = 0; - while ((ch = getopt(argc, argv, "b:Bc:CdEfFm:nprSyZ")) != -1) { + while ((ch = getopt(argc, argv, "b:Bc:CdEfFm:npRrSyZ")) != -1) { switch (ch) { case 'b': skipclean = 0; @@ -138,6 +140,9 @@ main(int argc, char *argv[]) ckclean++; break; + case 'R': + wantrestart = 1; + break; case 'r': inoopt++; break; @@ -186,8 +191,12 @@ main(int argc, char *argv[]) rlimit.rlim_cur = rlimit.rlim_max; (void)setrlimit(RLIMIT_DATA, &rlimit); } - while (argc-- > 0) - (void)checkfilesys(*argv++); + while (argc > 0) { + if (checkfilesys(*argv) == ERESTART) + continue; + argc--; + argv++; + } if (returntosingle) ret = 2; @@ -228,6 +237,8 @@ checkfilesys(char *filesys) iov = NULL; iovlen = 0; errmsg[0] = '\0'; + fsutilinit(); + fsckinit(); cdevname = filesys; if (debug && ckclean) @@ -550,8 +561,12 @@ checkfilesys(char *filesys) inostathead = NULL; if (fsmodified && !preen) printf("\n***** FILE SYSTEM WAS MODIFIED *****\n"); - if (rerun) + if (rerun) { + if (wantrestart && (restarts++ < 10) && + (preen || reply("RESTART"))) + return (ERESTART); printf("\n***** PLEASE RERUN FSCK *****\n"); + } if (chkdoreload(mntp) != 0) { if (!fsmodified) return (0); @@ -654,3 +669,15 @@ usage(void) getprogname()); exit(1); } + +void +infohandler(int sig __unused) +{ + got_siginfo = 1; +} + +void +alarmhandler(int sig __unused) +{ + got_sigalarm = 1; +} Modified: head/sbin/fsck_ffs/pass1.c ============================================================================== --- head/sbin/fsck_ffs/pass1.c Mon Dec 30 01:06:21 2013 (r260067) +++ head/sbin/fsck_ffs/pass1.c Mon Dec 30 01:16:08 2013 (r260068) @@ -68,6 +68,8 @@ pass1(void) u_int8_t *cp; int c, rebuildcg; + badblk = dupblk = lastino = 0; + /* * Set file system reserved blocks in used block map. */ @@ -463,6 +465,7 @@ pass1check(struct inodesc *idesc) ckfini(0); exit(EEXIT); } + rerun = 1; return (STOP); } } @@ -483,6 +486,7 @@ pass1check(struct inodesc *idesc) ckfini(0); exit(EEXIT); } + rerun = 1; return (STOP); } new = (struct dups *)Malloc(sizeof(struct dups)); @@ -492,6 +496,7 @@ pass1check(struct inodesc *idesc) ckfini(0); exit(EEXIT); } + rerun = 1; return (STOP); } new->dup = blkno; Modified: head/sbin/fsck_ffs/pass1b.c ============================================================================== --- head/sbin/fsck_ffs/pass1b.c Mon Dec 30 01:06:21 2013 (r260067) +++ head/sbin/fsck_ffs/pass1b.c Mon Dec 30 01:16:08 2013 (r260068) @@ -80,8 +80,10 @@ pass1b(void) continue; idesc.id_number = inumber; if (inoinfo(inumber)->ino_state != USTATE && - (ckinode(dp, &idesc) & STOP)) + (ckinode(dp, &idesc) & STOP)) { + rerun = 1; return; + } } } } @@ -106,8 +108,10 @@ pass1bcheck(struct inodesc *idesc) if (dlp == muldup) break; } - if (muldup == 0 || duphead == muldup->next) + if (muldup == 0 || duphead == muldup->next) { + rerun = 1; return (STOP); + } } return (res); } Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Mon Dec 30 01:06:21 2013 (r260067) +++ head/sbin/fsck_ffs/suj.c Mon Dec 30 01:16:08 2013 (r260068) @@ -125,26 +125,26 @@ struct suj_cg { int sc_cgx; }; -LIST_HEAD(cghd, suj_cg) cghash[SUJ_HASHSIZE]; -LIST_HEAD(dblkhd, data_blk) dbhash[SUJ_HASHSIZE]; -struct suj_cg *lastcg; -struct data_blk *lastblk; +static LIST_HEAD(cghd, suj_cg) cghash[SUJ_HASHSIZE]; +static LIST_HEAD(dblkhd, data_blk) dbhash[SUJ_HASHSIZE]; +static struct suj_cg *lastcg; +static struct data_blk *lastblk; -TAILQ_HEAD(seghd, suj_seg) allsegs; -uint64_t oldseq; +static TAILQ_HEAD(seghd, suj_seg) allsegs; +static uint64_t oldseq; static struct uufsd *disk = NULL; static struct fs *fs = NULL; -ino_t sujino; +static ino_t sujino; /* * Summary statistics. */ -uint64_t freefrags; -uint64_t freeblocks; -uint64_t freeinos; -uint64_t freedir; -uint64_t jbytes; -uint64_t jrecs; +static uint64_t freefrags; +static uint64_t freeblocks; +static uint64_t freeinos; +static uint64_t freedir; +static uint64_t jbytes; +static uint64_t jrecs; static jmp_buf jmpbuf; @@ -155,6 +155,7 @@ static void ino_decr(ino_t); static void ino_adjust(struct suj_ino *); static void ino_build(struct suj_ino *); static int blk_isfree(ufs2_daddr_t); +static void initsuj(void); static void * errmalloc(size_t n) @@ -2413,7 +2414,7 @@ struct jextent { int je_blocks; /* Disk block count. */ }; -struct jblocks *suj_jblocks; +static struct jblocks *suj_jblocks; static struct jblocks * jblocks_create(void) @@ -2673,8 +2674,8 @@ suj_check(const char *filesys) struct suj_seg *seg; struct suj_seg *segn; + initsuj(); opendisk(filesys); - TAILQ_INIT(&allsegs); /* * Set an exit point when SUJ check failed @@ -2763,3 +2764,28 @@ suj_check(const char *filesys) return (0); } + +static void +initsuj(void) +{ + int i; + + for (i = 0; i < SUJ_HASHSIZE; i++) { + LIST_INIT(&cghash[i]); + LIST_INIT(&dbhash[i]); + } + lastcg = NULL; + lastblk = NULL; + TAILQ_INIT(&allsegs); + oldseq = 0; + disk = NULL; + fs = NULL; + sujino = 0; + freefrags = 0; + freeblocks = 0; + freeinos = 0; + freedir = 0; + jbytes = 0; + jrecs = 0; + suj_jblocks = NULL; +} Modified: head/sbin/fsck_ffs/utilities.c ============================================================================== --- head/sbin/fsck_ffs/utilities.c Mon Dec 30 01:06:21 2013 (r260067) +++ head/sbin/fsck_ffs/utilities.c Mon Dec 30 01:16:08 2013 (r260068) @@ -108,14 +108,3 @@ retry: return (origname); } -void -infohandler(int sig __unused) -{ - got_siginfo = 1; -} - -void -alarmhandler(int sig __unused) -{ - got_sigalarm = 1; -} From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 01:17:06 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2B4C8139; Mon, 30 Dec 2013 01:17:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1770B175F; Mon, 30 Dec 2013 01:17:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBU1H5x1062237; Mon, 30 Dec 2013 01:17:05 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBU1H5xm062236; Mon, 30 Dec 2013 01:17:05 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201312300117.rBU1H5xm062236@svn.freebsd.org> From: Scott Long Date: Mon, 30 Dec 2013 01:17:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260069 - head/sbin/fsdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 01:17:06 -0000 Author: scottl Date: Mon Dec 30 01:17:05 2013 New Revision: 260069 URL: http://svnweb.freebsd.org/changeset/base/260069 Log: Add globs.c to the build now that it's a separate file. Reviewed by: max Obtained from: Netflix MFC after: 3 days Modified: head/sbin/fsdb/Makefile Modified: head/sbin/fsdb/Makefile ============================================================================== --- head/sbin/fsdb/Makefile Mon Dec 30 01:16:08 2013 (r260068) +++ head/sbin/fsdb/Makefile Mon Dec 30 01:17:05 2013 (r260069) @@ -6,7 +6,7 @@ PROG= fsdb MAN= fsdb.8 SRCS= fsdb.c fsdbutil.c \ dir.c ea.c fsutil.c inode.c pass1.c pass1b.c pass2.c pass3.c pass4.c \ - pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c + pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c globs.c CFLAGS+= -I${.CURDIR}/../fsck_ffs WARNS?= 2 LDADD= -ledit -ltermcap From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 01:32:18 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0CCC2551; Mon, 30 Dec 2013 01:32:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ED3E4186E; Mon, 30 Dec 2013 01:32:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBU1WHqJ068936; Mon, 30 Dec 2013 01:32:17 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBU1WH7H068933; Mon, 30 Dec 2013 01:32:17 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201312300132.rBU1WH7H068933@svn.freebsd.org> From: Scott Long Date: Mon, 30 Dec 2013 01:32:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260070 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 01:32:18 -0000 Author: scottl Date: Mon Dec 30 01:32:17 2013 New Revision: 260070 URL: http://svnweb.freebsd.org/changeset/base/260070 Log: Multi-queue NIC drivers and multi-port lagg tend to use the same lower bits of the flowid as each other, resulting in a poor distribution of packets among queues in certain cases. Work around this by adding a set of sysctls for controlling a bit-shift on the flowid when doing multi-port aggrigation in lagg and lacp. By default, lagg/lacp will now use bits 16 and higher instead of 0 and higher. Reviewed by: max Obtained from: Netflix MFC after: 3 days Modified: head/sys/net/ieee8023ad_lacp.c head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sys/net/ieee8023ad_lacp.c ============================================================================== --- head/sys/net/ieee8023ad_lacp.c Mon Dec 30 01:17:05 2013 (r260069) +++ head/sys/net/ieee8023ad_lacp.c Mon Dec 30 01:32:17 2013 (r260070) @@ -877,7 +877,7 @@ lacp_select_tx_port(struct lagg_softc *s } if (sc->use_flowid && (m->m_flags & M_FLOWID)) - hash = m->m_pkthdr.flowid; + hash = m->m_pkthdr.flowid >> sc->flowid_shift; else hash = lagg_hashmbuf(sc, m, lsc->lsc_hashkey); hash %= pm->pm_count; Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Mon Dec 30 01:17:05 2013 (r260069) +++ head/sys/net/if_lagg.c Mon Dec 30 01:32:17 2013 (r260070) @@ -184,6 +184,11 @@ TUNABLE_INT("net.link.lagg.default_use_f SYSCTL_INT(_net_link_lagg, OID_AUTO, default_use_flowid, CTLFLAG_RW, &def_use_flowid, 0, "Default setting for using flow id for load sharing"); +static int def_flowid_shift = 16; /* Default value for using M_FLOWID */ +TUNABLE_INT("net.link.lagg.default_flowid_shift", &def_flowid_shift); +SYSCTL_INT(_net_link_lagg, OID_AUTO, default_flowid_shift, CTLFLAG_RW, + &def_flowid_shift, 0, + "Default setting for flowid shift for load sharing"); static int lagg_modevent(module_t mod, int type, void *data) @@ -293,12 +298,17 @@ lagg_clone_create(struct if_clone *ifc, sysctl_ctx_init(&sc->ctx); snprintf(num, sizeof(num), "%u", unit); sc->use_flowid = def_use_flowid; + sc->flowid_shift = def_flowid_shift; sc->sc_oid = oid = SYSCTL_ADD_NODE(&sc->ctx, &SYSCTL_NODE_CHILDREN(_net_link, lagg), OID_AUTO, num, CTLFLAG_RD, NULL, ""); SYSCTL_ADD_INT(&sc->ctx, SYSCTL_CHILDREN(oid), OID_AUTO, - "use_flowid", CTLTYPE_INT|CTLFLAG_RW, &sc->use_flowid, sc->use_flowid, - "Use flow id for load sharing"); + "use_flowid", CTLTYPE_INT|CTLFLAG_RW, &sc->use_flowid, + sc->use_flowid, "Use flow id for load sharing"); + SYSCTL_ADD_INT(&sc->ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + "flowid_shift", CTLTYPE_INT|CTLFLAG_RW, &sc->flowid_shift, + sc->flowid_shift, + "Shift flowid bits to prevent multiqueue collisions"); SYSCTL_ADD_INT(&sc->ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "count", CTLTYPE_INT|CTLFLAG_RD, &sc->sc_count, sc->sc_count, "Total number of ports"); @@ -1850,7 +1860,7 @@ lagg_lb_start(struct lagg_softc *sc, str uint32_t p = 0; if (sc->use_flowid && (m->m_flags & M_FLOWID)) - p = m->m_pkthdr.flowid; + p = m->m_pkthdr.flowid >> sc->flowid_shift; else p = lagg_hashmbuf(sc, m, lb->lb_key); p %= sc->sc_count; Modified: head/sys/net/if_lagg.h ============================================================================== --- head/sys/net/if_lagg.h Mon Dec 30 01:17:05 2013 (r260069) +++ head/sys/net/if_lagg.h Mon Dec 30 01:32:17 2013 (r260070) @@ -231,6 +231,7 @@ struct lagg_softc { struct sysctl_ctx_list ctx; /* sysctl variables */ struct sysctl_oid *sc_oid; /* sysctl tree oid */ int use_flowid; /* use M_FLOWID */ + int flowid_shift; /* shift the flowid */ }; struct lagg_port { From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 01:41:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B42F894 for ; Mon, 30 Dec 2013 01:41:33 +0000 (UTC) Received: from nm15-vm6.bullet.mail.ne1.yahoo.com (nm15-vm6.bullet.mail.ne1.yahoo.com [98.138.91.108]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BEBA618F0 for ; Mon, 30 Dec 2013 01:41:32 +0000 (UTC) Received: from [98.138.101.129] by nm15.bullet.mail.ne1.yahoo.com with NNFMP; 30 Dec 2013 01:36:04 -0000 Received: from [98.138.84.41] by tm17.bullet.mail.ne1.yahoo.com with NNFMP; 30 Dec 2013 01:36:04 -0000 Received: from [127.0.0.1] by smtp109.mail.ne1.yahoo.com with NNFMP; 30 Dec 2013 01:36:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1388367364; bh=chi1UUPnrgDPi7VEOCjCbGGLN6TSyPiG/t+DbMjylnE=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=EYw2Xx2VRI6pSNHEy2xSKMTNEUhH1FbA6Z7g9P+pT3BkG9d4DVoNpqsU3jLL9ZWNQgosuoW5USO4Rg/WC0s/8gxJn6kgnBfIUpwfGH2+y5u72dUugG+K76azqdEcGqhXmLSksRIHiyWK+qDpYZzM6m7Kmibw3zE7FidYb8jvWB0= X-Yahoo-Newman-Id: 156983.82151.bm@smtp109.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: eCLRElsVM1kVXLDu3WZeqtkazabaETkY2_YAwhGNDFl0uP1 fzhn5VhXc__jVJGV8w400S3BU1hqqxpD0KjoCLGcLmSNkXWmvbos2jJzQ4KM E9v6.XqQhkfze6Hd0kNnlL2FRVDboHROpNxFdZY7JW0yrjr0deUjyrhiuJHT dp70N8PUr7Gd9KEITijw7seAMN0Ght1v.jxYUKPx_PUs0pSyepLz0YEVAT4w tZbeUXVykzyErASMc4oAj8JoAjf.YIWnMzOIwP1LaLnViJHXPY4o.9p6hiGt MG8kdSp2E8pZBFyX6r9LCx.Kcoy0OgWJVcrD6bZvE6SoyKRvfDpm_5OiWAvt .MpkmB9HvuiDGN7pXwsdACfTrO9eOUeCn6uu92RtIakXv8Q_m_ocr2KKX.hu ea1nroO_3MfvC_rp7aEiWVHOaaQ_GxmPcX0ih2vt6qzjEen1m5Hal2yeBLz7 JwWGreN97KmXeDZKunisNYLno4y5Qr32yexf5zofBkw0WGVOR3RmiX1beYjS wv4Qyw4vrDty0fS8en_kRzDFoDmufUs5oClFhgKprd0fPt_4Z9BWvVz6CAwM h1amq8uMF0Ta2gQ-- X-Yahoo-SMTP: clhABp.swBB7fs.LwIJpv3jkWgo2NU8- X-Rocket-Received: from lglt-nvaradarajan.corp.netflix.com (scott4long@69.53.236.251 with plain [98.139.211.125]) by smtp109.mail.ne1.yahoo.com with SMTP; 29 Dec 2013 17:36:04 -0800 PST Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r259896 - head/sys/dev/cxgb/common From: Scott Long In-Reply-To: <20131229212825.GE99167@funkthat.com> Date: Sun, 29 Dec 2013 18:35:59 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <7E3BD20D-C9EB-46B4-8744-D7F99100E408@yahoo.com> References: <201312252245.rBPMjX5J046556@svn.freebsd.org> <76C5CECF-1A27-4245-B5D1-335C46B253E7@FreeBSD.org> <52C08B47.70106@FreeBSD.org> <20131229212825.GE99167@funkthat.com> To: John-Mark Gurney , Pedro Giffuni , Adrian Chadd , Dimitry Andric X-Mailer: Apple Mail (2.1827) 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.17 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, 30 Dec 2013 01:41:33 -0000 On Dec 29, 2013, at 2:28 PM, John-Mark Gurney wrote: > Pedro Giffuni wrote this message on Sun, Dec 29, 2013 at 15:51 -0500: >> On 26.12.2013 06:13, Dimitry Andric wrote: >>> On 26 Dec 2013, at 02:51, Adrian Chadd wrote: >>>> I'd prefer you didn't remove unused code in drivers like this. If = you >>>> must, #if 0 them out. >>> I don't mind either way, but some other people are very much opposed = to >>> littering code with #if 0'd sections. So, how do to determine what = is >>> right in each situation? :-) >>>=20 >>=20 >> FWIW, I am also in favor of removing instead of #if 0. >> If we really need the code back, we have subversion for that. >>=20 >> I guess an exception would be on contributed code, where one >> still wants to keep things similar. >>=20 >> Just my 0.02$, no strong feelings about either way. >=20 > My vote for code like this to #if 0 it out.. The reason being is > that this is generic hardware register access, and it's likely that > if it is removed and someone needs it, they'll write their own > instead of dig it out of history, since they might not even realize > that it even existed... >=20 > Though can't we annotate it as unused? Since it is static inline, the > compiler should end up not including it in the object. >=20 Since it=92s code that has an active maintainer, why not ask him instead of pretending that all of our opinions are more important? Scott From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 02:52:45 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7A38C24E; Mon, 30 Dec 2013 02:52:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5A7BC1D76; Mon, 30 Dec 2013 02:52:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBU2qjnk098619; Mon, 30 Dec 2013 02:52:45 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBU2qhYK098609; Mon, 30 Dec 2013 02:52:43 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312300252.rBU2qhYK098609@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 30 Dec 2013 02:52:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260073 - in head/contrib/gcc: . cp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 02:52:45 -0000 Author: pfg Date: Mon Dec 30 02:52:43 2013 New Revision: 260073 URL: http://svnweb.freebsd.org/changeset/base/260073 Log: gcc: small diff reduction wrt gcc43 and Apple GCC. Obtained from: gcc 4.3 (rev. 121464, 122528, 124106; GPLv2) MFC after: 3 weeks Modified: head/contrib/gcc/ChangeLog.gcc43 head/contrib/gcc/cp/ChangeLog head/contrib/gcc/cp/g++spec.c head/contrib/gcc/libgcc2.c head/contrib/gcc/libgcc2.h head/contrib/gcc/loop-init.c head/contrib/gcc/toplev.c head/contrib/gcc/tree-ssa-address.c Modified: head/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- head/contrib/gcc/ChangeLog.gcc43 Mon Dec 30 02:19:48 2013 (r260072) +++ head/contrib/gcc/ChangeLog.gcc43 Mon Dec 30 02:52:43 2013 (r260073) @@ -156,6 +156,15 @@ * reload1.c (merge_assigned_reloads) : Do not merge a RELOAD_OTHER instruction with a RELOAD_FOR_OPERAND_ADDRESS instruction. +2007-04-24 Richard Henderson (r124106) + + * libgcc2.h (AVOID_FP_TYPE_CONVERSION): Rename from + IS_IBM_EXTENDED. Also define in terms of WIDEST_HARDWARE_FP_SIZE. + * libgcc2.c (__floatdisf): Avoid double-word arithmetic when + looking for non-zero bits shifted out. Avoid a recursive call + when constructing the scalar. + (__floatundisf): Likewise. + 2007-04-16 Lawrence Crowl (r123909) * doc/invoke.texi (Debugging Options): Add documentation for the @@ -248,6 +257,11 @@ * tree-vrp.c (vrp_int_const_binop): Handle PLUS_EXPR and the *_DIV_EXPR codes correctly with overflow infinities. +2007-03-04 Zdenek Dvorak (r122528) + + * tree-ssa-address.c (create_mem_ref): Do not put an expression + containing a cast to the base of TARGET_MEM_REF. + 2007-02-09 Dwarakanath Rajagopal (r121763) * config/i386/driver-i386.c: Turn on -mtune=native for AMDFAM10. @@ -424,6 +438,11 @@ and amdfam10. * doc/extend.texi: Add documentation for SSE4A builtins. +2007-02-01 Zdenek Dvorak (r121464) + + * toplev.c (lang_dependent_init): Call init_set_costs. + * loop-init.c (loop_optimizer_init): Do not call init_set_costs. + 2007-01-24 Jakub Jelinek (r121140) * config/i386/i386.h (x86_cmpxchg16b): Remove const. Modified: head/contrib/gcc/cp/ChangeLog ============================================================================== --- head/contrib/gcc/cp/ChangeLog Mon Dec 30 02:19:48 2013 (r260072) +++ head/contrib/gcc/cp/ChangeLog Mon Dec 30 02:52:43 2013 (r260073) @@ -314,6 +314,12 @@ PR c++/30895 * tree.c (cp_tree_equal): Properly handle COMPLEX_CST trees. +2007-03-02 Geoffrey Keating (r122488) + + * g++spec.c (lang_specific_driver): Add -lstdc++ when compiling + Objective-C++. Don't exit early if -shared-libgcc needs to be + added. + 2007-02-22 Simon Martin PR c++/29475 Modified: head/contrib/gcc/cp/g++spec.c ============================================================================== --- head/contrib/gcc/cp/g++spec.c Mon Dec 30 02:19:48 2013 (r260072) +++ head/contrib/gcc/cp/g++spec.c Mon Dec 30 02:52:43 2013 (r260073) @@ -159,11 +159,19 @@ lang_specific_driver (int *in_argc, cons arg = ""; if (library == 0 && (strcmp (arg, "c++") == 0 - || strcmp (arg, "c++-cpp-output") == 0)) + || strcmp (arg, "c++-cpp-output") == 0 + || strcmp (arg, "objective-c++") == 0 + || strcmp (arg, "objective-c++-cpp-output") == 0)) library = 1; saw_speclang = 1; } + else if (strcmp (argv[i], "-ObjC++") == 0) + { + if (library == 0) + library = 1; + saw_speclang = 1; + } /* Arguments that go directly to the linker might be .o files, or something, and so might cause libstdc++ to be needed. */ else if (strcmp (argv[i], "-Xlinker") == 0) @@ -237,13 +245,6 @@ lang_specific_driver (int *in_argc, cons if (quote) fatal ("argument to '%s' missing\n", quote); - /* If we know we don't have to do anything, bail now. */ - if (! added && library <= 0) - { - free (args); - return; - } - /* There's no point adding -shared-libgcc if we don't have a shared libgcc. */ #ifndef ENABLE_SHARED_LIBGCC Modified: head/contrib/gcc/libgcc2.c ============================================================================== --- head/contrib/gcc/libgcc2.c Mon Dec 30 02:19:48 2013 (r260072) +++ head/contrib/gcc/libgcc2.c Mon Dec 30 02:52:43 2013 (r260073) @@ -1420,11 +1420,7 @@ __floatunditf (UDWtype u) #define F_MODE_OK(SIZE) \ (SIZE < DI_SIZE \ && SIZE > (DI_SIZE - SIZE + FSSIZE) \ - /* Don't use IBM Extended Double TFmode for TI->SF calculations. \ - The conversion from long double to float suffers from double \ - rounding, because we convert via double. In any case, the \ - fallback code is faster. */ \ - && !IS_IBM_EXTENDED (SIZE)) + && !AVOID_FP_TYPE_CONVERSION(SIZE)) #if defined(L_floatdisf) #define FUNC __floatdisf #define FSTYPE SFtype @@ -1515,13 +1511,21 @@ FUNC (DWtype u) hi = u >> shift; /* If we lost any nonzero bits, set the lsb to ensure correct rounding. */ - if (u & (((DWtype)1 << shift) - 1)) + if ((UWtype)u << (W_TYPE_SIZE - shift)) hi |= 1; /* Convert the one word of data, and rescale. */ - FSTYPE f = hi; - f *= (UDWtype)1 << shift; - return f; + FSTYPE f = hi, e; + if (shift == W_TYPE_SIZE) + e = Wtype_MAXp1_F; + /* The following two cases could be merged if we knew that the target + supported a native unsigned->float conversion. More often, we only + have a signed conversion, and have to add extra fixup code. */ + else if (shift == W_TYPE_SIZE - 1) + e = Wtype_MAXp1_F / 2; + else + e = (Wtype)1 << shift; + return f * e; #endif } #endif @@ -1532,11 +1536,7 @@ FUNC (DWtype u) #define F_MODE_OK(SIZE) \ (SIZE < DI_SIZE \ && SIZE > (DI_SIZE - SIZE + FSSIZE) \ - /* Don't use IBM Extended Double TFmode for TI->SF calculations. \ - The conversion from long double to float suffers from double \ - rounding, because we convert via double. In any case, the \ - fallback code is faster. */ \ - && !IS_IBM_EXTENDED (SIZE)) + && !AVOID_FP_TYPE_CONVERSION(SIZE)) #if defined(L_floatundisf) #define FUNC __floatundisf #define FSTYPE SFtype @@ -1620,13 +1620,21 @@ FUNC (UDWtype u) hi = u >> shift; /* If we lost any nonzero bits, set the lsb to ensure correct rounding. */ - if (u & (((UDWtype)1 << shift) - 1)) + if ((UWtype)u << (W_TYPE_SIZE - shift)) hi |= 1; /* Convert the one word of data, and rescale. */ - FSTYPE f = hi; - f *= (UDWtype)1 << shift; - return f; + FSTYPE f = hi, e; + if (shift == W_TYPE_SIZE) + e = Wtype_MAXp1_F; + /* The following two cases could be merged if we knew that the target + supported a native unsigned->float conversion. More often, we only + have a signed conversion, and have to add extra fixup code. */ + else if (shift == W_TYPE_SIZE - 1) + e = Wtype_MAXp1_F / 2; + else + e = (Wtype)1 << shift; + return f * e; #endif } #endif Modified: head/contrib/gcc/libgcc2.h ============================================================================== --- head/contrib/gcc/libgcc2.h Mon Dec 30 02:19:48 2013 (r260072) +++ head/contrib/gcc/libgcc2.h Mon Dec 30 02:52:43 2013 (r260073) @@ -119,10 +119,16 @@ extern short int __get_eh_table_version /* FIXME: This #ifdef probably should be removed, ie. enable the test for mips too. */ +/* Don't use IBM Extended Double TFmode for TI->SF calculations. + The conversion from long double to float suffers from double + rounding, because we convert via double. In other cases, going + through the software fp routines is much slower than the fallback. */ #ifdef __powerpc__ -#define IS_IBM_EXTENDED(SIZE) (SIZE == 106) +#define AVOID_FP_TYPE_CONVERSION(SIZE) (SIZE == 106) +#elif defined(WIDEST_HARDWARE_FP_SIZE) +#define AVOID_FP_TYPE_CONVERSION(SIZE) (SIZE > WIDEST_HARDWARE_FP_SIZE) #else -#define IS_IBM_EXTENDED(SIZE) 0 +#define AVOID_FP_TYPE_CONVERSION(SIZE) 0 #endif /* In the first part of this file, we are interfacing to calls generated Modified: head/contrib/gcc/loop-init.c ============================================================================== --- head/contrib/gcc/loop-init.c Mon Dec 30 02:19:48 2013 (r260072) +++ head/contrib/gcc/loop-init.c Mon Dec 30 02:52:43 2013 (r260073) @@ -43,13 +43,6 @@ loop_optimizer_init (unsigned flags) struct loops *loops = XCNEW (struct loops); edge e; edge_iterator ei; - static bool first_time = true; - - if (first_time) - { - first_time = false; - init_set_costs (); - } /* Avoid annoying special cases of edges going to exit block. */ Modified: head/contrib/gcc/toplev.c ============================================================================== --- head/contrib/gcc/toplev.c Mon Dec 30 02:19:48 2013 (r260072) +++ head/contrib/gcc/toplev.c Mon Dec 30 02:52:43 2013 (r260073) @@ -1948,6 +1948,11 @@ lang_dependent_init (const char *name) provide a dummy function context for them. */ init_dummy_function_start (); init_expr_once (); + + /* Although the actions of init_set_costs are language-independent, + it uses optabs, so we cannot call it from backend_init. */ + init_set_costs (); + expand_dummy_function_end (); /* If dbx symbol table desired, initialize writing it and output the Modified: head/contrib/gcc/tree-ssa-address.c ============================================================================== --- head/contrib/gcc/tree-ssa-address.c Mon Dec 30 02:19:48 2013 (r260072) +++ head/contrib/gcc/tree-ssa-address.c Mon Dec 30 02:52:43 2013 (r260073) @@ -569,7 +569,7 @@ create_mem_ref (block_stmt_iterator *bsi struct affine_tree_combination *addr) { tree mem_ref, tmp; - tree addr_type = build_pointer_type (type), atype; + tree atype; struct mem_address parts; addr_to_parts (addr, &parts); @@ -597,18 +597,23 @@ create_mem_ref (block_stmt_iterator *bsi if (parts.symbol) { - tmp = fold_convert (addr_type, - build_addr (parts.symbol, current_function_decl)); + tmp = build_addr (parts.symbol, current_function_decl); + gcc_assert (is_gimple_val (tmp)); /* Add the symbol to base, eventually forcing it to register. */ if (parts.base) { + gcc_assert (TREE_TYPE (parts.base) == sizetype); + if (parts.index) - parts.base = force_gimple_operand_bsi (bsi, - fold_build2 (PLUS_EXPR, addr_type, - fold_convert (addr_type, parts.base), + { + atype = TREE_TYPE (tmp); + parts.base = force_gimple_operand_bsi (bsi, + fold_build2 (PLUS_EXPR, atype, + fold_convert (atype, parts.base), tmp), true, NULL_TREE); + } else { parts.index = parts.base; From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 05:02:58 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2457321F; Mon, 30 Dec 2013 05:02:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 050ED1587; Mon, 30 Dec 2013 05:02:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBU52vbC047758; Mon, 30 Dec 2013 05:02:57 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBU52vZv047757; Mon, 30 Dec 2013 05:02:57 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201312300502.rBU52vZv047757@svn.freebsd.org> From: Scott Long Date: Mon, 30 Dec 2013 05:02:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260076 - head/sbin/fsck_ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 05:02:58 -0000 Author: scottl Date: Mon Dec 30 05:02:57 2013 New Revision: 260076 URL: http://svnweb.freebsd.org/changeset/base/260076 Log: Add globs.c, missed in r260068,260069 Submitted by: peter Obtained from: Netflix MFC after: 3 Days Added: head/sbin/fsck_ffs/globs.c (contents, props changed) Added: head/sbin/fsck_ffs/globs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/fsck_ffs/globs.c Mon Dec 30 05:02:57 2013 (r260076) @@ -0,0 +1,165 @@ +/* + * Copyright (c) 1980, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if 0 +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1980, 1986, 1993\n\ + The Regents of the University of California. All rights reserved.\n"; +#endif /* not lint */ + +#ifndef lint +static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; +#endif /* not lint */ +#endif +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include "fsck.h" + +long readcnt[BT_NUMBUFTYPES]; +long totalreadcnt[BT_NUMBUFTYPES]; +struct timespec readtime[BT_NUMBUFTYPES]; +struct timespec totalreadtime[BT_NUMBUFTYPES]; +struct timespec startprog; +struct bufarea sblk; /* file system superblock */ +struct bufarea *pdirbp; /* current directory contents */ +struct bufarea *pbp; /* current inode block */ +ino_t cursnapshot; +long numdirs, dirhash, listmax, inplast; +long countdirs; /* number of directories we actually found */ +int adjrefcnt[MIBSIZE]; /* MIB command to adjust inode reference cnt */ +int adjblkcnt[MIBSIZE]; /* MIB command to adjust inode block count */ +int adjndir[MIBSIZE]; /* MIB command to adjust number of directories */ +int adjnbfree[MIBSIZE]; /* MIB command to adjust number of free blocks */ +int adjnifree[MIBSIZE]; /* MIB command to adjust number of free inodes */ +int adjnffree[MIBSIZE]; /* MIB command to adjust number of free frags */ +int adjnumclusters[MIBSIZE]; /* MIB command to adjust number of free clusters */ +int freefiles[MIBSIZE]; /* MIB command to free a set of files */ +int freedirs[MIBSIZE]; /* MIB command to free a set of directories */ +int freeblks[MIBSIZE]; /* MIB command to free a set of data blocks */ +struct fsck_cmd cmd; /* sysctl file system update commands */ +char snapname[BUFSIZ]; /* when doing snapshots, the name of the file */ +char *cdevname; /* name of device being checked */ +long dev_bsize; /* computed value of DEV_BSIZE */ +long secsize; /* actual disk sector size */ +u_int real_dev_bsize; /* actual disk sector size, not overriden */ +char nflag; /* assume a no response */ +char yflag; /* assume a yes response */ +int bkgrdflag; /* use a snapshot to run on an active system */ +int bflag; /* location of alternate super block */ +int debug; /* output debugging info */ +int Eflag; /* delete empty data blocks */ +int Zflag; /* zero empty data blocks */ +int inoopt; /* trim out unused inodes */ +char ckclean; /* only do work if not cleanly unmounted */ +int cvtlevel; /* convert to newer file system format */ +int bkgrdcheck; /* determine if background check is possible */ +int bkgrdsumadj; /* whether the kernel have ability to adjust superblock summary */ +char usedsoftdep; /* just fix soft dependency inconsistencies */ +char preen; /* just fix normal inconsistencies */ +char rerun; /* rerun fsck. Only used in non-preen mode */ +int returntosingle; /* 1 => return to single user mode on exit */ +char resolved; /* cleared if unresolved changes => not clean */ +char havesb; /* superblock has been read */ +char skipclean; /* skip clean file systems if preening */ +int fsmodified; /* 1 => write done to file system */ +int fsreadfd; /* file descriptor for reading file system */ +int fswritefd; /* file descriptor for writing file system */ +int surrender; /* Give up if reads fail */ +int wantrestart; /* Restart fsck on early termination */ +ufs2_daddr_t maxfsblock; /* number of blocks in the file system */ +char *blockmap; /* ptr to primary blk allocation map */ +ino_t maxino; /* number of inodes in file system */ +ino_t lfdir; /* lost & found directory inode number */ +const char *lfname; /* lost & found directory name */ +int lfmode; /* lost & found directory creation mode */ +ufs2_daddr_t n_blks; /* number of blocks in use */ +ino_t n_files; /* number of files in use */ +volatile sig_atomic_t got_siginfo; /* received a SIGINFO */ +volatile sig_atomic_t got_sigalarm; /* received a SIGALRM */ +struct ufs1_dinode ufs1_zino; +struct ufs2_dinode ufs2_zino; + +void +fsckinit(void) +{ + bzero(readcnt, sizeof(long) * BT_NUMBUFTYPES); + bzero(totalreadcnt, sizeof(long) * BT_NUMBUFTYPES); + bzero(readtime, sizeof(struct timespec) * BT_NUMBUFTYPES); + bzero(totalreadtime, sizeof(struct timespec) * BT_NUMBUFTYPES); + bzero(&startprog, sizeof(struct timespec));; + bzero(&sblk, sizeof(struct bufarea)); + pdirbp = NULL; + pbp = NULL; + cursnapshot = 0; + numdirs = dirhash = listmax = inplast = 0; + countdirs = 0; + bzero(adjrefcnt, sizeof(int) * MIBSIZE); + bzero(adjblkcnt, sizeof(int) * MIBSIZE); + bzero(adjndir, sizeof(int) * MIBSIZE); + bzero(adjnbfree, sizeof(int) * MIBSIZE); + bzero(adjnifree, sizeof(int) * MIBSIZE); + bzero(adjnffree, sizeof(int) * MIBSIZE); + bzero(adjnumclusters, sizeof(int) * MIBSIZE); + bzero(freefiles, sizeof(int) * MIBSIZE); + bzero(freedirs, sizeof(int) * MIBSIZE); + bzero(freeblks, sizeof(int) * MIBSIZE); + bzero(&cmd, sizeof(struct fsck_cmd)); + bzero(snapname, sizeof(char) * BUFSIZ); + cdevname = NULL; + dev_bsize = 0; + secsize = 0; + real_dev_bsize = 0; + bkgrdsumadj = 0; + usedsoftdep = 0; + rerun = 0; + returntosingle = 0; + resolved = 0; + havesb = 0; + fsmodified = 0; + fsreadfd = 0; + fswritefd = 0; + maxfsblock = 0; + blockmap = NULL; + maxino = 0; + lfdir = 0; + lfname = "lost+found"; + lfmode = 0700; + n_blks = 0; + n_files = 0; + got_siginfo = 0; + got_sigalarm = 0; + bzero(&ufs1_zino, sizeof(struct ufs1_dinode)); + bzero(&ufs2_zino, sizeof(struct ufs2_dinode)); +} From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 06:19:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5976F96E; Mon, 30 Dec 2013 06:19:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 457031955; Mon, 30 Dec 2013 06:19:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBU6JhXB074383; Mon, 30 Dec 2013 06:19:43 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBU6JhPb074382; Mon, 30 Dec 2013 06:19:43 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201312300619.rBU6JhPb074382@svn.freebsd.org> From: Kirk McKusick Date: Mon, 30 Dec 2013 06:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260079 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 06:19:43 -0000 Author: mckusick Date: Mon Dec 30 06:19:42 2013 New Revision: 260079 URL: http://svnweb.freebsd.org/changeset/base/260079 Log: Properly handle unsigned comparison. MFC after: 2 weeks Modified: head/sys/ufs/ufs/ufs_quota.c Modified: head/sys/ufs/ufs/ufs_quota.c ============================================================================== --- head/sys/ufs/ufs/ufs_quota.c Mon Dec 30 05:22:22 2013 (r260078) +++ head/sys/ufs/ufs/ufs_quota.c Mon Dec 30 06:19:42 2013 (r260079) @@ -307,7 +307,6 @@ int chkiq(struct inode *ip, int change, struct ucred *cred, int flags) { struct dquot *dq; - ino_t ncurinodes; int i, error, warn, do_check; #ifdef DIAGNOSTIC @@ -322,10 +321,8 @@ chkiq(struct inode *ip, int change, stru continue; DQI_LOCK(dq); DQI_WAIT(dq, PINOD+1, "chkiq1"); - ncurinodes = dq->dq_curinodes + change; - /* XXX: ncurinodes is unsigned */ - if (dq->dq_curinodes != 0 && ncurinodes >= 0) - dq->dq_curinodes = ncurinodes; + if (dq->dq_curinodes >= -change) + dq->dq_curinodes += change; else dq->dq_curinodes = 0; dq->dq_flags &= ~DQ_INODS; @@ -359,11 +356,8 @@ chkiq(struct inode *ip, int change, stru continue; DQI_LOCK(dq); DQI_WAIT(dq, PINOD+1, "chkiq3"); - ncurinodes = dq->dq_curinodes - change; - /* XXX: ncurinodes is unsigned */ - if (dq->dq_curinodes != 0 && - ncurinodes >= 0) - dq->dq_curinodes = ncurinodes; + if (dq->dq_curinodes >= change) + dq->dq_curinodes -= change; else dq->dq_curinodes = 0; dq->dq_flags &= ~DQ_INODS; From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 08:36:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1D80D564; Mon, 30 Dec 2013 08:36:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 09D82152F; Mon, 30 Dec 2013 08:36:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBU8aHw8025800; Mon, 30 Dec 2013 08:36:17 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBU8aHXT025799; Mon, 30 Dec 2013 08:36:17 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201312300836.rBU8aHXT025799@svn.freebsd.org> From: Rui Paulo Date: Mon, 30 Dec 2013 08:36:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260080 - head/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 08:36:18 -0000 Author: rpaulo Date: Mon Dec 30 08:36:17 2013 New Revision: 260080 URL: http://svnweb.freebsd.org/changeset/base/260080 Log: Add netpfil to CSCOPEDIRS. Modified: head/sys/Makefile Modified: head/sys/Makefile ============================================================================== --- head/sys/Makefile Mon Dec 30 06:19:42 2013 (r260079) +++ head/sys/Makefile Mon Dec 30 08:36:17 2013 (r260080) @@ -10,7 +10,7 @@ SUBDIR= boot # Directories to include in cscope name file and TAGS. CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ geom gnu isa kern libkern modules net net80211 netatalk \ - netgraph netinet netinet6 netipsec netipx netnatm \ + netgraph netinet netinet6 netipsec netipx netnatm netpfil \ netsmb nfs nfsclient nfsserver nlm ofed opencrypto \ pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} .if !defined(CSCOPE_ARCHDIR) From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 12:18:07 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0EBD0360; Mon, 30 Dec 2013 12:18:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EE80F1754; Mon, 30 Dec 2013 12:18:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUCI6ig012047; Mon, 30 Dec 2013 12:18:06 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUCI6bm012046; Mon, 30 Dec 2013 12:18:06 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201312301218.rBUCI6bm012046@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 30 Dec 2013 12:18:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260083 - head/sys/dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 12:18:07 -0000 Author: trasz Date: Mon Dec 30 12:18:06 2013 New Revision: 260083 URL: http://svnweb.freebsd.org/changeset/base/260083 Log: Fix extremely slow operation with data digests enabled. This was caused by receive code waiting for data digest even when the data segment was empty. It didn't actually read it, but it waited until those four bytes become available in the socket buffer, i.e. until any other PDU (such as NOP) came in. PR: kern/185240 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iscsi/icl.c Modified: head/sys/dev/iscsi/icl.c ============================================================================== --- head/sys/dev/iscsi/icl.c Mon Dec 30 09:04:06 2013 (r260082) +++ head/sys/dev/iscsi/icl.c Mon Dec 30 12:18:06 2013 (r260083) @@ -239,7 +239,7 @@ icl_pdu_size(const struct icl_pdu *respo icl_pdu_padding(response); if (response->ip_conn->ic_header_crc32c) len += ISCSI_HEADER_DIGEST_SIZE; - if (response->ip_conn->ic_data_crc32c) + if (response->ip_data_len != 0 && response->ip_conn->ic_data_crc32c) len += ISCSI_DATA_DIGEST_SIZE; return (len); @@ -615,7 +615,7 @@ icl_conn_receive_pdu(struct icl_conn *ic break; ic->ic_receive_state = ICL_CONN_STATE_DATA_DIGEST; - if (ic->ic_data_crc32c == false) + if (request->ip_data_len == 0 || ic->ic_data_crc32c == false) ic->ic_receive_len = 0; else ic->ic_receive_len = ISCSI_DATA_DIGEST_SIZE; From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 16:46:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 037EC273; Mon, 30 Dec 2013 16:46:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E35FA1AFF; Mon, 30 Dec 2013 16:46:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUGkoTx015014; Mon, 30 Dec 2013 16:46:50 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUGkoIJ015013; Mon, 30 Dec 2013 16:46:50 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201312301646.rBUGkoIJ015013@svn.freebsd.org> From: Marius Strobl Date: Mon, 30 Dec 2013 16:46:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260086 - head/sys/dev/iwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 16:46:51 -0000 Author: marius Date: Mon Dec 30 16:46:50 2013 New Revision: 260086 URL: http://svnweb.freebsd.org/changeset/base/260086 Log: - Probe with BUS_PROBE_DEFAULT instead of 0. - Remove clearing PCIM_CMD_INTxDIS; pci(4) will do that as appropriate since r189367. MFC after: 1 week Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Mon Dec 30 14:09:04 2013 (r260085) +++ head/sys/dev/iwn/if_iwn.c Mon Dec 30 16:46:50 2013 (r260086) @@ -380,7 +380,7 @@ iwn_probe(device_t dev) if (pci_get_vendor(dev) == ident->vendor && pci_get_device(dev) == ident->device) { device_set_desc(dev, ident->name); - return 0; + return (BUS_PROBE_DEFAULT); } } return ENXIO; @@ -392,7 +392,6 @@ iwn_attach(device_t dev) struct iwn_softc *sc = (struct iwn_softc *)device_get_softc(dev); struct ieee80211com *ic; struct ifnet *ifp; - uint32_t reg; int i, error, rid; uint8_t macaddr[IEEE80211_ADDR_LEN]; @@ -422,15 +421,6 @@ iwn_attach(device_t dev) /* Clear device-specific "PCI retry timeout" register (41h). */ pci_write_config(dev, 0x41, 0, 1); - /* Hardware bug workaround. */ - reg = pci_read_config(dev, PCIR_COMMAND, 2); - if (reg & PCIM_CMD_INTxDIS) { - DPRINTF(sc, IWN_DEBUG_RESET, "%s: PCIe INTx Disable set\n", - __func__); - reg &= ~PCIM_CMD_INTxDIS; - pci_write_config(dev, PCIR_COMMAND, reg, 2); - } - /* Enable bus-mastering. */ pci_enable_busmaster(dev); @@ -6066,7 +6056,6 @@ iwn_send_advanced_btcoex(struct iwn_soft sizeof(btconfig), 1); } - if (error != 0) return error; From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 16:49:31 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A1F033DD; Mon, 30 Dec 2013 16:49:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8DA8F1B18; Mon, 30 Dec 2013 16:49:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUGnVlq015336; Mon, 30 Dec 2013 16:49:31 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUGnVaK015335; Mon, 30 Dec 2013 16:49:31 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201312301649.rBUGnVaK015335@svn.freebsd.org> From: Scott Long Date: Mon, 30 Dec 2013 16:49:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260087 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 16:49:31 -0000 Author: scottl Date: Mon Dec 30 16:49:31 2013 New Revision: 260087 URL: http://svnweb.freebsd.org/changeset/base/260087 Log: getopt returns an int, not a char, so use the correct data type for the return value. Fixes powerpc tinderbox. MFC after: 2 days Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Mon Dec 30 16:46:50 2013 (r260086) +++ head/sbin/camcontrol/camcontrol.c Mon Dec 30 16:49:31 2013 (r260087) @@ -420,7 +420,7 @@ getdevtree(int argc, char **argv, char * int error = 0; int skip_device = 0; int busonly = 0; - char c; + int c; while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 17:04:25 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 464DCA3C; Mon, 30 Dec 2013 17:04:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3150C1D5E; Mon, 30 Dec 2013 17:04:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUH4PuC022596; Mon, 30 Dec 2013 17:04:25 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUH4PmQ022595; Mon, 30 Dec 2013 17:04:25 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201312301704.rBUH4PmQ022595@svn.freebsd.org> From: Kirk McKusick Date: Mon, 30 Dec 2013 17:04:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260088 - head/sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 17:04:25 -0000 Author: mckusick Date: Mon Dec 30 17:04:24 2013 New Revision: 260088 URL: http://svnweb.freebsd.org/changeset/base/260088 Log: Fine tune filesystem block allocations under low free-space conditions (-r254995) based on further operational experience. Submitted by: Dmitry Sivachenko Fix Tested by: Dmitry Sivachenko MFC after: 2 weeks Modified: head/sys/ufs/ffs/ffs_alloc.c Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Mon Dec 30 16:49:31 2013 (r260087) +++ head/sys/ufs/ffs/ffs_alloc.c Mon Dec 30 17:04:24 2013 (r260088) @@ -517,12 +517,12 @@ ffs_reallocblks_ufs1(ap) fs = ip->i_fs; ump = ip->i_ump; /* - * If we are not tracking block clusters or if we have less than 2% + * If we are not tracking block clusters or if we have less than 4% * free blocks left, then do not attempt to cluster. Running with * less than 5% free block reserve is not recommended and those that * choose to do so do not expect to have good file layout. */ - if (fs->fs_contigsumsize <= 0 || freespace(fs, 2) < 0) + if (fs->fs_contigsumsize <= 0 || freespace(fs, 4) < 0) return (ENOSPC); buflist = ap->a_buflist; len = buflist->bs_nchildren; @@ -744,12 +744,12 @@ ffs_reallocblks_ufs2(ap) fs = ip->i_fs; ump = ip->i_ump; /* - * If we are not tracking block clusters or if we have less than 2% + * If we are not tracking block clusters or if we have less than 4% * free blocks left, then do not attempt to cluster. Running with * less than 5% free block reserve is not recommended and those that * choose to do so do not expect to have good file layout. */ - if (fs->fs_contigsumsize <= 0 || freespace(fs, 2) < 0) + if (fs->fs_contigsumsize <= 0 || freespace(fs, 4) < 0) return (ENOSPC); buflist = ap->a_buflist; len = buflist->bs_nchildren; From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 17:11:37 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 509CBDF0; Mon, 30 Dec 2013 17:11:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3CA5B1DE8; Mon, 30 Dec 2013 17:11:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUHBbJL026420; Mon, 30 Dec 2013 17:11:37 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUHBbQ8026419; Mon, 30 Dec 2013 17:11:37 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201312301711.rBUHBbQ8026419@svn.freebsd.org> From: Steve Kargl Date: Mon, 30 Dec 2013 17:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260089 - head/lib/msun/man X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 17:11:37 -0000 Author: kargl Date: Mon Dec 30 17:11:36 2013 New Revision: 260089 URL: http://svnweb.freebsd.org/changeset/base/260089 Log: Fix a mismerge of my local doc changes to msun/man/sinh.3. Modified: head/lib/msun/man/sinh.3 Modified: head/lib/msun/man/sinh.3 ============================================================================== --- head/lib/msun/man/sinh.3 Mon Dec 30 17:04:24 2013 (r260088) +++ head/lib/msun/man/sinh.3 Mon Dec 30 17:11:36 2013 (r260089) @@ -27,12 +27,14 @@ .\" .\" from: @(#)sinh.3 6.6 (Berkeley) 4/19/91 .\" $FreeBSD$ -.Dd January 14, 2005 +.\" +.Dd August 17, 2013 .Dt SINH 3 .Os .Sh NAME .Nm sinh , -.Nm sinhf +.Nm sinhf , +.Nm sinhl .Nd hyperbolic sine function .Sh LIBRARY .Lb libm From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 17:37:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E0FFA9F; Mon, 30 Dec 2013 17:37:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5D2C41F83; Mon, 30 Dec 2013 17:37:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUHbXjx035092; Mon, 30 Dec 2013 17:37:33 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUHbW3I035088; Mon, 30 Dec 2013 17:37:32 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201312301737.rBUHbW3I035088@svn.freebsd.org> From: Mark Johnston Date: Mon, 30 Dec 2013 17:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260091 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys dev/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 17:37:33 -0000 Author: markj Date: Mon Dec 30 17:37:32 2013 New Revision: 260091 URL: http://svnweb.freebsd.org/changeset/base/260091 Log: Now that vmem(9) is available, use vmem arenas to allocate probe and aggregation IDs, as is done in the upstream illumos code. This still requires some FreeBSD-specific code, as our vmem API is not identical to the one in illumos. Submitted by: Mike Ma Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h head/sys/cddl/dev/dtrace/dtrace_load.c head/sys/cddl/dev/dtrace/dtrace_unload.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Mon Dec 30 17:26:06 2013 (r260090) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Mon Dec 30 17:37:32 2013 (r260091) @@ -206,12 +206,11 @@ const char dtrace_zero[256] = { 0 }; /* #if defined(sun) static dev_info_t *dtrace_devi; /* device info */ #endif -#if defined(sun) static vmem_t *dtrace_arena; /* probe ID arena */ +#if defined(sun) static vmem_t *dtrace_minor; /* minor number arena */ #else static taskq_t *dtrace_taskq; /* task queue */ -static struct unrhdr *dtrace_arena; /* Probe ID number. */ #endif static dtrace_probe_t **dtrace_probes; /* array of all probes */ static int dtrace_nprobes; /* number of probes */ @@ -7832,7 +7831,7 @@ dtrace_unregister(dtrace_provider_id_t i #if defined(sun) vmem_free(dtrace_arena, (void *)(uintptr_t)(probe->dtpr_id), 1); #else - free_unr(dtrace_arena, probe->dtpr_id); + vmem_free(dtrace_arena, (vmem_addr_t)(probe->dtpr_id), 1); #endif kmem_free(probe, sizeof (dtrace_probe_t)); } @@ -7953,7 +7952,7 @@ dtrace_condense(dtrace_provider_id_t id) #if defined(sun) vmem_free(dtrace_arena, (void *)((uintptr_t)i + 1), 1); #else - free_unr(dtrace_arena, i + 1); + vmem_free(dtrace_arena, (vmem_addr_t)i + 1, 1); #endif } @@ -7983,6 +7982,9 @@ dtrace_probe_create(dtrace_provider_id_t dtrace_probe_t *probe, **probes; dtrace_provider_t *provider = (dtrace_provider_t *)prov; dtrace_id_t id; +#if !defined(sun) + vmem_addr_t addr; +#endif if (provider == dtrace_provider) { ASSERT(MUTEX_HELD(&dtrace_lock)); @@ -7992,9 +7994,10 @@ dtrace_probe_create(dtrace_provider_id_t #if defined(sun) id = (dtrace_id_t)(uintptr_t)vmem_alloc(dtrace_arena, 1, - VM_BESTFIT | VM_SLEEP); + VM_BESTFIT | VM_WAITOK); #else - id = alloc_unr(dtrace_arena); + vmem_alloc(dtrace_arena, 1, M_BESTFIT | M_WAITOK, &addr); + id = (dtrace_id_t)addr; #endif probe = kmem_zalloc(sizeof (dtrace_probe_t), KM_SLEEP); @@ -10045,6 +10048,9 @@ dtrace_ecb_aggregation_create(dtrace_ecb dtrace_recdesc_t *frec; dtrace_aggid_t aggid; dtrace_state_t *state = ecb->dte_state; +#if !defined(sun) + vmem_addr_t addr; +#endif agg = kmem_zalloc(sizeof (dtrace_aggregation_t), KM_SLEEP); agg->dtag_ecb = ecb; @@ -10184,7 +10190,8 @@ success: aggid = (dtrace_aggid_t)(uintptr_t)vmem_alloc(state->dts_aggid_arena, 1, VM_BESTFIT | VM_SLEEP); #else - aggid = alloc_unr(state->dts_aggid_arena); + vmem_alloc(state->dts_aggid_arena, 1, M_BESTFIT | M_WAITOK, &addr); + aggid = (dtrace_aggid_t)addr; #endif if (aggid - 1 >= state->dts_naggregations) { @@ -10237,7 +10244,7 @@ dtrace_ecb_aggregation_destroy(dtrace_ec #if defined(sun) vmem_free(state->dts_aggid_arena, (void *)(uintptr_t)aggid, 1); #else - free_unr(state->dts_aggid_arena, aggid); + vmem_free(state->dts_aggid_arena, (vmem_addr_t)aggid, 1); #endif ASSERT(state->dts_aggregations[aggid - 1] == agg); @@ -13205,7 +13212,7 @@ dtrace_state_create(struct cdev *dev) if (dev != NULL) { cr = dev->si_cred; m = dev2unit(dev); - } + } /* Allocate memory for the state. */ state = kmem_zalloc(sizeof(dtrace_state_t), KM_SLEEP); @@ -13217,7 +13224,12 @@ dtrace_state_create(struct cdev *dev) #if defined(sun) state->dts_aggid_arena = vmem_create(c, (void *)1, UINT32_MAX, 1, NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER); +#else + state->dts_aggid_arena = vmem_create(c, (vmem_addr_t)1, UINT32_MAX, 1, + 0, M_WAITOK); +#endif +#if defined(sun) if (devp != NULL) { major = getemajor(*devp); } else { @@ -13229,7 +13241,6 @@ dtrace_state_create(struct cdev *dev) if (devp != NULL) *devp = state->dts_dev; #else - state->dts_aggid_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx); state->dts_dev = dev; #endif @@ -14036,11 +14047,7 @@ dtrace_state_destroy(dtrace_state_t *sta dtrace_format_destroy(state); if (state->dts_aggid_arena != NULL) { -#if defined(sun) vmem_destroy(state->dts_aggid_arena); -#else - delete_unrhdr(state->dts_aggid_arena); -#endif state->dts_aggid_arena = NULL; } #if defined(sun) @@ -15375,7 +15382,7 @@ dtrace_module_unloaded(modctl_t *ctl, in #if defined(sun) vmem_free(dtrace_arena, (void *)(uintptr_t)probe->dtpr_id, 1); #else - free_unr(dtrace_arena, probe->dtpr_id); + vmem_free(dtrace_arena, (vmem_addr_t)probe->dtpr_id, 1); #endif kmem_free(probe, sizeof (dtrace_probe_t)); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Mon Dec 30 17:26:06 2013 (r260090) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Mon Dec 30 17:37:32 2013 (r260091) @@ -1139,11 +1139,7 @@ struct dtrace_state { int dts_nspeculations; /* number of speculations */ int dts_naggregations; /* number of aggregations */ dtrace_aggregation_t **dts_aggregations; /* aggregation array */ -#if defined(sun) vmem_t *dts_aggid_arena; /* arena for aggregation IDs */ -#else - struct unrhdr *dts_aggid_arena; /* arena for aggregation IDs */ -#endif uint64_t dts_errors; /* total number of errors */ uint32_t dts_speculations_busy; /* number of spec. busy */ uint32_t dts_speculations_unavail; /* number of spec unavail */ Modified: head/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_load.c Mon Dec 30 17:26:06 2013 (r260090) +++ head/sys/cddl/dev/dtrace/dtrace_load.c Mon Dec 30 17:37:32 2013 (r260091) @@ -58,6 +58,9 @@ dtrace_load(void *dummy) dtrace_taskq = taskq_create("dtrace_taskq", 1, maxclsyspri, 0, 0, 0); + dtrace_arena = vmem_create("dtrace", 1, UINT32_MAX, 1, 0, + M_WAITOK | M_BESTFIT); + /* Register callbacks for linker file load and unload events. */ dtrace_kld_load_tag = EVENTHANDLER_REGISTER(kld_load, dtrace_kld_load, NULL, EVENTHANDLER_PRI_ANY); @@ -85,8 +88,6 @@ dtrace_load(void *dummy) ASSERT(MUTEX_HELD(&cpu_lock)); - dtrace_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx); - dtrace_state_cache = kmem_cache_create("dtrace_state_cache", sizeof (dtrace_dstate_percpu_t) * NCPU, DTRACE_STATE_ALIGN, NULL, NULL, NULL, NULL, NULL, 0); Modified: head/sys/cddl/dev/dtrace/dtrace_unload.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_unload.c Mon Dec 30 17:26:06 2013 (r260090) +++ head/sys/cddl/dev/dtrace/dtrace_unload.c Mon Dec 30 17:37:32 2013 (r260091) @@ -104,7 +104,7 @@ dtrace_unload() kmem_cache_destroy(dtrace_state_cache); - delete_unrhdr(dtrace_arena); + vmem_destroy(dtrace_arena); if (dtrace_toxrange != NULL) { kmem_free(dtrace_toxrange, 0); From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 18:07:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3EE8A1DC; Mon, 30 Dec 2013 18:07:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2A89311B7; Mon, 30 Dec 2013 18:07:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUI7oWi046497; Mon, 30 Dec 2013 18:07:50 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUI7ok5046496; Mon, 30 Dec 2013 18:07:50 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201312301807.rBUI7ok5046496@svn.freebsd.org> From: Warner Losh Date: Mon, 30 Dec 2013 18:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260092 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 18:07:51 -0000 Author: imp Date: Mon Dec 30 18:07:50 2013 New Revision: 260092 URL: http://svnweb.freebsd.org/changeset/base/260092 Log: Allow AT91_MCI_ALLOW_OVERCLOCK to be an option in kernel config files. Modified: head/sys/conf/options.arm Modified: head/sys/conf/options.arm ============================================================================== --- head/sys/conf/options.arm Mon Dec 30 17:37:32 2013 (r260091) +++ head/sys/conf/options.arm Mon Dec 30 18:07:50 2013 (r260092) @@ -54,6 +54,7 @@ XSACLE_DISABLE_CCNT opt_timer.h VERBOSE_INIT_ARM opt_global.h VM_MAXUSER_ADDRESS opt_global.h AT91_ATE_USE_RMII opt_at91.h +AT91_MCI_ALLOW_OVERCLOCK opt_at91.h AT91_MCI_HAS_4WIRE opt_at91.h AT91_MCI_SLOT_B opt_at91.h GFB_DEBUG opt_gfb.h From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 18:10:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 677C3408; Mon, 30 Dec 2013 18:10:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3A19C11CB; Mon, 30 Dec 2013 18:10:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUIA5SX048573; Mon, 30 Dec 2013 18:10:05 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUIA5LG048572; Mon, 30 Dec 2013 18:10:05 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201312301810.rBUIA5LG048572@svn.freebsd.org> From: Warner Losh Date: Mon, 30 Dec 2013 18:10:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260093 - head/sys/arm/at91 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 18:10:05 -0000 Author: imp Date: Mon Dec 30 18:10:04 2013 New Revision: 260093 URL: http://svnweb.freebsd.org/changeset/base/260093 Log: Set the SoC name for the atmelbus name. Modified: head/sys/arm/at91/at91.c Modified: head/sys/arm/at91/at91.c ============================================================================== --- head/sys/arm/at91/at91.c Mon Dec 30 18:07:50 2013 (r260092) +++ head/sys/arm/at91/at91.c Mon Dec 30 18:10:04 2013 (r260093) @@ -231,7 +231,7 @@ static int at91_probe(device_t dev) { - device_set_desc(dev, "AT91 device bus"); + device_set_desc(dev, soc_info.name); return (BUS_PROBE_NOWILDCARD); } From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 19:05:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0E69D227; Mon, 30 Dec 2013 19:05:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ECB2115FC; Mon, 30 Dec 2013 19:05:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUJ5pdm070357; Mon, 30 Dec 2013 19:05:51 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUJ5oKp070349; Mon, 30 Dec 2013 19:05:50 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312301905.rBUJ5oKp070349@svn.freebsd.org> From: Dimitry Andric Date: Mon, 30 Dec 2013 19:05:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260095 - in head/sys/boot: i386 i386/boot2 i386/gptboot i386/gptzfsboot i386/zfsboot pc98/boot2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 19:05:52 -0000 Author: dim Date: Mon Dec 30 19:05:50 2013 New Revision: 260095 URL: http://svnweb.freebsd.org/changeset/base/260095 Log: For sys/boot/i386 and sys/boot/pc98, separate flags to be passed directly to the linker (LD_FLAGS) from flags passed indirectly, via the compiler driver (LDFLAGS). This is because several Makefiles under sys/boot/i386 and sys/boot/pc98 use ${LD} directly to link, and the normal LDFLAGS value should not be used in these cases. MFC after: 3 days Modified: head/sys/boot/i386/Makefile.inc head/sys/boot/i386/boot2/Makefile head/sys/boot/i386/gptboot/Makefile head/sys/boot/i386/gptzfsboot/Makefile head/sys/boot/i386/zfsboot/Makefile head/sys/boot/pc98/boot2/Makefile Modified: head/sys/boot/i386/Makefile.inc ============================================================================== --- head/sys/boot/i386/Makefile.inc Mon Dec 30 18:42:09 2013 (r260094) +++ head/sys/boot/i386/Makefile.inc Mon Dec 30 19:05:50 2013 (r260095) @@ -13,7 +13,8 @@ LDFLAGS+= -nostdlib .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -m32 ACFLAGS+= -m32 -LDFLAGS+= -m elf_i386_fbsd +# LD_FLAGS is passed directly to ${LD}, not via ${CC}: +LD_FLAGS+= -m elf_i386_fbsd AFLAGS+= --32 .endif Modified: head/sys/boot/i386/boot2/Makefile ============================================================================== --- head/sys/boot/i386/boot2/Makefile Mon Dec 30 18:42:09 2013 (r260094) +++ head/sys/boot/i386/boot2/Makefile Mon Dec 30 19:05:50 2013 (r260095) @@ -44,7 +44,7 @@ CFLAGS.gcc+= -fno-guess-branch-probabili -fno-unit-at-a-time \ -mno-align-long-strings \ -LDFLAGS=-static -N --gc-sections +LD_FLAGS=-static -N --gc-sections # Pick up ../Makefile.inc early. .include @@ -60,7 +60,7 @@ boot1: boot1.out objcopy -S -O binary boot1.out ${.TARGET} boot1.out: boot1.o - ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o + ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ boot2.s boot2.s.tmp boot2.h sio.o @@ -81,7 +81,7 @@ boot2.bin: boot2.out objcopy -S -O binary boot2.out ${.TARGET} boot2.out: ${BTXCRT} boot2.o sio.o - ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} boot2.o: boot2.s ${CC} ${ACFLAGS} -c boot2.s Modified: head/sys/boot/i386/gptboot/Makefile ============================================================================== --- head/sys/boot/i386/gptboot/Makefile Mon Dec 30 18:42:09 2013 (r260094) +++ head/sys/boot/i386/gptboot/Makefile Mon Dec 30 19:05:50 2013 (r260095) @@ -37,7 +37,7 @@ CFLAGS= -DBOOTPROG=\"gptboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline --param max-inline-insns-single=100 -LDFLAGS=-static -N --gc-sections +LD_FLAGS=-static -N --gc-sections # Pick up ../Makefile.inc early. .include @@ -54,7 +54,7 @@ gptldr.bin: gptldr.out objcopy -S -O binary gptldr.out ${.TARGET} gptldr.out: gptldr.o - ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o + ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o CLEANFILES+= gptboot.bin gptboot.out gptboot.o sio.o gpt.o crc32.o drv.o \ cons.o util.o @@ -63,7 +63,7 @@ gptboot.bin: gptboot.out objcopy -S -O binary gptboot.out ${.TARGET} gptboot.out: ${BTXCRT} gptboot.o sio.o gpt.o crc32.o drv.o cons.o util.o - ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND} gptboot.o: ${.CURDIR}/../../common/ufsread.c Modified: head/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- head/sys/boot/i386/gptzfsboot/Makefile Mon Dec 30 18:42:09 2013 (r260094) +++ head/sys/boot/i386/gptzfsboot/Makefile Mon Dec 30 19:05:50 2013 (r260095) @@ -34,7 +34,7 @@ CFLAGS= -DBOOTPROG=\"gptzfsboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline --param max-inline-insns-single=100 -LDFLAGS=-static -N --gc-sections +LD_FLAGS=-static -N --gc-sections # Pick up ../Makefile.inc early. .include @@ -51,7 +51,7 @@ gptldr.bin: gptldr.out objcopy -S -O binary gptldr.out ${.TARGET} gptldr.out: gptldr.o - ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o + ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o CLEANFILES+= gptzfsboot.bin gptzfsboot.out zfsboot.o sio.o cons.o \ drv.o gpt.o util.o @@ -60,7 +60,7 @@ gptzfsboot.bin: gptzfsboot.out objcopy -S -O binary gptzfsboot.out ${.TARGET} gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o - ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND} zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c Modified: head/sys/boot/i386/zfsboot/Makefile ============================================================================== --- head/sys/boot/i386/zfsboot/Makefile Mon Dec 30 18:42:09 2013 (r260094) +++ head/sys/boot/i386/zfsboot/Makefile Mon Dec 30 19:05:50 2013 (r260095) @@ -31,7 +31,7 @@ CFLAGS= -DBOOTPROG=\"zfsboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Winline --param max-inline-insns-single=100 -LDFLAGS=-static -N --gc-sections +LD_FLAGS=-static -N --gc-sections # Pick up ../Makefile.inc early. .include @@ -47,7 +47,7 @@ zfsboot1: zfsldr.out objcopy -S -O binary zfsldr.out ${.TARGET} zfsldr.out: zfsldr.o - ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} zfsldr.o + ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} zfsldr.o CLEANFILES+= zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \ zfsboot.o zfsboot.s zfsboot.s.tmp sio.o cons.o drv.o util.o @@ -73,7 +73,7 @@ zfsboot.bin: zfsboot.out objcopy -S -O binary zfsboot.out ${.TARGET} zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o - ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND} SRCS= zfsboot.c Modified: head/sys/boot/pc98/boot2/Makefile ============================================================================== --- head/sys/boot/pc98/boot2/Makefile Mon Dec 30 18:42:09 2013 (r260094) +++ head/sys/boot/pc98/boot2/Makefile Mon Dec 30 19:05:50 2013 (r260095) @@ -50,7 +50,7 @@ CFLAGS= -Os \ # Initialize the bi_bios_geom using the BIOS geometry #CFLAGS+= -DGET_BIOSGEOM -LDFLAGS=-static -N --gc-sections +LD_FLAGS=-static -N --gc-sections # Pick up ../Makefile.inc early. .include @@ -68,7 +68,7 @@ boot1: boot1.out objcopy -S -O binary boot1.out ${.TARGET} boot1.out: boot1.o - ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o + ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ boot2.s boot2.s.tmp boot2.h sio.o @@ -89,7 +89,7 @@ boot2.bin: boot2.out objcopy -S -O binary boot2.out ${.TARGET} boot2.out: ${BTXCRT} boot2.o sio.o - ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} boot2.o: boot2.s From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 20:23:16 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 65A124E5; Mon, 30 Dec 2013 20:23:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 508661C85; Mon, 30 Dec 2013 20:23:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUKNGIG003235; Mon, 30 Dec 2013 20:23:16 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUKNF2L003229; Mon, 30 Dec 2013 20:23:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201312302023.rBUKNF2L003229@svn.freebsd.org> From: Alexander Motin Date: Mon, 30 Dec 2013 20:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260097 - in head/sys: nfs rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 20:23:16 -0000 Author: mav Date: Mon Dec 30 20:23:15 2013 New Revision: 260097 URL: http://svnweb.freebsd.org/changeset/base/260097 Log: Move most of NFS file handle affinity code out of the heavily congested global RPC thread pool lock and protect it with own set of locks. On synthetic benchmarks this improves peak NFS request rate by 40%. Modified: head/sys/nfs/nfs_fha.c head/sys/nfs/nfs_fha.h head/sys/rpc/svc.c head/sys/rpc/svc.h Modified: head/sys/nfs/nfs_fha.c ============================================================================== --- head/sys/nfs/nfs_fha.c Mon Dec 30 20:15:46 2013 (r260096) +++ head/sys/nfs/nfs_fha.c Mon Dec 30 20:23:15 2013 (r260097) @@ -52,13 +52,10 @@ void fha_init(struct fha_params *softc) { char tmpstr[128]; + int i; - /* - * A small hash table to map filehandles to fha_hash_entry - * structures. - */ - softc->g_fha.hashtable = hashinit(256, M_NFS_FHA, - &softc->g_fha.hashmask); + for (i = 0; i < FHA_HASH_SIZE; i++) + mtx_init(&softc->fha_hash[i].mtx, "fhalock", NULL, MTX_DEF); /* * Set the default tuning parameters. @@ -117,8 +114,11 @@ fha_init(struct fha_params *softc) void fha_uninit(struct fha_params *softc) { + int i; + sysctl_ctx_free(&softc->sysctl_ctx); - hashdestroy(softc->g_fha.hashtable, M_NFS_FHA, softc->g_fha.hashmask); + for (i = 0; i < FHA_HASH_SIZE; i++) + mtx_destroy(&softc->fha_hash[i].mtx); } /* @@ -207,8 +207,13 @@ static void fha_hash_entry_destroy(struct fha_hash_entry *e) { - if (e->num_rw + e->num_exclusive) - panic("nonempty fhe"); + mtx_assert(e->mtx, MA_OWNED); + KASSERT(e->num_rw == 0, + ("%d reqs on destroyed fhe %p", e->num_rw, e)); + KASSERT(e->num_exclusive == 0, + ("%d exclusive reqs on destroyed fhe %p", e->num_exclusive, e)); + KASSERT(e->num_threads == 0, + ("%d threads on destroyed fhe %p", e->num_threads, e)); free(e, M_NFS_FHA); } @@ -216,6 +221,7 @@ static void fha_hash_entry_remove(struct fha_hash_entry *e) { + mtx_assert(e->mtx, MA_OWNED); LIST_REMOVE(e, link); fha_hash_entry_destroy(e); } @@ -224,36 +230,22 @@ static struct fha_hash_entry * fha_hash_entry_lookup(struct fha_params *softc, u_int64_t fh) { SVCPOOL *pool; - - pool = *softc->pool; - + struct fha_hash_slot *fhs; struct fha_hash_entry *fhe, *new_fhe; - LIST_FOREACH(fhe, &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], - link) + pool = *softc->pool; + fhs = &softc->fha_hash[fh % FHA_HASH_SIZE]; + new_fhe = fha_hash_entry_new(fh); + new_fhe->mtx = &fhs->mtx; + mtx_lock(&fhs->mtx); + LIST_FOREACH(fhe, &fhs->list, link) if (fhe->fh == fh) break; - if (!fhe) { - /* Allocate a new entry. */ - mtx_unlock(&pool->sp_lock); - new_fhe = fha_hash_entry_new(fh); - mtx_lock(&pool->sp_lock); - - /* Double-check to make sure we still need the new entry. */ - LIST_FOREACH(fhe, - &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], link) - if (fhe->fh == fh) - break; - if (!fhe) { - fhe = new_fhe; - LIST_INSERT_HEAD( - &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], - fhe, link); - } else - fha_hash_entry_destroy(new_fhe); - } - + fhe = new_fhe; + LIST_INSERT_HEAD(&fhs->list, fhe, link); + } else + fha_hash_entry_destroy(new_fhe); return (fhe); } @@ -261,6 +253,8 @@ static void fha_hash_entry_add_thread(struct fha_hash_entry *fhe, SVCTHREAD *thread) { + mtx_assert(fhe->mtx, MA_OWNED); + thread->st_p2 = 0; LIST_INSERT_HEAD(&fhe->threads, thread, st_alink); fhe->num_threads++; } @@ -269,6 +263,9 @@ static void fha_hash_entry_remove_thread(struct fha_hash_entry *fhe, SVCTHREAD *thread) { + mtx_assert(fhe->mtx, MA_OWNED); + KASSERT(thread->st_p2 == 0, + ("%d reqs on removed thread %p", thread->st_p2, thread)); LIST_REMOVE(thread, st_alink); fhe->num_threads--; } @@ -280,6 +277,7 @@ static void fha_hash_entry_add_op(struct fha_hash_entry *fhe, int locktype, int count) { + mtx_assert(fhe->mtx, MA_OWNED); if (LK_EXCLUSIVE == locktype) fhe->num_exclusive += count; else @@ -306,7 +304,7 @@ fha_hash_entry_choose_thread(struct fha_ pool = *softc->pool; LIST_FOREACH(thread, &fhe->threads, st_alink) { - req_count = thread->st_reqcount; + req_count = thread->st_p2; /* If there are any writes in progress, use the first thread. */ if (fhe->num_exclusive) { @@ -322,7 +320,7 @@ fha_hash_entry_choose_thread(struct fha_ * exceed our per-thread load limit in the process. */ offset1 = i->offset; - offset2 = STAILQ_FIRST(&thread->st_reqs)->rq_p3; + offset2 = thread->st_p3; if (((offset1 >= offset2) && ((offset1 - offset2) < (1 << softc->ctls.bin_shift))) @@ -360,28 +358,11 @@ fha_hash_entry_choose_thread(struct fha_ */ if ((softc->ctls.max_nfsds_per_fh == 0) || (fhe->num_threads < softc->ctls.max_nfsds_per_fh)) { - /* - * We can add a new thread, so try for an idle thread - * first, and fall back to this_thread if none are idle. - */ - if (STAILQ_EMPTY(&this_thread->st_reqs)) { - thread = this_thread; + thread = this_thread; #if 0 - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, - "fha: %p(%d)t", thread, thread->st_reqcount); -#endif - } else if ((thread = LIST_FIRST(&pool->sp_idlethreads))) { -#if 0 - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, - "fha: %p(%d)i", thread, thread->st_reqcount); -#endif - } else { - thread = this_thread; -#if 0 - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, - "fha: %p(%d)b", thread, thread->st_reqcount); + ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, + "fha: %p(%d)t", thread, thread->st_p2); #endif - } fha_hash_entry_add_thread(fhe, thread); } else { /* @@ -411,16 +392,16 @@ fha_assign(SVCTHREAD *this_thread, struc /* Check to see whether we're enabled. */ if (softc->ctls.enable == 0) - return (this_thread); + goto thist; /* * Only do placement if this is an NFS request. */ if (req->rq_prog != NFS_PROG) - return (this_thread); + goto thist; if (req->rq_vers != 2 && req->rq_vers != 3) - return (this_thread); + goto thist; fha_extract_info(req, &i, cb); @@ -440,8 +421,21 @@ fha_assign(SVCTHREAD *this_thread, struc thread = fha_hash_entry_choose_thread(softc, fhe, &i, this_thread); KASSERT(thread, ("fha_assign: NULL thread!")); fha_hash_entry_add_op(fhe, i.locktype, 1); + thread->st_p2++; + thread->st_p3 = i.offset; + + /* + * Grab the pool lock here to not let chosen thread go away before + * the new request inserted to its queue while we drop fhe lock. + */ + mtx_lock(&(*softc->pool)->sp_lock); + mtx_unlock(fhe->mtx); return (thread); +thist: + req->rq_p1 = NULL; + mtx_lock(&(*softc->pool)->sp_lock); + return (this_thread); } /* @@ -452,6 +446,7 @@ void fha_nd_complete(SVCTHREAD *thread, struct svc_req *req) { struct fha_hash_entry *fhe = req->rq_p1; + struct mtx *mtx; /* * This may be called for reqs that didn't go through @@ -460,13 +455,18 @@ fha_nd_complete(SVCTHREAD *thread, struc if (!fhe) return; + mtx = fhe->mtx; + mtx_lock(mtx); fha_hash_entry_add_op(fhe, req->rq_p2, -1); - - if (thread->st_reqcount == 0) { + thread->st_p2--; + KASSERT(thread->st_p2 >= 0, ("Negative request count %d on %p", + thread->st_p2, thread)); + if (thread->st_p2 == 0) { fha_hash_entry_remove_thread(fhe, thread); if (0 == fhe->num_rw + fhe->num_exclusive) fha_hash_entry_remove(fhe); } + mtx_unlock(mtx); } int @@ -489,10 +489,9 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st } pool = *softc->pool; - mtx_lock(&pool->sp_lock); count = 0; - for (i = 0; i <= softc->g_fha.hashmask; i++) - if (!LIST_EMPTY(&softc->g_fha.hashtable[i])) + for (i = 0; i < FHA_HASH_SIZE; i++) + if (!LIST_EMPTY(&softc->fha_hash[i].list)) count++; if (count == 0) { @@ -500,8 +499,9 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st goto out; } - for (i = 0; i <= softc->g_fha.hashmask; i++) { - LIST_FOREACH(fhe, &softc->g_fha.hashtable[i], link) { + for (i = 0; i < FHA_HASH_SIZE; i++) { + mtx_lock(&softc->fha_hash[i].mtx); + LIST_FOREACH(fhe, &softc->fha_hash[i].list, link) { sbuf_printf(&sb, "%sfhe %p: {\n", first ? "" : ", ", fhe); sbuf_printf(&sb, " fh: %ju\n", (uintmax_t) fhe->fh); @@ -512,8 +512,7 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st LIST_FOREACH(thread, &fhe->threads, st_alink) { sbuf_printf(&sb, " thread %p offset %ju " "(count %d)\n", thread, - STAILQ_FIRST(&thread->st_reqs)->rq_p3, - thread->st_reqcount); + thread->st_p3, thread->st_p2); } sbuf_printf(&sb, "}"); @@ -525,11 +524,10 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st break; } } + mtx_unlock(&softc->fha_hash[i].mtx); } out: - if (pool) - mtx_unlock(&pool->sp_lock); sbuf_trim(&sb); sbuf_finish(&sb); error = sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); Modified: head/sys/nfs/nfs_fha.h ============================================================================== --- head/sys/nfs/nfs_fha.h Mon Dec 30 20:15:46 2013 (r260096) +++ head/sys/nfs/nfs_fha.h Mon Dec 30 20:23:15 2013 (r260097) @@ -35,11 +35,7 @@ #define FHA_DEF_MAX_NFSDS_PER_FH 8 #define FHA_DEF_MAX_REQS_PER_NFSD 0 /* Unlimited */ -/* This is the global structure that represents the state of the fha system. */ -struct fha_global { - struct fha_hash_entry_list *hashtable; - u_long hashmask; -}; +#define FHA_HASH_SIZE 251 struct fha_ctls { int enable; @@ -62,6 +58,7 @@ struct fha_ctls { * avoid contention between threads over single files. */ struct fha_hash_entry { + struct mtx *mtx; LIST_ENTRY(fha_hash_entry) link; u_int64_t fh; u_int32_t num_rw; @@ -72,6 +69,11 @@ struct fha_hash_entry { LIST_HEAD(fha_hash_entry_list, fha_hash_entry); +struct fha_hash_slot { + struct fha_hash_entry_list list; + struct mtx mtx; +}; + /* A structure used for passing around data internally. */ struct fha_info { u_int64_t fh; @@ -93,7 +95,7 @@ struct fha_callbacks { }; struct fha_params { - struct fha_global g_fha; + struct fha_hash_slot fha_hash[FHA_HASH_SIZE]; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; struct fha_ctls ctls; Modified: head/sys/rpc/svc.c ============================================================================== --- head/sys/rpc/svc.c Mon Dec 30 20:15:46 2013 (r260096) +++ head/sys/rpc/svc.c Mon Dec 30 20:23:15 2013 (r260097) @@ -71,6 +71,8 @@ static struct svc_callout *svc_find(SVCP char *); static void svc_new_thread(SVCPOOL *pool); static void xprt_unregister_locked(SVCXPRT *xprt); +static void svc_change_space_used(SVCPOOL *pool, int delta); +static bool_t svc_request_space_available(SVCPOOL *pool); /* *************** SVCXPRT related stuff **************** */ @@ -373,7 +375,8 @@ xprt_active(SVCXPRT *xprt) if (!xprt->xp_active) { xprt->xp_active = TRUE; if (xprt->xp_thread == NULL) { - if (!xprt_assignthread(xprt)) + if (!svc_request_space_available(pool) || + !xprt_assignthread(xprt)) TAILQ_INSERT_TAIL(&pool->sp_active, xprt, xp_alink); } @@ -965,56 +968,63 @@ svc_assign_waiting_sockets(SVCPOOL *pool { SVCXPRT *xprt; + mtx_lock(&pool->sp_lock); while ((xprt = TAILQ_FIRST(&pool->sp_active)) != NULL) { if (xprt_assignthread(xprt)) TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); else break; } + mtx_unlock(&pool->sp_lock); } -static bool_t -svc_request_space_available(SVCPOOL *pool) +static void +svc_change_space_used(SVCPOOL *pool, int delta) { + unsigned int value; - mtx_assert(&pool->sp_lock, MA_OWNED); - - if (pool->sp_space_throttled) { - /* - * Below the low-water yet? If so, assign any waiting sockets. - */ - if (pool->sp_space_used < pool->sp_space_low) { - pool->sp_space_throttled = FALSE; - svc_assign_waiting_sockets(pool); - return TRUE; - } - - return FALSE; - } else { - if (pool->sp_space_used - >= pool->sp_space_high) { + value = atomic_fetchadd_int(&pool->sp_space_used, delta) + delta; + if (delta > 0) { + if (value >= pool->sp_space_high && !pool->sp_space_throttled) { pool->sp_space_throttled = TRUE; pool->sp_space_throttle_count++; - return FALSE; } - - return TRUE; + if (value > pool->sp_space_used_highest) + pool->sp_space_used_highest = value; + } else { + if (value < pool->sp_space_low && pool->sp_space_throttled) { + pool->sp_space_throttled = FALSE; + svc_assign_waiting_sockets(pool); + } } } +static bool_t +svc_request_space_available(SVCPOOL *pool) +{ + + if (pool->sp_space_throttled) + return (FALSE); + return (TRUE); +} + static void svc_run_internal(SVCPOOL *pool, bool_t ismaster) { + struct svc_reqlist reqs; SVCTHREAD *st, *stpref; SVCXPRT *xprt; enum xprt_stat stat; struct svc_req *rqstp; + size_t sz; int error; st = mem_alloc(sizeof(*st)); + st->st_pool = pool; st->st_xprt = NULL; STAILQ_INIT(&st->st_reqs); cv_init(&st->st_cond, "rpcsvc"); + STAILQ_INIT(&reqs); mtx_lock(&pool->sp_lock); LIST_INSERT_HEAD(&pool->sp_threads, st, st_link); @@ -1108,15 +1118,14 @@ svc_run_internal(SVCPOOL *pool, bool_t i * RPCs. */ xprt->xp_lastactive = time_uptime; - stat = XPRT_IDLE; do { + mtx_unlock(&pool->sp_lock); if (!svc_request_space_available(pool)) break; rqstp = NULL; - mtx_unlock(&pool->sp_lock); stat = svc_getreq(xprt, &rqstp); - mtx_lock(&pool->sp_lock); if (rqstp) { + svc_change_space_used(pool, rqstp->rq_size); /* * See if the application has * a preference for some other @@ -1126,17 +1135,12 @@ svc_run_internal(SVCPOOL *pool, bool_t i if (pool->sp_assign) stpref = pool->sp_assign(st, rqstp); + else + mtx_lock(&pool->sp_lock); - pool->sp_space_used += - rqstp->rq_size; - if (pool->sp_space_used - > pool->sp_space_used_highest) - pool->sp_space_used_highest = - pool->sp_space_used; rqstp->rq_thread = stpref; STAILQ_INSERT_TAIL(&stpref->st_reqs, rqstp, rq_link); - stpref->st_reqcount++; /* * If we assigned the request @@ -1156,7 +1160,8 @@ svc_run_internal(SVCPOOL *pool, bool_t i stpref->st_idle = FALSE; cv_signal(&stpref->st_cond); } - } + } else + mtx_lock(&pool->sp_lock); } while (stat == XPRT_MOREREQS && pool->sp_state != SVCPOOL_CLOSING); @@ -1171,25 +1176,30 @@ svc_run_internal(SVCPOOL *pool, bool_t i xprt->xp_thread = NULL; st->st_xprt = NULL; if (xprt->xp_active) { - if (!xprt_assignthread(xprt)) + if (!svc_request_space_available(pool) || + !xprt_assignthread(xprt)) TAILQ_INSERT_TAIL(&pool->sp_active, xprt, xp_alink); } + STAILQ_CONCAT(&reqs, &st->st_reqs); mtx_unlock(&pool->sp_lock); SVC_RELEASE(xprt); - mtx_lock(&pool->sp_lock); + } else { + STAILQ_CONCAT(&reqs, &st->st_reqs); + mtx_unlock(&pool->sp_lock); } /* * Execute what we have queued. */ - while ((rqstp = STAILQ_FIRST(&st->st_reqs)) != NULL) { - size_t sz = rqstp->rq_size; - mtx_unlock(&pool->sp_lock); + sz = 0; + while ((rqstp = STAILQ_FIRST(&reqs)) != NULL) { + STAILQ_REMOVE_HEAD(&reqs, rq_link); + sz += rqstp->rq_size; svc_executereq(rqstp); - mtx_lock(&pool->sp_lock); - pool->sp_space_used -= sz; } + svc_change_space_used(pool, -sz); + mtx_lock(&pool->sp_lock); } if (st->st_xprt) { @@ -1309,24 +1319,13 @@ void svc_freereq(struct svc_req *rqstp) { SVCTHREAD *st; - SVCXPRT *xprt; SVCPOOL *pool; st = rqstp->rq_thread; - xprt = rqstp->rq_xprt; - if (xprt) - pool = xprt->xp_pool; - else - pool = NULL; if (st) { - mtx_lock(&pool->sp_lock); - KASSERT(rqstp == STAILQ_FIRST(&st->st_reqs), - ("Freeing request out of order")); - STAILQ_REMOVE_HEAD(&st->st_reqs, rq_link); - st->st_reqcount--; + pool = st->st_pool; if (pool->sp_done) pool->sp_done(st, rqstp); - mtx_unlock(&pool->sp_lock); } if (rqstp->rq_auth.svc_ah_ops) Modified: head/sys/rpc/svc.h ============================================================================== --- head/sys/rpc/svc.h Mon Dec 30 20:15:46 2013 (r260096) +++ head/sys/rpc/svc.h Mon Dec 30 20:23:15 2013 (r260097) @@ -275,14 +275,16 @@ STAILQ_HEAD(svc_reqlist, svc_req); * thread to read and execute pending RPCs. */ typedef struct __rpc_svcthread { + struct __rpc_svcpool *st_pool; SVCXPRT *st_xprt; /* transport we are processing */ struct svc_reqlist st_reqs; /* RPC requests to execute */ - int st_reqcount; /* number of queued reqs */ int st_idle; /* thread is on idle list */ struct cv st_cond; /* sleeping for work */ LIST_ENTRY(__rpc_svcthread) st_link; /* all threads list */ LIST_ENTRY(__rpc_svcthread) st_ilink; /* idle threads list */ LIST_ENTRY(__rpc_svcthread) st_alink; /* application thread list */ + int st_p2; /* application workspace */ + uint64_t st_p3; /* application workspace */ } SVCTHREAD; LIST_HEAD(svcthread_list, __rpc_svcthread); From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 20:24:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 554AD71F; Mon, 30 Dec 2013 20:24:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 422161C97; Mon, 30 Dec 2013 20:24:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUKO67M003404; Mon, 30 Dec 2013 20:24:06 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUKO6pI003403; Mon, 30 Dec 2013 20:24:06 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312302024.rBUKO6pI003403@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 30 Dec 2013 20:24:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260099 - head/contrib/gcc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 20:24:06 -0000 Author: pfg Date: Mon Dec 30 20:24:05 2013 New Revision: 260099 URL: http://svnweb.freebsd.org/changeset/base/260099 Log: gcc: Fix issue with "unavailable" attribute. While here, point where we dropped the support for objc from r260014. MFC after: 3 weeks Modified: head/contrib/gcc/c-common.c Modified: head/contrib/gcc/c-common.c ============================================================================== --- head/contrib/gcc/c-common.c Mon Dec 30 20:23:40 2013 (r260098) +++ head/contrib/gcc/c-common.c Mon Dec 30 20:24:05 2013 (r260099) @@ -5380,7 +5380,9 @@ handle_unavailable_attribute (tree *node if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == VAR_DECL - || TREE_CODE (decl) == FUNCTION_DECL) + || TREE_CODE (decl) == FUNCTION_DECL + || TREE_CODE (decl) == FIELD_DECL) + /* Removed radar 3803157 - objc attribute */ { TREE_UNAVAILABLE (decl) = 1; } From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 20:34:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 789B5DED; Mon, 30 Dec 2013 20:34:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 58C661D63; Mon, 30 Dec 2013 20:34:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUKYu8W007393; Mon, 30 Dec 2013 20:34:56 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUKYsGc007377; Mon, 30 Dec 2013 20:34:54 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312302034.rBUKYsGc007377@svn.freebsd.org> From: Dimitry Andric Date: Mon, 30 Dec 2013 20:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260102 - in head/sys: conf modules/drm2/radeonkms modules/ibcore modules/ipoib modules/mlx4 modules/mlx4ib modules/mlxen modules/mthca ofed/drivers/infiniband/hw/mlx4 ofed/drivers/net/... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 20:34:56 -0000 Author: dim Date: Mon Dec 30 20:34:53 2013 New Revision: 260102 URL: http://svnweb.freebsd.org/changeset/base/260102 Log: Similar to r260020, only use -fms-extensions with gcc, for all other modules which require this flag to compile. Use a GCC_MS_EXTENSIONS variable, defined in kern.pre.mk, which can be used to easily supply the flag (or not), depending on the compiler type. MFC after: 3 days Modified: head/sys/conf/kern.pre.mk head/sys/modules/drm2/radeonkms/Makefile head/sys/modules/ibcore/Makefile head/sys/modules/ipoib/Makefile head/sys/modules/mlx4/Makefile head/sys/modules/mlx4ib/Makefile head/sys/modules/mlxen/Makefile head/sys/modules/mthca/Makefile head/sys/ofed/drivers/infiniband/hw/mlx4/Makefile head/sys/ofed/drivers/net/mlx4/Makefile Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Mon Dec 30 20:32:27 2013 (r260101) +++ head/sys/conf/kern.pre.mk Mon Dec 30 20:34:53 2013 (r260102) @@ -100,6 +100,8 @@ ASM_CFLAGS= -x assembler-with-cpp -DLOCO .if ${COMPILER_TYPE} == "clang" CLANG_NO_IAS= -no-integrated-as +.else +GCC_MS_EXTENSIONS= -fms-extensions .endif .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1 @@ -158,7 +160,7 @@ NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLA # Infiniband C flags. Correct include paths and omit errors that linux # does not honor. OFEDINCLUDES= -I$S/ofed/include/ -OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} OFEDCFLAGS= ${CFLAGS:N-I*} ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR} OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF} OFED_C= ${OFED_C_NOIMP} ${.IMPSRC} Modified: head/sys/modules/drm2/radeonkms/Makefile ============================================================================== --- head/sys/modules/drm2/radeonkms/Makefile Mon Dec 30 20:32:27 2013 (r260101) +++ head/sys/modules/drm2/radeonkms/Makefile Mon Dec 30 20:34:53 2013 (r260102) @@ -105,9 +105,6 @@ SRCS += \ iicbus_if.h \ pci_if.h -CFLAGS += -I${.CURDIR}/../../../dev/drm2/radeon -.if ${COMPILER_TYPE} == "gcc" -CFLAGS += -fms-extensions -.endif +CFLAGS += -I${.CURDIR}/../../../dev/drm2/radeon ${GCC_MS_EXTENSIONS} .include Modified: head/sys/modules/ibcore/Makefile ============================================================================== --- head/sys/modules/ibcore/Makefile Mon Dec 30 20:32:27 2013 (r260101) +++ head/sys/modules/ibcore/Makefile Mon Dec 30 20:34:53 2013 (r260102) @@ -20,4 +20,4 @@ CFLAGS+= -DINET6 -DINET -DOFED .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: head/sys/modules/ipoib/Makefile ============================================================================== --- head/sys/modules/ipoib/Makefile Mon Dec 30 20:32:27 2013 (r260101) +++ head/sys/modules/ipoib/Makefile Mon Dec 30 20:34:53 2013 (r260102) @@ -28,4 +28,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: head/sys/modules/mlx4/Makefile ============================================================================== --- head/sys/modules/mlx4/Makefile Mon Dec 30 20:32:27 2013 (r260101) +++ head/sys/modules/mlx4/Makefile Mon Dec 30 20:34:53 2013 (r260102) @@ -26,4 +26,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: head/sys/modules/mlx4ib/Makefile ============================================================================== --- head/sys/modules/mlx4ib/Makefile Mon Dec 30 20:32:27 2013 (r260101) +++ head/sys/modules/mlx4ib/Makefile Mon Dec 30 20:34:53 2013 (r260102) @@ -31,4 +31,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: head/sys/modules/mlxen/Makefile ============================================================================== --- head/sys/modules/mlxen/Makefile Mon Dec 30 20:32:27 2013 (r260101) +++ head/sys/modules/mlxen/Makefile Mon Dec 30 20:34:53 2013 (r260102) @@ -25,4 +25,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: head/sys/modules/mthca/Makefile ============================================================================== --- head/sys/modules/mthca/Makefile Mon Dec 30 20:32:27 2013 (r260101) +++ head/sys/modules/mthca/Makefile Mon Dec 30 20:34:53 2013 (r260102) @@ -28,4 +28,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: head/sys/ofed/drivers/infiniband/hw/mlx4/Makefile ============================================================================== --- head/sys/ofed/drivers/infiniband/hw/mlx4/Makefile Mon Dec 30 20:32:27 2013 (r260101) +++ head/sys/ofed/drivers/infiniband/hw/mlx4/Makefile Mon Dec 30 20:34:53 2013 (r260102) @@ -28,4 +28,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: head/sys/ofed/drivers/net/mlx4/Makefile ============================================================================== --- head/sys/ofed/drivers/net/mlx4/Makefile Mon Dec 30 20:32:27 2013 (r260101) +++ head/sys/ofed/drivers/net/mlx4/Makefile Mon Dec 30 20:34:53 2013 (r260102) @@ -30,5 +30,5 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 20:37:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C8895F64; Mon, 30 Dec 2013 20:37:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B4B631D7D; Mon, 30 Dec 2013 20:37:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUKblVv007740; Mon, 30 Dec 2013 20:37:47 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUKblCD007739; Mon, 30 Dec 2013 20:37:47 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312302037.rBUKblCD007739@svn.freebsd.org> From: Dimitry Andric Date: Mon, 30 Dec 2013 20:37:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260103 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 20:37:47 -0000 Author: dim Date: Mon Dec 30 20:37:47 2013 New Revision: 260103 URL: http://svnweb.freebsd.org/changeset/base/260103 Log: In sys/amd64/amd64/pmap.c, remove static function pmap_is_current(), which has been unused since r189415. Reviewed by: alc MFC after: 3 days Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Dec 30 20:34:53 2013 (r260102) +++ head/sys/amd64/amd64/pmap.c Mon Dec 30 20:37:47 2013 (r260103) @@ -1766,16 +1766,6 @@ pmap_invalidate_cache_pages(vm_page_t *p } /* - * Are we current address space or kernel? - */ -static __inline int -pmap_is_current(pmap_t pmap) -{ - return (pmap == kernel_pmap || - (pmap->pm_pml4[PML4PML4I] & PG_FRAME) == (PML4pml4e[0] & PG_FRAME)); -} - -/* * Routine: pmap_extract * Function: * Extract the physical page address associated From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 20:42:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26F9139C; Mon, 30 Dec 2013 20:42:20 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9C1A21E17; Mon, 30 Dec 2013 20:42:18 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.7/8.14.7) with ESMTP id rBUKgAIF040076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 31 Dec 2013 00:42:10 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.7/8.14.7/Submit) id rBUKgA0I040075; Tue, 31 Dec 2013 00:42:10 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 31 Dec 2013 00:42:10 +0400 From: Gleb Smirnoff To: Mark Johnston , Mike Ma Subject: Re: svn commit: r260091 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys dev/dtrace Message-ID: <20131230204210.GD71033@FreeBSD.org> References: <201312301737.rBUHbW3I035088@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201312301737.rBUHbW3I035088@svn.freebsd.org> User-Agent: Mutt/1.5.22 (2013-10-16) 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.17 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, 30 Dec 2013 20:42:20 -0000 On Mon, Dec 30, 2013 at 05:37:32PM +0000, Mark Johnston wrote: M> Author: markj M> Date: Mon Dec 30 17:37:32 2013 M> New Revision: 260091 M> URL: http://svnweb.freebsd.org/changeset/base/260091 M> M> Log: M> Now that vmem(9) is available, use vmem arenas to allocate probe and M> aggregation IDs, as is done in the upstream illumos code. This still M> requires some FreeBSD-specific code, as our vmem API is not identical to the M> one in illumos. M> M> Submitted by: Mike Ma IMHO, alloc_unr() was lighter and thus better for allocating just IDs. -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 20:58:07 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A73A85D; Mon, 30 Dec 2013 20:58:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 264621EF2; Mon, 30 Dec 2013 20:58:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUKw7fO018136; Mon, 30 Dec 2013 20:58:07 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUKw63B018134; Mon, 30 Dec 2013 20:58:06 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312302058.rBUKw63B018134@svn.freebsd.org> From: Dimitry Andric Date: Mon, 30 Dec 2013 20:58:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260104 - in head/sys: conf modules/ibcore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 20:58:07 -0000 Author: dim Date: Mon Dec 30 20:58:06 2013 New Revision: 260104 URL: http://svnweb.freebsd.org/changeset/base/260104 Log: For sys/ofed/drivers/infiniband/core/cm.c, disable warning about unused functions for now. MFC after: 3 days Modified: head/sys/conf/files head/sys/modules/ibcore/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Dec 30 20:37:47 2013 (r260103) +++ head/sys/conf/files Mon Dec 30 20:58:06 2013 (r260104) @@ -3461,7 +3461,7 @@ ofed/drivers/infiniband/core/mad.c opti compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/cm.c optional ofed \ no-depend \ - compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" + compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/ -Wno-unused-function" ofed/drivers/infiniband/core/cma.c optional ofed \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" Modified: head/sys/modules/ibcore/Makefile ============================================================================== --- head/sys/modules/ibcore/Makefile Mon Dec 30 20:37:47 2013 (r260103) +++ head/sys/modules/ibcore/Makefile Mon Dec 30 20:58:06 2013 (r260104) @@ -21,3 +21,6 @@ CFLAGS+= -DINET6 -DINET -DOFED .include CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} + +CWARNFLAGS.cm.c= -Wno-unused-function +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 21:04:25 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2FA49A7F; Mon, 30 Dec 2013 21:04:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1B4B01FAB; Mon, 30 Dec 2013 21:04:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUL4OU0021772; Mon, 30 Dec 2013 21:04:24 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUL4OEp021771; Mon, 30 Dec 2013 21:04:24 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201312302104.rBUL4OEp021771@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 30 Dec 2013 21:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260105 - head/usr.bin/iscsictl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 21:04:25 -0000 Author: trasz Date: Mon Dec 30 21:04:24 2013 New Revision: 260105 URL: http://svnweb.freebsd.org/changeset/base/260105 Log: Fix typo. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/iscsictl/iscsictl.8 Modified: head/usr.bin/iscsictl/iscsictl.8 ============================================================================== --- head/usr.bin/iscsictl/iscsictl.8 Mon Dec 30 20:58:06 2013 (r260104) +++ head/usr.bin/iscsictl/iscsictl.8 Mon Dec 30 21:04:24 2013 (r260105) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 30, 2013 +.Dd December 30, 2013 .Dt ISCSICTL 8 .Os .Sh NAME @@ -132,8 +132,8 @@ The .Nm utility exits 0 on success, and >0 if an error occurs. .Sh EXAMPLES -Attach to target qn.2012-06.com.example:target0, served by 192.168.1.1: -.Dl Nm Fl A Fl t Ar qn.2012-06.com.example:target0 Fl p Ar 192.168.1.1 +Attach to target iqn.2012-06.com.example:target0, served by 192.168.1.1: +.Dl Nm Fl A Fl t Ar iqn.2012-06.com.example:target0 Fl p Ar 192.168.1.1 .Pp Disconnect all iSCSI sessions: .Dl Nm Fl Ra From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 21:06:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2D60BBD5; Mon, 30 Dec 2013 21:06:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 18A2D1FBC; Mon, 30 Dec 2013 21:06:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUL68si022078; Mon, 30 Dec 2013 21:06:08 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUL68ec022077; Mon, 30 Dec 2013 21:06:08 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201312302106.rBUL68ec022077@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 30 Dec 2013 21:06:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260106 - head/usr.bin/iscsictl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 21:06:09 -0000 Author: trasz Date: Mon Dec 30 21:06:08 2013 New Revision: 260106 URL: http://svnweb.freebsd.org/changeset/base/260106 Log: The devd part never got implemented; remove for now, until someone actually needs this feature and can talk to me about how it should look like. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/iscsictl/iscsictl.8 Modified: head/usr.bin/iscsictl/iscsictl.8 ============================================================================== --- head/usr.bin/iscsictl/iscsictl.8 Mon Dec 30 21:04:24 2013 (r260105) +++ head/usr.bin/iscsictl/iscsictl.8 Mon Dec 30 21:06:08 2013 (r260106) @@ -99,9 +99,6 @@ exit status does not mean that the sessi Use .Nm Fl L to check the connection status. -The initiator notifies -.Xr devd 8 -when session gets connected or disconnected. .Pp Note that in order to the iSCSI initiator to be able to connect to a target, the From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 21:30:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 717CB9E; Mon, 30 Dec 2013 21:30:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5CB2D1288; Mon, 30 Dec 2013 21:30:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBULUoTm031209; Mon, 30 Dec 2013 21:30:50 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBULUoNv031208; Mon, 30 Dec 2013 21:30:50 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201312302130.rBULUoNv031208@svn.freebsd.org> From: Xin LI Date: Mon, 30 Dec 2013 21:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260110 - head/sys/dev/oce X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 21:30:50 -0000 Author: delphij Date: Mon Dec 30 21:30:49 2013 New Revision: 260110 URL: http://svnweb.freebsd.org/changeset/base/260110 Log: Eliminate unused drbr_stats_update implementation in oce(4) driver. Noticed by: dim MFC after: 2 weeks Modified: head/sys/dev/oce/oce_if.c Modified: head/sys/dev/oce/oce_if.c ============================================================================== --- head/sys/dev/oce/oce_if.c Mon Dec 30 21:24:41 2013 (r260109) +++ head/sys/dev/oce/oce_if.c Mon Dec 30 21:30:49 2013 (r260110) @@ -1233,18 +1233,6 @@ oce_wq_handler(void *arg) } -#if __FreeBSD_version >= 1000000 -static __inline void -drbr_stats_update(struct ifnet *ifp, int len, int mflags) -{ -#ifndef NO_SLOW_STATS - ifp->if_obytes += len; - if (mflags & M_MCAST) - ifp->if_omcasts++; -#endif -} -#endif - static int oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, struct oce_wq *wq) { From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 22:14:31 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E184FEE2; Mon, 30 Dec 2013 22:14:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CD65715D5; Mon, 30 Dec 2013 22:14:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUMEVXF049504; Mon, 30 Dec 2013 22:14:31 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUMEV0E049502; Mon, 30 Dec 2013 22:14:31 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312302214.rBUMEV0E049502@svn.freebsd.org> From: Dimitry Andric Date: Mon, 30 Dec 2013 22:14:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260111 - in head/sys: conf modules/mlx4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 22:14:32 -0000 Author: dim Date: Mon Dec 30 22:14:31 2013 New Revision: 260111 URL: http://svnweb.freebsd.org/changeset/base/260111 Log: For sys/ofed/drivers/infiniband/hw/mlx4/mcg.c, disable warning about unused variables for now. MFC after: 3 days Modified: head/sys/conf/files head/sys/modules/mlx4/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Dec 30 21:30:49 2013 (r260110) +++ head/sys/conf/files Mon Dec 30 22:14:31 2013 (r260111) @@ -3569,7 +3569,7 @@ ofed/drivers/infiniband/hw/mlx4/alias_GU compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" ofed/drivers/infiniband/hw/mlx4/mcg.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ - compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" + compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/ -Wno-unused" ofed/drivers/infiniband/hw/mlx4/sysfs.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" Modified: head/sys/modules/mlx4/Makefile ============================================================================== --- head/sys/modules/mlx4/Makefile Mon Dec 30 21:30:49 2013 (r260110) +++ head/sys/modules/mlx4/Makefile Mon Dec 30 22:14:31 2013 (r260111) @@ -27,3 +27,6 @@ opt_inet6.h: .include CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} + +CWARNFLAGS.mcg.c= -Wno-unused +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 22:17:34 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D4721BD; Mon, 30 Dec 2013 22:17:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 68EB915F7; Mon, 30 Dec 2013 22:17:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUMHYkP049969; Mon, 30 Dec 2013 22:17:34 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUMHYTG049968; Mon, 30 Dec 2013 22:17:34 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201312302217.rBUMHYTG049968@svn.freebsd.org> From: Dimitry Andric Date: Mon, 30 Dec 2013 22:17:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260112 - head/sys/dev/sound/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 22:17:34 -0000 Author: dim Date: Mon Dec 30 22:17:33 2013 New Revision: 260112 URL: http://svnweb.freebsd.org/changeset/base/260112 Log: In sys/dev/sound/pci/maestro.c, #if 0 two unused static functions. MFC after: 3 days Modified: head/sys/dev/sound/pci/maestro.c Modified: head/sys/dev/sound/pci/maestro.c ============================================================================== --- head/sys/dev/sound/pci/maestro.c Mon Dec 30 22:14:31 2013 (r260111) +++ head/sys/dev/sound/pci/maestro.c Mon Dec 30 22:17:33 2013 (r260112) @@ -207,9 +207,11 @@ SYSCTL_UINT(_debug_maestro, OID_AUTO, po static void agg_sleep(struct agg_info*, const char *wmesg, int msec); +#if 0 static __inline u_int32_t agg_rd(struct agg_info*, int, int size); static __inline void agg_wr(struct agg_info*, int, u_int32_t data, int size); +#endif static int agg_rdcodec(struct agg_info*, int); static int agg_wrcodec(struct agg_info*, int, u_int32_t); @@ -286,6 +288,7 @@ agg_sleep(struct agg_info *sc, const cha /* I/O port */ +#if 0 static __inline u_int32_t agg_rd(struct agg_info *sc, int regno, int size) { @@ -300,12 +303,14 @@ agg_rd(struct agg_info *sc, int regno, i return ~(u_int32_t)0; } } +#endif #define AGG_RD(sc, regno, size) \ bus_space_read_##size( \ ((struct agg_info*)(sc))->st, \ ((struct agg_info*)(sc))->sh, (regno)) +#if 0 static __inline void agg_wr(struct agg_info *sc, int regno, u_int32_t data, int size) { @@ -321,6 +326,7 @@ agg_wr(struct agg_info *sc, int regno, u break; } } +#endif #define AGG_WR(sc, regno, data, size) \ bus_space_write_##size( \ From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 22:23:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E04D5536; Mon, 30 Dec 2013 22:23:27 +0000 (UTC) Received: from mail-qe0-x22b.google.com (mail-qe0-x22b.google.com [IPv6:2607:f8b0:400d:c02::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 620BB1686; Mon, 30 Dec 2013 22:23:27 +0000 (UTC) Received: by mail-qe0-f43.google.com with SMTP id jy17so11875440qeb.2 for ; Mon, 30 Dec 2013 14:23:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=wey4LSoIQVtuQ42sY9CGTEiC5e1qbh6wRkZD2GeVZc0=; b=c7D75zimYh/GFqyWHuYuEV/usgfkG4AwZg0ihig5EX9PBqDMGqxFE2oQIfBdl8lTDq moct/b2d+wQ6HbZYzLnG6b2jmd3JfaRUmHudtm814uNo3IV0rK4Wjip42RzbGzyT+/8a lyYglGfBQnFZkbI7OowNQ35q9If6ohknONOucb8JCHuhOphO3A2cDJQvEoDz7j4Jp2pQ PRzktyf3XsKWXWzDTaqPbGaRtVQ4mbuP0IlsY4yiJeNj8Wimu8nOWommlr668Q++F2R0 TL7FMjJwxrx8gGmT/8/98+YBEW5dKMbfEpbArpHMngoJlZjGbTq3vMcVco8KNg663rtg nleQ== MIME-Version: 1.0 X-Received: by 10.49.34.207 with SMTP id b15mr114568277qej.49.1388442206633; Mon, 30 Dec 2013 14:23:26 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.52.8 with HTTP; Mon, 30 Dec 2013 14:23:26 -0800 (PST) In-Reply-To: <201312302023.rBUKNF2L003229@svn.freebsd.org> References: <201312302023.rBUKNF2L003229@svn.freebsd.org> Date: Mon, 30 Dec 2013 14:23:26 -0800 X-Google-Sender-Auth: dzo5rExTO1OZV5smBGYAvXiwot8 Message-ID: Subject: Re: svn commit: r260097 - in head/sys: nfs rpc From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 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.17 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, 30 Dec 2013 22:23:28 -0000 Hm, this kind of per-bucket hash table may end up wanting to be used in a variety of places. I wonder if we should create a locked hash table type to reuse in various laces. Nice work though. I wonder about doing this elsewhere (eg inpcb hash, kqueue hash, etc.) -a On 30 December 2013 12:23, Alexander Motin wrote: > Author: mav > Date: Mon Dec 30 20:23:15 2013 > New Revision: 260097 > URL: http://svnweb.freebsd.org/changeset/base/260097 > > Log: > Move most of NFS file handle affinity code out of the heavily congested > global RPC thread pool lock and protect it with own set of locks. > > On synthetic benchmarks this improves peak NFS request rate by 40%. > > Modified: > head/sys/nfs/nfs_fha.c > head/sys/nfs/nfs_fha.h > head/sys/rpc/svc.c > head/sys/rpc/svc.h > > Modified: head/sys/nfs/nfs_fha.c > ============================================================================== > --- head/sys/nfs/nfs_fha.c Mon Dec 30 20:15:46 2013 (r260096) > +++ head/sys/nfs/nfs_fha.c Mon Dec 30 20:23:15 2013 (r260097) > @@ -52,13 +52,10 @@ void > fha_init(struct fha_params *softc) > { > char tmpstr[128]; > + int i; > > - /* > - * A small hash table to map filehandles to fha_hash_entry > - * structures. > - */ > - softc->g_fha.hashtable = hashinit(256, M_NFS_FHA, > - &softc->g_fha.hashmask); > + for (i = 0; i < FHA_HASH_SIZE; i++) > + mtx_init(&softc->fha_hash[i].mtx, "fhalock", NULL, MTX_DEF); > > /* > * Set the default tuning parameters. > @@ -117,8 +114,11 @@ fha_init(struct fha_params *softc) > void > fha_uninit(struct fha_params *softc) > { > + int i; > + > sysctl_ctx_free(&softc->sysctl_ctx); > - hashdestroy(softc->g_fha.hashtable, M_NFS_FHA, softc->g_fha.hashmask); > + for (i = 0; i < FHA_HASH_SIZE; i++) > + mtx_destroy(&softc->fha_hash[i].mtx); > } > > /* > @@ -207,8 +207,13 @@ static void > fha_hash_entry_destroy(struct fha_hash_entry *e) > { > > - if (e->num_rw + e->num_exclusive) > - panic("nonempty fhe"); > + mtx_assert(e->mtx, MA_OWNED); > + KASSERT(e->num_rw == 0, > + ("%d reqs on destroyed fhe %p", e->num_rw, e)); > + KASSERT(e->num_exclusive == 0, > + ("%d exclusive reqs on destroyed fhe %p", e->num_exclusive, e)); > + KASSERT(e->num_threads == 0, > + ("%d threads on destroyed fhe %p", e->num_threads, e)); > free(e, M_NFS_FHA); > } > > @@ -216,6 +221,7 @@ static void > fha_hash_entry_remove(struct fha_hash_entry *e) > { > > + mtx_assert(e->mtx, MA_OWNED); > LIST_REMOVE(e, link); > fha_hash_entry_destroy(e); > } > @@ -224,36 +230,22 @@ static struct fha_hash_entry * > fha_hash_entry_lookup(struct fha_params *softc, u_int64_t fh) > { > SVCPOOL *pool; > - > - pool = *softc->pool; > - > + struct fha_hash_slot *fhs; > struct fha_hash_entry *fhe, *new_fhe; > > - LIST_FOREACH(fhe, &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], > - link) > + pool = *softc->pool; > + fhs = &softc->fha_hash[fh % FHA_HASH_SIZE]; > + new_fhe = fha_hash_entry_new(fh); > + new_fhe->mtx = &fhs->mtx; > + mtx_lock(&fhs->mtx); > + LIST_FOREACH(fhe, &fhs->list, link) > if (fhe->fh == fh) > break; > - > if (!fhe) { > - /* Allocate a new entry. */ > - mtx_unlock(&pool->sp_lock); > - new_fhe = fha_hash_entry_new(fh); > - mtx_lock(&pool->sp_lock); > - > - /* Double-check to make sure we still need the new entry. */ > - LIST_FOREACH(fhe, > - &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], link) > - if (fhe->fh == fh) > - break; > - if (!fhe) { > - fhe = new_fhe; > - LIST_INSERT_HEAD( > - &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], > - fhe, link); > - } else > - fha_hash_entry_destroy(new_fhe); > - } > - > + fhe = new_fhe; > + LIST_INSERT_HEAD(&fhs->list, fhe, link); > + } else > + fha_hash_entry_destroy(new_fhe); > return (fhe); > } > > @@ -261,6 +253,8 @@ static void > fha_hash_entry_add_thread(struct fha_hash_entry *fhe, SVCTHREAD *thread) > { > > + mtx_assert(fhe->mtx, MA_OWNED); > + thread->st_p2 = 0; > LIST_INSERT_HEAD(&fhe->threads, thread, st_alink); > fhe->num_threads++; > } > @@ -269,6 +263,9 @@ static void > fha_hash_entry_remove_thread(struct fha_hash_entry *fhe, SVCTHREAD *thread) > { > > + mtx_assert(fhe->mtx, MA_OWNED); > + KASSERT(thread->st_p2 == 0, > + ("%d reqs on removed thread %p", thread->st_p2, thread)); > LIST_REMOVE(thread, st_alink); > fhe->num_threads--; > } > @@ -280,6 +277,7 @@ static void > fha_hash_entry_add_op(struct fha_hash_entry *fhe, int locktype, int count) > { > > + mtx_assert(fhe->mtx, MA_OWNED); > if (LK_EXCLUSIVE == locktype) > fhe->num_exclusive += count; > else > @@ -306,7 +304,7 @@ fha_hash_entry_choose_thread(struct fha_ > pool = *softc->pool; > > LIST_FOREACH(thread, &fhe->threads, st_alink) { > - req_count = thread->st_reqcount; > + req_count = thread->st_p2; > > /* If there are any writes in progress, use the first thread. */ > if (fhe->num_exclusive) { > @@ -322,7 +320,7 @@ fha_hash_entry_choose_thread(struct fha_ > * exceed our per-thread load limit in the process. > */ > offset1 = i->offset; > - offset2 = STAILQ_FIRST(&thread->st_reqs)->rq_p3; > + offset2 = thread->st_p3; > > if (((offset1 >= offset2) > && ((offset1 - offset2) < (1 << softc->ctls.bin_shift))) > @@ -360,28 +358,11 @@ fha_hash_entry_choose_thread(struct fha_ > */ > if ((softc->ctls.max_nfsds_per_fh == 0) || > (fhe->num_threads < softc->ctls.max_nfsds_per_fh)) { > - /* > - * We can add a new thread, so try for an idle thread > - * first, and fall back to this_thread if none are idle. > - */ > - if (STAILQ_EMPTY(&this_thread->st_reqs)) { > - thread = this_thread; > + thread = this_thread; > #if 0 > - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, > - "fha: %p(%d)t", thread, thread->st_reqcount); > -#endif > - } else if ((thread = LIST_FIRST(&pool->sp_idlethreads))) { > -#if 0 > - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, > - "fha: %p(%d)i", thread, thread->st_reqcount); > -#endif > - } else { > - thread = this_thread; > -#if 0 > - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, > - "fha: %p(%d)b", thread, thread->st_reqcount); > + ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, > + "fha: %p(%d)t", thread, thread->st_p2); > #endif > - } > fha_hash_entry_add_thread(fhe, thread); > } else { > /* > @@ -411,16 +392,16 @@ fha_assign(SVCTHREAD *this_thread, struc > > /* Check to see whether we're enabled. */ > if (softc->ctls.enable == 0) > - return (this_thread); > + goto thist; > > /* > * Only do placement if this is an NFS request. > */ > if (req->rq_prog != NFS_PROG) > - return (this_thread); > + goto thist; > > if (req->rq_vers != 2 && req->rq_vers != 3) > - return (this_thread); > + goto thist; > > fha_extract_info(req, &i, cb); > > @@ -440,8 +421,21 @@ fha_assign(SVCTHREAD *this_thread, struc > thread = fha_hash_entry_choose_thread(softc, fhe, &i, this_thread); > KASSERT(thread, ("fha_assign: NULL thread!")); > fha_hash_entry_add_op(fhe, i.locktype, 1); > + thread->st_p2++; > + thread->st_p3 = i.offset; > + > + /* > + * Grab the pool lock here to not let chosen thread go away before > + * the new request inserted to its queue while we drop fhe lock. > + */ > + mtx_lock(&(*softc->pool)->sp_lock); > + mtx_unlock(fhe->mtx); > > return (thread); > +thist: > + req->rq_p1 = NULL; > + mtx_lock(&(*softc->pool)->sp_lock); > + return (this_thread); > } > > /* > @@ -452,6 +446,7 @@ void > fha_nd_complete(SVCTHREAD *thread, struct svc_req *req) > { > struct fha_hash_entry *fhe = req->rq_p1; > + struct mtx *mtx; > > /* > * This may be called for reqs that didn't go through > @@ -460,13 +455,18 @@ fha_nd_complete(SVCTHREAD *thread, struc > if (!fhe) > return; > > + mtx = fhe->mtx; > + mtx_lock(mtx); > fha_hash_entry_add_op(fhe, req->rq_p2, -1); > - > - if (thread->st_reqcount == 0) { > + thread->st_p2--; > + KASSERT(thread->st_p2 >= 0, ("Negative request count %d on %p", > + thread->st_p2, thread)); > + if (thread->st_p2 == 0) { > fha_hash_entry_remove_thread(fhe, thread); > if (0 == fhe->num_rw + fhe->num_exclusive) > fha_hash_entry_remove(fhe); > } > + mtx_unlock(mtx); > } > > int > @@ -489,10 +489,9 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st > } > pool = *softc->pool; > > - mtx_lock(&pool->sp_lock); > count = 0; > - for (i = 0; i <= softc->g_fha.hashmask; i++) > - if (!LIST_EMPTY(&softc->g_fha.hashtable[i])) > + for (i = 0; i < FHA_HASH_SIZE; i++) > + if (!LIST_EMPTY(&softc->fha_hash[i].list)) > count++; > > if (count == 0) { > @@ -500,8 +499,9 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st > goto out; > } > > - for (i = 0; i <= softc->g_fha.hashmask; i++) { > - LIST_FOREACH(fhe, &softc->g_fha.hashtable[i], link) { > + for (i = 0; i < FHA_HASH_SIZE; i++) { > + mtx_lock(&softc->fha_hash[i].mtx); > + LIST_FOREACH(fhe, &softc->fha_hash[i].list, link) { > sbuf_printf(&sb, "%sfhe %p: {\n", first ? "" : ", ", fhe); > > sbuf_printf(&sb, " fh: %ju\n", (uintmax_t) fhe->fh); > @@ -512,8 +512,7 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st > LIST_FOREACH(thread, &fhe->threads, st_alink) { > sbuf_printf(&sb, " thread %p offset %ju " > "(count %d)\n", thread, > - STAILQ_FIRST(&thread->st_reqs)->rq_p3, > - thread->st_reqcount); > + thread->st_p3, thread->st_p2); > } > > sbuf_printf(&sb, "}"); > @@ -525,11 +524,10 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st > break; > } > } > + mtx_unlock(&softc->fha_hash[i].mtx); > } > > out: > - if (pool) > - mtx_unlock(&pool->sp_lock); > sbuf_trim(&sb); > sbuf_finish(&sb); > error = sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); > > Modified: head/sys/nfs/nfs_fha.h > ============================================================================== > --- head/sys/nfs/nfs_fha.h Mon Dec 30 20:15:46 2013 (r260096) > +++ head/sys/nfs/nfs_fha.h Mon Dec 30 20:23:15 2013 (r260097) > @@ -35,11 +35,7 @@ > #define FHA_DEF_MAX_NFSDS_PER_FH 8 > #define FHA_DEF_MAX_REQS_PER_NFSD 0 /* Unlimited */ > > -/* This is the global structure that represents the state of the fha system. */ > -struct fha_global { > - struct fha_hash_entry_list *hashtable; > - u_long hashmask; > -}; > +#define FHA_HASH_SIZE 251 > > struct fha_ctls { > int enable; > @@ -62,6 +58,7 @@ struct fha_ctls { > * avoid contention between threads over single files. > */ > struct fha_hash_entry { > + struct mtx *mtx; > LIST_ENTRY(fha_hash_entry) link; > u_int64_t fh; > u_int32_t num_rw; > @@ -72,6 +69,11 @@ struct fha_hash_entry { > > LIST_HEAD(fha_hash_entry_list, fha_hash_entry); > > +struct fha_hash_slot { > + struct fha_hash_entry_list list; > + struct mtx mtx; > +}; > + > /* A structure used for passing around data internally. */ > struct fha_info { > u_int64_t fh; > @@ -93,7 +95,7 @@ struct fha_callbacks { > }; > > struct fha_params { > - struct fha_global g_fha; > + struct fha_hash_slot fha_hash[FHA_HASH_SIZE]; > struct sysctl_ctx_list sysctl_ctx; > struct sysctl_oid *sysctl_tree; > struct fha_ctls ctls; > > Modified: head/sys/rpc/svc.c > ============================================================================== > --- head/sys/rpc/svc.c Mon Dec 30 20:15:46 2013 (r260096) > +++ head/sys/rpc/svc.c Mon Dec 30 20:23:15 2013 (r260097) > @@ -71,6 +71,8 @@ static struct svc_callout *svc_find(SVCP > char *); > static void svc_new_thread(SVCPOOL *pool); > static void xprt_unregister_locked(SVCXPRT *xprt); > +static void svc_change_space_used(SVCPOOL *pool, int delta); > +static bool_t svc_request_space_available(SVCPOOL *pool); > > /* *************** SVCXPRT related stuff **************** */ > > @@ -373,7 +375,8 @@ xprt_active(SVCXPRT *xprt) > if (!xprt->xp_active) { > xprt->xp_active = TRUE; > if (xprt->xp_thread == NULL) { > - if (!xprt_assignthread(xprt)) > + if (!svc_request_space_available(pool) || > + !xprt_assignthread(xprt)) > TAILQ_INSERT_TAIL(&pool->sp_active, xprt, > xp_alink); > } > @@ -965,56 +968,63 @@ svc_assign_waiting_sockets(SVCPOOL *pool > { > SVCXPRT *xprt; > > + mtx_lock(&pool->sp_lock); > while ((xprt = TAILQ_FIRST(&pool->sp_active)) != NULL) { > if (xprt_assignthread(xprt)) > TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); > else > break; > } > + mtx_unlock(&pool->sp_lock); > } > > -static bool_t > -svc_request_space_available(SVCPOOL *pool) > +static void > +svc_change_space_used(SVCPOOL *pool, int delta) > { > + unsigned int value; > > - mtx_assert(&pool->sp_lock, MA_OWNED); > - > - if (pool->sp_space_throttled) { > - /* > - * Below the low-water yet? If so, assign any waiting sockets. > - */ > - if (pool->sp_space_used < pool->sp_space_low) { > - pool->sp_space_throttled = FALSE; > - svc_assign_waiting_sockets(pool); > - return TRUE; > - } > - > - return FALSE; > - } else { > - if (pool->sp_space_used > - >= pool->sp_space_high) { > + value = atomic_fetchadd_int(&pool->sp_space_used, delta) + delta; > + if (delta > 0) { > + if (value >= pool->sp_space_high && !pool->sp_space_throttled) { > pool->sp_space_throttled = TRUE; > pool->sp_space_throttle_count++; > - return FALSE; > } > - > - return TRUE; > + if (value > pool->sp_space_used_highest) > + pool->sp_space_used_highest = value; > + } else { > + if (value < pool->sp_space_low && pool->sp_space_throttled) { > + pool->sp_space_throttled = FALSE; > + svc_assign_waiting_sockets(pool); > + } > } > } > > +static bool_t > +svc_request_space_available(SVCPOOL *pool) > +{ > + > + if (pool->sp_space_throttled) > + return (FALSE); > + return (TRUE); > +} > + > static void > svc_run_internal(SVCPOOL *pool, bool_t ismaster) > { > + struct svc_reqlist reqs; > SVCTHREAD *st, *stpref; > SVCXPRT *xprt; > enum xprt_stat stat; > struct svc_req *rqstp; > + size_t sz; > int error; > > st = mem_alloc(sizeof(*st)); > + st->st_pool = pool; > st->st_xprt = NULL; > STAILQ_INIT(&st->st_reqs); > cv_init(&st->st_cond, "rpcsvc"); > + STAILQ_INIT(&reqs); > > mtx_lock(&pool->sp_lock); > LIST_INSERT_HEAD(&pool->sp_threads, st, st_link); > @@ -1108,15 +1118,14 @@ svc_run_internal(SVCPOOL *pool, bool_t i > * RPCs. > */ > xprt->xp_lastactive = time_uptime; > - stat = XPRT_IDLE; > do { > + mtx_unlock(&pool->sp_lock); > if (!svc_request_space_available(pool)) > break; > rqstp = NULL; > - mtx_unlock(&pool->sp_lock); > stat = svc_getreq(xprt, &rqstp); > - mtx_lock(&pool->sp_lock); > if (rqstp) { > + svc_change_space_used(pool, rqstp->rq_size); > /* > * See if the application has > * a preference for some other > @@ -1126,17 +1135,12 @@ svc_run_internal(SVCPOOL *pool, bool_t i > if (pool->sp_assign) > stpref = pool->sp_assign(st, > rqstp); > + else > + mtx_lock(&pool->sp_lock); > > - pool->sp_space_used += > - rqstp->rq_size; > - if (pool->sp_space_used > - > pool->sp_space_used_highest) > - pool->sp_space_used_highest = > - pool->sp_space_used; > rqstp->rq_thread = stpref; > STAILQ_INSERT_TAIL(&stpref->st_reqs, > rqstp, rq_link); > - stpref->st_reqcount++; > > /* > * If we assigned the request > @@ -1156,7 +1160,8 @@ svc_run_internal(SVCPOOL *pool, bool_t i > stpref->st_idle = FALSE; > cv_signal(&stpref->st_cond); > } > - } > + } else > + mtx_lock(&pool->sp_lock); > } while (stat == XPRT_MOREREQS > && pool->sp_state != SVCPOOL_CLOSING); > > @@ -1171,25 +1176,30 @@ svc_run_internal(SVCPOOL *pool, bool_t i > xprt->xp_thread = NULL; > st->st_xprt = NULL; > if (xprt->xp_active) { > - if (!xprt_assignthread(xprt)) > + if (!svc_request_space_available(pool) || > + !xprt_assignthread(xprt)) > TAILQ_INSERT_TAIL(&pool->sp_active, > xprt, xp_alink); > } > + STAILQ_CONCAT(&reqs, &st->st_reqs); > mtx_unlock(&pool->sp_lock); > SVC_RELEASE(xprt); > - mtx_lock(&pool->sp_lock); > + } else { > + STAILQ_CONCAT(&reqs, &st->st_reqs); > + mtx_unlock(&pool->sp_lock); > } > > /* > * Execute what we have queued. > */ > - while ((rqstp = STAILQ_FIRST(&st->st_reqs)) != NULL) { > - size_t sz = rqstp->rq_size; > - mtx_unlock(&pool->sp_lock); > + sz = 0; > + while ((rqstp = STAILQ_FIRST(&reqs)) != NULL) { > + STAILQ_REMOVE_HEAD(&reqs, rq_link); > + sz += rqstp->rq_size; > svc_executereq(rqstp); > - mtx_lock(&pool->sp_lock); > - pool->sp_space_used -= sz; > } > + svc_change_space_used(pool, -sz); > + mtx_lock(&pool->sp_lock); > } > > if (st->st_xprt) { > @@ -1309,24 +1319,13 @@ void > svc_freereq(struct svc_req *rqstp) > { > SVCTHREAD *st; > - SVCXPRT *xprt; > SVCPOOL *pool; > > st = rqstp->rq_thread; > - xprt = rqstp->rq_xprt; > - if (xprt) > - pool = xprt->xp_pool; > - else > - pool = NULL; > if (st) { > - mtx_lock(&pool->sp_lock); > - KASSERT(rqstp == STAILQ_FIRST(&st->st_reqs), > - ("Freeing request out of order")); > - STAILQ_REMOVE_HEAD(&st->st_reqs, rq_link); > - st->st_reqcount--; > + pool = st->st_pool; > if (pool->sp_done) > pool->sp_done(st, rqstp); > - mtx_unlock(&pool->sp_lock); > } > > if (rqstp->rq_auth.svc_ah_ops) > > Modified: head/sys/rpc/svc.h > ============================================================================== > --- head/sys/rpc/svc.h Mon Dec 30 20:15:46 2013 (r260096) > +++ head/sys/rpc/svc.h Mon Dec 30 20:23:15 2013 (r260097) > @@ -275,14 +275,16 @@ STAILQ_HEAD(svc_reqlist, svc_req); > * thread to read and execute pending RPCs. > */ > typedef struct __rpc_svcthread { > + struct __rpc_svcpool *st_pool; > SVCXPRT *st_xprt; /* transport we are processing */ > struct svc_reqlist st_reqs; /* RPC requests to execute */ > - int st_reqcount; /* number of queued reqs */ > int st_idle; /* thread is on idle list */ > struct cv st_cond; /* sleeping for work */ > LIST_ENTRY(__rpc_svcthread) st_link; /* all threads list */ > LIST_ENTRY(__rpc_svcthread) st_ilink; /* idle threads list */ > LIST_ENTRY(__rpc_svcthread) st_alink; /* application thread list */ > + int st_p2; /* application workspace */ > + uint64_t st_p3; /* application workspace */ > } SVCTHREAD; > LIST_HEAD(svcthread_list, __rpc_svcthread); > From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 22:31:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 90B629AF; Mon, 30 Dec 2013 22:31:02 +0000 (UTC) Received: from mail-ea0-x22b.google.com (mail-ea0-x22b.google.com [IPv6:2a00:1450:4013:c01::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7E550173C; Mon, 30 Dec 2013 22:31:01 +0000 (UTC) Received: by mail-ea0-f171.google.com with SMTP id h10so5337236eak.30 for ; Mon, 30 Dec 2013 14:31:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=pQAjUZPXBMQup8VwJnTDtFpWyh2SnuHAjolbkTfPc1w=; b=Ya3D1pfSx3KzNKzko5Ji+dZsW8/f9SrRC2lFrTlOCN8oWTmOOZQTs9a4kOsqLEwCrj ZpCGluu+NtjHu8WEBj6VZyYAh6xqvPX6Xb6Wr5M9y/o3t/9RIY5SlSY4pPTo1Spe3tXF sh50wxwA+DriEvvyI9YeKTOnDaw3VZ4NLofBWSbSjaladkgV0elceuBSulVDRP9fJrds u8SGTosU26OMZkOow0SXDqNBXMgCibYm+yn3rP8Bqf8tZIuL3FFqIVsGrCJYX/fnnyy3 Qgsv1+xPMUsIzwqy4h1O6VdF5WOAnkKqftq6hRf6qUs057mJlBae6SDhRcn7XvuG3rKj WZdQ== X-Received: by 10.15.75.68 with SMTP id k44mr3818720eey.57.1388442659932; Mon, 30 Dec 2013 14:30:59 -0800 (PST) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by mx.google.com with ESMTPSA id n1sm112615024eep.20.2013.12.30.14.30.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Dec 2013 14:30:58 -0800 (PST) Sender: Alexander Motin Message-ID: <52C1F420.80306@FreeBSD.org> Date: Tue, 31 Dec 2013 00:30:56 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r260097 - in head/sys: nfs rpc References: <201312302023.rBUKNF2L003229@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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.17 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, 30 Dec 2013 22:31:02 -0000 On 31.12.2013 00:23, Adrian Chadd wrote: > Hm, this kind of per-bucket hash table may end up wanting to be used > in a variety of places. I wonder if we should create a locked hash > table type to reuse in various laces. I don't see there enough of reuse to create KPI for it. IMHO existing hashinit(9) KPI is quite useless either in its triviality. IMO simple array of struct as here now is much easier for understanding. > Nice work though. I wonder about doing this elsewhere (eg inpcb hash, > kqueue hash, etc.) > > > > -a > > > On 30 December 2013 12:23, Alexander Motin wrote: >> Author: mav >> Date: Mon Dec 30 20:23:15 2013 >> New Revision: 260097 >> URL: http://svnweb.freebsd.org/changeset/base/260097 >> >> Log: >> Move most of NFS file handle affinity code out of the heavily congested >> global RPC thread pool lock and protect it with own set of locks. >> >> On synthetic benchmarks this improves peak NFS request rate by 40%. >> >> Modified: >> head/sys/nfs/nfs_fha.c >> head/sys/nfs/nfs_fha.h >> head/sys/rpc/svc.c >> head/sys/rpc/svc.h >> >> Modified: head/sys/nfs/nfs_fha.c >> ============================================================================== >> --- head/sys/nfs/nfs_fha.c Mon Dec 30 20:15:46 2013 (r260096) >> +++ head/sys/nfs/nfs_fha.c Mon Dec 30 20:23:15 2013 (r260097) >> @@ -52,13 +52,10 @@ void >> fha_init(struct fha_params *softc) >> { >> char tmpstr[128]; >> + int i; >> >> - /* >> - * A small hash table to map filehandles to fha_hash_entry >> - * structures. >> - */ >> - softc->g_fha.hashtable = hashinit(256, M_NFS_FHA, >> - &softc->g_fha.hashmask); >> + for (i = 0; i < FHA_HASH_SIZE; i++) >> + mtx_init(&softc->fha_hash[i].mtx, "fhalock", NULL, MTX_DEF); >> >> /* >> * Set the default tuning parameters. >> @@ -117,8 +114,11 @@ fha_init(struct fha_params *softc) >> void >> fha_uninit(struct fha_params *softc) >> { >> + int i; >> + >> sysctl_ctx_free(&softc->sysctl_ctx); >> - hashdestroy(softc->g_fha.hashtable, M_NFS_FHA, softc->g_fha.hashmask); >> + for (i = 0; i < FHA_HASH_SIZE; i++) >> + mtx_destroy(&softc->fha_hash[i].mtx); >> } >> >> /* >> @@ -207,8 +207,13 @@ static void >> fha_hash_entry_destroy(struct fha_hash_entry *e) >> { >> >> - if (e->num_rw + e->num_exclusive) >> - panic("nonempty fhe"); >> + mtx_assert(e->mtx, MA_OWNED); >> + KASSERT(e->num_rw == 0, >> + ("%d reqs on destroyed fhe %p", e->num_rw, e)); >> + KASSERT(e->num_exclusive == 0, >> + ("%d exclusive reqs on destroyed fhe %p", e->num_exclusive, e)); >> + KASSERT(e->num_threads == 0, >> + ("%d threads on destroyed fhe %p", e->num_threads, e)); >> free(e, M_NFS_FHA); >> } >> >> @@ -216,6 +221,7 @@ static void >> fha_hash_entry_remove(struct fha_hash_entry *e) >> { >> >> + mtx_assert(e->mtx, MA_OWNED); >> LIST_REMOVE(e, link); >> fha_hash_entry_destroy(e); >> } >> @@ -224,36 +230,22 @@ static struct fha_hash_entry * >> fha_hash_entry_lookup(struct fha_params *softc, u_int64_t fh) >> { >> SVCPOOL *pool; >> - >> - pool = *softc->pool; >> - >> + struct fha_hash_slot *fhs; >> struct fha_hash_entry *fhe, *new_fhe; >> >> - LIST_FOREACH(fhe, &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], >> - link) >> + pool = *softc->pool; >> + fhs = &softc->fha_hash[fh % FHA_HASH_SIZE]; >> + new_fhe = fha_hash_entry_new(fh); >> + new_fhe->mtx = &fhs->mtx; >> + mtx_lock(&fhs->mtx); >> + LIST_FOREACH(fhe, &fhs->list, link) >> if (fhe->fh == fh) >> break; >> - >> if (!fhe) { >> - /* Allocate a new entry. */ >> - mtx_unlock(&pool->sp_lock); >> - new_fhe = fha_hash_entry_new(fh); >> - mtx_lock(&pool->sp_lock); >> - >> - /* Double-check to make sure we still need the new entry. */ >> - LIST_FOREACH(fhe, >> - &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], link) >> - if (fhe->fh == fh) >> - break; >> - if (!fhe) { >> - fhe = new_fhe; >> - LIST_INSERT_HEAD( >> - &softc->g_fha.hashtable[fh % softc->g_fha.hashmask], >> - fhe, link); >> - } else >> - fha_hash_entry_destroy(new_fhe); >> - } >> - >> + fhe = new_fhe; >> + LIST_INSERT_HEAD(&fhs->list, fhe, link); >> + } else >> + fha_hash_entry_destroy(new_fhe); >> return (fhe); >> } >> >> @@ -261,6 +253,8 @@ static void >> fha_hash_entry_add_thread(struct fha_hash_entry *fhe, SVCTHREAD *thread) >> { >> >> + mtx_assert(fhe->mtx, MA_OWNED); >> + thread->st_p2 = 0; >> LIST_INSERT_HEAD(&fhe->threads, thread, st_alink); >> fhe->num_threads++; >> } >> @@ -269,6 +263,9 @@ static void >> fha_hash_entry_remove_thread(struct fha_hash_entry *fhe, SVCTHREAD *thread) >> { >> >> + mtx_assert(fhe->mtx, MA_OWNED); >> + KASSERT(thread->st_p2 == 0, >> + ("%d reqs on removed thread %p", thread->st_p2, thread)); >> LIST_REMOVE(thread, st_alink); >> fhe->num_threads--; >> } >> @@ -280,6 +277,7 @@ static void >> fha_hash_entry_add_op(struct fha_hash_entry *fhe, int locktype, int count) >> { >> >> + mtx_assert(fhe->mtx, MA_OWNED); >> if (LK_EXCLUSIVE == locktype) >> fhe->num_exclusive += count; >> else >> @@ -306,7 +304,7 @@ fha_hash_entry_choose_thread(struct fha_ >> pool = *softc->pool; >> >> LIST_FOREACH(thread, &fhe->threads, st_alink) { >> - req_count = thread->st_reqcount; >> + req_count = thread->st_p2; >> >> /* If there are any writes in progress, use the first thread. */ >> if (fhe->num_exclusive) { >> @@ -322,7 +320,7 @@ fha_hash_entry_choose_thread(struct fha_ >> * exceed our per-thread load limit in the process. >> */ >> offset1 = i->offset; >> - offset2 = STAILQ_FIRST(&thread->st_reqs)->rq_p3; >> + offset2 = thread->st_p3; >> >> if (((offset1 >= offset2) >> && ((offset1 - offset2) < (1 << softc->ctls.bin_shift))) >> @@ -360,28 +358,11 @@ fha_hash_entry_choose_thread(struct fha_ >> */ >> if ((softc->ctls.max_nfsds_per_fh == 0) || >> (fhe->num_threads < softc->ctls.max_nfsds_per_fh)) { >> - /* >> - * We can add a new thread, so try for an idle thread >> - * first, and fall back to this_thread if none are idle. >> - */ >> - if (STAILQ_EMPTY(&this_thread->st_reqs)) { >> - thread = this_thread; >> + thread = this_thread; >> #if 0 >> - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, >> - "fha: %p(%d)t", thread, thread->st_reqcount); >> -#endif >> - } else if ((thread = LIST_FIRST(&pool->sp_idlethreads))) { >> -#if 0 >> - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, >> - "fha: %p(%d)i", thread, thread->st_reqcount); >> -#endif >> - } else { >> - thread = this_thread; >> -#if 0 >> - ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, >> - "fha: %p(%d)b", thread, thread->st_reqcount); >> + ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO, >> + "fha: %p(%d)t", thread, thread->st_p2); >> #endif >> - } >> fha_hash_entry_add_thread(fhe, thread); >> } else { >> /* >> @@ -411,16 +392,16 @@ fha_assign(SVCTHREAD *this_thread, struc >> >> /* Check to see whether we're enabled. */ >> if (softc->ctls.enable == 0) >> - return (this_thread); >> + goto thist; >> >> /* >> * Only do placement if this is an NFS request. >> */ >> if (req->rq_prog != NFS_PROG) >> - return (this_thread); >> + goto thist; >> >> if (req->rq_vers != 2 && req->rq_vers != 3) >> - return (this_thread); >> + goto thist; >> >> fha_extract_info(req, &i, cb); >> >> @@ -440,8 +421,21 @@ fha_assign(SVCTHREAD *this_thread, struc >> thread = fha_hash_entry_choose_thread(softc, fhe, &i, this_thread); >> KASSERT(thread, ("fha_assign: NULL thread!")); >> fha_hash_entry_add_op(fhe, i.locktype, 1); >> + thread->st_p2++; >> + thread->st_p3 = i.offset; >> + >> + /* >> + * Grab the pool lock here to not let chosen thread go away before >> + * the new request inserted to its queue while we drop fhe lock. >> + */ >> + mtx_lock(&(*softc->pool)->sp_lock); >> + mtx_unlock(fhe->mtx); >> >> return (thread); >> +thist: >> + req->rq_p1 = NULL; >> + mtx_lock(&(*softc->pool)->sp_lock); >> + return (this_thread); >> } >> >> /* >> @@ -452,6 +446,7 @@ void >> fha_nd_complete(SVCTHREAD *thread, struct svc_req *req) >> { >> struct fha_hash_entry *fhe = req->rq_p1; >> + struct mtx *mtx; >> >> /* >> * This may be called for reqs that didn't go through >> @@ -460,13 +455,18 @@ fha_nd_complete(SVCTHREAD *thread, struc >> if (!fhe) >> return; >> >> + mtx = fhe->mtx; >> + mtx_lock(mtx); >> fha_hash_entry_add_op(fhe, req->rq_p2, -1); >> - >> - if (thread->st_reqcount == 0) { >> + thread->st_p2--; >> + KASSERT(thread->st_p2 >= 0, ("Negative request count %d on %p", >> + thread->st_p2, thread)); >> + if (thread->st_p2 == 0) { >> fha_hash_entry_remove_thread(fhe, thread); >> if (0 == fhe->num_rw + fhe->num_exclusive) >> fha_hash_entry_remove(fhe); >> } >> + mtx_unlock(mtx); >> } >> >> int >> @@ -489,10 +489,9 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st >> } >> pool = *softc->pool; >> >> - mtx_lock(&pool->sp_lock); >> count = 0; >> - for (i = 0; i <= softc->g_fha.hashmask; i++) >> - if (!LIST_EMPTY(&softc->g_fha.hashtable[i])) >> + for (i = 0; i < FHA_HASH_SIZE; i++) >> + if (!LIST_EMPTY(&softc->fha_hash[i].list)) >> count++; >> >> if (count == 0) { >> @@ -500,8 +499,9 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st >> goto out; >> } >> >> - for (i = 0; i <= softc->g_fha.hashmask; i++) { >> - LIST_FOREACH(fhe, &softc->g_fha.hashtable[i], link) { >> + for (i = 0; i < FHA_HASH_SIZE; i++) { >> + mtx_lock(&softc->fha_hash[i].mtx); >> + LIST_FOREACH(fhe, &softc->fha_hash[i].list, link) { >> sbuf_printf(&sb, "%sfhe %p: {\n", first ? "" : ", ", fhe); >> >> sbuf_printf(&sb, " fh: %ju\n", (uintmax_t) fhe->fh); >> @@ -512,8 +512,7 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st >> LIST_FOREACH(thread, &fhe->threads, st_alink) { >> sbuf_printf(&sb, " thread %p offset %ju " >> "(count %d)\n", thread, >> - STAILQ_FIRST(&thread->st_reqs)->rq_p3, >> - thread->st_reqcount); >> + thread->st_p3, thread->st_p2); >> } >> >> sbuf_printf(&sb, "}"); >> @@ -525,11 +524,10 @@ fhe_stats_sysctl(SYSCTL_HANDLER_ARGS, st >> break; >> } >> } >> + mtx_unlock(&softc->fha_hash[i].mtx); >> } >> >> out: >> - if (pool) >> - mtx_unlock(&pool->sp_lock); >> sbuf_trim(&sb); >> sbuf_finish(&sb); >> error = sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); >> >> Modified: head/sys/nfs/nfs_fha.h >> ============================================================================== >> --- head/sys/nfs/nfs_fha.h Mon Dec 30 20:15:46 2013 (r260096) >> +++ head/sys/nfs/nfs_fha.h Mon Dec 30 20:23:15 2013 (r260097) >> @@ -35,11 +35,7 @@ >> #define FHA_DEF_MAX_NFSDS_PER_FH 8 >> #define FHA_DEF_MAX_REQS_PER_NFSD 0 /* Unlimited */ >> >> -/* This is the global structure that represents the state of the fha system. */ >> -struct fha_global { >> - struct fha_hash_entry_list *hashtable; >> - u_long hashmask; >> -}; >> +#define FHA_HASH_SIZE 251 >> >> struct fha_ctls { >> int enable; >> @@ -62,6 +58,7 @@ struct fha_ctls { >> * avoid contention between threads over single files. >> */ >> struct fha_hash_entry { >> + struct mtx *mtx; >> LIST_ENTRY(fha_hash_entry) link; >> u_int64_t fh; >> u_int32_t num_rw; >> @@ -72,6 +69,11 @@ struct fha_hash_entry { >> >> LIST_HEAD(fha_hash_entry_list, fha_hash_entry); >> >> +struct fha_hash_slot { >> + struct fha_hash_entry_list list; >> + struct mtx mtx; >> +}; >> + >> /* A structure used for passing around data internally. */ >> struct fha_info { >> u_int64_t fh; >> @@ -93,7 +95,7 @@ struct fha_callbacks { >> }; >> >> struct fha_params { >> - struct fha_global g_fha; >> + struct fha_hash_slot fha_hash[FHA_HASH_SIZE]; >> struct sysctl_ctx_list sysctl_ctx; >> struct sysctl_oid *sysctl_tree; >> struct fha_ctls ctls; >> >> Modified: head/sys/rpc/svc.c >> ============================================================================== >> --- head/sys/rpc/svc.c Mon Dec 30 20:15:46 2013 (r260096) >> +++ head/sys/rpc/svc.c Mon Dec 30 20:23:15 2013 (r260097) >> @@ -71,6 +71,8 @@ static struct svc_callout *svc_find(SVCP >> char *); >> static void svc_new_thread(SVCPOOL *pool); >> static void xprt_unregister_locked(SVCXPRT *xprt); >> +static void svc_change_space_used(SVCPOOL *pool, int delta); >> +static bool_t svc_request_space_available(SVCPOOL *pool); >> >> /* *************** SVCXPRT related stuff **************** */ >> >> @@ -373,7 +375,8 @@ xprt_active(SVCXPRT *xprt) >> if (!xprt->xp_active) { >> xprt->xp_active = TRUE; >> if (xprt->xp_thread == NULL) { >> - if (!xprt_assignthread(xprt)) >> + if (!svc_request_space_available(pool) || >> + !xprt_assignthread(xprt)) >> TAILQ_INSERT_TAIL(&pool->sp_active, xprt, >> xp_alink); >> } >> @@ -965,56 +968,63 @@ svc_assign_waiting_sockets(SVCPOOL *pool >> { >> SVCXPRT *xprt; >> >> + mtx_lock(&pool->sp_lock); >> while ((xprt = TAILQ_FIRST(&pool->sp_active)) != NULL) { >> if (xprt_assignthread(xprt)) >> TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink); >> else >> break; >> } >> + mtx_unlock(&pool->sp_lock); >> } >> >> -static bool_t >> -svc_request_space_available(SVCPOOL *pool) >> +static void >> +svc_change_space_used(SVCPOOL *pool, int delta) >> { >> + unsigned int value; >> >> - mtx_assert(&pool->sp_lock, MA_OWNED); >> - >> - if (pool->sp_space_throttled) { >> - /* >> - * Below the low-water yet? If so, assign any waiting sockets. >> - */ >> - if (pool->sp_space_used < pool->sp_space_low) { >> - pool->sp_space_throttled = FALSE; >> - svc_assign_waiting_sockets(pool); >> - return TRUE; >> - } >> - >> - return FALSE; >> - } else { >> - if (pool->sp_space_used >> - >= pool->sp_space_high) { >> + value = atomic_fetchadd_int(&pool->sp_space_used, delta) + delta; >> + if (delta > 0) { >> + if (value >= pool->sp_space_high && !pool->sp_space_throttled) { >> pool->sp_space_throttled = TRUE; >> pool->sp_space_throttle_count++; >> - return FALSE; >> } >> - >> - return TRUE; >> + if (value > pool->sp_space_used_highest) >> + pool->sp_space_used_highest = value; >> + } else { >> + if (value < pool->sp_space_low && pool->sp_space_throttled) { >> + pool->sp_space_throttled = FALSE; >> + svc_assign_waiting_sockets(pool); >> + } >> } >> } >> >> +static bool_t >> +svc_request_space_available(SVCPOOL *pool) >> +{ >> + >> + if (pool->sp_space_throttled) >> + return (FALSE); >> + return (TRUE); >> +} >> + >> static void >> svc_run_internal(SVCPOOL *pool, bool_t ismaster) >> { >> + struct svc_reqlist reqs; >> SVCTHREAD *st, *stpref; >> SVCXPRT *xprt; >> enum xprt_stat stat; >> struct svc_req *rqstp; >> + size_t sz; >> int error; >> >> st = mem_alloc(sizeof(*st)); >> + st->st_pool = pool; >> st->st_xprt = NULL; >> STAILQ_INIT(&st->st_reqs); >> cv_init(&st->st_cond, "rpcsvc"); >> + STAILQ_INIT(&reqs); >> >> mtx_lock(&pool->sp_lock); >> LIST_INSERT_HEAD(&pool->sp_threads, st, st_link); >> @@ -1108,15 +1118,14 @@ svc_run_internal(SVCPOOL *pool, bool_t i >> * RPCs. >> */ >> xprt->xp_lastactive = time_uptime; >> - stat = XPRT_IDLE; >> do { >> + mtx_unlock(&pool->sp_lock); >> if (!svc_request_space_available(pool)) >> break; >> rqstp = NULL; >> - mtx_unlock(&pool->sp_lock); >> stat = svc_getreq(xprt, &rqstp); >> - mtx_lock(&pool->sp_lock); >> if (rqstp) { >> + svc_change_space_used(pool, rqstp->rq_size); >> /* >> * See if the application has >> * a preference for some other >> @@ -1126,17 +1135,12 @@ svc_run_internal(SVCPOOL *pool, bool_t i >> if (pool->sp_assign) >> stpref = pool->sp_assign(st, >> rqstp); >> + else >> + mtx_lock(&pool->sp_lock); >> >> - pool->sp_space_used += >> - rqstp->rq_size; >> - if (pool->sp_space_used >> - > pool->sp_space_used_highest) >> - pool->sp_space_used_highest = >> - pool->sp_space_used; >> rqstp->rq_thread = stpref; >> STAILQ_INSERT_TAIL(&stpref->st_reqs, >> rqstp, rq_link); >> - stpref->st_reqcount++; >> >> /* >> * If we assigned the request >> @@ -1156,7 +1160,8 @@ svc_run_internal(SVCPOOL *pool, bool_t i >> stpref->st_idle = FALSE; >> cv_signal(&stpref->st_cond); >> } >> - } >> + } else >> + mtx_lock(&pool->sp_lock); >> } while (stat == XPRT_MOREREQS >> && pool->sp_state != SVCPOOL_CLOSING); >> >> @@ -1171,25 +1176,30 @@ svc_run_internal(SVCPOOL *pool, bool_t i >> xprt->xp_thread = NULL; >> st->st_xprt = NULL; >> if (xprt->xp_active) { >> - if (!xprt_assignthread(xprt)) >> + if (!svc_request_space_available(pool) || >> + !xprt_assignthread(xprt)) >> TAILQ_INSERT_TAIL(&pool->sp_active, >> xprt, xp_alink); >> } >> + STAILQ_CONCAT(&reqs, &st->st_reqs); >> mtx_unlock(&pool->sp_lock); >> SVC_RELEASE(xprt); >> - mtx_lock(&pool->sp_lock); >> + } else { >> + STAILQ_CONCAT(&reqs, &st->st_reqs); >> + mtx_unlock(&pool->sp_lock); >> } >> >> /* >> * Execute what we have queued. >> */ >> - while ((rqstp = STAILQ_FIRST(&st->st_reqs)) != NULL) { >> - size_t sz = rqstp->rq_size; >> - mtx_unlock(&pool->sp_lock); >> + sz = 0; >> + while ((rqstp = STAILQ_FIRST(&reqs)) != NULL) { >> + STAILQ_REMOVE_HEAD(&reqs, rq_link); >> + sz += rqstp->rq_size; >> svc_executereq(rqstp); >> - mtx_lock(&pool->sp_lock); >> - pool->sp_space_used -= sz; >> } >> + svc_change_space_used(pool, -sz); >> + mtx_lock(&pool->sp_lock); >> } >> >> if (st->st_xprt) { >> @@ -1309,24 +1319,13 @@ void >> svc_freereq(struct svc_req *rqstp) >> { >> SVCTHREAD *st; >> - SVCXPRT *xprt; >> SVCPOOL *pool; >> >> st = rqstp->rq_thread; >> - xprt = rqstp->rq_xprt; >> - if (xprt) >> - pool = xprt->xp_pool; >> - else >> - pool = NULL; >> if (st) { >> - mtx_lock(&pool->sp_lock); >> - KASSERT(rqstp == STAILQ_FIRST(&st->st_reqs), >> - ("Freeing request out of order")); >> - STAILQ_REMOVE_HEAD(&st->st_reqs, rq_link); >> - st->st_reqcount--; >> + pool = st->st_pool; >> if (pool->sp_done) >> pool->sp_done(st, rqstp); >> - mtx_unlock(&pool->sp_lock); >> } >> >> if (rqstp->rq_auth.svc_ah_ops) >> >> Modified: head/sys/rpc/svc.h >> ============================================================================== >> --- head/sys/rpc/svc.h Mon Dec 30 20:15:46 2013 (r260096) >> +++ head/sys/rpc/svc.h Mon Dec 30 20:23:15 2013 (r260097) >> @@ -275,14 +275,16 @@ STAILQ_HEAD(svc_reqlist, svc_req); >> * thread to read and execute pending RPCs. >> */ >> typedef struct __rpc_svcthread { >> + struct __rpc_svcpool *st_pool; >> SVCXPRT *st_xprt; /* transport we are processing */ >> struct svc_reqlist st_reqs; /* RPC requests to execute */ >> - int st_reqcount; /* number of queued reqs */ >> int st_idle; /* thread is on idle list */ >> struct cv st_cond; /* sleeping for work */ >> LIST_ENTRY(__rpc_svcthread) st_link; /* all threads list */ >> LIST_ENTRY(__rpc_svcthread) st_ilink; /* idle threads list */ >> LIST_ENTRY(__rpc_svcthread) st_alink; /* application thread list */ >> + int st_p2; /* application workspace */ >> + uint64_t st_p3; /* application workspace */ >> } SVCTHREAD; >> LIST_HEAD(svcthread_list, __rpc_svcthread); >> -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Mon Dec 30 23:02:27 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F29B2266; Mon, 30 Dec 2013 23:02:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DD9AC192C; Mon, 30 Dec 2013 23:02:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBUN2QBO068428; Mon, 30 Dec 2013 23:02:26 GMT (envelope-from edavis@svn.freebsd.org) Received: (from edavis@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBUN2QIk068426; Mon, 30 Dec 2013 23:02:26 GMT (envelope-from edavis@svn.freebsd.org) Message-Id: <201312302302.rBUN2QIk068426@svn.freebsd.org> From: Eric Davis Date: Mon, 30 Dec 2013 23:02:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260113 - head/sys/dev/bxe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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, 30 Dec 2013 23:02:27 -0000 Author: edavis Date: Mon Dec 30 23:02:26 2013 New Revision: 260113 URL: http://svnweb.freebsd.org/changeset/base/260113 Log: For TSO, when the first mbuf contains both the packet header and data, the header is split out into its own BD for processing by the firmware. When this split occurred the data length in the BD was not being set correctly resulting in packet corruption. Approved by: davidcd (mentor) Modified: head/sys/dev/bxe/bxe.c head/sys/dev/bxe/ecore_sp.c Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Mon Dec 30 22:17:33 2013 (r260112) +++ head/sys/dev/bxe/bxe.c Mon Dec 30 23:02:26 2013 (r260113) @@ -34,7 +34,7 @@ #include __FBSDID("$FreeBSD$"); -#define BXE_DRIVER_VERSION "1.78.75" +#define BXE_DRIVER_VERSION "1.78.76" #include "bxe.h" #include "ecore_sp.h" @@ -5004,6 +5004,7 @@ bxe_dump_mbuf(struct bxe_softc *sc, uint8_t contents) { char * type; + int i = 0; if (!(sc->debug & DBG_MBUF)) { return; @@ -5016,28 +5017,21 @@ bxe_dump_mbuf(struct bxe_softc *sc, while (m) { BLOGD(sc, DBG_MBUF, - "mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n", - m, m->m_len, m->m_flags, - "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY", m->m_data); + "%02d: mbuf=%p m_len=%d m_flags=0x%b m_data=%p\n", + i, m, m->m_len, m->m_flags, M_FLAG_BITS, m->m_data); if (m->m_flags & M_PKTHDR) { BLOGD(sc, DBG_MBUF, - "- m_pkthdr: len=%d flags=0x%b csum_flags=%b\n", - m->m_pkthdr.len, m->m_flags, - "\20\12M_BCAST\13M_MCAST\14M_FRAG" - "\15M_FIRSTFRAG\16M_LASTFRAG\21M_VLANTAG" - "\22M_PROMISC\23M_NOFREE", - (int)m->m_pkthdr.csum_flags, - "\20\1CSUM_IP\2CSUM_TCP\3CSUM_UDP\4CSUM_IP_FRAGS" - "\5CSUM_FRAGMENT\6CSUM_TSO\11CSUM_IP_CHECKED" - "\12CSUM_IP_VALID\13CSUM_DATA_VALID" - "\14CSUM_PSEUDO_HDR"); + "%02d: - m_pkthdr: tot_len=%d flags=0x%b csum_flags=%b\n", + i, m->m_pkthdr.len, m->m_flags, M_FLAG_BITS, + (int)m->m_pkthdr.csum_flags, CSUM_BITS); } if (m->m_flags & M_EXT) { switch (m->m_ext.ext_type) { case EXT_CLUSTER: type = "EXT_CLUSTER"; break; case EXT_SFBUF: type = "EXT_SFBUF"; break; + case EXT_JUMBOP: type = "EXT_JUMBOP"; break; case EXT_JUMBO9: type = "EXT_JUMBO9"; break; case EXT_JUMBO16: type = "EXT_JUMBO16"; break; case EXT_PACKET: type = "EXT_PACKET"; break; @@ -5050,8 +5044,8 @@ bxe_dump_mbuf(struct bxe_softc *sc, } BLOGD(sc, DBG_MBUF, - "- m_ext: %p ext_size=%d, type=%s\n", - m->m_ext.ext_buf, m->m_ext.ext_size, type); + "%02d: - m_ext: %p ext_size=%d type=%s\n", + i, m->m_ext.ext_buf, m->m_ext.ext_size, type); } if (contents) { @@ -5059,6 +5053,7 @@ bxe_dump_mbuf(struct bxe_softc *sc, } m = m->m_next; + i++; } } @@ -5669,6 +5664,7 @@ bxe_tx_encap_continue: /* split the first BD into header/data making the fw job easy */ nbds++; tx_start_bd->nbd = htole16(nbds); + tx_start_bd->nbytes = htole16(hlen); bd_prod = TX_BD_NEXT(bd_prod); Modified: head/sys/dev/bxe/ecore_sp.c ============================================================================== --- head/sys/dev/bxe/ecore_sp.c Mon Dec 30 22:17:33 2013 (r260112) +++ head/sys/dev/bxe/ecore_sp.c Mon Dec 30 23:02:26 2013 (r260113) @@ -4264,7 +4264,7 @@ void ecore_init_mac_credit_pool(struct b if (!CHIP_REV_IS_SLOW(sc)) cam_sz = (MAX_MAC_CREDIT_E2 - GET_NUM_VFS_PER_PATH(sc)) - / func_num + / func_num + GET_NUM_VFS_PER_PF(sc); else cam_sz = ECORE_CAM_SIZE_EMUL; @@ -4443,8 +4443,11 @@ int ecore_config_rss(struct bxe_softc *s struct ecore_raw_obj *r = &o->raw; /* Do nothing if only driver cleanup was requested */ - if (ECORE_TEST_BIT(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) + if (ECORE_TEST_BIT(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) { + ECORE_MSG(sc, "Not configuring RSS ramrod_flags=%lx\n", + p->ramrod_flags); return ECORE_SUCCESS; + } r->set_pending(r); From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 02:41:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D0676565; Tue, 31 Dec 2013 02:41:13 +0000 (UTC) Received: from mail-ie0-x22f.google.com (mail-ie0-x22f.google.com [IPv6:2607:f8b0:4001:c03::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7CCD016D6; Tue, 31 Dec 2013 02:41:13 +0000 (UTC) Received: by mail-ie0-f175.google.com with SMTP id x13so12631996ief.20 for ; Mon, 30 Dec 2013 18:41:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=nVgTfs5Yn3VHY8p9Kcv0aNNUZnp5LRefEgdRmlZTXCU=; b=mtr9Vx5iHoC/ZkxvVC544jDFfSB5lpd8VTe6ugsQfW+0IeeomzE1eh3TH7Xio7LWxx GH2dX26bmVABnLLaggitE2GJEP4+JiqSAzfz74dA3YOCK0fcnEpWoecfkAKjJVdcYDuT kMI4d/Ms1avXgPwRncfVnuGwdlalwjUxfdmJM50MkjQCWTbBgHtRGEzNdQtiFw+QymlB BjtYOjsIOBHfQCzjgNLtk11nFC7p2aKOdhxc64fNw3QOg9nuqSd6B4r5b+ChRoGGGD98 Y6MmYve/mNlHNvYlt7RZKB8FNQeLTlbk1GI3GI5TuYiHofqbtEC8pkkCU6pDbXG6ugzj BUSg== X-Received: by 10.42.4.201 with SMTP id 9mr5425629ict.57.1388457672802; Mon, 30 Dec 2013 18:41:12 -0800 (PST) Received: from charmander.home ([65.95.94.123]) by mx.google.com with ESMTPSA id v2sm60828837igz.3.2013.12.30.18.41.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Dec 2013 18:41:11 -0800 (PST) Sender: Mark Johnston Date: Mon, 30 Dec 2013 21:40:34 -0500 From: Mark Johnston To: Gleb Smirnoff Subject: Re: svn commit: r260091 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys dev/dtrace Message-ID: <20131231023952.GA11997@charmander.home> References: <201312301737.rBUHbW3I035088@svn.freebsd.org> <20131230204210.GD71033@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131230204210.GD71033@FreeBSD.org> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Mike Ma , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 02:41:13 -0000 On Tue, Dec 31, 2013 at 12:42:10AM +0400, Gleb Smirnoff wrote: > On Mon, Dec 30, 2013 at 05:37:32PM +0000, Mark Johnston wrote: > M> Author: markj > M> Date: Mon Dec 30 17:37:32 2013 > M> New Revision: 260091 > M> URL: http://svnweb.freebsd.org/changeset/base/260091 > M> > M> Log: > M> Now that vmem(9) is available, use vmem arenas to allocate probe and > M> aggregation IDs, as is done in the upstream illumos code. This still > M> requires some FreeBSD-specific code, as our vmem API is not identical to the > M> one in illumos. > M> > M> Submitted by: Mike Ma > > IMHO, alloc_unr() was lighter and thus better for allocating just IDs. That's true; I committed the change since it helps keep our code similar to upstream and, as Pedro notes, it was a long-standing todo item on the wiki. After doing some testing, it looks like vmem is a bit slower: process startup is on the order of tenths of milliseconds longer with this change, for executables containing one USDT probe (since such probes are allocated during process startup). So probably the right thing to do is revert this change. It doesn't actually reduce the upstream diff as much as I'd hoped, anyway. Thanks, -Mark From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 03:22:09 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C197124 for ; Tue, 31 Dec 2013 03:22:09 +0000 (UTC) Received: from nm4.bullet.mail.bf1.yahoo.com (nm4.bullet.mail.bf1.yahoo.com [98.139.212.163]) by mx1.freebsd.org (Postfix) with SMTP id 1AB911A4E for ; Tue, 31 Dec 2013 03:22:09 +0000 (UTC) Received: from [98.139.212.153] by nm4.bullet.mail.bf1.yahoo.com with NNFMP; 31 Dec 2013 03:22:01 -0000 Received: from [98.139.211.206] by tm10.bullet.mail.bf1.yahoo.com with NNFMP; 31 Dec 2013 03:22:00 -0000 Received: from [127.0.0.1] by smtp215.mail.bf1.yahoo.com with NNFMP; 31 Dec 2013 03:22:00 -0000 X-Yahoo-Newman-Id: 976141.96410.bm@smtp215.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Thkt8PIVM1kEaiFSX68uXeeB5FSV2CCHrzH4uEIKSkPZ24e KAXATPh8M_NboE6RgSoASTCIGVs7h_plBXl.Tw6Z3L0SCytFvl17jGX0khpp JQRKuBRgSamZCu.DmNt0LHybyr1jclpS9BjGBJnn0v8zQ.MfIrhNRGAnkwNp Ff5wtgkuMgL1D9vAVAPYN.6.oID7IN4.TpdQmtTlE1vb3lcwZcFkarfEJOec MkzgjOBYGEE_O01SWmkgoDewXPcw4q5MhcdsvFXweB.iZgfu4D6k4S1bzx6A 3sXi8k74eMS9RDOBDLjHUaYFj7VIsHO7hyDbgJKmw_d9ZwfwsFC.3B82WHOz E_1eEj1Kaq3uohrKpPqQxs7DYUP66Iybwx5YBbv5FHaDRuTFX4ugIVMsWOqk H5_mwtC534h0Q8dtsL3n5By8HEKPz5CnB2wllrGF7NW36xMsuXaCFWD3iqm. 3RhJ1zBQf8SP5rbstG26vse9zR.NcRVyiHfU548gFNWhK8KyLwHrNhqVfylg FZf752vRbXwQ8O7F3H.jUlyp84U0lUnWhEQqkmC3Cz8_IUxMJI2I- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.101] (pfg@190.157.126.109 with plain [98.139.211.125]) by smtp215.mail.bf1.yahoo.com with SMTP; 30 Dec 2013 19:22:00 -0800 PST Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) Subject: Re: svn commit: r260091 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys dev/dtrace From: Pedro Giffuni In-Reply-To: <20131231023952.GA11997@charmander.home> Date: Mon, 30 Dec 2013 22:21:58 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <7A335B4A-D986-4E6E-8D8B-22E7E7991A75@FreeBSD.org> References: <201312301737.rBUHbW3I035088@svn.freebsd.org> <20131230204210.GD71033@FreeBSD.org> <20131231023952.GA11997@charmander.home> To: Mark Johnston X-Mailer: Apple Mail (2.1822) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gleb Smirnoff , Mike Ma , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 03:22:09 -0000 Il giorno 30/dic/2013, alle ore 21:40, Mark Johnston = ha scritto: > On Tue, Dec 31, 2013 at 12:42:10AM +0400, Gleb Smirnoff wrote: >> On Mon, Dec 30, 2013 at 05:37:32PM +0000, Mark Johnston wrote: >> M> Author: markj >> M> Date: Mon Dec 30 17:37:32 2013 >> M> New Revision: 260091 >> M> URL: http://svnweb.freebsd.org/changeset/base/260091 >> M>=20 >> M> Log: >> M> Now that vmem(9) is available, use vmem arenas to allocate probe = and >> M> aggregation IDs, as is done in the upstream illumos code. This = still >> M> requires some FreeBSD-specific code, as our vmem API is not = identical to the >> M> one in illumos. >> M> =20 >> M> Submitted by: Mike Ma >>=20 >> IMHO, alloc_unr() was lighter and thus better for allocating just = IDs. >=20 > That's true; I committed the change since it helps keep our code = similar > to upstream and, as Pedro notes, it was a long-standing todo item on = the > wiki. After doing some testing, it looks like vmem is a bit slower: > process startup is on the order of tenths of milliseconds longer with > this change, for executables containing one USDT probe (since such > probes are allocated during process startup). >=20 > So probably the right thing to do is revert this change. It doesn't > actually reduce the upstream diff as much as I'd hoped, anyway. >=20 Since it is our option to decide, perhaps just keep the vmem version as = reference and #ifdef FreeBSD alloc_unr() ? I don=92t think we need to keep most of those SUN defines anymore. Pedro. > Thanks, > -Mark From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 03:29:20 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6EDD6376; Tue, 31 Dec 2013 03:29:20 +0000 (UTC) Received: from mail-ie0-x235.google.com (mail-ie0-x235.google.com [IPv6:2607:f8b0:4001:c03::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0FBA61A8C; Tue, 31 Dec 2013 03:29:20 +0000 (UTC) Received: by mail-ie0-f181.google.com with SMTP id e14so12720734iej.40 for ; Mon, 30 Dec 2013 19:29:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=1UEiP1L5DMizIrqAu4Id5eqdjUK6XT3tijXdRe5BJ1c=; b=bYODebS+VFFyEq5FLC6ZtJBoCX1DvITeR5ZAh/bROfJh1DE0pYsVDeoGXTDizb/tQe MANMWWIph9ghpZPVni+K5wGx0SHaL2w/glP+QcjxNV101+SXAL7FdWHpPDcpD1EE4BKG Yi5FNOg401lAk+WU4kqvo/RChFST+aUiWOBtvgY1VSvlyR+jzMllMWiz0BmPKC3RqXfy 28ProcmGxt5YPPAowKWn9INOEeeJ8HFsXGrUtdQZKlAqy0Sad22N8kdNcBD9DEmddWYv O4g+3PC7uw/EmpNLhcH+HiHMYtEamvz7Nxt4lVhI+wjiolTMWvnIu9FLUICCp19yfe8R dBAg== X-Received: by 10.50.29.114 with SMTP id j18mr57943142igh.24.1388460559385; Mon, 30 Dec 2013 19:29:19 -0800 (PST) Received: from charmander.home ([65.95.94.123]) by mx.google.com with ESMTPSA id o1sm62710885igh.9.2013.12.30.19.29.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Dec 2013 19:29:18 -0800 (PST) Sender: Mark Johnston Date: Mon, 30 Dec 2013 22:28:46 -0500 From: Mark Johnston To: Pedro Giffuni Subject: Re: svn commit: r260091 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys dev/dtrace Message-ID: <20131231032845.GB11997@charmander.home> References: <201312301737.rBUHbW3I035088@svn.freebsd.org> <20131230204210.GD71033@FreeBSD.org> <20131231023952.GA11997@charmander.home> <7A335B4A-D986-4E6E-8D8B-22E7E7991A75@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7A335B4A-D986-4E6E-8D8B-22E7E7991A75@FreeBSD.org> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gleb Smirnoff , Mike Ma , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 03:29:20 -0000 On Mon, Dec 30, 2013 at 10:21:58PM -0500, Pedro Giffuni wrote: > > Il giorno 30/dic/2013, alle ore 21:40, Mark Johnston ha scritto: > > > On Tue, Dec 31, 2013 at 12:42:10AM +0400, Gleb Smirnoff wrote: > >> On Mon, Dec 30, 2013 at 05:37:32PM +0000, Mark Johnston wrote: > >> M> Author: markj > >> M> Date: Mon Dec 30 17:37:32 2013 > >> M> New Revision: 260091 > >> M> URL: http://svnweb.freebsd.org/changeset/base/260091 > >> M> > >> M> Log: > >> M> Now that vmem(9) is available, use vmem arenas to allocate probe and > >> M> aggregation IDs, as is done in the upstream illumos code. This still > >> M> requires some FreeBSD-specific code, as our vmem API is not identical to the > >> M> one in illumos. > >> M> > >> M> Submitted by: Mike Ma > >> > >> IMHO, alloc_unr() was lighter and thus better for allocating just IDs. > > > > That's true; I committed the change since it helps keep our code similar > > to upstream and, as Pedro notes, it was a long-standing todo item on the > > wiki. After doing some testing, it looks like vmem is a bit slower: > > process startup is on the order of tenths of milliseconds longer with > > this change, for executables containing one USDT probe (since such > > probes are allocated during process startup). > > > > So probably the right thing to do is revert this change. It doesn't > > actually reduce the upstream diff as much as I'd hoped, anyway. > > > > Since it is our option to decide, perhaps just keep the vmem version as reference and #ifdef FreeBSD alloc_unr() ? You mean just having #if defined(sun) vmem code #else *_unr code #endif ? That's what we'd get by reverting the change. From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 03:49:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3039A72B for ; Tue, 31 Dec 2013 03:49:41 +0000 (UTC) Received: from nm8-vm0.bullet.mail.bf1.yahoo.com (nm8-vm0.bullet.mail.bf1.yahoo.com [98.139.213.95]) by mx1.freebsd.org (Postfix) with SMTP id B651A1CCC for ; Tue, 31 Dec 2013 03:49:40 +0000 (UTC) Received: from [98.139.215.143] by nm8.bullet.mail.bf1.yahoo.com with NNFMP; 31 Dec 2013 03:49:33 -0000 Received: from [68.142.230.69] by tm14.bullet.mail.bf1.yahoo.com with NNFMP; 31 Dec 2013 03:49:33 -0000 Received: from [127.0.0.1] by smtp226.mail.bf1.yahoo.com with NNFMP; 31 Dec 2013 03:49:33 -0000 X-Yahoo-Newman-Id: 412209.9915.bm@smtp226.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: pffOzqsVM1k4vZ9_HlITKy2U9WJqOpNa0FH4zIkMaiRJxeK Hu_Z5acsQ0EF.MKnUufr3Jkq4u1pWOmg7W6bLN7ti.LO_3ggZ9.oDJj_DCsU puNhNUX9mUtHMAo_SkrJqhGOSvERhBauimm5IT8Kt6hc0gwS54ciFr3pj5Sj 2XFRWNIMUluEqrDhnoxbjNiwaxip92nBEK1w_zp_Xlp1qpYaGzWC1zqcfp.e oO24.49RHgN4IIMs2j5wmwtm4dgTAaBQ6nGyFXm8GqImkrVDrgWm3hj_7uWr CHGaFqn2dYh3pdvFD97u6_WdA._ig_3wM_B.K8hbm9MqWG5NjD1LO6v7GAKO __Wv4DkGPD1ZMJOwtgWihoBK65C7PlsFILqqZwK0fbcGZ1T1jG4ZE._MqMWY ig6mfD2zCWGM1Jp8iSBZg27.KVyj4oAzFe4w9pvnZQ0u8D6VhwA9fOgxUDad RWDQpn.hYNbunhPGsnxhlHmuW6Fky6T0CgU57RgTZY_Kqkg35iz56RwNq0Qc yZboFoypB0SN87L42mUHr9Z02t_Lc.Yhbecxou8h.iZYW7VdLKek- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.101] (pfg@190.157.126.109 with plain [98.139.211.125]) by smtp226.mail.bf1.yahoo.com with SMTP; 31 Dec 2013 03:49:33 +0000 UTC Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) Subject: Re: svn commit: r260091 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys dev/dtrace From: Pedro Giffuni In-Reply-To: <20131231032845.GB11997@charmander.home> Date: Mon, 30 Dec 2013 22:49:23 -0500 Message-Id: References: <201312301737.rBUHbW3I035088@svn.freebsd.org> <20131230204210.GD71033@FreeBSD.org> <20131231023952.GA11997@charmander.home> <7A335B4A-D986-4E6E-8D8B-22E7E7991A75@FreeBSD.org> <20131231032845.GB11997@charmander.home> To: Mark Johnston X-Mailer: Apple Mail (2.1822) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gleb Smirnoff , Mike Ma , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 03:49:41 -0000 Il giorno 30/dic/2013, alle ore 22:28, Mark Johnston = ha scritto: > On Mon, Dec 30, 2013 at 10:21:58PM -0500, Pedro Giffuni wrote: >>=20 >> Il giorno 30/dic/2013, alle ore 21:40, Mark Johnston = ha scritto: >>=20 >>> On Tue, Dec 31, 2013 at 12:42:10AM +0400, Gleb Smirnoff wrote: >>>> On Mon, Dec 30, 2013 at 05:37:32PM +0000, Mark Johnston wrote: >>>> M> Author: markj >>>> M> Date: Mon Dec 30 17:37:32 2013 >>>> M> New Revision: 260091 >>>> M> URL: http://svnweb.freebsd.org/changeset/base/260091 >>>> M>=20 >>>> M> Log: >>>> M> Now that vmem(9) is available, use vmem arenas to allocate = probe and >>>> M> aggregation IDs, as is done in the upstream illumos code. This = still >>>> M> requires some FreeBSD-specific code, as our vmem API is not = identical to the >>>> M> one in illumos. >>>> M> =20 >>>> M> Submitted by: Mike Ma >>>>=20 >>>> IMHO, alloc_unr() was lighter and thus better for allocating just = IDs. >>>=20 >>> That's true; I committed the change since it helps keep our code = similar >>> to upstream and, as Pedro notes, it was a long-standing todo item on = the >>> wiki. After doing some testing, it looks like vmem is a bit slower: >>> process startup is on the order of tenths of milliseconds longer = with >>> this change, for executables containing one USDT probe (since such >>> probes are allocated during process startup). >>>=20 >>> So probably the right thing to do is revert this change. It doesn't >>> actually reduce the upstream diff as much as I'd hoped, anyway. >>>=20 >>=20 >> Since it is our option to decide, perhaps just keep the vmem version = as reference and #ifdef FreeBSD alloc_unr() ? >=20 > You mean just having >=20 > #if defined(sun) > vmem code > #else > *_unr code > #endif >=20 > ? That's what we'd get by reverting the change. Rather=20 #ifdef __FreeBSD__ *_unr code #else vmem code (FreeBSD variant) #endif Not much different, but if we are going to keep dead code let=92s keep = at least code that is known to work ;) Pedro.= From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 04:00:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 98B6A8C9; Tue, 31 Dec 2013 04:00:31 +0000 (UTC) Received: from mail-ie0-x22f.google.com (mail-ie0-x22f.google.com [IPv6:2607:f8b0:4001:c03::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 366051D9A; Tue, 31 Dec 2013 04:00:31 +0000 (UTC) Received: by mail-ie0-f175.google.com with SMTP id x13so12713074ief.34 for ; Mon, 30 Dec 2013 20:00:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=coEH8EjPeTJ82uun9ijjmuVtHBGKKIDhkbSI5jRy0d4=; b=vEdkOi7iXlkT6/7owgPs2DkbeFwmcixlH3XqeMinyZL+e1aFJrJGrZarnicqbS/rxY qC6ejM+cbUQCy2852Bp7iB7FWmqQV0f5+BbAnRAO7ZMmyXuUTGap8et70mcmp21TXxkO 7SI7tM40deJGfJ39/wltOhn28m8BH2yRBG8UQOC6BpjzXgQwQ2+qAjr1ywYrBNBbfgkj pewU50XXCvD3Mwnh81blWJjI+lddznXLx+w4yMxoqD38VwMMRFFyujrjfZ2/PwIr+pBF 4E/cEBGhKLLKSMKOOezHP3wTIqrZyhCVSD6jehf8SBzyUylz3UDMcQbk/4fI0yYzBnLt 3l2g== X-Received: by 10.50.25.227 with SMTP id f3mr58638578igg.21.1388462430686; Mon, 30 Dec 2013 20:00:30 -0800 (PST) Received: from charmander.home ([65.95.94.123]) by mx.google.com with ESMTPSA id au9sm23933288igc.7.2013.12.30.20.00.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Dec 2013 20:00:30 -0800 (PST) Sender: Mark Johnston Date: Mon, 30 Dec 2013 22:59:57 -0500 From: Mark Johnston To: Pedro Giffuni Subject: Re: svn commit: r260091 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys dev/dtrace Message-ID: <20131231035957.GC11997@charmander.home> References: <201312301737.rBUHbW3I035088@svn.freebsd.org> <20131230204210.GD71033@FreeBSD.org> <20131231023952.GA11997@charmander.home> <7A335B4A-D986-4E6E-8D8B-22E7E7991A75@FreeBSD.org> <20131231032845.GB11997@charmander.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gleb Smirnoff , Mike Ma , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 04:00:31 -0000 On Mon, Dec 30, 2013 at 10:49:23PM -0500, Pedro Giffuni wrote: > > Il giorno 30/dic/2013, alle ore 22:28, Mark Johnston ha scritto: > > > On Mon, Dec 30, 2013 at 10:21:58PM -0500, Pedro Giffuni wrote: > >> > >> Il giorno 30/dic/2013, alle ore 21:40, Mark Johnston ha scritto: > >> > >>> On Tue, Dec 31, 2013 at 12:42:10AM +0400, Gleb Smirnoff wrote: > >>>> On Mon, Dec 30, 2013 at 05:37:32PM +0000, Mark Johnston wrote: > >>>> M> Author: markj > >>>> M> Date: Mon Dec 30 17:37:32 2013 > >>>> M> New Revision: 260091 > >>>> M> URL: http://svnweb.freebsd.org/changeset/base/260091 > >>>> M> > >>>> M> Log: > >>>> M> Now that vmem(9) is available, use vmem arenas to allocate probe and > >>>> M> aggregation IDs, as is done in the upstream illumos code. This still > >>>> M> requires some FreeBSD-specific code, as our vmem API is not identical to the > >>>> M> one in illumos. > >>>> M> > >>>> M> Submitted by: Mike Ma > >>>> > >>>> IMHO, alloc_unr() was lighter and thus better for allocating just IDs. > >>> > >>> That's true; I committed the change since it helps keep our code similar > >>> to upstream and, as Pedro notes, it was a long-standing todo item on the > >>> wiki. After doing some testing, it looks like vmem is a bit slower: > >>> process startup is on the order of tenths of milliseconds longer with > >>> this change, for executables containing one USDT probe (since such > >>> probes are allocated during process startup). > >>> > >>> So probably the right thing to do is revert this change. It doesn't > >>> actually reduce the upstream diff as much as I'd hoped, anyway. > >>> > >> > >> Since it is our option to decide, perhaps just keep the vmem version as reference and #ifdef FreeBSD alloc_unr() ? > > > > You mean just having > > > > #if defined(sun) > > vmem code > > #else > > *_unr code > > #endif > > > > ? That's what we'd get by reverting the change. > > > Rather > #ifdef __FreeBSD__ > *_unr code > #else > vmem code (FreeBSD variant) > #endif > > Not much different, but if we are going to keep dead code let’s keep at least code that is known to work ;) IMHO, the whole point of keeping the dead code is to make it easier to merge upstream changes, and to have a quick reference handy when comparing illumos- and FreeBSD-specific code. That's how it's used in all of dtrace.c, so I'd prefer to be consistent in this case as well, rather than having two versions of FreeBSD-specific code. -Mark From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 04:40:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 90DAB9E5; Tue, 31 Dec 2013 04:40:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7E8731FF1; Tue, 31 Dec 2013 04:40:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBV4ePMd098694; Tue, 31 Dec 2013 04:40:25 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBV4ePup098693; Tue, 31 Dec 2013 04:40:25 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201312310440.rBV4ePup098693@svn.freebsd.org> From: Warner Losh Date: Tue, 31 Dec 2013 04:40:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260118 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 04:40:25 -0000 Author: imp Date: Tue Dec 31 04:40:25 2013 New Revision: 260118 URL: http://svnweb.freebsd.org/changeset/base/260118 Log: Delete echoed doesn't rub out the previous character, so always use instead. This fixes hitting DELETE instead of BACKSPACE at mountroot> prompt. Modified: head/sys/kern/kern_cons.c Modified: head/sys/kern/kern_cons.c ============================================================================== --- head/sys/kern/kern_cons.c Tue Dec 31 01:11:03 2013 (r260117) +++ head/sys/kern/kern_cons.c Tue Dec 31 04:40:25 2013 (r260118) @@ -432,10 +432,8 @@ cngets(char *cp, size_t size, int visibl case '\b': case '\177': if (lp > cp) { - if (visible) { - cnputc(c); - cnputs(" \b"); - } + if (visible) + cnputs("\b \b"); lp--; } continue; From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 07:36:40 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1281BD6A; Tue, 31 Dec 2013 07:36:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F20331A3B; Tue, 31 Dec 2013 07:36:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBV7adxl066812; Tue, 31 Dec 2013 07:36:39 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBV7adgx066811; Tue, 31 Dec 2013 07:36:39 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201312310736.rBV7adgx066811@svn.freebsd.org> From: Warner Losh Date: Tue, 31 Dec 2013 07:36:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260121 - head/sys/dev/nand X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 07:36:40 -0000 Author: imp Date: Tue Dec 31 07:36:39 2013 New Revision: 260121 URL: http://svnweb.freebsd.org/changeset/base/260121 Log: Add support for Samsung K9F2G08U0A (256MiB SLC) NAND found on some old Atmel boards I have. # All Samsung, Toshiba and SanDisk parts will need to be in this table # since they don't conform to the ONFI specification (they are all Toggle # parts). There's some standards for the additional bytes so there's some hope # to decode them automatically on a per-vendor basis, but even that has # problems (and is what motivated the ONFI parameter page). Modified: head/sys/dev/nand/nand_id.c Modified: head/sys/dev/nand/nand_id.c ============================================================================== --- head/sys/dev/nand/nand_id.c Tue Dec 31 05:20:44 2013 (r260120) +++ head/sys/dev/nand/nand_id.c Tue Dec 31 07:36:39 2013 (r260121) @@ -39,6 +39,8 @@ struct nand_params nand_ids[] = { 0x400, 0x800, 0x40, 0x40, 0 }, { { NAND_MAN_SAMSUNG, 0xdc }, "Samsung NAND 512MiB 3,3V 8-bit", 0x200, 0x800, 0x40, 0x40, 0 }, + { { NAND_MAN_SAMSUNG, 0xda }, "Samsung NAND 256MiB 3,3V 8-bit", + 0x100, 0x800, 0x40, 0x40, 0 }, { { NAND_MAN_HYNIX, 0x76 }, "Hynix NAND 64MiB 3,3V 8-bit", 0x40, 0x200, 0x10, 0x20, 0 }, { { NAND_MAN_HYNIX, 0xdc }, "Hynix NAND 512MiB 3,3V 8-bit", From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 12:11:48 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D8CCB5EF; Tue, 31 Dec 2013 12:11:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C522A1CCF; Tue, 31 Dec 2013 12:11:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBVCBmjZ076420; Tue, 31 Dec 2013 12:11:48 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBVCBmrm076419; Tue, 31 Dec 2013 12:11:48 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201312311211.rBVCBmrm076419@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Tue, 31 Dec 2013 12:11:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260124 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 12:11:48 -0000 Author: melifaro Date: Tue Dec 31 12:11:48 2013 New Revision: 260124 URL: http://svnweb.freebsd.org/changeset/base/260124 Log: Explicitly free rt_tables to please Coverity. Reported by: Coverity Coverity CID: 1147174 MFC after: 2 weeks Modified: head/usr.bin/netstat/route.c Modified: head/usr.bin/netstat/route.c ============================================================================== --- head/usr.bin/netstat/route.c Tue Dec 31 11:54:37 2013 (r260123) +++ head/usr.bin/netstat/route.c Tue Dec 31 12:11:48 2013 (r260124) @@ -426,7 +426,7 @@ p_rtable_kvm(int fibnum, int af) if (kread((u_long)(rtree), (char *)(rt_tables) + fibnum * af_size, af_size) != 0) - return; + err(EX_OSERR, "error retrieving radix pointers"); for (fam = 0; fam <= AF_MAX; fam++) { int tmpfib; @@ -462,6 +462,8 @@ p_rtable_kvm(int fibnum, int af) p_rtree_kvm(head.rnh_treetop); } } + + free(rt_tables); } /* From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 12:18:11 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 53C7B759; Tue, 31 Dec 2013 12:18:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 406B71CEF; Tue, 31 Dec 2013 12:18:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBVCIBdQ077263; Tue, 31 Dec 2013 12:18:11 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBVCIACe077258; Tue, 31 Dec 2013 12:18:10 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201312311218.rBVCIACe077258@svn.freebsd.org> From: Glen Barber Date: Tue, 31 Dec 2013 12:18:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260125 - in head: . sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 12:18:11 -0000 Author: gjb Date: Tue Dec 31 12:18:10 2013 New Revision: 260125 URL: http://svnweb.freebsd.org/changeset/base/260125 Log: Bump copyright year. Happy New Year 2014! Sponsored by: The FreeBSD Foundation Modified: head/COPYRIGHT head/sys/sys/copyright.h Modified: head/COPYRIGHT ============================================================================== --- head/COPYRIGHT Tue Dec 31 12:11:48 2013 (r260124) +++ head/COPYRIGHT Tue Dec 31 12:18:10 2013 (r260125) @@ -4,7 +4,7 @@ The compilation of software known as FreeBSD is distributed under the following terms: -Copyright (c) 1992-2013 The FreeBSD Project. All rights reserved. +Copyright (c) 1992-2014 The FreeBSD Project. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: head/sys/sys/copyright.h ============================================================================== --- head/sys/sys/copyright.h Tue Dec 31 12:11:48 2013 (r260124) +++ head/sys/sys/copyright.h Tue Dec 31 12:18:10 2013 (r260125) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 1992-2013 The FreeBSD Project. All rights reserved. + * Copyright (C) 1992-2014 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,7 +30,7 @@ /* FreeBSD */ #define COPYRIGHT_FreeBSD \ - "Copyright (c) 1992-2013 The FreeBSD Project.\n" + "Copyright (c) 1992-2014 The FreeBSD Project.\n" /* Foundation */ #define TRADEMARK_Foundation \ From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 15:37:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 06D0AABF; Tue, 31 Dec 2013 15:37:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DC0721A7D; Tue, 31 Dec 2013 15:37:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBVFbqXX056585; Tue, 31 Dec 2013 15:37:52 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBVFbqND056581; Tue, 31 Dec 2013 15:37:52 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201312311537.rBVFbqND056581@svn.freebsd.org> From: Mark Johnston Date: Tue, 31 Dec 2013 15:37:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260131 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys dev/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 15:37:53 -0000 Author: markj Date: Tue Dec 31 15:37:51 2013 New Revision: 260131 URL: http://svnweb.freebsd.org/changeset/base/260131 Log: Revert r260091. The vmem calls seem to be slower than the *_unr() calls that they replaced, which is important considering that probe IDs are allocated during process startup for USDT probes. Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h head/sys/cddl/dev/dtrace/dtrace_load.c head/sys/cddl/dev/dtrace/dtrace_unload.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Dec 31 12:36:46 2013 (r260130) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Dec 31 15:37:51 2013 (r260131) @@ -206,11 +206,12 @@ const char dtrace_zero[256] = { 0 }; /* #if defined(sun) static dev_info_t *dtrace_devi; /* device info */ #endif -static vmem_t *dtrace_arena; /* probe ID arena */ #if defined(sun) +static vmem_t *dtrace_arena; /* probe ID arena */ static vmem_t *dtrace_minor; /* minor number arena */ #else static taskq_t *dtrace_taskq; /* task queue */ +static struct unrhdr *dtrace_arena; /* Probe ID number. */ #endif static dtrace_probe_t **dtrace_probes; /* array of all probes */ static int dtrace_nprobes; /* number of probes */ @@ -7831,7 +7832,7 @@ dtrace_unregister(dtrace_provider_id_t i #if defined(sun) vmem_free(dtrace_arena, (void *)(uintptr_t)(probe->dtpr_id), 1); #else - vmem_free(dtrace_arena, (vmem_addr_t)(probe->dtpr_id), 1); + free_unr(dtrace_arena, probe->dtpr_id); #endif kmem_free(probe, sizeof (dtrace_probe_t)); } @@ -7952,7 +7953,7 @@ dtrace_condense(dtrace_provider_id_t id) #if defined(sun) vmem_free(dtrace_arena, (void *)((uintptr_t)i + 1), 1); #else - vmem_free(dtrace_arena, (vmem_addr_t)i + 1, 1); + free_unr(dtrace_arena, i + 1); #endif } @@ -7982,9 +7983,6 @@ dtrace_probe_create(dtrace_provider_id_t dtrace_probe_t *probe, **probes; dtrace_provider_t *provider = (dtrace_provider_t *)prov; dtrace_id_t id; -#if !defined(sun) - vmem_addr_t addr; -#endif if (provider == dtrace_provider) { ASSERT(MUTEX_HELD(&dtrace_lock)); @@ -7994,10 +7992,9 @@ dtrace_probe_create(dtrace_provider_id_t #if defined(sun) id = (dtrace_id_t)(uintptr_t)vmem_alloc(dtrace_arena, 1, - VM_BESTFIT | VM_WAITOK); + VM_BESTFIT | VM_SLEEP); #else - vmem_alloc(dtrace_arena, 1, M_BESTFIT | M_WAITOK, &addr); - id = (dtrace_id_t)addr; + id = alloc_unr(dtrace_arena); #endif probe = kmem_zalloc(sizeof (dtrace_probe_t), KM_SLEEP); @@ -10048,9 +10045,6 @@ dtrace_ecb_aggregation_create(dtrace_ecb dtrace_recdesc_t *frec; dtrace_aggid_t aggid; dtrace_state_t *state = ecb->dte_state; -#if !defined(sun) - vmem_addr_t addr; -#endif agg = kmem_zalloc(sizeof (dtrace_aggregation_t), KM_SLEEP); agg->dtag_ecb = ecb; @@ -10190,8 +10184,7 @@ success: aggid = (dtrace_aggid_t)(uintptr_t)vmem_alloc(state->dts_aggid_arena, 1, VM_BESTFIT | VM_SLEEP); #else - vmem_alloc(state->dts_aggid_arena, 1, M_BESTFIT | M_WAITOK, &addr); - aggid = (dtrace_aggid_t)addr; + aggid = alloc_unr(state->dts_aggid_arena); #endif if (aggid - 1 >= state->dts_naggregations) { @@ -10244,7 +10237,7 @@ dtrace_ecb_aggregation_destroy(dtrace_ec #if defined(sun) vmem_free(state->dts_aggid_arena, (void *)(uintptr_t)aggid, 1); #else - vmem_free(state->dts_aggid_arena, (vmem_addr_t)aggid, 1); + free_unr(state->dts_aggid_arena, aggid); #endif ASSERT(state->dts_aggregations[aggid - 1] == agg); @@ -13212,7 +13205,7 @@ dtrace_state_create(struct cdev *dev) if (dev != NULL) { cr = dev->si_cred; m = dev2unit(dev); - } + } /* Allocate memory for the state. */ state = kmem_zalloc(sizeof(dtrace_state_t), KM_SLEEP); @@ -13224,12 +13217,7 @@ dtrace_state_create(struct cdev *dev) #if defined(sun) state->dts_aggid_arena = vmem_create(c, (void *)1, UINT32_MAX, 1, NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER); -#else - state->dts_aggid_arena = vmem_create(c, (vmem_addr_t)1, UINT32_MAX, 1, - 0, M_WAITOK); -#endif -#if defined(sun) if (devp != NULL) { major = getemajor(*devp); } else { @@ -13241,6 +13229,7 @@ dtrace_state_create(struct cdev *dev) if (devp != NULL) *devp = state->dts_dev; #else + state->dts_aggid_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx); state->dts_dev = dev; #endif @@ -14047,7 +14036,11 @@ dtrace_state_destroy(dtrace_state_t *sta dtrace_format_destroy(state); if (state->dts_aggid_arena != NULL) { +#if defined(sun) vmem_destroy(state->dts_aggid_arena); +#else + delete_unrhdr(state->dts_aggid_arena); +#endif state->dts_aggid_arena = NULL; } #if defined(sun) @@ -15382,7 +15375,7 @@ dtrace_module_unloaded(modctl_t *ctl, in #if defined(sun) vmem_free(dtrace_arena, (void *)(uintptr_t)probe->dtpr_id, 1); #else - vmem_free(dtrace_arena, (vmem_addr_t)probe->dtpr_id, 1); + free_unr(dtrace_arena, probe->dtpr_id); #endif kmem_free(probe, sizeof (dtrace_probe_t)); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Tue Dec 31 12:36:46 2013 (r260130) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Tue Dec 31 15:37:51 2013 (r260131) @@ -1139,7 +1139,11 @@ struct dtrace_state { int dts_nspeculations; /* number of speculations */ int dts_naggregations; /* number of aggregations */ dtrace_aggregation_t **dts_aggregations; /* aggregation array */ +#if defined(sun) vmem_t *dts_aggid_arena; /* arena for aggregation IDs */ +#else + struct unrhdr *dts_aggid_arena; /* arena for aggregation IDs */ +#endif uint64_t dts_errors; /* total number of errors */ uint32_t dts_speculations_busy; /* number of spec. busy */ uint32_t dts_speculations_unavail; /* number of spec unavail */ Modified: head/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_load.c Tue Dec 31 12:36:46 2013 (r260130) +++ head/sys/cddl/dev/dtrace/dtrace_load.c Tue Dec 31 15:37:51 2013 (r260131) @@ -58,9 +58,6 @@ dtrace_load(void *dummy) dtrace_taskq = taskq_create("dtrace_taskq", 1, maxclsyspri, 0, 0, 0); - dtrace_arena = vmem_create("dtrace", 1, UINT32_MAX, 1, 0, - M_WAITOK | M_BESTFIT); - /* Register callbacks for linker file load and unload events. */ dtrace_kld_load_tag = EVENTHANDLER_REGISTER(kld_load, dtrace_kld_load, NULL, EVENTHANDLER_PRI_ANY); @@ -88,6 +85,8 @@ dtrace_load(void *dummy) ASSERT(MUTEX_HELD(&cpu_lock)); + dtrace_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx); + dtrace_state_cache = kmem_cache_create("dtrace_state_cache", sizeof (dtrace_dstate_percpu_t) * NCPU, DTRACE_STATE_ALIGN, NULL, NULL, NULL, NULL, NULL, 0); Modified: head/sys/cddl/dev/dtrace/dtrace_unload.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_unload.c Tue Dec 31 12:36:46 2013 (r260130) +++ head/sys/cddl/dev/dtrace/dtrace_unload.c Tue Dec 31 15:37:51 2013 (r260131) @@ -104,7 +104,7 @@ dtrace_unload() kmem_cache_destroy(dtrace_state_cache); - vmem_destroy(dtrace_arena); + delete_unrhdr(dtrace_arena); if (dtrace_toxrange != NULL) { kmem_free(dtrace_toxrange, 0); From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 15:41:16 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8E68C2C; Tue, 31 Dec 2013 15:41:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A525C1AE7; Tue, 31 Dec 2013 15:41:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBVFfGXM059167; Tue, 31 Dec 2013 15:41:16 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBVFfGlw059166; Tue, 31 Dec 2013 15:41:16 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201312311541.rBVFfGlw059166@svn.freebsd.org> From: Mark Johnston Date: Tue, 31 Dec 2013 15:41:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260132 - head/sys/cddl/dev/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 15:41:16 -0000 Author: markj Date: Tue Dec 31 15:41:16 2013 New Revision: 260132 URL: http://svnweb.freebsd.org/changeset/base/260132 Log: Allocate the probe ID unrhdr before the DTrace kld_* event handlers are registered. Otherwise there is a small window during which probe IDs may be allocated before the unrhdr is allocated. MFC after: 2 weeks Modified: head/sys/cddl/dev/dtrace/dtrace_load.c Modified: head/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_load.c Tue Dec 31 15:37:51 2013 (r260131) +++ head/sys/cddl/dev/dtrace/dtrace_load.c Tue Dec 31 15:41:16 2013 (r260132) @@ -58,6 +58,8 @@ dtrace_load(void *dummy) dtrace_taskq = taskq_create("dtrace_taskq", 1, maxclsyspri, 0, 0, 0); + dtrace_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx); + /* Register callbacks for linker file load and unload events. */ dtrace_kld_load_tag = EVENTHANDLER_REGISTER(kld_load, dtrace_kld_load, NULL, EVENTHANDLER_PRI_ANY); @@ -85,8 +87,6 @@ dtrace_load(void *dummy) ASSERT(MUTEX_HELD(&cpu_lock)); - dtrace_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx); - dtrace_state_cache = kmem_cache_create("dtrace_state_cache", sizeof (dtrace_dstate_percpu_t) * NCPU, DTRACE_STATE_ALIGN, NULL, NULL, NULL, NULL, NULL, 0); From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 15:45:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5E63D80; Tue, 31 Dec 2013 15:45:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 91ED31AF6; Tue, 31 Dec 2013 15:45:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBVFjCpG060065; Tue, 31 Dec 2013 15:45:12 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBVFjC8V060064; Tue, 31 Dec 2013 15:45:12 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201312311545.rBVFjC8V060064@svn.freebsd.org> From: Mark Johnston Date: Tue, 31 Dec 2013 15:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260133 - head/tools/test/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 15:45:12 -0000 Author: markj Date: Tue Dec 31 15:45:12 2013 New Revision: 260133 URL: http://svnweb.freebsd.org/changeset/base/260133 Log: Some DTrace tests (mostly in the pid provider directory) make use of executable ksh scripts. These are currently not copied into the test directory the way that compiled executables are, so the tests which make use of them cannot work. This changes the test Makefile to copy the scripts into the test directory. Modified: head/tools/test/dtrace/Makefile Modified: head/tools/test/dtrace/Makefile ============================================================================== --- head/tools/test/dtrace/Makefile Tue Dec 31 15:41:16 2013 (r260132) +++ head/tools/test/dtrace/Makefile Tue Dec 31 15:45:12 2013 (r260133) @@ -297,6 +297,8 @@ ${_d}_TSTD!= find ${TESTSRCDIR}/tst/comm ${_d}_TSTC!= find ${TESTSRCDIR}/tst/common/${_d} -name "tst.*.c" ${_d}_SHERR!= find ${TESTSRCDIR}/tst/common/${_d} -name "err.*.ksh" ${_d}_SHTST!= find ${TESTSRCDIR}/tst/common/${_d} -name "tst.*.ksh" +${_d}_EXE!= find ${TESTSRCDIR}/tst/common/${_d} -name "tst.*.exe" -o \ + -name "err.*.exe" ${_d}_TF= ${${_d}_ERR} ${${_d}_TSTD} ${${_d}_SHERR} ${${_d}_SHTST} # Go through the list of test files and prepare another list that contains @@ -317,15 +319,16 @@ ${_d}_TFCS+= ${_f} .endfor ALL_TESTCFILES+= ${${_d}_TFCS} +ALL_TESTEXEFILES+= ${${_d}_EXE} -${_d} : ${${_d}_TFCS:T:S/c$/exe/} +${_d} : ${${_d}_TFCS:T:S/c$/exe/} ${${_d}_EXE:T} @${DTEST} ${${_d}_TFS} .endfor # -------------------------------------------------------------------------------- # -PRGS= ${ALL_TESTCFILES:T:S/c$/exe/} +PRGS= ${ALL_TESTCFILES:T:S/c$/exe/} ${ALL_TESTEXEFILES:T} listprgs : @echo ${PRGS} @@ -338,6 +341,12 @@ ${_f:T:S/c$/exe/} : ${_f} gcc -o ${.TARGET} ${_f} -lrt .endfor +.for _f in ${ALL_TESTEXEFILES} +${_f:T} : ${_f} + cp -f ${_f} ${.TARGET} + chmod a+x ${.TARGET} +.endfor + listcfiles : @echo ${ALL_TESTCFILES} From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 18:25:16 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 803D1872; Tue, 31 Dec 2013 18:25:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6B2F3162E; Tue, 31 Dec 2013 18:25:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBVIPGj2021269; Tue, 31 Dec 2013 18:25:16 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBVIPFZs021262; Tue, 31 Dec 2013 18:25:15 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201312311825.rBVIPFZs021262@svn.freebsd.org> From: Alan Cox Date: Tue, 31 Dec 2013 18:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260137 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 18:25:16 -0000 Author: alc Date: Tue Dec 31 18:25:15 2013 New Revision: 260137 URL: http://svnweb.freebsd.org/changeset/base/260137 Log: Since the introduction of the popmap to reservations in r259999, there is no longer any need for the page's PG_CACHED and PG_FREE flags to be set and cleared while the free page queues lock is held. Thus, vm_page_alloc(), vm_page_alloc_contig(), and vm_page_alloc_freelist() can wait until after the free page queues lock is released to clear the page's flags. Moreover, the PG_FREE flag can be retired. Now that the reservation system no longer uses it, its only uses are in a few assertions. Eliminating these assertions is no real loss. Other assertions catch the same types of misbehavior, like doubly freeing a page (see r260032) or dirtying a free page (free pages are invalid and only valid pages can be dirtied). Eliminate an unneeded variable from vm_page_alloc_contig(). Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_phys.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Dec 31 17:29:29 2013 (r260136) +++ head/sys/vm/vm_page.c Tue Dec 31 18:25:15 2013 (r260137) @@ -922,8 +922,6 @@ vm_page_dirty_KBI(vm_page_t m) /* These assertions refer to this operation by its public name. */ KASSERT((m->flags & PG_CACHED) == 0, ("vm_page_dirty: page in cache!")); - KASSERT(!VM_PAGE_IS_FREE(m), - ("vm_page_dirty: page is free!")); KASSERT(m->valid == VM_PAGE_BITS_ALL, ("vm_page_dirty: page is invalid!")); m->dirty = VM_PAGE_BITS_ALL; @@ -1568,27 +1566,24 @@ vm_page_alloc(vm_object_t object, vm_pin vm_object_cache_is_empty(m_object)) vp = m_object->handle; } else { - KASSERT(VM_PAGE_IS_FREE(m), - ("vm_page_alloc: page %p is not free", m)); KASSERT(m->valid == 0, ("vm_page_alloc: free page %p is valid", m)); vm_phys_freecnt_adj(m, -1); + if ((m->flags & PG_ZERO) != 0) + vm_page_zero_count--; } + mtx_unlock(&vm_page_queue_free_mtx); /* - * Only the PG_ZERO flag is inherited. The PG_CACHED or PG_FREE flag - * must be cleared before the free page queues lock is released. + * Initialize the page. Only the PG_ZERO flag is inherited. */ flags = 0; - if (m->flags & PG_ZERO) { - vm_page_zero_count--; - if (req & VM_ALLOC_ZERO) - flags = PG_ZERO; - } - if (req & VM_ALLOC_NODUMP) + if ((req & VM_ALLOC_ZERO) != 0) + flags = PG_ZERO; + flags &= m->flags; + if ((req & VM_ALLOC_NODUMP) != 0) flags |= PG_NODUMP; m->flags = flags; - mtx_unlock(&vm_page_queue_free_mtx); m->aflags = 0; m->oflags = object == NULL || (object->flags & OBJ_UNMANAGED) != 0 ? VPO_UNMANAGED : 0; @@ -1704,7 +1699,7 @@ vm_page_alloc_contig(vm_object_t object, struct vnode *drop; struct spglist deferred_vdrop_list; vm_page_t m, m_tmp, m_ret; - u_int flags, oflags; + u_int flags; int req_class; KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) && @@ -1782,7 +1777,6 @@ retry: flags |= PG_NODUMP; if ((req & VM_ALLOC_WIRED) != 0) atomic_add_int(&cnt.v_wire_count, npages); - oflags = VPO_UNMANAGED; if (object != NULL) { if (object->memattr != VM_MEMATTR_DEFAULT && memattr == VM_MEMATTR_DEFAULT) @@ -1801,7 +1795,7 @@ retry: if ((req & VM_ALLOC_WIRED) != 0) m->wire_count = 1; /* Unmanaged pages don't use "act_count". */ - m->oflags = oflags; + m->oflags = VPO_UNMANAGED; if (object != NULL) { if (vm_page_insert(m, object, pindex)) { vm_page_alloc_contig_vdrop( @@ -1873,16 +1867,12 @@ vm_page_alloc_init(vm_page_t m) vm_object_cache_is_empty(m_object)) drop = m_object->handle; } else { - KASSERT(VM_PAGE_IS_FREE(m), - ("vm_page_alloc_init: page %p is not free", m)); KASSERT(m->valid == 0, ("vm_page_alloc_init: free page %p is valid", m)); vm_phys_freecnt_adj(m, -1); if ((m->flags & PG_ZERO) != 0) vm_page_zero_count--; } - /* Don't clear the PG_ZERO flag; we'll need it later. */ - m->flags &= PG_ZERO; return (drop); } @@ -2211,10 +2201,9 @@ vm_page_cache_turn_free(vm_page_t m) m->object = NULL; m->valid = 0; - /* Clear PG_CACHED and set PG_FREE. */ - m->flags ^= PG_CACHED | PG_FREE; - KASSERT((m->flags & (PG_CACHED | PG_FREE)) == PG_FREE, - ("vm_page_cache_free: page %p has inconsistent flags", m)); + KASSERT((m->flags & PG_CACHED) != 0, + ("vm_page_cache_turn_free: page %p is not cached", m)); + m->flags &= ~PG_CACHED; cnt.v_cache_count--; vm_phys_freecnt_adj(m, 1); } @@ -2240,9 +2229,7 @@ vm_page_free_toq(vm_page_t m) ("vm_page_free_toq: unmanaged page %p is queued", m)); PCPU_INC(cnt.v_tfree); - if (VM_PAGE_IS_FREE(m)) - panic("vm_page_free: freeing free page %p", m); - else if (vm_page_sbusied(m)) + if (vm_page_sbusied(m)) panic("vm_page_free: freeing busy page %p", m); /* @@ -2284,7 +2271,6 @@ vm_page_free_toq(vm_page_t m) * cache/free page queues. */ mtx_lock(&vm_page_queue_free_mtx); - m->flags |= PG_FREE; vm_phys_freecnt_adj(m, 1); #if VM_NRESERVLEVEL > 0 if (!vm_reserv_free_page(m)) Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Tue Dec 31 17:29:29 2013 (r260136) +++ head/sys/vm/vm_page.h Tue Dec 31 18:25:15 2013 (r260137) @@ -321,7 +321,6 @@ extern struct mtx_padalign pa_lock[]; * freeing, the modification must be protected by the vm_page lock. */ #define PG_CACHED 0x0001 /* page is cached */ -#define PG_FREE 0x0002 /* page is free */ #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ #define PG_ZERO 0x0008 /* page is zeroed */ #define PG_MARKER 0x0010 /* special queue marker page */ @@ -372,8 +371,6 @@ extern vm_page_t vm_page_array; /* Firs extern long vm_page_array_size; /* number of vm_page_t's */ extern long first_page; /* first physical page number */ -#define VM_PAGE_IS_FREE(m) (((m)->flags & PG_FREE) != 0) - #define VM_PAGE_TO_PHYS(entry) ((entry)->phys_addr) vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Tue Dec 31 17:29:29 2013 (r260136) +++ head/sys/vm/vm_phys.c Tue Dec 31 18:25:15 2013 (r260137) @@ -391,7 +391,6 @@ vm_phys_add_page(vm_paddr_t pa) vmd = vm_phys_domain(m); vmd->vmd_page_count++; vmd->vmd_segs |= 1UL << m->segind; - m->flags = PG_FREE; KASSERT(m->order == VM_NFREEORDER, ("vm_phys_add_page: page %p has unexpected order %d", m, m->order)); From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 19:39:17 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2846E244; Tue, 31 Dec 2013 19:39:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 103221A88; Tue, 31 Dec 2013 19:39:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBVJdHjN048003; Tue, 31 Dec 2013 19:39:17 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBVJdFUs047994; Tue, 31 Dec 2013 19:39:15 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201312311939.rBVJdFUs047994@svn.freebsd.org> From: Xin LI Date: Tue, 31 Dec 2013 19:39:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260138 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/common/sys sys/... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 19:39:17 -0000 Author: delphij Date: Tue Dec 31 19:39:15 2013 New Revision: 260138 URL: http://svnweb.freebsd.org/changeset/base/260138 Log: MFV r242733: 3306 zdb should be able to issue reads in parallel 3321 'zpool reopen' command should be documented in the man page and help message illumos/illumos-gate@31d7e8fa33fae995f558673adb22641b5aa8b6e1 FreeBSD porting notes: the kernel part of this changeset depends on Solaris buf(9S) interfaces and are not really applicable for our use. vdev_disk.c is patched as-is to reduce diverge from upstream, but vdev_file.c is left intact. MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Tue Dec 31 18:25:15 2013 (r260137) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Tue Dec 31 19:39:15 2013 (r260138) @@ -14,11 +14,12 @@ .\" .\" Copyright 2012, Richard Lowe. .\" Copyright (c) 2012, Marcelo Araujo . +.\" Copyright (c) 2012 by Delphix. All rights reserved. .\" All Rights Reserved. .\" .\" $FreeBSD$ .\" -.Dd May 10, 2012 +.Dd December 31, 2013 .Dt ZDB 8 .Os .Sh NAME @@ -29,27 +30,35 @@ .Op Fl CumdibcsDvhLXFPA .Op Fl e Op Fl p Ar path... .Op Fl t Ar txg +.Op Fl U Ar cache +.Op Fl M Ar inflight I/Os .Ar poolname .Op Ar object ... .Nm .Op Fl divPA .Op Fl e Op Fl p Ar path... +.Op Fl U Ar cache .Ar dataset .Op Ar object ... .Nm .Fl m Op Fl LXFPA .Op Fl t Ar txg .Op Fl e Op Fl p Ar path... +.Op Fl U Ar cache .Ar poolname .Nm .Fl R Op Fl A .Op Fl e Op Fl p Ar path... +.Op Fl U Ar cache +.Ar poolname .Ar poolname .Ar vdev Ns : Ns Ar offset Ns : Ns Ar size Ns Op Ns : Ns Ar flags .Nm .Fl S .Op Fl AP .Op Fl e Op Fl p Ar path... +.Op Fl U Ar cache +.Ar poolname .Ar poolname .Nm .Fl l @@ -205,6 +214,11 @@ flag specifies the path under which devi .It Fl F Attempt to make an unreadable pool readable by trying progressively older transactions. +.It Fl M Ar inflight I/Os +Limit the number of outstanding checksum I/Os to the specified value. +The default value is 200. This option affects the performance of the +.Fl c +option. .It Fl P Print numbers in an unscaled form more amenable to parsing, eg. 1000000 rather than 1M. @@ -218,9 +232,7 @@ options for a means to see the available transaction numbers. .It Fl U Ar cachefile Use a cache file other than -.Pa /etc/zfs/zpool.cache . -This option is only valid with -.Fl C +.Pa /boot/zfs/zpool.cache . .It Fl v Enable verbosity. Specify multiple times for increased verbosity. Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Dec 31 18:25:15 2013 (r260137) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Dec 31 19:39:15 2013 (r260138) @@ -89,6 +89,7 @@ extern void dump_intent_log(zilog_t *); uint64_t *zopt_object = NULL; int zopt_objects = 0; libzfs_handle_t *g_zfs; +uint64_t max_inflight = 200; /* * These libumem hooks provide a reasonable set of defaults for the allocator's @@ -110,16 +111,17 @@ static void usage(void) { (void) fprintf(stderr, - "Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]]" - "poolname [object...]\n" - " %s [-divPA] [-e -p path...] dataset [object...]\n" - " %s -m [-LXFPA] [-t txg] [-e [-p path...]]" - "poolname [vdev [metaslab...]]\n" - " %s -R [-A] [-e [-p path...]] poolname " - "vdev:offset:size[:flags]\n" - " %s -S [-PA] [-e [-p path...]] poolname\n" - " %s -l [-uA] device\n" - " %s -C [-A] [-U config]\n\n", + "Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]] " + "[-U config] [-M inflight I/Os] poolname [object...]\n" + " %s [-divPA] [-e -p path...] [-U config] dataset " + "[object...]\n" + " %s -m [-LXFPA] [-t txg] [-e [-p path...]] [-U config] " + "poolname [vdev [metaslab...]]\n" + " %s -R [-A] [-e [-p path...]] poolname " + "vdev:offset:size[:flags]\n" + " %s -S [-PA] [-e [-p path...]] [-U config] poolname\n" + " %s -l [-uA] device\n" + " %s -C [-A] [-U config]\n\n", cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname); (void) fprintf(stderr, " Dataset name must include at least one " @@ -164,6 +166,8 @@ usage(void) (void) fprintf(stderr, " -P print numbers in parseable form\n"); (void) fprintf(stderr, " -t -- highest txg to use when " "searching for uberblocks\n"); + (void) fprintf(stderr, " -M -- " + "specify the maximum number of checksumming I/Os [default is 200]"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " "to make only that option verbose\n"); (void) fprintf(stderr, "Default is to dump everything non-verbosely\n"); @@ -2154,6 +2158,47 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t * bp, NULL, NULL, ZIO_FLAG_CANFAIL)), ==, 0); } +/* ARGSUSED */ +static void +zdb_blkptr_done(zio_t *zio) +{ + spa_t *spa = zio->io_spa; + blkptr_t *bp = zio->io_bp; + int ioerr = zio->io_error; + zdb_cb_t *zcb = zio->io_private; + zbookmark_t *zb = &zio->io_bookmark; + + zio_data_buf_free(zio->io_data, zio->io_size); + + mutex_enter(&spa->spa_scrub_lock); + spa->spa_scrub_inflight--; + cv_broadcast(&spa->spa_scrub_io_cv); + + if (ioerr && !(zio->io_flags & ZIO_FLAG_SPECULATIVE)) { + char blkbuf[BP_SPRINTF_LEN]; + + zcb->zcb_haderrors = 1; + zcb->zcb_errors[ioerr]++; + + if (dump_opt['b'] >= 2) + sprintf_blkptr(blkbuf, bp); + else + blkbuf[0] = '\0'; + + (void) printf("zdb_blkptr_cb: " + "Got error %d reading " + "<%llu, %llu, %lld, %llx> %s -- skipping\n", + ioerr, + (u_longlong_t)zb->zb_objset, + (u_longlong_t)zb->zb_object, + (u_longlong_t)zb->zb_level, + (u_longlong_t)zb->zb_blkid, + blkbuf); + } + mutex_exit(&spa->spa_scrub_lock); +} + +/* ARGSUSED */ static int zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) @@ -2174,38 +2219,22 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog is_metadata = (BP_GET_LEVEL(bp) != 0 || DMU_OT_IS_METADATA(type)); if (dump_opt['c'] > 1 || (dump_opt['c'] && is_metadata)) { - int ioerr; size_t size = BP_GET_PSIZE(bp); - void *data = malloc(size); + void *data = zio_data_buf_alloc(size); int flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCRUB | ZIO_FLAG_RAW; /* If it's an intent log block, failure is expected. */ if (zb->zb_level == ZB_ZIL_LEVEL) flags |= ZIO_FLAG_SPECULATIVE; - ioerr = zio_wait(zio_read(NULL, spa, bp, data, size, - NULL, NULL, ZIO_PRIORITY_ASYNC_READ, flags, zb)); - - free(data); - if (ioerr && !(flags & ZIO_FLAG_SPECULATIVE)) { - zcb->zcb_haderrors = 1; - zcb->zcb_errors[ioerr]++; + mutex_enter(&spa->spa_scrub_lock); + while (spa->spa_scrub_inflight > max_inflight) + cv_wait(&spa->spa_scrub_io_cv, &spa->spa_scrub_lock); + spa->spa_scrub_inflight++; + mutex_exit(&spa->spa_scrub_lock); - if (dump_opt['b'] >= 2) - sprintf_blkptr(blkbuf, bp); - else - blkbuf[0] = '\0'; - - (void) printf("zdb_blkptr_cb: " - "Got error %d reading " - "<%llu, %llu, %lld, %llx> %s -- skipping\n", - ioerr, - (u_longlong_t)zb->zb_objset, - (u_longlong_t)zb->zb_object, - (u_longlong_t)zb->zb_level, - (u_longlong_t)zb->zb_blkid, - blkbuf); - } + zio_nowait(zio_read(NULL, spa, bp, data, size, + zdb_blkptr_done, zcb, ZIO_PRIORITY_ASYNC_READ, flags, zb)); } zcb->zcb_readfails = 0; @@ -2433,6 +2462,18 @@ dump_block_stats(spa_t *spa) zcb.zcb_start = zcb.zcb_lastprint = gethrtime(); zcb.zcb_haderrors |= traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb); + /* + * If we've traversed the data blocks then we need to wait for those + * I/Os to complete. We leverage "The Godfather" zio to wait on + * all async I/Os to complete. + */ + if (dump_opt['c']) { + (void) zio_wait(spa->spa_async_zio_root); + spa->spa_async_zio_root = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } + if (zcb.zcb_haderrors) { (void) printf("\nError counts:\n\n"); (void) printf("\t%5s %s\n", "errno", "count"); @@ -3202,7 +3243,7 @@ main(int argc, char **argv) dprintf_setup(&argc, argv); - while ((c = getopt(argc, argv, "bcdhilmsuCDRSAFLXevp:t:U:P")) != -1) { + while ((c = getopt(argc, argv, "bcdhilmM:suCDRSAFLXevp:t:U:P")) != -1) { switch (c) { case 'b': case 'c': @@ -3231,6 +3272,15 @@ main(int argc, char **argv) case 'v': verbose++; break; + case 'M': + max_inflight = strtoull(optarg, NULL, 0); + if (max_inflight == 0) { + (void) fprintf(stderr, "maximum number " + "of inflight I/Os must be greater " + "than 0\n"); + usage(); + } + break; case 'p': if (searchdirs == NULL) { searchdirs = umem_alloc(sizeof (char *), Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Tue Dec 31 18:25:15 2013 (r260137) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Tue Dec 31 19:39:15 2013 (r260138) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 14, 2013 +.Dd December 31, 2013 .Dt ZPOOL 8 .Os .Sh NAME @@ -141,6 +141,9 @@ .Cm remove .Ar pool device ... .Nm +.Cm reopen +.Ar pool +.Nm .Cm replace .Op Fl f .Ar pool device @@ -1431,6 +1434,13 @@ command. Non-redundant and devices cannot be removed from a pool. .It Xo .Nm +.Cm reopen +.Ar pool +.Xc +.Pp +Reopen all the vdevs associated with the pool. +.It Xo +.Nm .Cm replace .Op Fl f .Ar pool device Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Dec 31 18:25:15 2013 (r260137) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Dec 31 19:39:15 2013 (r260138) @@ -248,7 +248,7 @@ get_usage(zpool_help_t idx) { case HELP_REMOVE: return (gettext("\tremove ...\n")); case HELP_REOPEN: - return (""); /* Undocumented command */ + return (gettext("\treopen \n")); case HELP_SCRUB: return (gettext("\tscrub [-s] ...\n")); case HELP_STATUS: @@ -3720,22 +3720,37 @@ zpool_do_reguid(int argc, char **argv) * zpool reopen * * Reopen the pool so that the kernel can update the sizes of all vdevs. - * - * NOTE: This command is currently undocumented. If the command is ever - * exposed then the appropriate usage() messages will need to be made. */ int zpool_do_reopen(int argc, char **argv) { + int c; int ret = 0; zpool_handle_t *zhp; char *pool; + /* check options */ + while ((c = getopt(argc, argv, "")) != -1) { + switch (c) { + case '?': + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + usage(B_FALSE); + } + } + argc--; argv++; - if (argc != 1) - return (2); + if (argc < 1) { + (void) fprintf(stderr, gettext("missing pool name\n")); + usage(B_FALSE); + } + + if (argc > 1) { + (void) fprintf(stderr, gettext("too many arguments\n")); + usage(B_FALSE); + } pool = argv[0]; if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Tue Dec 31 18:25:15 2013 (r260137) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Tue Dec 31 19:39:15 2013 (r260138) @@ -661,7 +661,7 @@ __dprintf(const char *file, const char * if (dprintf_find_string("pid")) (void) printf("%d ", getpid()); if (dprintf_find_string("tid")) - (void) printf("%u ", thr_self()); + (void) printf("%ul ", thr_self()); #if 0 if (dprintf_find_string("cpu")) (void) printf("%u ", getcpuid()); @@ -1125,3 +1125,50 @@ zvol_create_minors(const char *name) return (0); } #endif + +#ifdef illumos +void +bioinit(buf_t *bp) +{ + bzero(bp, sizeof (buf_t)); +} + +void +biodone(buf_t *bp) +{ + if (bp->b_iodone != NULL) { + (*(bp->b_iodone))(bp); + return; + } + ASSERT((bp->b_flags & B_DONE) == 0); + bp->b_flags |= B_DONE; +} + +void +bioerror(buf_t *bp, int error) +{ + ASSERT(bp != NULL); + ASSERT(error >= 0); + + if (error != 0) { + bp->b_flags |= B_ERROR; + } else { + bp->b_flags &= ~B_ERROR; + } + bp->b_error = error; +} + + +int +geterror(struct buf *bp) +{ + int error = 0; + + if (bp->b_flags & B_ERROR) { + error = bp->b_error; + if (!error) + error = EIO; + } + return (error); +} +#endif Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Tue Dec 31 18:25:15 2013 (r260137) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Tue Dec 31 19:39:15 2013 (r260138) @@ -778,6 +778,38 @@ extern void cyclic_remove(cyclic_id_t); extern int cyclic_reprogram(cyclic_id_t, hrtime_t); #endif /* illumos */ +#ifdef illumos +/* + * Buf structure + */ +#define B_BUSY 0x0001 +#define B_DONE 0x0002 +#define B_ERROR 0x0004 +#define B_READ 0x0040 /* read when I/O occurs */ +#define B_WRITE 0x0100 /* non-read pseudo-flag */ + +typedef struct buf { + int b_flags; + size_t b_bcount; + union { + caddr_t b_addr; + } b_un; + + lldaddr_t _b_blkno; +#define b_lblkno _b_blkno._f + size_t b_resid; + size_t b_bufsize; + int (*b_iodone)(struct buf *); + int b_error; + void *b_private; +} buf_t; + +extern void bioinit(buf_t *); +extern void biodone(buf_t *); +extern void bioerror(buf_t *, int); +extern int geterror(buf_t *); +#endif + #ifdef __cplusplus } #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Tue Dec 31 18:25:15 2013 (r260137) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Tue Dec 31 19:39:15 2013 (r260138) @@ -363,6 +363,16 @@ extern void vdev_set_min_asize(vdev_t *v /* zdb uses this tunable, so it must be declared here to make lint happy. */ extern int zfs_vdev_cache_size; +#ifdef illumos +/* + * The vdev_buf_t is used to translate between zio_t and buf_t, and back again. + */ +typedef struct vdev_buf { + buf_t vb_buf; /* buffer that describes the io */ + zio_t *vb_io; /* pointer back to the original zio_t */ +} vdev_buf_t; +#endif + #ifdef __cplusplus } #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Tue Dec 31 18:25:15 2013 (r260137) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Tue Dec 31 19:39:15 2013 (r260138) @@ -42,11 +42,6 @@ extern ldi_ident_t zfs_li; -typedef struct vdev_disk_buf { - buf_t vdb_buf; - zio_t *vdb_io; -} vdev_disk_buf_t; - static void vdev_disk_hold(vdev_t *vd) { @@ -483,8 +478,8 @@ vdev_disk_ldi_physio(ldi_handle_t vd_lh, static void vdev_disk_io_intr(buf_t *bp) { - vdev_disk_buf_t *vdb = (vdev_disk_buf_t *)bp; - zio_t *zio = vdb->vdb_io; + vdev_buf_t *vb = (vdev_buf_t *)bp; + zio_t *zio = vb->vb_io; /* * The rest of the zio stack only deals with EIO, ECKSUM, and ENXIO. @@ -496,7 +491,7 @@ vdev_disk_io_intr(buf_t *bp) if (zio->io_error == 0 && bp->b_resid != 0) zio->io_error = SET_ERROR(EIO); - kmem_free(vdb, sizeof (vdev_disk_buf_t)); + kmem_free(vb, sizeof (vdev_buf_t)); zio_interrupt(zio); } @@ -527,7 +522,7 @@ vdev_disk_io_start(zio_t *zio) { vdev_t *vd = zio->io_vd; vdev_disk_t *dvd = vd->vdev_tsd; - vdev_disk_buf_t *vdb; + vdev_buf_t *vb; struct dk_callback *dkc; buf_t *bp; int error; @@ -591,10 +586,10 @@ vdev_disk_io_start(zio_t *zio) return (ZIO_PIPELINE_CONTINUE); } - vdb = kmem_alloc(sizeof (vdev_disk_buf_t), KM_SLEEP); + vb = kmem_alloc(sizeof (vdev_buf_t), KM_SLEEP); - vdb->vdb_io = zio; - bp = &vdb->vdb_buf; + vb->vb_io = zio; + bp = &vb->vb_buf; bioinit(bp); bp->b_flags = B_BUSY | B_NOCACHE | From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 21:24:01 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 02B07D9F; Tue, 31 Dec 2013 21:24:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D69CB1179; Tue, 31 Dec 2013 21:24:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBVLO0C0089081; Tue, 31 Dec 2013 21:24:00 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBVLO04d089078; Tue, 31 Dec 2013 21:24:00 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201312312124.rBVLO04d089078@svn.freebsd.org> From: Xin LI Date: Tue, 31 Dec 2013 21:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260141 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 21:24:01 -0000 Author: delphij Date: Tue Dec 31 21:24:00 2013 New Revision: 260141 URL: http://svnweb.freebsd.org/changeset/base/260141 Log: MFV r258385: (Note: this change is not applicable to FreeBSD and the file is not included in build. It's integrated for completeness). 4128 disks in zpools never go away when pulled illumos/illumos-gate@39cddb10a31c1c2e66aed69e6871d09caa4c8147 MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_disk.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_disk.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_disk.h Tue Dec 31 20:18:10 2013 (r260140) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_disk.h Tue Dec 31 21:24:00 2013 (r260141) @@ -22,6 +22,7 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright (c) 2013 Joyent, Inc. All rights reserved. + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. */ #ifndef _SYS_VDEV_DISK_H @@ -44,6 +45,8 @@ typedef struct vdev_disk { ddi_devid_t vd_devid; char *vd_minor; ldi_handle_t vd_lh; + list_t vd_ldi_cbs; + boolean_t vd_ldi_offline; } vdev_disk_t; #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Tue Dec 31 20:18:10 2013 (r260140) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Tue Dec 31 21:24:00 2013 (r260141) @@ -22,7 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. - * Copyright 2013 Joyent, Inc. All rights reserved. + * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ #include @@ -42,6 +42,146 @@ extern ldi_ident_t zfs_li; +static void vdev_disk_close(vdev_t *); + +typedef struct vdev_disk_ldi_cb { + list_node_t lcb_next; + ldi_callback_id_t lcb_id; +} vdev_disk_ldi_cb_t; + +static void +vdev_disk_alloc(vdev_t *vd) +{ + vdev_disk_t *dvd; + + dvd = vd->vdev_tsd = kmem_zalloc(sizeof (vdev_disk_t), KM_SLEEP); + /* + * Create the LDI event callback list. + */ + list_create(&dvd->vd_ldi_cbs, sizeof (vdev_disk_ldi_cb_t), + offsetof(vdev_disk_ldi_cb_t, lcb_next)); +} + +static void +vdev_disk_free(vdev_t *vd) +{ + vdev_disk_t *dvd = vd->vdev_tsd; + vdev_disk_ldi_cb_t *lcb; + + if (dvd == NULL) + return; + + /* + * We have already closed the LDI handle. Clean up the LDI event + * callbacks and free vd->vdev_tsd. + */ + while ((lcb = list_head(&dvd->vd_ldi_cbs)) != NULL) { + list_remove(&dvd->vd_ldi_cbs, lcb); + (void) ldi_ev_remove_callbacks(lcb->lcb_id); + kmem_free(lcb, sizeof (vdev_disk_ldi_cb_t)); + } + list_destroy(&dvd->vd_ldi_cbs); + kmem_free(dvd, sizeof (vdev_disk_t)); + vd->vdev_tsd = NULL; +} + +/* ARGSUSED */ +static int +vdev_disk_off_notify(ldi_handle_t lh, ldi_ev_cookie_t ecookie, void *arg, + void *ev_data) +{ + vdev_t *vd = (vdev_t *)arg; + vdev_disk_t *dvd = vd->vdev_tsd; + + /* + * Ignore events other than offline. + */ + if (strcmp(ldi_ev_get_type(ecookie), LDI_EV_OFFLINE) != 0) + return (LDI_EV_SUCCESS); + + /* + * All LDI handles must be closed for the state change to succeed, so + * call on vdev_disk_close() to do this. + * + * We inform vdev_disk_close that it is being called from offline + * notify context so it will defer cleanup of LDI event callbacks and + * freeing of vd->vdev_tsd to the offline finalize or a reopen. + */ + dvd->vd_ldi_offline = B_TRUE; + vdev_disk_close(vd); + + /* + * Now that the device is closed, request that the spa_async_thread + * mark the device as REMOVED and notify FMA of the removal. + */ + zfs_post_remove(vd->vdev_spa, vd); + vd->vdev_remove_wanted = B_TRUE; + spa_async_request(vd->vdev_spa, SPA_ASYNC_REMOVE); + + return (LDI_EV_SUCCESS); +} + +/* ARGSUSED */ +static void +vdev_disk_off_finalize(ldi_handle_t lh, ldi_ev_cookie_t ecookie, + int ldi_result, void *arg, void *ev_data) +{ + vdev_t *vd = (vdev_t *)arg; + + /* + * Ignore events other than offline. + */ + if (strcmp(ldi_ev_get_type(ecookie), LDI_EV_OFFLINE) != 0) + return; + + /* + * We have already closed the LDI handle in notify. + * Clean up the LDI event callbacks and free vd->vdev_tsd. + */ + vdev_disk_free(vd); + + /* + * Request that the vdev be reopened if the offline state change was + * unsuccessful. + */ + if (ldi_result != LDI_EV_SUCCESS) { + vd->vdev_probe_wanted = B_TRUE; + spa_async_request(vd->vdev_spa, SPA_ASYNC_PROBE); + } +} + +static ldi_ev_callback_t vdev_disk_off_callb = { + .cb_vers = LDI_EV_CB_VERS, + .cb_notify = vdev_disk_off_notify, + .cb_finalize = vdev_disk_off_finalize +}; + +/* ARGSUSED */ +static void +vdev_disk_dgrd_finalize(ldi_handle_t lh, ldi_ev_cookie_t ecookie, + int ldi_result, void *arg, void *ev_data) +{ + vdev_t *vd = (vdev_t *)arg; + + /* + * Ignore events other than degrade. + */ + if (strcmp(ldi_ev_get_type(ecookie), LDI_EV_DEGRADE) != 0) + return; + + /* + * Degrade events always succeed. Mark the vdev as degraded. + * This status is purely informative for the user. + */ + (void) vdev_degrade(vd->vdev_spa, vd->vdev_guid, 0); +} + +static ldi_ev_callback_t vdev_disk_dgrd_callb = { + .cb_vers = LDI_EV_CB_VERS, + .cb_notify = NULL, + .cb_finalize = vdev_disk_dgrd_finalize +}; + static void vdev_disk_hold(vdev_t *vd) { @@ -146,7 +286,9 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi uint64_t *ashift) { spa_t *spa = vd->vdev_spa; - vdev_disk_t *dvd; + vdev_disk_t *dvd = vd->vdev_tsd; + ldi_ev_cookie_t ecookie; + vdev_disk_ldi_cb_t *lcb; union { struct dk_minfo_ext ude; struct dk_minfo ud; @@ -172,13 +314,25 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi * Reopen the device if it's not currently open. Otherwise, * just update the physical size of the device. */ - if (vd->vdev_tsd != NULL) { - ASSERT(vd->vdev_reopening); - dvd = vd->vdev_tsd; - goto skip_open; + if (dvd != NULL) { + if (dvd->vd_ldi_offline && dvd->vd_lh == NULL) { + /* + * If we are opening a device in its offline notify + * context, the LDI handle was just closed. Clean + * up the LDI event callbacks and free vd->vdev_tsd. + */ + vdev_disk_free(vd); + } else { + ASSERT(vd->vdev_reopening); + goto skip_open; + } } - dvd = vd->vdev_tsd = kmem_zalloc(sizeof (vdev_disk_t), KM_SLEEP); + /* + * Create vd->vdev_tsd. + */ + vdev_disk_alloc(vd); + dvd = vd->vdev_tsd; /* * When opening a disk device, we want to preserve the user's original @@ -211,23 +365,28 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi if (vd->vdev_wholedisk == -1ULL) { size_t len = strlen(vd->vdev_path) + 3; char *buf = kmem_alloc(len, KM_SLEEP); - ldi_handle_t lh; (void) snprintf(buf, len, "%ss0", vd->vdev_path); - if (ldi_open_by_name(buf, spa_mode(spa), kcred, - &lh, zfs_li) == 0) { + error = ldi_open_by_name(buf, spa_mode(spa), kcred, + &dvd->vd_lh, zfs_li); + if (error == 0) { spa_strfree(vd->vdev_path); vd->vdev_path = buf; vd->vdev_wholedisk = 1ULL; - (void) ldi_close(lh, spa_mode(spa), kcred); } else { kmem_free(buf, len); } } - error = ldi_open_by_name(vd->vdev_path, spa_mode(spa), kcred, - &dvd->vd_lh, zfs_li); + /* + * If we have not yet opened the device, try to open it by the + * specified path. + */ + if (error != 0) { + error = ldi_open_by_name(vd->vdev_path, spa_mode(spa), + kcred, &dvd->vd_lh, zfs_li); + } /* * Compare the devid to the stored value. @@ -334,6 +493,27 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi kmem_free(physpath, MAXPATHLEN); } + /* + * Register callbacks for the LDI offline event. + */ + if (ldi_ev_get_cookie(dvd->vd_lh, LDI_EV_OFFLINE, &ecookie) == + LDI_EV_SUCCESS) { + lcb = kmem_zalloc(sizeof (vdev_disk_ldi_cb_t), KM_SLEEP); + list_insert_tail(&dvd->vd_ldi_cbs, lcb); + (void) ldi_ev_register_callbacks(dvd->vd_lh, ecookie, + &vdev_disk_off_callb, (void *) vd, &lcb->lcb_id); + } + + /* + * Register callbacks for the LDI degrade event. + */ + if (ldi_ev_get_cookie(dvd->vd_lh, LDI_EV_DEGRADE, &ecookie) == + LDI_EV_SUCCESS) { + lcb = kmem_zalloc(sizeof (vdev_disk_ldi_cb_t), KM_SLEEP); + list_insert_tail(&dvd->vd_ldi_cbs, lcb); + (void) ldi_ev_register_callbacks(dvd->vd_lh, ecookie, + &vdev_disk_dgrd_callb, (void *) vd, &lcb->lcb_id); + } skip_open: /* * Determine the actual size of the device. @@ -412,18 +592,31 @@ vdev_disk_close(vdev_t *vd) if (vd->vdev_reopening || dvd == NULL) return; - if (dvd->vd_minor != NULL) + if (dvd->vd_minor != NULL) { ddi_devid_str_free(dvd->vd_minor); + dvd->vd_minor = NULL; + } - if (dvd->vd_devid != NULL) + if (dvd->vd_devid != NULL) { ddi_devid_free(dvd->vd_devid); + dvd->vd_devid = NULL; + } - if (dvd->vd_lh != NULL) + if (dvd->vd_lh != NULL) { (void) ldi_close(dvd->vd_lh, spa_mode(vd->vdev_spa), kcred); + dvd->vd_lh = NULL; + } vd->vdev_delayed_close = B_FALSE; - kmem_free(dvd, sizeof (vdev_disk_t)); - vd->vdev_tsd = NULL; + /* + * If we closed the LDI handle due to an offline notify from LDI, + * don't free vd->vdev_tsd or unregister the callbacks here; + * the offline finalize callback or a reopen will take care of it. + */ + if (dvd->vd_ldi_offline) + return; + + vdev_disk_free(vd); } int @@ -432,6 +625,13 @@ vdev_disk_physio(vdev_t *vd, caddr_t dat { vdev_disk_t *dvd = vd->vdev_tsd; + /* + * If the vdev is closed, it's likely in the REMOVED or FAULTED state. + * Nothing to be done here but return failure. + */ + if (dvd == NULL || (dvd->vd_ldi_offline && dvd->vd_lh == NULL)) + return (EIO); + ASSERT(vd->vdev_ops == &vdev_disk_ops); /* @@ -527,6 +727,15 @@ vdev_disk_io_start(zio_t *zio) buf_t *bp; int error; + /* + * If the vdev is closed, it's likely in the REMOVED or FAULTED state. + * Nothing to be done here but return failure. + */ + if (dvd == NULL || (dvd->vd_ldi_offline && dvd->vd_lh == NULL)) { + zio->io_error = ENXIO; + return (ZIO_PIPELINE_CONTINUE); + } + if (zio->io_type == ZIO_TYPE_IOCTL) { /* XXPOLICY */ if (!vdev_readable(vd)) { From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 21:37:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C403CFAE; Tue, 31 Dec 2013 21:37:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ADC1E1223; Tue, 31 Dec 2013 21:37:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBVLbPhd093213; Tue, 31 Dec 2013 21:37:25 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBVLbPUe093210; Tue, 31 Dec 2013 21:37:25 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201312312137.rBVLbPUe093210@svn.freebsd.org> From: Xin LI Date: Tue, 31 Dec 2013 21:37:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260142 - head/cddl/contrib/opensolaris/cmd/zstreamdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 31 Dec 2013 21:37:25 -0000 Author: delphij Date: Tue Dec 31 21:37:24 2013 New Revision: 260142 URL: http://svnweb.freebsd.org/changeset/base/260142 Log: MFV r258972: 4373 add block contents print to zstreamdump illumos/illumos-gate@994fb6b8a9d07a8021d77d79f46e30637bca3ad3 MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Tue Dec 31 21:24:00 2013 (r260141) +++ head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Tue Dec 31 21:37:24 2013 (r260142) @@ -18,10 +18,11 @@ .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. +.\" Copyright (c) 2013, Delphix. All Rights Reserved. .\" .\" $FreeBSD$ .\" -.Dd November 26, 2011 +.Dd December 31, 2013 .Dt ZSTREAMDUMP 8 .Os .Sh NAME @@ -30,6 +31,7 @@ .Sh SYNOPSIS .Nm .Op Fl C +.Op Fl d .Op Fl v .Sh DESCRIPTION The @@ -43,6 +45,8 @@ The following options are supported: .Bl -tag -width indent .It Fl C Suppress the validation of checksums. +.It Fl d +Dump contents of blocks modified, implies verbose. .It Fl v Verbose. Dump all headers, not only begin and end headers. .El Modified: head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c Tue Dec 31 21:24:00 2013 (r260141) +++ head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c Tue Dec 31 21:37:24 2013 (r260142) @@ -24,6 +24,11 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + */ + +#include #include #include #include @@ -34,6 +39,16 @@ #include #include +/* + * If dump mode is enabled, the number of bytes to print per line + */ +#define BYTES_PER_LINE 16 +/* + * If dump mode is enabled, the number of bytes to group together, separated + * by newlines or spaces + */ +#define DUMP_GROUPING 4 + uint64_t drr_record_count[DRR_NUMTYPES]; uint64_t total_write_size = 0; uint64_t total_stream_len = 0; @@ -45,9 +60,11 @@ boolean_t do_cksum = B_TRUE; static void usage(void) { - (void) fprintf(stderr, "usage: zstreamdump [-v] [-C] < file\n"); + (void) fprintf(stderr, "usage: zstreamdump [-v] [-C] [-d] < file\n"); (void) fprintf(stderr, "\t -v -- verbose\n"); (void) fprintf(stderr, "\t -C -- suppress checksum verification\n"); + (void) fprintf(stderr, "\t -d -- dump contents of blocks modified, " + "implies verbose\n"); exit(1); } @@ -75,6 +92,70 @@ ssread(void *buf, size_t len, zio_cksum_ return (outlen); } +/* + * Print part of a block in ASCII characters + */ +static void +print_ascii_block(char *subbuf, int length) +{ + int i; + + for (i = 0; i < length; i++) { + char char_print = isprint(subbuf[i]) ? subbuf[i] : '.'; + if (i != 0 && i % DUMP_GROUPING == 0) { + (void) printf(" "); + } + (void) printf("%c", char_print); + } + (void) printf("\n"); +} + +/* + * print_block - Dump the contents of a modified block to STDOUT + * + * Assume that buf has capacity evenly divisible by BYTES_PER_LINE + */ +static void +print_block(char *buf, int length) +{ + int i; + /* + * Start printing ASCII characters at a constant offset, after + * the hex prints. Leave 3 characters per byte on a line (2 digit + * hex number plus 1 space) plus spaces between characters and + * groupings + */ + int ascii_start = BYTES_PER_LINE * 3 + + BYTES_PER_LINE / DUMP_GROUPING + 2; + + for (i = 0; i < length; i += BYTES_PER_LINE) { + int j; + int this_line_length = MIN(BYTES_PER_LINE, length - i); + int print_offset = 0; + + for (j = 0; j < this_line_length; j++) { + int buf_offset = i + j; + + /* + * Separate every DUMP_GROUPING bytes by a space. + */ + if (buf_offset % DUMP_GROUPING == 0) { + print_offset += printf(" "); + } + + /* + * Print the two-digit hex value for this byte. + */ + unsigned char hex_print = buf[buf_offset]; + print_offset += printf("%02x ", hex_print); + } + + (void) printf("%*s", ascii_start - print_offset, " "); + + print_ascii_block(buf + i, this_line_length); + } +} + int main(int argc, char *argv[]) { @@ -92,11 +173,17 @@ main(int argc, char *argv[]) char c; boolean_t verbose = B_FALSE; boolean_t first = B_TRUE; + /* + * dump flag controls whether the contents of any modified data blocks + * are printed to the console during processing of the stream. Warning: + * for large streams, this can obviously lead to massive prints. + */ + boolean_t dump = B_FALSE; int err; zio_cksum_t zc = { 0 }; zio_cksum_t pcksum = { 0 }; - while ((c = getopt(argc, argv, ":vC")) != -1) { + while ((c = getopt(argc, argv, ":vCd")) != -1) { switch (c) { case 'C': do_cksum = B_FALSE; @@ -104,6 +191,10 @@ main(int argc, char *argv[]) case 'v': verbose = B_TRUE; break; + case 'd': + dump = B_TRUE; + verbose = B_TRUE; + break; case ':': (void) fprintf(stderr, "missing argument for '%c' option\n", optopt); @@ -128,6 +219,10 @@ main(int argc, char *argv[]) pcksum = zc; while (ssread(drr, sizeof (dmu_replay_record_t), &zc)) { + /* + * If this is the first DMU record being processed, check for + * the magic bytes and figure out the endian-ness based on them. + */ if (first) { if (drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC)) { do_byteswap = B_TRUE; @@ -209,7 +304,7 @@ main(int argc, char *argv[]) nvlist_t *nv; int sz = drr->drr_payloadlen; - if (sz > 1<<20) { + if (sz > INITIAL_BUFLEN) { free(buf); buf = malloc(sz); } @@ -283,6 +378,10 @@ main(int argc, char *argv[]) if (drro->drr_bonuslen > 0) { (void) ssread(buf, P2ROUNDUP(drro->drr_bonuslen, 8), &zc); + if (dump) { + print_block(buf, + P2ROUNDUP(drro->drr_bonuslen, 8)); + } } break; @@ -312,6 +411,10 @@ main(int argc, char *argv[]) drrw->drr_key.ddk_prop = BSWAP_64(drrw->drr_key.ddk_prop); } + /* + * If this is verbose and/or dump output, + * print info on the modified block + */ if (verbose) { (void) printf("WRITE object = %llu type = %u " "checksum type = %u\n" @@ -324,7 +427,16 @@ main(int argc, char *argv[]) (u_longlong_t)drrw->drr_length, (u_longlong_t)drrw->drr_key.ddk_prop); } + /* + * Read the contents of the block in from STDIN to buf + */ (void) ssread(buf, drrw->drr_length, &zc); + /* + * If in dump mode + */ + if (dump) { + print_block(buf, drrw->drr_length); + } total_write_size += drrw->drr_length; break; @@ -390,6 +502,9 @@ main(int argc, char *argv[]) drrs->drr_length); } (void) ssread(buf, drrs->drr_length, &zc); + if (dump) { + print_block(buf, drrs->drr_length); + } break; } pcksum = zc;