From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 06:08: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 ESMTP id 5A861779; Sun, 18 Aug 2013 06:08:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) 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 47AAF208D; Sun, 18 Aug 2013 06:08:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7I68rAe031515; Sun, 18 Aug 2013 06:08:53 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7I68qKF031513; Sun, 18 Aug 2013 06:08:52 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201308180608.r7I68qKF031513@svn.freebsd.org> From: Adrian Chadd Date: Sun, 18 Aug 2013 06:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254476 - head/sys/dev/hwpmc 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.14 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, 18 Aug 2013 06:08:53 -0000 Author: adrian Date: Sun Aug 18 06:08:52 2013 New Revision: 254476 URL: http://svnweb.freebsd.org/changeset/base/254476 Log: Add in missing events for Sandy Bridge Xeon. * Add in MEM_LOAD_UOPS_LLC_HIT_RETIRED for both sandy bridge and sandy bridge Xeon. Right now it only is enabled for Sandy Bridge. * D2/0F is actually a combination rather than a separate counter, so just flip that on for the CPU types that support it. There's an errata for using this on SB Xeon hardware - I've documented it in kern/181346. Tested: * Sandy Bridge * Sandy Bridge Xeon Sponsored by: Netflix, Inc. Modified: head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/pmc_events.h Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Sun Aug 18 04:22:13 2013 (r254475) +++ head/sys/dev/hwpmc/hwpmc_core.c Sun Aug 18 06:08:52 2013 (r254476) @@ -1541,15 +1541,21 @@ static struct iap_event_descr iap_events IAP_F_SBX | IAP_F_IBX | IAP_F_HW), IAPDESCR(D2H_01H, 0xD2, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | - IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_IBX | IAP_F_HW), + IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_SBX | IAP_F_IB | + IAP_F_IBX | IAP_F_HW), IAPDESCR(D2H_02H, 0xD2, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | - IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_IBX | IAP_F_HW), + IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_SBX | IAP_F_IB | + IAP_F_IBX | IAP_F_HW), IAPDESCR(D2H_04H, 0xD2, 0x04, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | - IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_IBX | IAP_F_HW), + IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_SBX | IAP_F_IB | + IAP_F_IBX | IAP_F_HW), IAPDESCR(D2H_08H, 0xD2, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | - IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_IBX | IAP_F_HW), + IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_SBX | IAP_F_IB | + IAP_F_IBX | IAP_F_HW), IAPDESCR(D2H_0FH, 0xD2, 0x0F, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | - IAP_F_I7 | IAP_F_WM), + IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_SBX | IAP_F_IB | + IAP_F_IBX | IAP_F_HW), + IAPDESCR(D2H_10H, 0xD2, 0x10, IAP_F_FM | IAP_F_CC2E), IAPDESCR(D3H_01H, 0xD3, 0x01, IAP_F_FM | IAP_F_IB | IAP_F_SBX | Modified: head/sys/dev/hwpmc/pmc_events.h ============================================================================== --- head/sys/dev/hwpmc/pmc_events.h Sun Aug 18 04:22:13 2013 (r254475) +++ head/sys/dev/hwpmc/pmc_events.h Sun Aug 18 06:08:52 2013 (r254476) @@ -2656,6 +2656,8 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE IAP_EVENT_D2H_04H) \ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE", \ IAP_EVENT_D2H_08H) \ +__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.ALL", \ + IAP_EVENT_D2H_0FH) \ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM", \ IAP_EVENT_D3H_01H) \ __PMC_EV_ALIAS("BACLEARS.ANY", IAP_EVENT_E6H_1FH) \ @@ -2859,6 +2861,8 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE IAP_EVENT_D2H_04H) \ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE", \ IAP_EVENT_D2H_08H) \ +__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.ALL", \ + IAP_EVENT_D2H_0FH) \ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM", \ IAP_EVENT_D3H_01H) \ __PMC_EV_ALIAS("L2_TRANS.DEMAND_DATA_RD", IAP_EVENT_F0H_01H) \ @@ -3524,6 +3528,18 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_RETIRED.L2 __PMC_EV_ALIAS("MEM_LOAD_UOPS_RETIRED.LLC_HIT", IAP_EVENT_D1H_04H) \ __PMC_EV_ALIAS("MEM_LOAD_UOPS_RETIRED.LLC_MISS", IAP_EVENT_D1H_20H) \ __PMC_EV_ALIAS("MEM_LOAD_UOPS_RETIRED.HIT_LFB", IAP_EVENT_D1H_40H) \ +__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_MISS", \ + IAP_EVENT_D2H_01H) \ +__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HIT", \ + IAP_EVENT_D2H_02H) \ +__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HITM", \ + IAP_EVENT_D2H_04H) \ +__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE", \ + IAP_EVENT_D2H_08H) \ +__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.ALL", \ + IAP_EVENT_D2H_0FH) \ +__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS", \ + IAP_EVENT_D4H_02H) \ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM", \ IAP_EVENT_D3H_01H) \ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_MISS_RETIRED.REMOTE_DRAM", \ From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 06:25: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 ESMTP id EF30999D; Sun, 18 Aug 2013 06:25:48 +0000 (UTC) (envelope-from hiren.panchasara@gmail.com) Received: from mail-ee0-x22e.google.com (mail-ee0-x22e.google.com [IPv6:2a00:1450:4013:c00::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0B3FE2126; Sun, 18 Aug 2013 06:25:47 +0000 (UTC) Received: by mail-ee0-f46.google.com with SMTP id c13so1585882eek.33 for ; Sat, 17 Aug 2013 23:25:46 -0700 (PDT) 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=I2T0HS3iwAJQSjc9lfot2F0FOhcs5qwBp5eJ+ejfXks=; b=VmswhELtCivoUmQBwTUwmkO7phM+cZPBkfO2cUvQCpO7NNKxL5tZ76iJIHh8Mj4rFq XdWGEd2bL/lU+BaTfXp4xiLc+Uq7Ce6sHlA3Qs+ViTYNAzEQehCaLc9uzZ1QEWwvkkmq +QLb9fDgZgGWp75M57jBJPT0OUAKQtRZu1rqcVby4J8tClFJcaYrchEkpUMXxKB6PnXC 9Bur4ASsTU0+y0imoacHQNrKkWEbCJMQizDj0DQDh2WwW/3xm/z48P2B22UEpRZppvrB d4dHXSlEwieNkzokQBqUUR3oP13wkrpqmIyuieKvyXtEazGPTfP/1yZQodeo8Q/j9Hlt zlnQ== MIME-Version: 1.0 X-Received: by 10.15.26.66 with SMTP id m42mr132781eeu.73.1376807146140; Sat, 17 Aug 2013 23:25:46 -0700 (PDT) Sender: hiren.panchasara@gmail.com Received: by 10.14.105.137 with HTTP; Sat, 17 Aug 2013 23:25:46 -0700 (PDT) In-Reply-To: <201308180608.r7I68qKF031513@svn.freebsd.org> References: <201308180608.r7I68qKF031513@svn.freebsd.org> Date: Sat, 17 Aug 2013 23:25:46 -0700 X-Google-Sender-Auth: kzy0jsGxkKcsiNttTBKY5mKJLO0 Message-ID: Subject: Re: svn commit: r254476 - head/sys/dev/hwpmc From: hiren panchasara To: Adrian Chadd Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head , svn-src-all , src-committers X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 18 Aug 2013 06:25:49 -0000 On Sat, Aug 17, 2013 at 11:08 PM, Adrian Chadd wrote: > Author: adrian > Date: Sun Aug 18 06:08:52 2013 > New Revision: 254476 > URL: http://svnweb.freebsd.org/changeset/base/254476 > > Log: > Add in missing events for Sandy Bridge Xeon. > > * Add in MEM_LOAD_UOPS_LLC_HIT_RETIRED for both sandy bridge and sandy > bridge Xeon. Right now it only is enabled for Sandy Bridge. > * D2/0F is actually a combination rather than a separate counter, so > just flip that on for the CPU types that support it. > > There's an errata for using this on SB Xeon hardware - I've documented > it in kern/181346. > > Tested: > > * Sandy Bridge > * Sandy Bridge Xeon > > Sponsored by: Netflix, Inc. > > Modified: > head/sys/dev/hwpmc/hwpmc_core.c > head/sys/dev/hwpmc/pmc_events.h > Please add new counters to sandybridge xeon manpage - man 3 pmc.sandybridgexeon Cheers, Hiren From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 09:45: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 ESMTP id 71A1D70A; Sun, 18 Aug 2013 09:45:17 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) by mx1.freebsd.org (Postfix) with ESMTP id 31AA8283E; Sun, 18 Aug 2013 09:45:17 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1VAza0-000N1j-5l; Sun, 18 Aug 2013 13:47:24 +0400 Date: Sun, 18 Aug 2013 13:47:24 +0400 From: Slawa Olhovchenkov To: Neel Natu Subject: Re: svn commit: r254466 - in head/sys/amd64: amd64 include Message-ID: <20130818094724.GA88321@zxy.spb.ru> References: <201308171949.r7HJn8sR091046@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201308171949.r7HJn8sR091046@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false 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.14 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, 18 Aug 2013 09:45:17 -0000 On Sat, Aug 17, 2013 at 07:49:08PM +0000, Neel Natu wrote: > Author: neel > Date: Sat Aug 17 19:49:08 2013 > New Revision: 254466 > URL: http://svnweb.freebsd.org/changeset/base/254466 > > Log: > Bump up the maximum addressable memory on amd64 systems from 1TB to 4TB. > Bump up the KVA size proportionally from 512GB to 2TB. > > The number of page table pages used by the direct map is now calculated at > run time based on 'Maxmem'. This means the small memory systems will not > see any additional tax in terms of page table pages for the direct map. > > However all amd64 systems, regardless of the memory size, will use 3 more > pages to accomodate the bump in the KVA size. > > More details available here: > http://lists.freebsd.org/pipermail/freebsd-hackers/2013-June/043015.html > http://lists.freebsd.org/pipermail/freebsd-current/2013-July/043143.html > > Tested with the following configurations: > - Sandybridge server with 64GB of memory. > - bhyve VM with 64MB of memory. > - bhyve VM with a 8GB of memory with the memory segment above 4GB cuddling > right up against the 4TB maximum memory limit. > > Discussed on: hackers@, current@ > Submitted by: Chris Torek (torek@torek.net) > > Modified: > head/sys/amd64/amd64/pmap.c > head/sys/amd64/include/pmap.h > head/sys/amd64/include/vmparam.h MFC planed? From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 09:45:53 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 ESMTP id 4371F84D; Sun, 18 Aug 2013 09:45:53 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 3156F2848; Sun, 18 Aug 2013 09:45:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7I9jrmP016263; Sun, 18 Aug 2013 09:45:53 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7I9jrbb016259; Sun, 18 Aug 2013 09:45:53 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308180945.r7I9jrbb016259@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 09:45:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254479 - 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.14 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, 18 Aug 2013 09:45:53 -0000 Author: pjd Date: Sun Aug 18 09:45:52 2013 New Revision: 254479 URL: http://svnweb.freebsd.org/changeset/base/254479 Log: Better organize the filecaps structure, which reduces its size from 32 bytes to 24 bytes on 64bit archs. Modified: head/sys/sys/filedesc.h Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Sun Aug 18 08:24:58 2013 (r254478) +++ head/sys/sys/filedesc.h Sun Aug 18 09:45:52 2013 (r254479) @@ -43,9 +43,9 @@ struct filecaps { cap_rights_t fc_rights; /* per-descriptor capability rights */ - uint32_t fc_fcntls; /* per-descriptor allowed fcntls */ u_long *fc_ioctls; /* per-descriptor allowed ioctls */ int16_t fc_nioctls; /* fc_ioctls array size */ + uint32_t fc_fcntls; /* per-descriptor allowed fcntls */ }; struct filedescent { From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 10:21: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 ESMTP id BF88FCC; Sun, 18 Aug 2013 10:21:31 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 9E2D229D9; Sun, 18 Aug 2013 10:21: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 r7IALV1B052059; Sun, 18 Aug 2013 10:21:31 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IALUgu051994; Sun, 18 Aug 2013 10:21:30 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308181021.r7IALUgu051994@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 10:21:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254480 - in head/sys: amd64/conf i386/conf ia64/conf pc98/conf powerpc/conf sparc64/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.14 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, 18 Aug 2013 10:21:31 -0000 Author: pjd Date: Sun Aug 18 10:21:29 2013 New Revision: 254480 URL: http://svnweb.freebsd.org/changeset/base/254480 Log: Add process descriptors support to the GENERIC kernel. It is already being used by the tools in base systems and with sandboxing more and more tools the usage should only increase. Submitted by: Mariusz Zaborski Sponsored by: Google Summer of Code 2013 MFC after: 1 month Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC head/sys/ia64/conf/GENERIC head/sys/pc98/conf/GENERIC head/sys/powerpc/conf/GENERIC head/sys/sparc64/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Sun Aug 18 09:45:52 2013 (r254479) +++ head/sys/amd64/conf/GENERIC Sun Aug 18 10:21:29 2013 (r254480) @@ -66,6 +66,7 @@ options HWPMC_HOOKS # Necessary kernel options AUDIT # Security event auditing options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities +options PROCDESC # Support for process descriptors options MAC # TrustedBSD MAC Framework options KDTRACE_FRAME # Ensure frames are compiled in options KDTRACE_HOOKS # Kernel DTrace hooks Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Sun Aug 18 09:45:52 2013 (r254479) +++ head/sys/i386/conf/GENERIC Sun Aug 18 10:21:29 2013 (r254480) @@ -67,6 +67,7 @@ options HWPMC_HOOKS # Necessary kernel options AUDIT # Security event auditing options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities +options PROCDESC # Support for process descriptors options MAC # TrustedBSD MAC Framework options KDTRACE_HOOKS # Kernel DTrace hooks options DDB_CTF # Kernel ELF linker loads CTF data Modified: head/sys/ia64/conf/GENERIC ============================================================================== --- head/sys/ia64/conf/GENERIC Sun Aug 18 09:45:52 2013 (r254479) +++ head/sys/ia64/conf/GENERIC Sun Aug 18 10:21:29 2013 (r254480) @@ -26,8 +26,8 @@ ident GENERIC makeoptions DEBUG=-g # Build kernel with debug information. options AUDIT # Security event auditing -options CAPABILITY_MODE # Capsicum capability mode -options CAPABILITIES # Capsicum capabilities +options CAPABILITY_MODE # Capsicum capability mode +options CAPABILITIES # Capsicum capabilities options CD9660 # ISO 9660 Filesystem options COMPAT_FREEBSD7 # Compatible with FreeBSD7 options FFS # Berkeley Fast Filesystem @@ -46,6 +46,7 @@ options NFS_ROOT # NFS usable as root d options P1003_1B_SEMAPHORES # POSIX-style semaphores options PREEMPTION # Enable kernel thread preemption options PRINTF_BUFR_SIZE=128 # Printf buffering to limit interspersion +options PROCDESC # Support for process descriptors options PROCFS # Process filesystem (/proc) options PSEUDOFS # Pseudo-filesystem framework options SCHED_ULE # ULE scheduler Modified: head/sys/pc98/conf/GENERIC ============================================================================== --- head/sys/pc98/conf/GENERIC Sun Aug 18 09:45:52 2013 (r254479) +++ head/sys/pc98/conf/GENERIC Sun Aug 18 10:21:29 2013 (r254480) @@ -65,6 +65,7 @@ options HWPMC_HOOKS # Necessary kernel options AUDIT # Security event auditing options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities +options PROCDESC # Support for process descriptors options MAC # TrustedBSD MAC Framework options INCLUDE_CONFIG_FILE # Include this file in kernel options KDB # Kernel debugger related code Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Sun Aug 18 09:45:52 2013 (r254479) +++ head/sys/powerpc/conf/GENERIC Sun Aug 18 10:21:29 2013 (r254480) @@ -69,6 +69,7 @@ options HWPMC_HOOKS # Necessary kernel options AUDIT # Security event auditing options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities +options PROCDESC # Support for process descriptors options MAC # TrustedBSD MAC Framework options KDTRACE_HOOKS # Kernel DTrace hooks options DDB_CTF # Kernel ELF linker loads CTF data Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Sun Aug 18 09:45:52 2013 (r254479) +++ head/sys/sparc64/conf/GENERIC Sun Aug 18 10:21:29 2013 (r254480) @@ -63,6 +63,7 @@ options HWPMC_HOOKS # Necessary kernel options AUDIT # Security event auditing options CAPABILITY_MODE # Capsicum capability mode options CAPABILITIES # Capsicum capabilities +options PROCDESC # Support for process descriptors options MAC # TrustedBSD MAC Framework options INCLUDE_CONFIG_FILE # Include this file in kernel From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 10:30: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 ESMTP id 0302A27A; Sun, 18 Aug 2013 10:30:43 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 E390A2A26; Sun, 18 Aug 2013 10:30:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7IAUg8D083240; Sun, 18 Aug 2013 10:30:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IAUfvb083190; Sun, 18 Aug 2013 10:30:41 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308181030.r7IAUfvb083190@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 10:30:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254481 - in head/sys: compat/freebsd32 conf kern 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.14 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, 18 Aug 2013 10:30:43 -0000 Author: pjd Date: Sun Aug 18 10:30:41 2013 New Revision: 254481 URL: http://svnweb.freebsd.org/changeset/base/254481 Log: Implement 32bit versions of the cap_ioctls_limit(2) and cap_ioctls_get(2) system calls as unsigned longs have different size on i386 and amd64. Reported by: jilles Sponsored by: The FreeBSD Foundation Added: head/sys/compat/freebsd32/freebsd32_capability.c (contents, props changed) Modified: head/sys/compat/freebsd32/syscalls.master head/sys/conf/files head/sys/kern/sys_capability.c head/sys/sys/syscallsubr.h Added: head/sys/compat/freebsd32/freebsd32_capability.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/freebsd32/freebsd32_capability.c Sun Aug 18 10:30:41 2013 (r254481) @@ -0,0 +1,153 @@ +/*- + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Pawel Jakub Dawidek under sponsorship from + * the FreeBSD Foundation. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_capsicum.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#ifdef CAPABILITIES + +MALLOC_DECLARE(M_FILECAPS); + +int +freebsd32_cap_ioctls_limit(struct thread *td, + struct freebsd32_cap_ioctls_limit_args *uap) +{ + u_long *cmds; + uint32_t *cmds32; + size_t ncmds; + u_int i; + int error; + + ncmds = uap->ncmds; + + if (ncmds > 256) /* XXX: Is 256 sane? */ + return (EINVAL); + + if (ncmds == 0) { + cmds = NULL; + } else { + cmds32 = malloc(sizeof(cmds32[0]) * ncmds, M_FILECAPS, M_WAITOK); + error = copyin(uap->cmds, cmds32, sizeof(cmds32[0]) * ncmds); + if (error != 0) { + free(cmds32, M_FILECAPS); + return (error); + } + cmds = malloc(sizeof(cmds[0]) * ncmds, M_FILECAPS, M_WAITOK); + for (i = 0; i < ncmds; i++) + cmds[i] = cmds32[i]; + free(cmds32, M_FILECAPS); + } + + return (kern_cap_ioctls_limit(td, uap->fd, cmds, ncmds)); +} + +int +freebsd32_cap_ioctls_get(struct thread *td, + struct freebsd32_cap_ioctls_get_args *uap) +{ + struct filedesc *fdp; + struct filedescent *fdep; + uint32_t *cmds32; + u_long *cmds; + size_t maxcmds; + int error, fd; + u_int i; + + fd = uap->fd; + cmds32 = uap->cmds; + maxcmds = uap->maxcmds; + + AUDIT_ARG_FD(fd); + + fdp = td->td_proc->p_fd; + FILEDESC_SLOCK(fdp); + + if (fget_locked(fdp, fd) == NULL) { + error = EBADF; + goto out; + } + + /* + * If all ioctls are allowed (fde_nioctls == -1 && fde_ioctls == NULL) + * the only sane thing we can do is to not populate the given array and + * return CAP_IOCTLS_ALL (actually, INT_MAX). + */ + + fdep = &fdp->fd_ofiles[fd]; + cmds = fdep->fde_ioctls; + if (cmds32 != NULL && cmds != NULL) { + for (i = 0; i < MIN(fdep->fde_nioctls, maxcmds); i++) { + error = suword32(&cmds32[i], cmds[i]); + if (error != 0) + goto out; + } + } + if (fdep->fde_nioctls == -1) + td->td_retval[0] = INT_MAX; + else + td->td_retval[0] = fdep->fde_nioctls; + + error = 0; +out: + FILEDESC_SUNLOCK(fdp); + return (error); +} + +#else /* !CAPABILITIES */ + +int +freebsd32_cap_ioctls_limit(struct thread *td, + struct freebsd32_cap_ioctls_limit_args *uap) +{ + + return (ENOSYS); +} + +int +freebsd32_cap_ioctls_get(struct thread *td, + struct freebsd32_cap_ioctls_get_args *uap) +{ + + return (ENOSYS); +} + +#endif /* CAPABILITIES */ Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Sun Aug 18 10:21:29 2013 (r254480) +++ head/sys/compat/freebsd32/syscalls.master Sun Aug 18 10:30:41 2013 (r254481) @@ -1032,10 +1032,12 @@ #endif 533 AUE_CAP_RIGHTS_LIMIT NOPROTO { int cap_rights_limit(int fd, \ uint64_t rights); } -534 AUE_CAP_IOCTLS_LIMIT NOPROTO { int cap_ioctls_limit(int fd, \ - const u_long *cmds, size_t ncmds); } -535 AUE_CAP_IOCTLS_GET NOPROTO { ssize_t cap_ioctls_get(int fd, \ - u_long *cmds, size_t maxcmds); } +534 AUE_CAP_IOCTLS_LIMIT STD { \ + int freebsd32_cap_ioctls_limit(int fd, \ + const uint32_t *cmds, size_t ncmds); } +535 AUE_CAP_IOCTLS_GET STD { \ + ssize_t freebsd32_cap_ioctls_get(int fd, \ + uint32_t *cmds, size_t maxcmds); } 536 AUE_CAP_FCNTLS_LIMIT NOPROTO { int cap_fcntls_limit(int fd, \ uint32_t fcntlrights); } 537 AUE_CAP_FCNTLS_GET NOPROTO { int cap_fcntls_get(int fd, \ Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 18 10:21:29 2013 (r254480) +++ head/sys/conf/files Sun Aug 18 10:30:41 2013 (r254481) @@ -275,6 +275,7 @@ cddl/contrib/opensolaris/uts/common/zmod cddl/contrib/opensolaris/uts/common/zmod/zmod.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/zmod/zutil.c optional zfs compile-with "${ZFS_C}" +compat/freebsd32/freebsd32_capability.c optional compat_freebsd32 compat/freebsd32/freebsd32_ioctl.c optional compat_freebsd32 compat/freebsd32/freebsd32_misc.c optional compat_freebsd32 compat/freebsd32/freebsd32_syscalls.c optional compat_freebsd32 Modified: head/sys/kern/sys_capability.c ============================================================================== --- head/sys/kern/sys_capability.c Sun Aug 18 10:21:29 2013 (r254480) +++ head/sys/kern/sys_capability.c Sun Aug 18 10:30:41 2013 (r254481) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -328,32 +329,14 @@ cap_ioctl_limit_check(struct filedesc *f } int -sys_cap_ioctls_limit(struct thread *td, struct cap_ioctls_limit_args *uap) +kern_cap_ioctls_limit(struct thread *td, int fd, u_long *cmds, size_t ncmds) { struct filedesc *fdp; - u_long *cmds, *ocmds; - size_t ncmds; - int error, fd; - - fd = uap->fd; - ncmds = uap->ncmds; + u_long *ocmds; + int error; AUDIT_ARG_FD(fd); - if (ncmds > 256) /* XXX: Is 256 sane? */ - return (EINVAL); - - if (ncmds == 0) { - cmds = NULL; - } else { - cmds = malloc(sizeof(cmds[0]) * ncmds, M_FILECAPS, M_WAITOK); - error = copyin(uap->cmds, cmds, sizeof(cmds[0]) * ncmds); - if (error != 0) { - free(cmds, M_FILECAPS); - return (error); - } - } - fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); @@ -379,6 +362,32 @@ out: } int +sys_cap_ioctls_limit(struct thread *td, struct cap_ioctls_limit_args *uap) +{ + u_long *cmds; + size_t ncmds; + int error; + + ncmds = uap->ncmds; + + if (ncmds > 256) /* XXX: Is 256 sane? */ + return (EINVAL); + + if (ncmds == 0) { + cmds = NULL; + } else { + cmds = malloc(sizeof(cmds[0]) * ncmds, M_FILECAPS, M_WAITOK); + error = copyin(uap->cmds, cmds, sizeof(cmds[0]) * ncmds); + if (error != 0) { + free(cmds, M_FILECAPS); + return (error); + } + } + + return (kern_cap_ioctls_limit(td, uap->fd, cmds, ncmds)); +} + +int sys_cap_ioctls_get(struct thread *td, struct cap_ioctls_get_args *uap) { struct filedesc *fdp; Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Sun Aug 18 10:21:29 2013 (r254480) +++ head/sys/sys/syscallsubr.h Sun Aug 18 10:30:41 2013 (r254481) @@ -71,6 +71,8 @@ int kern_adjtime(struct thread *td, stru int kern_alternate_path(struct thread *td, const char *prefix, const char *path, enum uio_seg pathseg, char **pathbuf, int create, int dirfd); int kern_bind(struct thread *td, int fd, struct sockaddr *sa); +int kern_cap_ioctls_limit(struct thread *td, int fd, u_long *cmds, + size_t ncmds); int kern_chdir(struct thread *td, char *path, enum uio_seg pathseg); int kern_chmod(struct thread *td, char *path, enum uio_seg pathseg, int mode); From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 10:31: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 ESMTP id 9B3E83BA; Sun, 18 Aug 2013 10:31:31 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 87DA22A30; Sun, 18 Aug 2013 10:31: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 r7IAVVg2085800; Sun, 18 Aug 2013 10:31:31 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IAVUsO085736; Sun, 18 Aug 2013 10:31:30 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308181031.r7IAVUsO085736@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 10:31:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254482 - head/sys/compat/freebsd32 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.14 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, 18 Aug 2013 10:31:31 -0000 Author: pjd Date: Sun Aug 18 10:31:30 2013 New Revision: 254482 URL: http://svnweb.freebsd.org/changeset/base/254482 Log: Regenerate after r254481. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Sun Aug 18 10:30:41 2013 (r254481) +++ head/sys/compat/freebsd32/freebsd32_proto.h Sun Aug 18 10:31:30 2013 (r254482) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254447 2013-08-17 14:17:13Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254481 2013-08-18 10:30:41Z pjd */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -653,6 +653,16 @@ struct freebsd32_wait6_args { char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)]; }; #endif +struct freebsd32_cap_ioctls_limit_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char cmds_l_[PADL_(const uint32_t *)]; const uint32_t * cmds; char cmds_r_[PADR_(const uint32_t *)]; + char ncmds_l_[PADL_(size_t)]; size_t ncmds; char ncmds_r_[PADR_(size_t)]; +}; +struct freebsd32_cap_ioctls_get_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char cmds_l_[PADL_(uint32_t *)]; uint32_t * cmds; char cmds_r_[PADR_(uint32_t *)]; + char maxcmds_l_[PADL_(size_t)]; size_t maxcmds; char maxcmds_r_[PADR_(size_t)]; +}; struct freebsd32_aio_mlock_args { char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; }; @@ -779,6 +789,8 @@ int freebsd32_posix_fallocate(struct thr int freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args *); int freebsd32_wait6(struct thread *, struct freebsd32_wait6_args *); #endif +int freebsd32_cap_ioctls_limit(struct thread *, struct freebsd32_cap_ioctls_limit_args *); +int freebsd32_cap_ioctls_get(struct thread *, struct freebsd32_cap_ioctls_get_args *); int freebsd32_aio_mlock(struct thread *, struct freebsd32_aio_mlock_args *); #ifdef COMPAT_43 @@ -1177,6 +1189,8 @@ int freebsd7_freebsd32_shmctl(struct thr #define FREEBSD32_SYS_AUE_freebsd32_posix_fallocate AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_posix_fadvise AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_wait6 AUE_WAIT6 +#define FREEBSD32_SYS_AUE_freebsd32_cap_ioctls_limit AUE_CAP_IOCTLS_LIMIT +#define FREEBSD32_SYS_AUE_freebsd32_cap_ioctls_get AUE_CAP_IOCTLS_GET #define FREEBSD32_SYS_AUE_freebsd32_aio_mlock AUE_NULL #undef PAD_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Sun Aug 18 10:30:41 2013 (r254481) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Sun Aug 18 10:31:30 2013 (r254482) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254447 2013-08-17 14:17:13Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254481 2013-08-18 10:30:41Z pjd */ #define FREEBSD32_SYS_syscall 0 @@ -442,8 +442,8 @@ #define FREEBSD32_SYS_freebsd32_posix_fadvise 531 #define FREEBSD32_SYS_freebsd32_wait6 532 #define FREEBSD32_SYS_cap_rights_limit 533 -#define FREEBSD32_SYS_cap_ioctls_limit 534 -#define FREEBSD32_SYS_cap_ioctls_get 535 +#define FREEBSD32_SYS_freebsd32_cap_ioctls_limit 534 +#define FREEBSD32_SYS_freebsd32_cap_ioctls_get 535 #define FREEBSD32_SYS_cap_fcntls_limit 536 #define FREEBSD32_SYS_cap_fcntls_get 537 #define FREEBSD32_SYS_bindat 538 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Sun Aug 18 10:30:41 2013 (r254481) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Sun Aug 18 10:31:30 2013 (r254482) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254447 2013-08-17 14:17:13Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254481 2013-08-18 10:30:41Z pjd */ const char *freebsd32_syscallnames[] = { @@ -563,8 +563,8 @@ const char *freebsd32_syscallnames[] = { "freebsd32_wait6", /* 532 = freebsd32_wait6 */ #endif "cap_rights_limit", /* 533 = cap_rights_limit */ - "cap_ioctls_limit", /* 534 = cap_ioctls_limit */ - "cap_ioctls_get", /* 535 = cap_ioctls_get */ + "freebsd32_cap_ioctls_limit", /* 534 = freebsd32_cap_ioctls_limit */ + "freebsd32_cap_ioctls_get", /* 535 = freebsd32_cap_ioctls_get */ "cap_fcntls_limit", /* 536 = cap_fcntls_limit */ "cap_fcntls_get", /* 537 = cap_fcntls_get */ "bindat", /* 538 = bindat */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Sun Aug 18 10:30:41 2013 (r254481) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Sun Aug 18 10:31:30 2013 (r254482) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254447 2013-08-17 14:17:13Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254481 2013-08-18 10:30:41Z pjd */ #include "opt_compat.h" @@ -600,8 +600,8 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_wait6_args), (sy_call_t *)freebsd32_wait6, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC }, /* 532 = freebsd32_wait6 */ #endif { AS(cap_rights_limit_args), (sy_call_t *)sys_cap_rights_limit, AUE_CAP_RIGHTS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 533 = cap_rights_limit */ - { AS(cap_ioctls_limit_args), (sy_call_t *)sys_cap_ioctls_limit, AUE_CAP_IOCTLS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 534 = cap_ioctls_limit */ - { AS(cap_ioctls_get_args), (sy_call_t *)sys_cap_ioctls_get, AUE_CAP_IOCTLS_GET, NULL, 0, 0, 0, SY_THR_STATIC }, /* 535 = cap_ioctls_get */ + { AS(freebsd32_cap_ioctls_limit_args), (sy_call_t *)freebsd32_cap_ioctls_limit, AUE_CAP_IOCTLS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 534 = freebsd32_cap_ioctls_limit */ + { AS(freebsd32_cap_ioctls_get_args), (sy_call_t *)freebsd32_cap_ioctls_get, AUE_CAP_IOCTLS_GET, NULL, 0, 0, 0, SY_THR_STATIC }, /* 535 = freebsd32_cap_ioctls_get */ { AS(cap_fcntls_limit_args), (sy_call_t *)sys_cap_fcntls_limit, AUE_CAP_FCNTLS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 536 = cap_fcntls_limit */ { AS(cap_fcntls_get_args), (sy_call_t *)sys_cap_fcntls_get, AUE_CAP_FCNTLS_GET, NULL, 0, 0, 0, SY_THR_STATIC }, /* 537 = cap_fcntls_get */ { AS(bindat_args), (sy_call_t *)sys_bindat, AUE_BINDAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 538 = bindat */ Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Sun Aug 18 10:30:41 2013 (r254481) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Sun Aug 18 10:31:30 2013 (r254482) @@ -3205,20 +3205,20 @@ systrace_args(int sysnum, void *params, *n_args = 2; break; } - /* cap_ioctls_limit */ + /* freebsd32_cap_ioctls_limit */ case 534: { - struct cap_ioctls_limit_args *p = params; + struct freebsd32_cap_ioctls_limit_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = (intptr_t) p->cmds; /* const u_long * */ + uarg[1] = (intptr_t) p->cmds; /* const uint32_t * */ uarg[2] = p->ncmds; /* size_t */ *n_args = 3; break; } - /* cap_ioctls_get */ + /* freebsd32_cap_ioctls_get */ case 535: { - struct cap_ioctls_get_args *p = params; + struct freebsd32_cap_ioctls_get_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = (intptr_t) p->cmds; /* u_long * */ + uarg[1] = (intptr_t) p->cmds; /* uint32_t * */ uarg[2] = p->maxcmds; /* size_t */ *n_args = 3; break; @@ -8662,14 +8662,14 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; - /* cap_ioctls_limit */ + /* freebsd32_cap_ioctls_limit */ case 534: switch(ndx) { case 0: p = "int"; break; case 1: - p = "const u_long *"; + p = "const uint32_t *"; break; case 2: p = "size_t"; @@ -8678,14 +8678,14 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; - /* cap_ioctls_get */ + /* freebsd32_cap_ioctls_get */ case 535: switch(ndx) { case 0: p = "int"; break; case 1: - p = "u_long *"; + p = "uint32_t *"; break; case 2: p = "size_t"; @@ -10644,12 +10644,12 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; - /* cap_ioctls_limit */ + /* freebsd32_cap_ioctls_limit */ case 534: if (ndx == 0 || ndx == 1) p = "int"; break; - /* cap_ioctls_get */ + /* freebsd32_cap_ioctls_get */ case 535: if (ndx == 0 || ndx == 1) p = "ssize_t"; From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 10:33: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 ESMTP id 2F431511; Sun, 18 Aug 2013 10:33:47 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 1CB172A3E; Sun, 18 Aug 2013 10:33: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 r7IAXkDB092423; Sun, 18 Aug 2013 10:33:46 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IAXk2p092422; Sun, 18 Aug 2013 10:33:46 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308181033.r7IAXk2p092422@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 10:33:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254483 - head/lib/libc/stdlib 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.14 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, 18 Aug 2013 10:33:47 -0000 Author: pjd Date: Sun Aug 18 10:33:46 2013 New Revision: 254483 URL: http://svnweb.freebsd.org/changeset/base/254483 Log: Make example more correct (errstr is a pointer, not boolean). Modified: head/lib/libc/stdlib/strtonum.3 Modified: head/lib/libc/stdlib/strtonum.3 ============================================================================== --- head/lib/libc/stdlib/strtonum.3 Sun Aug 18 10:31:30 2013 (r254482) +++ head/lib/libc/stdlib/strtonum.3 Sun Aug 18 10:33:46 2013 (r254483) @@ -97,7 +97,7 @@ int iterations; const char *errstr; iterations = strtonum(optarg, 1, 64, &errstr); -if (errstr) +if (errstr != NULL) errx(1, "number of iterations is %s: %s", errstr, optarg); .Ed .Pp From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 10:38:59 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 ESMTP id B21D56A0; Sun, 18 Aug 2013 10:38:59 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 9FC9B2A60; Sun, 18 Aug 2013 10:38:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7IAcxDf008488; Sun, 18 Aug 2013 10:38:59 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IAcxkM008487; Sun, 18 Aug 2013 10:38:59 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308181038.r7IAcxkM008487@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 10:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254484 - head/lib/libc/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.14 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, 18 Aug 2013 10:38:59 -0000 Author: pjd Date: Sun Aug 18 10:38:59 2013 New Revision: 254484 URL: http://svnweb.freebsd.org/changeset/base/254484 Log: Consistently use 'af' as an argument name for address family. Now both gethostbyname2(3) and gethostbyaddr(3) use the same argument name. The same argument name is also used in implementations of those functions. Modified: head/lib/libc/net/gethostbyname.3 Modified: head/lib/libc/net/gethostbyname.3 ============================================================================== --- head/lib/libc/net/gethostbyname.3 Sun Aug 18 10:33:46 2013 (r254483) +++ head/lib/libc/net/gethostbyname.3 Sun Aug 18 10:38:59 2013 (r254484) @@ -51,7 +51,7 @@ .Ft struct hostent * .Fn gethostbyname2 "const char *name" "int af" .Ft struct hostent * -.Fn gethostbyaddr "const void *addr" "socklen_t len" "int type" +.Fn gethostbyaddr "const void *addr" "socklen_t len" "int af" .Ft struct hostent * .Fn gethostent void .Ft void @@ -107,7 +107,7 @@ in binary form .Tn ASCII form). The -.Fa type +.Fa af argument specifies the address family (e.g.\& .Dv AF_INET , AF_INET6 , From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 10:44: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 ESMTP id 5AD9F9E8; Sun, 18 Aug 2013 10:44:38 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 472DC2AC6; Sun, 18 Aug 2013 10:44: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 r7IAicFJ027366; Sun, 18 Aug 2013 10:44:38 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IAicib027364; Sun, 18 Aug 2013 10:44:38 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308181044.r7IAicib027364@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 10:44:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254485 - head/usr.bin/procstat 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.14 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, 18 Aug 2013 10:44:38 -0000 Author: pjd Date: Sun Aug 18 10:44:37 2013 New Revision: 254485 URL: http://svnweb.freebsd.org/changeset/base/254485 Log: Make the "FD" column one character wider, so that "trace" can also align properly. Modified: head/usr.bin/procstat/procstat_files.c Modified: head/usr.bin/procstat/procstat_files.c ============================================================================== --- head/usr.bin/procstat/procstat_files.c Sun Aug 18 10:38:59 2013 (r254484) +++ head/usr.bin/procstat/procstat_files.c Sun Aug 18 10:44:37 2013 (r254485) @@ -332,19 +332,19 @@ procstat_files(struct procstat *procstat printf("%5d ", kipp->ki_pid); printf("%-16s ", kipp->ki_comm); if (fst->fs_uflags & PS_FST_UFLAG_CTTY) - printf("ctty "); + printf(" ctty "); else if (fst->fs_uflags & PS_FST_UFLAG_CDIR) - printf(" cwd "); + printf(" cwd "); else if (fst->fs_uflags & PS_FST_UFLAG_JAIL) - printf("jail "); + printf(" jail "); else if (fst->fs_uflags & PS_FST_UFLAG_RDIR) - printf("root "); + printf(" root "); else if (fst->fs_uflags & PS_FST_UFLAG_TEXT) - printf("text "); + printf(" text "); else if (fst->fs_uflags & PS_FST_UFLAG_TRACE) printf("trace "); else - printf("%4d ", fst->fs_fd); + printf("%5d ", fst->fs_fd); switch (fst->fs_type) { case PS_FST_TYPE_VNODE: From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 11:25:43 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 ESMTP id 4CAB317E; Sun, 18 Aug 2013 11:25:43 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 3990E223D; Sun, 18 Aug 2013 11:25: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 r7IBPh1G048705; Sun, 18 Aug 2013 11:25:43 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IBPhLV048702; Sun, 18 Aug 2013 11:25:43 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308181125.r7IBPhLV048702@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 11:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254486 - head/usr.sbin/rwhod 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.14 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, 18 Aug 2013 11:25:43 -0000 Author: pjd Date: Sun Aug 18 11:25:42 2013 New Revision: 254486 URL: http://svnweb.freebsd.org/changeset/base/254486 Log: Cast argument of is*() ctype functions to unsigned char. Without the cast there is ambiguity between 0xFF and -1 (EOF). Suggested by: jilles Submitted by: Mariusz Zaborski Sponsored by: Google Summer of Code 2013 Modified: head/usr.sbin/rwhod/rwhod.c Modified: head/usr.sbin/rwhod/rwhod.c ============================================================================== --- head/usr.sbin/rwhod/rwhod.c Sun Aug 18 10:44:37 2013 (r254485) +++ head/usr.sbin/rwhod/rwhod.c Sun Aug 18 11:25:42 2013 (r254486) @@ -337,8 +337,11 @@ verify(char *name, int maxlen) size = 0; while (*name != '\0' && size < maxlen - 1) { - if (!isascii(*name) || !(isalnum(*name) || ispunct(*name))) + if (!isascii((unsigned char)*name) || + !(isalnum((unsigned char)*name) || + ispunct((unsigned char)*name))) { return (0); + } name++; size++; } From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 11:54: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 ESMTP id 47B542A5; Sun, 18 Aug 2013 11:54:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) 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 2CCE823C3; Sun, 18 Aug 2013 11:54:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7IBsLod025474; Sun, 18 Aug 2013 11:54:21 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IBsL5n025473; Sun, 18 Aug 2013 11:54:21 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201308181154.r7IBsL5n025473@svn.freebsd.org> From: Andrew Turner Date: Sun, 18 Aug 2013 11:54:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254487 - head/sys/arm/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.14 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, 18 Aug 2013 11:54:21 -0000 Author: andrew Date: Sun Aug 18 11:54:20 2013 New Revision: 254487 URL: http://svnweb.freebsd.org/changeset/base/254487 Log: Enable VFP support on EFIKA MX. Modified: head/sys/arm/conf/EFIKA_MX Modified: head/sys/arm/conf/EFIKA_MX ============================================================================== --- head/sys/arm/conf/EFIKA_MX Sun Aug 18 11:25:42 2013 (r254486) +++ head/sys/arm/conf/EFIKA_MX Sun Aug 18 11:54:20 2013 (r254487) @@ -58,6 +58,7 @@ options SYSVMSG # SYSV-style message options SYSVSEM # SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options INCLUDE_CONFIG_FILE # Include this file in kernel +options VFP # vfp/neon # required for netbooting #options BOOTP From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 13:25: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 ESMTP id DF4DCA40; Sun, 18 Aug 2013 13:25:18 +0000 (UTC) (envelope-from jilles@FreeBSD.org) 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 B22BF275E; Sun, 18 Aug 2013 13:25: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 r7IDPISY048082; Sun, 18 Aug 2013 13:25:18 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IDPIOL048080; Sun, 18 Aug 2013 13:25:18 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201308181325.r7IDPIOL048080@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 18 Aug 2013 13:25:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254488 - head/lib/libc/gen 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.14 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, 18 Aug 2013 13:25:19 -0000 Author: jilles Date: Sun Aug 18 13:25:18 2013 New Revision: 254488 URL: http://svnweb.freebsd.org/changeset/base/254488 Log: dup3(3): Replace copyright notice. Although I copied dup(2) to create dup3(3), I removed almost all the non-boilerplate, so dup3(3) is copyright me. Reported by: bjk Modified: head/lib/libc/gen/dup3.3 Modified: head/lib/libc/gen/dup3.3 ============================================================================== --- head/lib/libc/gen/dup3.3 Sun Aug 18 11:54:20 2013 (r254487) +++ head/lib/libc/gen/dup3.3 Sun Aug 18 13:25:18 2013 (r254488) @@ -1,5 +1,5 @@ -.\" Copyright (c) 1980, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. +.\" Copyright (c) 2013 Jilles Tjoelker +.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -9,14 +9,11 @@ .\" 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 +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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) @@ -25,7 +22,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)dup.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" .Dd August 16, 2013 From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 13:27: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 ESMTP id 1857CB93; Sun, 18 Aug 2013 13:27:05 +0000 (UTC) (envelope-from jilles@FreeBSD.org) 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 051252768; Sun, 18 Aug 2013 13:27: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 r7IDR4qZ051795; Sun, 18 Aug 2013 13:27:04 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IDR4Xg051791; Sun, 18 Aug 2013 13:27:04 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201308181327.r7IDR4Xg051791@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 18 Aug 2013 13:27:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254489 - 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.14 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, 18 Aug 2013 13:27:05 -0000 Author: jilles Date: Sun Aug 18 13:27:04 2013 New Revision: 254489 URL: http://svnweb.freebsd.org/changeset/base/254489 Log: Disallow opening a POSIX message queue for execute. O_EXEC was formerly ignored, so equivalent to O_RDONLY. Reject O_EXEC with [EINVAL] like the invalid mode 3. Modified: head/sys/kern/uipc_mqueue.c Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Sun Aug 18 13:25:18 2013 (r254488) +++ head/sys/kern/uipc_mqueue.c Sun Aug 18 13:27:04 2013 (r254489) @@ -2046,7 +2046,7 @@ sys_kmq_open(struct thread *td, struct k struct mq_attr attr; int flags, error; - if ((uap->flags & O_ACCMODE) == O_ACCMODE) + if ((uap->flags & O_ACCMODE) == O_ACCMODE || uap->flags & O_EXEC) return (EINVAL); flags = FFLAGS(uap->flags); if ((flags & O_CREAT) != 0 && uap->attr != NULL) { @@ -2682,7 +2682,7 @@ freebsd32_kmq_open(struct thread *td, st struct mq_attr32 attr32; int flags, error; - if ((uap->flags & O_ACCMODE) == O_ACCMODE) + if ((uap->flags & O_ACCMODE) == O_ACCMODE || uap->flags & O_EXEC) return (EINVAL); flags = FFLAGS(uap->flags); if ((flags & O_CREAT) != 0 && uap->attr != NULL) { From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 13:34:12 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 ESMTP id 67FB3FE5; Sun, 18 Aug 2013 13:34:12 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 53F3B27C4; Sun, 18 Aug 2013 13:34: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 r7IDYCop068618; Sun, 18 Aug 2013 13:34:12 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IDYBpt068604; Sun, 18 Aug 2013 13:34:11 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308181334.r7IDYBpt068604@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 13:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254490 - head/sys/compat/freebsd32 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.14 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, 18 Aug 2013 13:34:12 -0000 Author: pjd Date: Sun Aug 18 13:34:11 2013 New Revision: 254490 URL: http://svnweb.freebsd.org/changeset/base/254490 Log: Move the PAIR32TO64() macro and the RETVAL_HI/RETVAL_LO defines to a header file for use by other .c files. Sponsored by: The FreeBSD Foundation Added: head/sys/compat/freebsd32/freebsd32_misc.h (contents, props changed) Modified: head/sys/compat/freebsd32/freebsd32_misc.c Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Sun Aug 18 13:27:04 2013 (r254489) +++ head/sys/compat/freebsd32/freebsd32_misc.c Sun Aug 18 13:34:11 2013 (r254490) @@ -102,6 +102,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -128,16 +129,6 @@ CTASSERT(sizeof(struct sigaction32) == 2 static int freebsd32_kevent_copyout(void *arg, struct kevent *kevp, int count); static int freebsd32_kevent_copyin(void *arg, struct kevent *kevp, int count); -#if BYTE_ORDER == BIG_ENDIAN -#define PAIR32TO64(type, name) ((name ## 2) | ((type)(name ## 1) << 32)) -#define RETVAL_HI 0 -#define RETVAL_LO 1 -#else -#define PAIR32TO64(type, name) ((name ## 1) | ((type)(name ## 2) << 32)) -#define RETVAL_HI 1 -#define RETVAL_LO 0 -#endif - void freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32) { Added: head/sys/compat/freebsd32/freebsd32_misc.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/freebsd32/freebsd32_misc.h Sun Aug 18 13:34:11 2013 (r254490) @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Pawel Jakub Dawidek under sponsorship from + * the FreeBSD Foundation. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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. + * + * $FreeBSD$ + */ + +#ifndef _COMPAT_FREEBSD32_MISC_H_ +#define _COMPAT_FREEBSD32_MISC_H_ + +#include + +#if BYTE_ORDER == BIG_ENDIAN +#define PAIR32TO64(type, name) ((name ## 2) | ((type)(name ## 1) << 32)) +#define RETVAL_HI 0 +#define RETVAL_LO 1 +#else +#define PAIR32TO64(type, name) ((name ## 1) | ((type)(name ## 2) << 32)) +#define RETVAL_HI 1 +#define RETVAL_LO 0 +#endif + +#endif /* !_COMPAT_FREEBSD32_MISC_H_ */ From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 13:37:55 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 ESMTP id D7C801BC; Sun, 18 Aug 2013 13:37:55 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 B63A427D2; Sun, 18 Aug 2013 13:37: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 r7IDbtlo076179; Sun, 18 Aug 2013 13:37:55 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IDbtjm076169; Sun, 18 Aug 2013 13:37:55 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308181337.r7IDbtjm076169@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 13:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254491 - head/sys/compat/freebsd32 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.14 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, 18 Aug 2013 13:37:56 -0000 Author: pjd Date: Sun Aug 18 13:37:54 2013 New Revision: 254491 URL: http://svnweb.freebsd.org/changeset/base/254491 Log: The cap_rights_limit(2) system calls needs a wrapper for 32bit binaries running under 64bit kernels as the 'rights' argument has to be split into two registers or the half of the rights will disappear. Reported by: jilles Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/freebsd32/freebsd32_capability.c head/sys/compat/freebsd32/syscalls.master Modified: head/sys/compat/freebsd32/freebsd32_capability.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_capability.c Sun Aug 18 13:34:11 2013 (r254490) +++ head/sys/compat/freebsd32/freebsd32_capability.c Sun Aug 18 13:37:54 2013 (r254491) @@ -38,9 +38,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #ifdef CAPABILITIES @@ -48,6 +50,17 @@ __FBSDID("$FreeBSD$"); MALLOC_DECLARE(M_FILECAPS); int +freebsd32_cap_rights_limit(struct thread *td, + struct freebsd32_cap_rights_limit_args *uap) +{ + struct cap_rights_limit_args ap; + + ap.fd = uap->fd; + ap.rights = PAIR32TO64(uint64_t, uap->rights); + return (sys_cap_rights_limit(td, &ap)); +} + +int freebsd32_cap_ioctls_limit(struct thread *td, struct freebsd32_cap_ioctls_limit_args *uap) { @@ -135,6 +148,14 @@ out: #else /* !CAPABILITIES */ int +freebsd32_cap_rights_limit(struct thread *td, + struct freebsd32_cap_rights_limit_args *uap) +{ + + return (ENOSYS); +} + +int freebsd32_cap_ioctls_limit(struct thread *td, struct freebsd32_cap_ioctls_limit_args *uap) { Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Sun Aug 18 13:34:11 2013 (r254490) +++ head/sys/compat/freebsd32/syscalls.master Sun Aug 18 13:37:54 2013 (r254491) @@ -1016,6 +1016,10 @@ int *status, int options, \ struct wrusage32 *wrusage, \ siginfo_t *info); } +533 AUE_CAP_RIGHTS_LIMIT STD { \ + int freebsd32_cap_rights_limit(int fd, \ + int pad, \ + uint32_t rights1, uint32_t rights2); } #else 530 AUE_NULL STD { int freebsd32_posix_fallocate(int fd,\ uint32_t offset1, uint32_t offset2,\ @@ -1029,9 +1033,10 @@ int *status, int options, \ struct wrusage32 *wrusage, \ siginfo_t *info); } +533 AUE_CAP_RIGHTS_LIMIT STD { \ + int freebsd32_cap_rights_limit(int fd, \ + uint32_t rights1, uint32_t rights2); } #endif -533 AUE_CAP_RIGHTS_LIMIT NOPROTO { int cap_rights_limit(int fd, \ - uint64_t rights); } 534 AUE_CAP_IOCTLS_LIMIT STD { \ int freebsd32_cap_ioctls_limit(int fd, \ const uint32_t *cmds, size_t ncmds); } From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 13:38:40 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 ESMTP id CAAB32F3; Sun, 18 Aug 2013 13:38:40 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 B716627D7; Sun, 18 Aug 2013 13:38:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7IDceaM077754; Sun, 18 Aug 2013 13:38:40 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IDcdM0077720; Sun, 18 Aug 2013 13:38:39 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308181338.r7IDcdM0077720@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 13:38:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254492 - head/sys/compat/freebsd32 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.14 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, 18 Aug 2013 13:38:41 -0000 Author: pjd Date: Sun Aug 18 13:38:39 2013 New Revision: 254492 URL: http://svnweb.freebsd.org/changeset/base/254492 Log: Regenerate after r254491. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Sun Aug 18 13:37:54 2013 (r254491) +++ head/sys/compat/freebsd32/freebsd32_proto.h Sun Aug 18 13:38:39 2013 (r254492) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254481 2013-08-18 10:30:41Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254491 2013-08-18 13:37:54Z pjd */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -627,6 +627,12 @@ struct freebsd32_wait6_args { char wrusage_l_[PADL_(struct wrusage32 *)]; struct wrusage32 * wrusage; char wrusage_r_[PADR_(struct wrusage32 *)]; char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)]; }; +struct freebsd32_cap_rights_limit_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; + char rights1_l_[PADL_(uint32_t)]; uint32_t rights1; char rights1_r_[PADR_(uint32_t)]; + char rights2_l_[PADL_(uint32_t)]; uint32_t rights2; char rights2_r_[PADR_(uint32_t)]; +}; #else struct freebsd32_posix_fallocate_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; @@ -652,6 +658,11 @@ struct freebsd32_wait6_args { char wrusage_l_[PADL_(struct wrusage32 *)]; struct wrusage32 * wrusage; char wrusage_r_[PADR_(struct wrusage32 *)]; char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)]; }; +struct freebsd32_cap_rights_limit_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char rights1_l_[PADL_(uint32_t)]; uint32_t rights1; char rights1_r_[PADR_(uint32_t)]; + char rights2_l_[PADL_(uint32_t)]; uint32_t rights2; char rights2_r_[PADR_(uint32_t)]; +}; #endif struct freebsd32_cap_ioctls_limit_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; @@ -784,10 +795,12 @@ int freebsd32_pselect(struct thread *, s int freebsd32_posix_fallocate(struct thread *, struct freebsd32_posix_fallocate_args *); int freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args *); int freebsd32_wait6(struct thread *, struct freebsd32_wait6_args *); +int freebsd32_cap_rights_limit(struct thread *, struct freebsd32_cap_rights_limit_args *); #else int freebsd32_posix_fallocate(struct thread *, struct freebsd32_posix_fallocate_args *); int freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args *); int freebsd32_wait6(struct thread *, struct freebsd32_wait6_args *); +int freebsd32_cap_rights_limit(struct thread *, struct freebsd32_cap_rights_limit_args *); #endif int freebsd32_cap_ioctls_limit(struct thread *, struct freebsd32_cap_ioctls_limit_args *); int freebsd32_cap_ioctls_get(struct thread *, struct freebsd32_cap_ioctls_get_args *); @@ -1186,9 +1199,11 @@ int freebsd7_freebsd32_shmctl(struct thr #define FREEBSD32_SYS_AUE_freebsd32_posix_fallocate AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_posix_fadvise AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_wait6 AUE_WAIT6 +#define FREEBSD32_SYS_AUE_freebsd32_cap_rights_limit AUE_CAP_RIGHTS_LIMIT #define FREEBSD32_SYS_AUE_freebsd32_posix_fallocate AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_posix_fadvise AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_wait6 AUE_WAIT6 +#define FREEBSD32_SYS_AUE_freebsd32_cap_rights_limit AUE_CAP_RIGHTS_LIMIT #define FREEBSD32_SYS_AUE_freebsd32_cap_ioctls_limit AUE_CAP_IOCTLS_LIMIT #define FREEBSD32_SYS_AUE_freebsd32_cap_ioctls_get AUE_CAP_IOCTLS_GET #define FREEBSD32_SYS_AUE_freebsd32_aio_mlock AUE_NULL Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Sun Aug 18 13:37:54 2013 (r254491) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Sun Aug 18 13:38:39 2013 (r254492) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254481 2013-08-18 10:30:41Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254491 2013-08-18 13:37:54Z pjd */ #define FREEBSD32_SYS_syscall 0 @@ -438,10 +438,11 @@ #define FREEBSD32_SYS_freebsd32_posix_fallocate 530 #define FREEBSD32_SYS_freebsd32_posix_fadvise 531 #define FREEBSD32_SYS_freebsd32_wait6 532 +#define FREEBSD32_SYS_freebsd32_cap_rights_limit 533 #define FREEBSD32_SYS_freebsd32_posix_fallocate 530 #define FREEBSD32_SYS_freebsd32_posix_fadvise 531 #define FREEBSD32_SYS_freebsd32_wait6 532 -#define FREEBSD32_SYS_cap_rights_limit 533 +#define FREEBSD32_SYS_freebsd32_cap_rights_limit 533 #define FREEBSD32_SYS_freebsd32_cap_ioctls_limit 534 #define FREEBSD32_SYS_freebsd32_cap_ioctls_get 535 #define FREEBSD32_SYS_cap_fcntls_limit 536 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Sun Aug 18 13:37:54 2013 (r254491) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Sun Aug 18 13:38:39 2013 (r254492) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254481 2013-08-18 10:30:41Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254491 2013-08-18 13:37:54Z pjd */ const char *freebsd32_syscallnames[] = { @@ -557,12 +557,13 @@ const char *freebsd32_syscallnames[] = { "freebsd32_posix_fallocate", /* 530 = freebsd32_posix_fallocate */ "freebsd32_posix_fadvise", /* 531 = freebsd32_posix_fadvise */ "freebsd32_wait6", /* 532 = freebsd32_wait6 */ + "freebsd32_cap_rights_limit", /* 533 = freebsd32_cap_rights_limit */ #else "freebsd32_posix_fallocate", /* 530 = freebsd32_posix_fallocate */ "freebsd32_posix_fadvise", /* 531 = freebsd32_posix_fadvise */ "freebsd32_wait6", /* 532 = freebsd32_wait6 */ + "freebsd32_cap_rights_limit", /* 533 = freebsd32_cap_rights_limit */ #endif - "cap_rights_limit", /* 533 = cap_rights_limit */ "freebsd32_cap_ioctls_limit", /* 534 = freebsd32_cap_ioctls_limit */ "freebsd32_cap_ioctls_get", /* 535 = freebsd32_cap_ioctls_get */ "cap_fcntls_limit", /* 536 = cap_fcntls_limit */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Sun Aug 18 13:37:54 2013 (r254491) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Sun Aug 18 13:38:39 2013 (r254492) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254481 2013-08-18 10:30:41Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 254491 2013-08-18 13:37:54Z pjd */ #include "opt_compat.h" @@ -594,12 +594,13 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_posix_fallocate_args), (sy_call_t *)freebsd32_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 530 = freebsd32_posix_fallocate */ { AS(freebsd32_posix_fadvise_args), (sy_call_t *)freebsd32_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 531 = freebsd32_posix_fadvise */ { AS(freebsd32_wait6_args), (sy_call_t *)freebsd32_wait6, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC }, /* 532 = freebsd32_wait6 */ + { AS(freebsd32_cap_rights_limit_args), (sy_call_t *)freebsd32_cap_rights_limit, AUE_CAP_RIGHTS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 533 = freebsd32_cap_rights_limit */ #else { AS(freebsd32_posix_fallocate_args), (sy_call_t *)freebsd32_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 530 = freebsd32_posix_fallocate */ { AS(freebsd32_posix_fadvise_args), (sy_call_t *)freebsd32_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 531 = freebsd32_posix_fadvise */ { AS(freebsd32_wait6_args), (sy_call_t *)freebsd32_wait6, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC }, /* 532 = freebsd32_wait6 */ + { AS(freebsd32_cap_rights_limit_args), (sy_call_t *)freebsd32_cap_rights_limit, AUE_CAP_RIGHTS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 533 = freebsd32_cap_rights_limit */ #endif - { AS(cap_rights_limit_args), (sy_call_t *)sys_cap_rights_limit, AUE_CAP_RIGHTS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 533 = cap_rights_limit */ { AS(freebsd32_cap_ioctls_limit_args), (sy_call_t *)freebsd32_cap_ioctls_limit, AUE_CAP_IOCTLS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 534 = freebsd32_cap_ioctls_limit */ { AS(freebsd32_cap_ioctls_get_args), (sy_call_t *)freebsd32_cap_ioctls_get, AUE_CAP_IOCTLS_GET, NULL, 0, 0, 0, SY_THR_STATIC }, /* 535 = freebsd32_cap_ioctls_get */ { AS(cap_fcntls_limit_args), (sy_call_t *)sys_cap_fcntls_limit, AUE_CAP_FCNTLS_LIMIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 536 = cap_fcntls_limit */ Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Sun Aug 18 13:37:54 2013 (r254491) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Sun Aug 18 13:38:39 2013 (r254492) @@ -3159,6 +3159,16 @@ systrace_args(int sysnum, void *params, *n_args = 8; break; } + /* freebsd32_cap_rights_limit */ + case 533: { + struct freebsd32_cap_rights_limit_args *p = params; + iarg[0] = p->fd; /* int */ + iarg[1] = p->pad; /* int */ + uarg[2] = p->rights1; /* uint32_t */ + uarg[3] = p->rights2; /* uint32_t */ + *n_args = 4; + break; + } #else /* freebsd32_posix_fallocate */ case 530: { @@ -3196,15 +3206,16 @@ systrace_args(int sysnum, void *params, *n_args = 7; break; } -#endif - /* cap_rights_limit */ + /* freebsd32_cap_rights_limit */ case 533: { - struct cap_rights_limit_args *p = params; + struct freebsd32_cap_rights_limit_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = p->rights; /* uint64_t */ - *n_args = 2; + uarg[1] = p->rights1; /* uint32_t */ + uarg[2] = p->rights2; /* uint32_t */ + *n_args = 3; break; } +#endif /* freebsd32_cap_ioctls_limit */ case 534: { struct freebsd32_cap_ioctls_limit_args *p = params; @@ -8572,6 +8583,25 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; + /* freebsd32_cap_rights_limit */ + case 533: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + case 2: + p = "uint32_t"; + break; + case 3: + p = "uint32_t"; + break; + default: + break; + }; + break; #else /* freebsd32_posix_fallocate */ case 530: @@ -8648,20 +8678,23 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; -#endif - /* cap_rights_limit */ + /* freebsd32_cap_rights_limit */ case 533: switch(ndx) { case 0: p = "int"; break; case 1: - p = "uint64_t"; + p = "uint32_t"; + break; + case 2: + p = "uint32_t"; break; default: break; }; break; +#endif /* freebsd32_cap_ioctls_limit */ case 534: switch(ndx) { @@ -10622,6 +10655,11 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; + /* freebsd32_cap_rights_limit */ + case 533: + if (ndx == 0 || ndx == 1) + p = "int"; + break; #else /* freebsd32_posix_fallocate */ case 530: @@ -10638,12 +10676,12 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; -#endif - /* cap_rights_limit */ + /* freebsd32_cap_rights_limit */ case 533: if (ndx == 0 || ndx == 1) p = "int"; break; +#endif /* freebsd32_cap_ioctls_limit */ case 534: if (ndx == 0 || ndx == 1) From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 16:16: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 ESMTP id 6C99B45D; Sun, 18 Aug 2013 16:16:37 +0000 (UTC) (envelope-from andrew@FreeBSD.org) 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 580752E88; Sun, 18 Aug 2013 16:16: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 r7IGGbUV009007; Sun, 18 Aug 2013 16:16:37 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IGGbDH008999; Sun, 18 Aug 2013 16:16:37 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201308181616.r7IGGbDH008999@svn.freebsd.org> From: Andrew Turner Date: Sun, 18 Aug 2013 16:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254493 - head/sys/arm/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.14 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, 18 Aug 2013 16:16:37 -0000 Author: andrew Date: Sun Aug 18 16:16:36 2013 New Revision: 254493 URL: http://svnweb.freebsd.org/changeset/base/254493 Log: Enable VFP on the CubieBoard and CubieBoard 2. Modified: head/sys/arm/conf/CUBIEBOARD head/sys/arm/conf/CUBIEBOARD2 Modified: head/sys/arm/conf/CUBIEBOARD ============================================================================== --- head/sys/arm/conf/CUBIEBOARD Sun Aug 18 13:38:39 2013 (r254492) +++ head/sys/arm/conf/CUBIEBOARD Sun Aug 18 16:16:36 2013 (r254493) @@ -47,6 +47,7 @@ options _KPOSIX_PRIORITY_SCHEDULING #Po options KBD_INSTALL_CDEV # install a CDEV entry in /dev options PREEMPTION options FREEBSD_BOOT_LOADER +options VFP # vfp/neon # Debugging makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols Modified: head/sys/arm/conf/CUBIEBOARD2 ============================================================================== --- head/sys/arm/conf/CUBIEBOARD2 Sun Aug 18 13:38:39 2013 (r254492) +++ head/sys/arm/conf/CUBIEBOARD2 Sun Aug 18 16:16:36 2013 (r254493) @@ -47,6 +47,7 @@ options _KPOSIX_PRIORITY_SCHEDULING #Po options KBD_INSTALL_CDEV # install a CDEV entry in /dev options PREEMPTION options FREEBSD_BOOT_LOADER +options VFP # vfp/neon # Debugging makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 17:18:52 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 ESMTP id DA6B43B4; Sun, 18 Aug 2013 17:18:52 +0000 (UTC) (envelope-from andrew@FreeBSD.org) 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 C6F8121A8; Sun, 18 Aug 2013 17:18: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 r7IHIqVp020285; Sun, 18 Aug 2013 17:18:52 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IHIqw5020284; Sun, 18 Aug 2013 17:18:52 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201308181718.r7IHIqw5020284@svn.freebsd.org> From: Andrew Turner Date: Sun, 18 Aug 2013 17:18:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254494 - head/sys/arm/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.14 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, 18 Aug 2013 17:18:52 -0000 Author: andrew Date: Sun Aug 18 17:18:52 2013 New Revision: 254494 URL: http://svnweb.freebsd.org/changeset/base/254494 Log: Enable VFP in the Versatile PB (QEMU) kernel. Tested on QEMU 1.6.0. Modified: head/sys/arm/conf/VERSATILEPB Modified: head/sys/arm/conf/VERSATILEPB ============================================================================== --- head/sys/arm/conf/VERSATILEPB Sun Aug 18 16:16:36 2013 (r254493) +++ head/sys/arm/conf/VERSATILEPB Sun Aug 18 17:18:52 2013 (r254494) @@ -54,6 +54,7 @@ options SYSVSEM #SYSV-style semaphore options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev options ROOTDEVNAME=\"ufs:da0s2a\" +options VFP # vfp/neon options PREEMPTION From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 18:08: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 ESMTP id CDC26AA9; Sun, 18 Aug 2013 18:08:12 +0000 (UTC) (envelope-from cognet@FreeBSD.org) 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 BA7FC23D4; Sun, 18 Aug 2013 18:08: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 r7II8Cef005736; Sun, 18 Aug 2013 18:08:12 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7II8CoF005734; Sun, 18 Aug 2013 18:08:12 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201308181808.r7II8CoF005734@svn.freebsd.org> From: Olivier Houchard Date: Sun, 18 Aug 2013 18:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254495 - head/sys/arm/samsung/exynos 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.14 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, 18 Aug 2013 18:08:12 -0000 Author: cognet Date: Sun Aug 18 18:08:12 2013 New Revision: 254495 URL: http://svnweb.freebsd.org/changeset/base/254495 Log: Increase the max KVA available for general consumption on the Exynos 5. Submitted by: Ruslan Bukin Modified: head/sys/arm/samsung/exynos/exynos5_machdep.c Modified: head/sys/arm/samsung/exynos/exynos5_machdep.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_machdep.c Sun Aug 18 17:18:52 2013 (r254494) +++ head/sys/arm/samsung/exynos/exynos5_machdep.c Sun Aug 18 18:08:12 2013 (r254495) @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #include -#define DEVMAP_BOOTSTRAP_MAP_START 0xE0000000 +#define DEVMAP_BOOTSTRAP_MAP_START 0xF0000000 extern int unmapped_buf_allowed; @@ -83,7 +83,7 @@ platform_devmap_init(void) int i; i = 0; - fdt_devmap[i].pd_va = 0xe2C00000; + fdt_devmap[i].pd_va = 0xf2C00000; fdt_devmap[i].pd_pa = 0x12C00000; fdt_devmap[i].pd_size = 0x100000; fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 19:08:54 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 ESMTP id DB4F88EA; Sun, 18 Aug 2013 19:08:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 C905A26C7; Sun, 18 Aug 2013 19:08:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7IJ8sGS006202; Sun, 18 Aug 2013 19:08:54 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IJ8sxR006193; Sun, 18 Aug 2013 19:08:54 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308181908.r7IJ8sxR006193@svn.freebsd.org> From: Ian Lepore Date: Sun, 18 Aug 2013 19:08:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254496 - head/sys/dev/sdhci 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.14 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, 18 Aug 2013 19:08:54 -0000 Author: ian Date: Sun Aug 18 19:08:53 2013 New Revision: 254496 URL: http://svnweb.freebsd.org/changeset/base/254496 Log: Add a new SDHCI_QUIRK_DONT_SHIFT_RESPONSE for hardware that pre-shifts the response bits the way we do in software. While the hardware is just doing the sensible thing rather than leaving it to the software, it's in violation of the spec by doing so. Grrrr. Modified: head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sun Aug 18 18:08:12 2013 (r254495) +++ head/sys/dev/sdhci/sdhci.c Sun Aug 18 19:08:53 2013 (r254496) @@ -835,8 +835,13 @@ sdhci_finish_command(struct sdhci_slot * uint8_t extra = 0; for (i = 0; i < 4; i++) { uint32_t val = RD4(slot, SDHCI_RESPONSE + i * 4); - slot->curcmd->resp[3 - i] = (val << 8) + extra; - extra = val >> 24; + if (slot->quirks & SDHCI_QUIRK_DONT_SHIFT_RESPONSE) + slot->curcmd->resp[3 - i] = val; + else { + slot->curcmd->resp[3 - i] = + (val << 8) | extra; + extra = val >> 24; + } } } else slot->curcmd->resp[0] = RD4(slot, SDHCI_RESPONSE); Modified: head/sys/dev/sdhci/sdhci.h ============================================================================== --- head/sys/dev/sdhci/sdhci.h Sun Aug 18 18:08:12 2013 (r254495) +++ head/sys/dev/sdhci/sdhci.h Sun Aug 18 19:08:53 2013 (r254496) @@ -57,6 +57,8 @@ #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<11) /* SDHCI_CAPABILITIES is invalid */ #define SDHCI_QUIRK_MISSING_CAPS (1<<12) +/* Hardware shifts the 136-bit response, don't do it in software. */ +#define SDHCI_QUIRK_DONT_SHIFT_RESPONSE (1<<13) /* * Controller registers From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 19:37: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 ESMTP id BECEC76D; Sun, 18 Aug 2013 19:37:35 +0000 (UTC) (envelope-from tijl@FreeBSD.org) 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 ACC8E2889; Sun, 18 Aug 2013 19:37:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7IJbZcT051724; Sun, 18 Aug 2013 19:37:35 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IJbZQW051722; Sun, 18 Aug 2013 19:37:35 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201308181937.r7IJbZQW051722@svn.freebsd.org> From: Tijl Coosemans Date: Sun, 18 Aug 2013 19:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254497 - 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.14 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, 18 Aug 2013 19:37:35 -0000 Author: tijl Date: Sun Aug 18 19:37:35 2013 New Revision: 254497 URL: http://svnweb.freebsd.org/changeset/base/254497 Log: Change the return type of the fallback implementation of the atomic_compare_exchange_* macros in stdatomic.h to _Bool. Modified: head/sys/sys/stdatomic.h Modified: head/sys/sys/stdatomic.h ============================================================================== --- head/sys/sys/stdatomic.h Sun Aug 18 19:08:53 2013 (r254496) +++ head/sys/sys/stdatomic.h Sun Aug 18 19:37:35 2013 (r254497) @@ -288,8 +288,8 @@ typedef _Atomic(__uintmax_t) atomic_uin __typeof__(expected) __ep = (expected); \ __typeof__(*__ep) __e = *__ep; \ (void)(success); (void)(failure); \ - (*__ep = __sync_val_compare_and_swap(&(object)->__val, \ - __e, desired)) == __e; \ + (_Bool)((*__ep = __sync_val_compare_and_swap(&(object)->__val, \ + __e, desired)) == __e); \ }) #define atomic_compare_exchange_weak_explicit(object, expected, \ desired, success, failure) \ From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 19:53: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 ESMTP id 1FC22D84; Sun, 18 Aug 2013 19:53:17 +0000 (UTC) (envelope-from joel@freebsd.org) Received: from mail.vnode.se (mail.vnode.se [212.247.52.13]) by mx1.freebsd.org (Postfix) with ESMTP id CE7372978; Sun, 18 Aug 2013 19:53:16 +0000 (UTC) Received: from mail.vnode.se (localhost [127.0.0.1]) by mail.vnode.se (Postfix) with ESMTP id 04F91E3F07A; Sun, 18 Aug 2013 21:53:09 +0200 (CEST) X-Virus-Scanned: amavisd-new at vnode.se Received: from mail.vnode.se ([127.0.0.1]) by mail.vnode.se (mail.vnode.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AbGr2TJuvLr6; Sun, 18 Aug 2013 21:53:06 +0200 (CEST) Received: from devbox.vnode.local (unknown [83.223.1.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.vnode.se (Postfix) with ESMTPSA id D7842E3F079; Sun, 18 Aug 2013 21:53:05 +0200 (CEST) Date: Sun, 18 Aug 2013 21:53:04 +0200 From: Joel Dahl To: Dimitry Andric Subject: Re: svn commit: r254273 - in head: . include lib lib/libc/iconv lib/libiconv_compat lib/libkiconv share/mk sys/sys tools/build/mk Message-ID: <20130818195304.GA81160@devbox.vnode.local> References: <201308130715.r7D7F1nu076335@svn.freebsd.org> <3887D7C7-D766-40DF-B154-D05768B86AA6@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3887D7C7-D766-40DF-B154-D05768B86AA6@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, FreeBSD Ports , Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 18 Aug 2013 19:53:17 -0000 On Sun, Aug 18, 2013 at 12:34:30AM +0200, Dimitry Andric wrote: > On Aug 13, 2013, at 09:15, Peter Wemm wrote: > > Author: peter > > Date: Tue Aug 13 07:15:01 2013 > > New Revision: 254273 > > URL: http://svnweb.freebsd.org/changeset/base/254273 > > > > Log: > > The iconv in libc did two things - implement the standard APIs, the GNU > > extensions and also tried to be link time compatible with ports libiconv. > > This splits that functionality and enables the parts that shouldn't > > interfere with the port by default. > > > > WITH_ICONV (now on by default) - adds iconv.h, iconv_open(3) etc. > > WITH_LIBICONV_COMPAT (off by default) adds the libiconv_open etc API, linker > > symbols and even a stub libiconv.so.3 that are good enough to be able > > to 'pkg delete -f libiconv' on a running system and reasonably expect it > > to work. > > > > I have tortured many machines over the last few days to try and reduce > > the possibilities of foot-shooting as much as I can. I've successfully > > recompiled to enable and disable the libiconv_compat modes, ports that use > > libiconv alongside system iconv etc. If you don't enable the > > WITH_LIBICONV_COMPAT switch, they don't share symbol space. > > > > This is an extension of behavior on other system. iconv(3) is a standard > > libc interface and libiconv port expects to be able to run alongside it on > > systems that have it. > > Unfortunately I expect this will break many ports, when the libiconv > port is installed. A simple example is the following: It also breaks installworld when /usr/src and /usr/obj are NFS exported read-only. -- Joel From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 20:06:36 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 ESMTP id 7FDF41DD; Sun, 18 Aug 2013 20:06:36 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 5340B2A12; Sun, 18 Aug 2013 20:06: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 r7IK6aJZ096787; Sun, 18 Aug 2013 20:06:36 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IK6aCu096786; Sun, 18 Aug 2013 20:06:36 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308182006.r7IK6aCu096786@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 20:06:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254498 - head/lib/libc/gen 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.14 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, 18 Aug 2013 20:06:36 -0000 Author: pjd Date: Sun Aug 18 20:06:35 2013 New Revision: 254498 URL: http://svnweb.freebsd.org/changeset/base/254498 Log: Remove redundant space. Modified: head/lib/libc/gen/Symbol.map Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Sun Aug 18 19:37:35 2013 (r254497) +++ head/lib/libc/gen/Symbol.map Sun Aug 18 20:06:35 2013 (r254498) @@ -384,7 +384,7 @@ FBSD_1.3 { clock_getcpuclockid; dirfd; dup3; - fdlopen; + fdlopen; __FreeBSD_libc_enter_restricted_mode; getcontextx; gid_from_group; From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 20:11: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 ESMTP id 463BC411; Sun, 18 Aug 2013 20:11:36 +0000 (UTC) (envelope-from pjd@FreeBSD.org) 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 237652A6B; Sun, 18 Aug 2013 20:11: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 r7IKBZ6r002429; Sun, 18 Aug 2013 20:11:35 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IKBZM3002425; Sun, 18 Aug 2013 20:11:35 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201308182011.r7IKBZM3002425@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Aug 2013 20:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254499 - in head: include lib/libc/gen 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.14 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, 18 Aug 2013 20:11:36 -0000 Author: pjd Date: Sun Aug 18 20:11:34 2013 New Revision: 254499 URL: http://svnweb.freebsd.org/changeset/base/254499 Log: Implement fdclosedir(3) function, which is equivalent to the closedir(3) function, but returns directory file descriptor instead of closing it. Submitted by: Mariusz Zaborski Sponsored by: Google Summer of Code 2013 Modified: head/include/dirent.h head/lib/libc/gen/Symbol.map head/lib/libc/gen/closedir.c head/lib/libc/gen/directory.3 Modified: head/include/dirent.h ============================================================================== --- head/include/dirent.h Sun Aug 18 20:06:35 2013 (r254498) +++ head/include/dirent.h Sun Aug 18 20:11:34 2013 (r254499) @@ -79,6 +79,7 @@ int dirfd(DIR *); #endif #if __BSD_VISIBLE DIR *__opendir2(const char *, int); +int fdclosedir(DIR *); int getdents(int, char *, int); int getdirentries(int, char *, int, long *); #endif Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Sun Aug 18 20:06:35 2013 (r254498) +++ head/lib/libc/gen/Symbol.map Sun Aug 18 20:11:34 2013 (r254499) @@ -384,6 +384,7 @@ FBSD_1.3 { clock_getcpuclockid; dirfd; dup3; + fdclosedir; fdlopen; __FreeBSD_libc_enter_restricted_mode; getcontextx; Modified: head/lib/libc/gen/closedir.c ============================================================================== --- head/lib/libc/gen/closedir.c Sun Aug 18 20:06:35 2013 (r254498) +++ head/lib/libc/gen/closedir.c Sun Aug 18 20:11:34 2013 (r254499) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); * close a directory. */ int -closedir(DIR *dirp) +fdclosedir(DIR *dirp) { int fd; @@ -65,5 +65,12 @@ closedir(DIR *dirp) _pthread_mutex_destroy(&dirp->dd_lock); } free((void *)dirp); - return(_close(fd)); + return (fd); +} + +int +closedir(DIR *dirp) +{ + + return (_close(fdclosedir(dirp))); } Modified: head/lib/libc/gen/directory.3 ============================================================================== --- head/lib/libc/gen/directory.3 Sun Aug 18 20:06:35 2013 (r254498) +++ head/lib/libc/gen/directory.3 Sun Aug 18 20:11:34 2013 (r254499) @@ -28,7 +28,7 @@ .\" @(#)directory.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 5, 2012 +.Dd August 18, 2013 .Dt DIRECTORY 3 .Os .Sh NAME @@ -40,6 +40,7 @@ .Nm seekdir , .Nm rewinddir , .Nm closedir , +.Nm fdclosedir , .Nm dirfd .Nd directory operations .Sh LIBRARY @@ -64,6 +65,8 @@ .Ft int .Fn closedir "DIR *dirp" .Ft int +.Fn fdclosedir "DIR *dirp" +.Ft int .Fn dirfd "DIR *dirp" .Sh DESCRIPTION The @@ -208,6 +211,13 @@ On failure, \-1 is returned and the glob is set to indicate the error. .Pp The +.Fn fdclosedir +function is equivalent to the +.Fn closedir +function except that this function returns directory file descriptor instead of +closing it. +.Pp +The .Fn dirfd function returns the integer file descriptor associated with the named @@ -252,6 +262,9 @@ The .Fn fdopendir function appeared in .Fx 8.0 . +.Fn fdclosedir +function appeared in +.Fx 10.0 . .Sh BUGS The invalidation of .Fn telldir From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 20:40: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 ESMTP id B7107BF5; Sun, 18 Aug 2013 20:40:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) 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 A4FF12B91; Sun, 18 Aug 2013 20:40: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 r7IKeD2R035059; Sun, 18 Aug 2013 20:40:13 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7IKeDsL035058; Sun, 18 Aug 2013 20:40:13 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201308182040.r7IKeDsL035058@svn.freebsd.org> From: Adrian Chadd Date: Sun, 18 Aug 2013 20:40:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254500 - head/sys/net80211 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.14 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, 18 Aug 2013 20:40:13 -0000 Author: adrian Date: Sun Aug 18 20:40:13 2013 New Revision: 254500 URL: http://svnweb.freebsd.org/changeset/base/254500 Log: Return the correct status if ieee80211_ff_check() consumes the mbuf. I broke this when converting the net80211 TX path to use if_transmit. Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sun Aug 18 20:11:34 2013 (r254499) +++ head/sys/net80211/ieee80211_output.c Sun Aug 18 20:40:13 2013 (r254500) @@ -210,8 +210,7 @@ ieee80211_vap_pkt_send_dest(struct ieee8 m = ieee80211_ff_check(ni, m); if (m == NULL) { /* NB: any ni ref held on stageq */ - /* XXX better status? */ - return (ENOBUFS); + return (0); } } #endif /* IEEE80211_SUPPORT_SUPERG */ From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 21:36:22 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 ESMTP id AE0C579F; Sun, 18 Aug 2013 21:36:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) 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 99B302E3A; Sun, 18 Aug 2013 21:36:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7ILaMxM093196; Sun, 18 Aug 2013 21:36:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7ILaMAb093192; Sun, 18 Aug 2013 21:36:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308182136.r7ILaMAb093192@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 18 Aug 2013 21:36:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254501 - 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.14 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, 18 Aug 2013 21:36:22 -0000 Author: kib Date: Sun Aug 18 21:36:22 2013 New Revision: 254501 URL: http://svnweb.freebsd.org/changeset/base/254501 Log: When code from r254064 in pmap_ts_referenced() drops pv lock and blocks on a pmap lock, pmap_release() might proceed in parallel and destroy the pmap mutex, since unlocked pv lock allows to remove pv entry owned by the pmap. For now, gate the pmap_release() on write-locked pvh_global_lock. Since pmap_ts_release() does not unlock the global lock, pmap_release() would not destroy pmap mutex until the pmap_ts_referenced() finished. We cannot enter pmap_ts_referenced() and encounter a pv entry for the destroyed pmap if pmap_release() passed the global lock gate, since pmap_remove_pages() would finish earlier. Reported by: jeff, pho Reviewed by: alc Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun Aug 18 20:40:13 2013 (r254500) +++ head/sys/amd64/amd64/pmap.c Sun Aug 18 21:36:22 2013 (r254501) @@ -1959,6 +1959,9 @@ pmap_release(pmap_t pmap) KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_release: pmap has reserved page table page(s)")); + rw_wlock(&pvh_global_lock); + rw_wunlock(&pvh_global_lock); + m = PHYS_TO_VM_PAGE(pmap->pm_pml4[PML4PML4I] & PG_FRAME); for (i = 0; i < NKPML4E; i++) /* KVA */ From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 22:00: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 ESMTP id D6E16D46; Sun, 18 Aug 2013 22:00:41 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-we0-x231.google.com (mail-we0-x231.google.com [IPv6:2a00:1450:400c:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E8CF92F4E; Sun, 18 Aug 2013 22:00:40 +0000 (UTC) Received: by mail-we0-f177.google.com with SMTP id m46so3065281wev.8 for ; Sun, 18 Aug 2013 15:00:39 -0700 (PDT) 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=5SZkx7lO8Z+4FcO3+7SJPwHhn/DdTMHtqJp2wL2ykRo=; b=I6Ki8vwTqIsgjRqznqaLg5zZoX0zSHXmCLCsjBp3lDXc3Z1q4clozCMOj+RKl57N4i LRDI7GI2gfmGyoJNV20gN+hKBXHwmtu3ctzYb0CCgPrXSxTDQVCVsdhITHBrdnaUBa0C d/F5vRI2SJ//b6CAUlvJkXDIqp7yYIradIE4iKNhmaaYsS2DNPArWWFnqq00FQ/z9pfP vCT+6VANUNf9cfiyVCmm8TJGFHswCAx8tuE4lCmkuB5oL8CfQgoCOx+F/Bkgpi55TOg4 FDCBb1iKEwuzMHk1IQ0yaWdDmYmAA7zuaWiaOtNSeEuHXCnq+BpHg5v3N/eRejKqfJgK eRmg== MIME-Version: 1.0 X-Received: by 10.194.20.170 with SMTP id o10mr4050175wje.4.1376863239158; Sun, 18 Aug 2013 15:00:39 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.217.116.136 with HTTP; Sun, 18 Aug 2013 15:00:39 -0700 (PDT) In-Reply-To: <201308070621.r776LLOs055455@svn.freebsd.org> References: <201308070621.r776LLOs055455@svn.freebsd.org> Date: Sun, 18 Aug 2013 15:00:39 -0700 X-Google-Sender-Auth: pYmo1G2XZ_FmV2xZqSxcKWBK3X0 Message-ID: Subject: Re: svn commit: r254025 - in head/sys: amd64/amd64 arm/arm arm/at91 arm/mv/armadaxp arm/s3c2xx0 arm/xscale/i80321 arm/xscale/i8134x arm/xscale/ixp425 cddl/compat/opensolaris/kern cddl/compat/opensolari... From: Adrian Chadd To: Jeff Roberson Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Joe Holden X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 18 Aug 2013 22:00:41 -0000 Hi Jeff, This has broken booting on the MIPS Octeon platform. Apparently things just plain hang during boot. Would you please work with Joe to sort out what's going on? I'd like to try and get this fixed up before 10.0-RELEASE is cut as the Octeon SMP platform seems to be somewhat popular. Thanks, -adrian From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 22:43: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 ESMTP id 874667E2; Sun, 18 Aug 2013 22:43:01 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5012::107]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4511C2135; Sun, 18 Aug 2013 22:43:01 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 4EE8D1203C3; Mon, 19 Aug 2013 00:42:45 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 2944328494; Mon, 19 Aug 2013 00:42:45 +0200 (CEST) Date: Mon, 19 Aug 2013 00:42:45 +0200 From: Jilles Tjoelker To: Joel Dahl Subject: Re: svn commit: r254273 - in head: . include lib lib/libc/iconv lib/libiconv_compat lib/libkiconv share/mk sys/sys tools/build/mk Message-ID: <20130818224244.GA59141@stack.nl> References: <201308130715.r7D7F1nu076335@svn.freebsd.org> <3887D7C7-D766-40DF-B154-D05768B86AA6@FreeBSD.org> <20130818195304.GA81160@devbox.vnode.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130818195304.GA81160@devbox.vnode.local> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: src-committers@freebsd.org, Peter Wemm , svn-src-all@freebsd.org, Dimitry Andric , gabor@freebsd.org, svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 18 Aug 2013 22:43:01 -0000 On Sun, Aug 18, 2013 at 09:53:04PM +0200, Joel Dahl wrote: > On Sun, Aug 18, 2013 at 12:34:30AM +0200, Dimitry Andric wrote: > > On Aug 13, 2013, at 09:15, Peter Wemm wrote: > > > Author: peter > > > Date: Tue Aug 13 07:15:01 2013 > > > New Revision: 254273 > > > URL: http://svnweb.freebsd.org/changeset/base/254273 > > > Log: > > > The iconv in libc did two things - implement the standard APIs, the GNU > > > extensions and also tried to be link time compatible with ports libiconv. > > > This splits that functionality and enables the parts that shouldn't > > > interfere with the port by default. > > > WITH_ICONV (now on by default) - adds iconv.h, iconv_open(3) etc. > > > WITH_LIBICONV_COMPAT (off by default) adds the libiconv_open etc API, linker > > > symbols and even a stub libiconv.so.3 that are good enough to be able > > > to 'pkg delete -f libiconv' on a running system and reasonably expect it > > > to work. > > > I have tortured many machines over the last few days to try and reduce > > > the possibilities of foot-shooting as much as I can. I've successfully > > > recompiled to enable and disable the libiconv_compat modes, ports that use > > > libiconv alongside system iconv etc. If you don't enable the > > > WITH_LIBICONV_COMPAT switch, they don't share symbol space. > > > This is an extension of behavior on other system. iconv(3) is a standard > > > libc interface and libiconv port expects to be able to run alongside it on > > > systems that have it. > > Unfortunately I expect this will break many ports, when the libiconv > > port is installed. A simple example is the following: > > It also breaks installworld when /usr/src and /usr/obj are NFS exported > read-only. I think it has to do with share/i18n/csmapper and share/i18n/esdb using directories as make targets. This apparently causes these files to be rebuilt at 'make installworld' time, which is always bad but is only detected when /usr/obj is read-only. A hack that works is to enclose the four targets depending on ${SUBDIR} in .if !make(install) . Unfortunately, the Makefiles were written to depend on the directories as make targets fairly deeply, so a real fix is harder. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 22:47: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 ESMTP id C33D697E for ; Sun, 18 Aug 2013 22:47:17 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-pb0-x234.google.com (mail-pb0-x234.google.com [IPv6:2607:f8b0:400e:c01::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 906A12160 for ; Sun, 18 Aug 2013 22:47:17 +0000 (UTC) Received: by mail-pb0-f52.google.com with SMTP id wz12so4206819pbc.39 for ; Sun, 18 Aug 2013 15:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=message-id:date:from:organization:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type; bh=aW3GUvKjzqzkOth10IAEtqtDS2Y8aukuahZa3dDx6Jw=; b=mmYjFTHpVgboNfsLabVTe9lml3tjfC2FBl2QUHGNDzydNoQqj/JQqDFzkbzZ8qvArc SiPhUvjZ6m95TYbPMrYN31MlUNMhUlG5RTMyOPouEBA3o8lrJ/5YR4rLOGIXspFTHBif tASpiqULBj+jt8GQedsKPSH+daT1O7rINhSno= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:message-id:date:from:organization:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type; bh=aW3GUvKjzqzkOth10IAEtqtDS2Y8aukuahZa3dDx6Jw=; b=hfnio1asAZVpbWJCEimehLAwvvQSO9TiGw3QJnLDF2FrvwNHPe9WDNEFKuLF66x2Df CW7Jl5ZfGuITstBke3xSxmSiLOlEIp0HXp4AZTiCLXTFLoZIBbPcuOBB1zO2F6j8yB4a 3UgeFrKkz1l0uRE29uhT4QtkLE+S3E3MEpWh3mNwACBFg7Mew7MQmQlTH5cxeVHewWpG ZuOKJfSqIOpNbNfjVob2BtaxzTHeCqrG1Cdh1W3UrPcFs2OdUCu0t9WwNagJJto2HO3D tuf9BrEUiG0HKwyI4n68WsdZ3ZQHy/nKV/IlOJvGr342h2UZEetLAMh57FWXBx3ERMbf vGgQ== X-Gm-Message-State: ALoCoQk1vZ38iJKusnf/g+NsYSUPE5py/zFiEZuX1Wk9NLFQx2f2lFZkwzfv+KArrxlDFTTxVUW+ X-Received: by 10.68.134.65 with SMTP id pi1mr10118814pbb.59.1376866036922; Sun, 18 Aug 2013 15:47:16 -0700 (PDT) Received: from hackintosh.wemm.org (c-71-198-8-135.hsd1.ca.comcast.net. [71.198.8.135]) by mx.google.com with ESMTPSA id xs1sm11604324pac.7.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 18 Aug 2013 15:47:16 -0700 (PDT) Message-ID: <52114EF2.6040901@wemm.org> Date: Sun, 18 Aug 2013 15:47:14 -0700 From: Peter Wemm Organization: World Domination in progress. User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Dimitry Andric Subject: Re: svn commit: r254273 - in head: . include lib lib/libc/iconv lib/libiconv_compat lib/libkiconv share/mk sys/sys tools/build/mk References: <201308130715.r7D7F1nu076335@svn.freebsd.org> <3887D7C7-D766-40DF-B154-D05768B86AA6@FreeBSD.org> In-Reply-To: <3887D7C7-D766-40DF-B154-D05768B86AA6@FreeBSD.org> X-Enigmail-Version: 1.5.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1108D0dque474thv0WB72TSxd6TVLrlWF" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, FreeBSD Ports , Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 18 Aug 2013 22:47:17 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1108D0dque474thv0WB72TSxd6TVLrlWF Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 8/17/13 3:34 PM, Dimitry Andric wrote: > On Aug 13, 2013, at 09:15, Peter Wemm wrote: >> Author: peter >> Date: Tue Aug 13 07:15:01 2013 >> New Revision: 254273 >> URL: http://svnweb.freebsd.org/changeset/base/254273 >> >> Log: >> The iconv in libc did two things - implement the standard APIs, the G= NU >> extensions and also tried to be link time compatible with ports libic= onv. >> This splits that functionality and enables the parts that shouldn't >> interfere with the port by default. >> >> WITH_ICONV (now on by default) - adds iconv.h, iconv_open(3) etc. >> WITH_LIBICONV_COMPAT (off by default) adds the libiconv_open etc API,= linker >> symbols and even a stub libiconv.so.3 that are good enough to be able= >> to 'pkg delete -f libiconv' on a running system and reasonably expect= it >> to work. >> >> I have tortured many machines over the last few days to try and reduc= e >> the possibilities of foot-shooting as much as I can. I've successful= ly >> recompiled to enable and disable the libiconv_compat modes, ports tha= t use >> libiconv alongside system iconv etc. If you don't enable the >> WITH_LIBICONV_COMPAT switch, they don't share symbol space. >> >> This is an extension of behavior on other system. iconv(3) is a stan= dard >> libc interface and libiconv port expects to be able to run alongside = it on >> systems that have it. >=20 > Unfortunately I expect this will break many ports, when the libiconv > port is installed. A simple example is the following: >=20 > #include >=20 > int main(void) > { > iconv_t ic =3D iconv_open("UTF-8", "ISO-8859-1"); > iconv_close(ic); > return 0; > } >=20 > If you compile this on a system after r254273 with -I/usr/local/include= , > and the libiconv port installed, it will result in: >=20 > $ cc -I/usr/local/include iconv-test.c -o iconv-test > /tmp/iconv-test-I1ltw1.o: In function `main': > iconv-test.c:(.text+0x21): undefined reference to `libiconv_open' > iconv-test.c:(.text+0x2f): undefined reference to `libiconv_close' > cc: error: linker command failed with exit code 1 (use -v to see invo= cation) >=20 > This is because libiconv's iconv.h does: >=20 > #define iconv_open libiconv_open > ... > #define iconv_close libiconv_close >=20 > and so on for most of its functions. Yep, but since is a standard include file, even on Linux system= s. Autoconf/libtool/etc know this, that's why it typically compiles and lin= ks like this: cc -I/usr/local/include -L/usr/local/lib iconv-test.c -liconv I'm sure there are exceptions though. Random linux box (ubuntu fwiw): peter@bit1:~$ readelf -a /lib/x86_64-linux-gnu/libc-2.15.so |grep iconv= 1554: 00220c0 45 FUNC GLOBAL DEFAULT 12 iconv_close@@GLIBC_2.2.= 5 1745: 0021f10 418 FUNC GLOBAL DEFAULT 12 iconv@@GLIBC_2.2.5 1764: 0021d00 523 FUNC GLOBAL DEFAULT 12 iconv_open@@GLIBC_2.2.5= peter@bit1:~$ grep '^extern' /usr/include/iconv.h extern iconv_t iconv_open (__const char *, __const char *); extern size_t iconv (iconv_t, char **__restrict, extern int iconv_close (iconv_t); If you mix includes and libraries like in your example, it would fail on linux too. However, linux tends to not add libiconv to the mix. peter@bit1:~$ find / -mount -name 'libiconv*' peter@bit1:~$ uname -a Linux bit1 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux The WITH_LIBICONV_COMPAT switch can be turned on - that adds the libiconv_open etc aliases. It was intended as a transition aid though - = it was intended to make 'pkg delete -f libiconv' on a running system keep wo= rking. I compile my personal systems like this: Index: Mk/Uses/iconv.mk =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- Mk/Uses/iconv.mk (revision 324679) +++ Mk/Uses/iconv.mk (working copy) @@ -16,6 +16,8 @@ IGNORE=3D USES=3Diconv does not require args .endif +.if !exists(/usr/include/iconv.h) LIB_DEPENDS+=3D libiconv.so.3:${PORTSDIR}/converters/libiconv +.endif .endif =2E. and keep libiconv completely off them. There's a couple of other po= rts with it hard coded in, but this covers most of them. eg: glib20, epic5, unzip, php-iconv. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6F= JV UTF-8: for when a ' just won\342\200\231t do. ZFS must be the bacon of file systems. "everything's better with ZFS" --1108D0dque474thv0WB72TSxd6TVLrlWF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (Darwin) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlIRTvIACgkQFRKuUnJ3cX+A6wCbBf8CKXehHv+8PLCikmiZwDZT LUkAoJJ448BiqHMW5bxl3GINw3kE5ZZD =T+p9 -----END PGP SIGNATURE----- --1108D0dque474thv0WB72TSxd6TVLrlWF-- From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 22:51: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 ESMTP id D729FB8C for ; Sun, 18 Aug 2013 22:51:28 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-pa0-x234.google.com (mail-pa0-x234.google.com [IPv6:2607:f8b0:400e:c03::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A13BA21A1 for ; Sun, 18 Aug 2013 22:51:28 +0000 (UTC) Received: by mail-pa0-f52.google.com with SMTP id kq13so3899298pab.11 for ; Sun, 18 Aug 2013 15:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=message-id:date:from:organization:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type; bh=z7I6FvlyZxgnSSdmnpZisynYeZw0pRS0BKRrxBcbDCY=; b=uHQOOHbs9ReZHyiWPMzFbcs7BEzMn4OpGICB+3lbSeYhTFwXScLgTJglXIR9v3S+f3 QoCErQ/sBFb3E8lRfxgU2ZRuu0lsCGbC+Fiq01gqLedeylq7hod5kxbJoeTOO7U24k45 NFTLO1a+PNg5emFfFXxRIAHsH+gC0Q12VTblw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:message-id:date:from:organization:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type; bh=z7I6FvlyZxgnSSdmnpZisynYeZw0pRS0BKRrxBcbDCY=; b=A7+vfbqQSOAZFW8ZoZwljI918JB3nsjwiW0tu38gr0U5MuYaPitwf2LVTt1oO/v0fM 5OQOTeC/WA/TJHVcuxkIfiY4HYraXeIEDZfQ1qg/9biWc5mIc2AB5KJO0cT4NiPaUdhA WAaFQtFUlUVBxJlO9MDDVSN0SSnXuhVEDNi7nqlz8kwlPQxuHoYMiDBPNkjHWqHfNQww ge4BEkiI3omEyhJgIBdpk+thFdRjMOYC5l8McHyN0w/rdHItGQSC6dOTy0czKmchXzLw LK6PsPKs9LIH9yAtPYbdXVpWQbla1RNarNUKm4osTBt2bThofsAIIL3huriGyZ+v2LxK LvKA== X-Gm-Message-State: ALoCoQlP7KDdyDyjGUnxlSMe3NyIpPoIC5jALvWQKQh2srsDmtnOv9GenQUNL7I+7WbmH8o/WUOR X-Received: by 10.67.23.227 with SMTP id id3mr10227285pad.101.1376866288296; Sun, 18 Aug 2013 15:51:28 -0700 (PDT) Received: from hackintosh.wemm.org (c-71-198-8-135.hsd1.ca.comcast.net. [71.198.8.135]) by mx.google.com with ESMTPSA id jf4sm11179695pbb.19.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 18 Aug 2013 15:51:27 -0700 (PDT) Message-ID: <52114FED.3010106@wemm.org> Date: Sun, 18 Aug 2013 15:51:25 -0700 From: Peter Wemm Organization: World Domination in progress. User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Jilles Tjoelker Subject: Re: svn commit: r254273 - in head: . include lib lib/libc/iconv lib/libiconv_compat lib/libkiconv share/mk sys/sys tools/build/mk References: <201308130715.r7D7F1nu076335@svn.freebsd.org> <3887D7C7-D766-40DF-B154-D05768B86AA6@FreeBSD.org> <20130818195304.GA81160@devbox.vnode.local> <20130818224244.GA59141@stack.nl> In-Reply-To: <20130818224244.GA59141@stack.nl> X-Enigmail-Version: 1.5.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CWQUSkf6tljNnRBk6efShnljn6Biwcs9I" Cc: src-committers@freebsd.org, Peter Wemm , svn-src-all@freebsd.org, Dimitry Andric , gabor@freebsd.org, Joel Dahl , svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 18 Aug 2013 22:51:28 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --CWQUSkf6tljNnRBk6efShnljn6Biwcs9I Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 8/18/13 3:42 PM, Jilles Tjoelker wrote: > On Sun, Aug 18, 2013 at 09:53:04PM +0200, Joel Dahl wrote: >> On Sun, Aug 18, 2013 at 12:34:30AM +0200, Dimitry Andric wrote: >>> On Aug 13, 2013, at 09:15, Peter Wemm wrote: >>>> Author: peter >>>> Date: Tue Aug 13 07:15:01 2013 >>>> New Revision: 254273 >>>> URL: http://svnweb.freebsd.org/changeset/base/254273 >=20 >>>> Log: >>>> The iconv in libc did two things - implement the standard APIs, the= GNU >>>> extensions and also tried to be link time compatible with ports lib= iconv. >>>> This splits that functionality and enables the parts that shouldn't= >>>> interfere with the port by default. >=20 >>>> WITH_ICONV (now on by default) - adds iconv.h, iconv_open(3) etc. >>>> WITH_LIBICONV_COMPAT (off by default) adds the libiconv_open etc AP= I, linker >>>> symbols and even a stub libiconv.so.3 that are good enough to be ab= le >>>> to 'pkg delete -f libiconv' on a running system and reasonably expe= ct it >>>> to work. >=20 >>>> I have tortured many machines over the last few days to try and red= uce >>>> the possibilities of foot-shooting as much as I can. I've successf= ully >>>> recompiled to enable and disable the libiconv_compat modes, ports t= hat use >>>> libiconv alongside system iconv etc. If you don't enable the >>>> WITH_LIBICONV_COMPAT switch, they don't share symbol space. >=20 >>>> This is an extension of behavior on other system. iconv(3) is a st= andard >>>> libc interface and libiconv port expects to be able to run alongsid= e it on >>>> systems that have it. >=20 >>> Unfortunately I expect this will break many ports, when the libiconv >>> port is installed. A simple example is the following: >> >=20 >> It also breaks installworld when /usr/src and /usr/obj are NFS exporte= d >> read-only. >=20 > I think it has to do with share/i18n/csmapper and share/i18n/esdb using= > directories as make targets. This apparently causes these files to be > rebuilt at 'make installworld' time, which is always bad but is only > detected when /usr/obj is read-only. >=20 > A hack that works is to enclose the four targets depending on ${SUBDIR}= > in .if !make(install) . >=20 > Unfortunately, the Makefiles were written to depend on the directories > as make targets fairly deeply, so a real fix is harder. I was looking at this yesterday, but was tied up with other things. I'll= take a look at it today after getting a few other things done. It should= be easy enough to replicate by changing /usr/obj to readonly on test systems= =2E --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6F= JV UTF-8: for when a ' just won\342\200\231t do. ZFS must be the bacon of file systems. "everything's better with ZFS" --CWQUSkf6tljNnRBk6efShnljn6Biwcs9I Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (Darwin) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlIRT+0ACgkQFRKuUnJ3cX+eHwCeNmqX55iCjJFkKy/yY1aj4+rI /CYAn3qzTFYfTJFTAfWd3HSQmFFrWjjD =LfC8 -----END PGP SIGNATURE----- --CWQUSkf6tljNnRBk6efShnljn6Biwcs9I-- From owner-svn-src-head@FreeBSD.ORG Sun Aug 18 23:40:30 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 ESMTP id C328B498; Sun, 18 Aug 2013 23:40:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) 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 B058D23BC; Sun, 18 Aug 2013 23:40: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 r7INeUJu021454; Sun, 18 Aug 2013 23:40:30 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7INeU4R021451; Sun, 18 Aug 2013 23:40:30 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201308182340.r7INeU4R021451@svn.freebsd.org> From: Adrian Chadd Date: Sun, 18 Aug 2013 23:40:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254506 - head/sys/net80211 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.14 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, 18 Aug 2013 23:40:30 -0000 Author: adrian Date: Sun Aug 18 23:40:30 2013 New Revision: 254506 URL: http://svnweb.freebsd.org/changeset/base/254506 Log: Don't return ENOTSUPP here - the net80211 pluggable ioctl API will treat this as the final item in the linker set and not try others. This stopped the fast frames IOCTLs from being called. Modified: head/sys/net80211/ieee80211_tdma.c Modified: head/sys/net80211/ieee80211_tdma.c ============================================================================== --- head/sys/net80211/ieee80211_tdma.c Sun Aug 18 23:15:29 2013 (r254505) +++ head/sys/net80211/ieee80211_tdma.c Sun Aug 18 23:40:30 2013 (r254506) @@ -744,7 +744,7 @@ tdma_ioctl_get80211(struct ieee80211vap struct ieee80211_tdma_state *ts = vap->iv_tdma; if ((vap->iv_caps & IEEE80211_C_TDMA) == 0) - return EOPNOTSUPP; + return ENOSYS; switch (ireq->i_type) { case IEEE80211_IOC_TDMA_SLOT: @@ -772,7 +772,7 @@ tdma_ioctl_set80211(struct ieee80211vap struct ieee80211_tdma_state *ts = vap->iv_tdma; if ((vap->iv_caps & IEEE80211_C_TDMA) == 0) - return EOPNOTSUPP; + return ENOSYS; switch (ireq->i_type) { case IEEE80211_IOC_TDMA_SLOT: From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 01:29:14 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 ESMTP id 93FE733D; Mon, 19 Aug 2013 01:29:14 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 72AC727E7; Mon, 19 Aug 2013 01:29:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7J1TEnr084159; Mon, 19 Aug 2013 01:29:14 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7J1TEaT084154; Mon, 19 Aug 2013 01:29:14 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308190129.r7J1TEaT084154@svn.freebsd.org> From: Ian Lepore Date: Mon, 19 Aug 2013 01:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254507 - head/sys/dev/sdhci 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.14 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, 19 Aug 2013 01:29:14 -0000 Author: ian Date: Mon Aug 19 01:29:13 2013 New Revision: 254507 URL: http://svnweb.freebsd.org/changeset/base/254507 Log: Allow a hardware driver to pass clock frequencies into the sdhci driver. The sdhci spec says that if the base or timeout clock frequency in the capabilities register is zero, the driver must obtain the frequency "from another source." This change defines that other source to be the low-level hardware driver, which can pre-set the frequencies in slot.max_clk and slot.timeout_clk before calling sdhci_init_slot(). This helps with a growing number of SoCs that have sdhci base clock frequencies that either won't fit into the range allowed by the number of bits available in the capabilities register, or the frequency is runtime- configurable. Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sun Aug 18 23:40:30 2013 (r254506) +++ head/sys/dev/sdhci/sdhci.c Mon Aug 19 01:29:13 2013 (r254507) @@ -477,7 +477,7 @@ sdhci_card_task(void *arg, int pending) int sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) { - uint32_t caps; + uint32_t caps, freq; int err; SDHCI_LOCK_INIT(slot); @@ -527,17 +527,23 @@ sdhci_init_slot(device_t dev, struct sdh caps = RD4(slot, SDHCI_CAPABILITIES); /* Calculate base clock frequency. */ if (slot->version >= SDHCI_SPEC_300) - slot->max_clk = (caps & SDHCI_CLOCK_V3_BASE_MASK) - >> SDHCI_CLOCK_BASE_SHIFT; + freq = (caps & SDHCI_CLOCK_V3_BASE_MASK) >> + SDHCI_CLOCK_BASE_SHIFT; else - slot->max_clk = (caps & SDHCI_CLOCK_BASE_MASK) - >> SDHCI_CLOCK_BASE_SHIFT; + freq = (caps & SDHCI_CLOCK_BASE_MASK) >> + SDHCI_CLOCK_BASE_SHIFT; + if (freq != 0) + slot->max_clk = freq * 1000000; + /* + * If the frequency wasn't in the capabilities and the hardware driver + * hasn't already set max_clk we're probably not going to work right + * with an assumption, so complain about it. + */ if (slot->max_clk == 0) { - slot->max_clk = SDHCI_DEFAULT_MAX_FREQ; + slot->max_clk = SDHCI_DEFAULT_MAX_FREQ * 1000000; device_printf(dev, "Hardware doesn't specify base clock " "frequency, using %dMHz as default.\n", SDHCI_DEFAULT_MAX_FREQ); } - slot->max_clk *= 1000000; /* Calculate timeout clock frequency. */ if (slot->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) { slot->timeout_clk = slot->max_clk / 1000; @@ -547,7 +553,11 @@ sdhci_init_slot(device_t dev, struct sdh if (caps & SDHCI_TIMEOUT_CLK_UNIT) slot->timeout_clk *= 1000; } - + /* + * If the frequency wasn't in the capabilities and the hardware driver + * hasn't already set timeout_clk we'll probably work okay using the + * max timeout, but still mention it. + */ if (slot->timeout_clk == 0) { device_printf(dev, "Hardware doesn't specify timeout clock " "frequency, setting BROKEN_TIMEOUT quirk.\n"); From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 04:56:04 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 ESMTP id 695367A; Mon, 19 Aug 2013 04:56:04 +0000 (UTC) (envelope-from peter@FreeBSD.org) 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 575222175; Mon, 19 Aug 2013 04:56:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7J4u4YR097607; Mon, 19 Aug 2013 04:56:04 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7J4u4EG097606; Mon, 19 Aug 2013 04:56:04 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201308190456.r7J4u4EG097606@svn.freebsd.org> From: Peter Wemm Date: Mon, 19 Aug 2013 04:56:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254508 - head/etc/rc.d 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.14 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, 19 Aug 2013 04:56:04 -0000 Author: peter Date: Mon Aug 19 04:56:03 2013 New Revision: 254508 URL: http://svnweb.freebsd.org/changeset/base/254508 Log: Add the optional ability to run as a different user. Obtained from: Antique freebsd.org cluster archive images Modified: head/etc/rc.d/bsnmpd Modified: head/etc/rc.d/bsnmpd ============================================================================== --- head/etc/rc.d/bsnmpd Mon Aug 19 01:29:13 2013 (r254507) +++ head/etc/rc.d/bsnmpd Mon Aug 19 04:56:03 2013 (r254508) @@ -12,7 +12,17 @@ name="bsnmpd" rcvar="bsnmpd_enable" command="/usr/sbin/${name}" -pidfile="/var/run/snmpd.pid" +start_cmd="bsnmpd_start" + +bsnmpd_start() +{ + rc_flags="-p ${pidfile} ${bsnmpd_flags}" + echo -n "Starting bsnmpd" + su -m $user -c "$command ${rc_flags}" + echo "." +} load_rc_config $name +user="${bsnmpd_username:-root}" +pidfile="${bsnmpd_pidfile:-/var/run/snmpd.pid}" run_rc_command "$1" From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 05:10: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 ESMTP id 2CD502A1; Mon, 19 Aug 2013 05:10:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) 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 008302218; Mon, 19 Aug 2013 05:10: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 r7J5AkqE014642; Mon, 19 Aug 2013 05:10:46 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7J5AkQQ014626; Mon, 19 Aug 2013 05:10:46 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201308190510.r7J5AkQQ014626@svn.freebsd.org> From: Justin Hibbits Date: Mon, 19 Aug 2013 05:10:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254509 - in head/sys: cddl/dev/dtrace/powerpc modules/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.14 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, 19 Aug 2013 05:10:47 -0000 Author: jhibbits Date: Mon Aug 19 05:10:46 2013 New Revision: 254509 URL: http://svnweb.freebsd.org/changeset/base/254509 Log: Fix some ppc64 dtrace bugs, and enable systrace_freebsd32 for ppc64. Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c head/sys/modules/dtrace/Makefile Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Mon Aug 19 04:56:03 2013 (r254508) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Mon Aug 19 05:10:46 2013 (r254509) @@ -50,6 +50,7 @@ void dtrace_membar_producer(void) */ ASENTRY_NOPROF(dtrace_membar_producer) + sync blr END(dtrace_membar_producer) @@ -57,6 +58,7 @@ END(dtrace_membar_producer) void dtrace_membar_consumer(void) */ ASENTRY_NOPROF(dtrace_membar_consumer) + isync blr END(dtrace_membar_consumer) @@ -97,12 +99,21 @@ void * dtrace_casptr(void *target, void *cmp, void *new) */ ASENTRY_NOPROF(dtrace_casptr) +#ifdef __powerpc64__ +1: + ldarx %r0,0,%r3 + cmpd %r4,%r0 + bne 2f + stdcx. %r5,0,%r3 + bne 1b +#else 1: lwarx %r0,0,%r3 cmpw %r4,%r0 bne 2f stwcx. %r5,0,%r3 bne 1b +#endif 2: mr %r3,%r0 blr END(dtrace_casptr) Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Mon Aug 19 04:56:03 2013 (r254508) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Mon Aug 19 05:10:46 2013 (r254509) @@ -80,7 +80,11 @@ dtrace_getpcstack(pc_t *pcstack, int pcs if (!INKERNEL((long) sp)) break; +#ifdef __powerpc64__ + callpc = *(uintptr_t *)(sp + RETURN_OFFSET64); +#else callpc = *(uintptr_t *)(sp + RETURN_OFFSET); +#endif if (!INKERNEL(callpc)) break; Modified: head/sys/modules/dtrace/Makefile ============================================================================== --- head/sys/modules/dtrace/Makefile Mon Aug 19 04:56:03 2013 (r254508) +++ head/sys/modules/dtrace/Makefile Mon Aug 19 05:10:46 2013 (r254509) @@ -22,7 +22,7 @@ SUBDIR+= fasttrap fbt systrace_linux32 .if ${MACHINE_CPUARCH} == "powerpc" SUBDIR+= fbt .endif -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" SUBDIR+= systrace_freebsd32 .endif From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 05:12:39 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 ESMTP id 818204C8; Mon, 19 Aug 2013 05:12:39 +0000 (UTC) (envelope-from peter@FreeBSD.org) 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 6F84B222B; Mon, 19 Aug 2013 05:12: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 r7J5Cd2K016617; Mon, 19 Aug 2013 05:12:39 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7J5CdAC016616; Mon, 19 Aug 2013 05:12:39 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201308190512.r7J5CdAC016616@svn.freebsd.org> From: Peter Wemm Date: Mon, 19 Aug 2013 05:12:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254510 - head/etc/rc.d 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.14 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, 19 Aug 2013 05:12:39 -0000 Author: peter Date: Mon Aug 19 05:12:38 2013 New Revision: 254510 URL: http://svnweb.freebsd.org/changeset/base/254510 Log: Revert r254508. Modified: head/etc/rc.d/bsnmpd Modified: head/etc/rc.d/bsnmpd ============================================================================== --- head/etc/rc.d/bsnmpd Mon Aug 19 05:10:46 2013 (r254509) +++ head/etc/rc.d/bsnmpd Mon Aug 19 05:12:38 2013 (r254510) @@ -12,17 +12,7 @@ name="bsnmpd" rcvar="bsnmpd_enable" command="/usr/sbin/${name}" -start_cmd="bsnmpd_start" - -bsnmpd_start() -{ - rc_flags="-p ${pidfile} ${bsnmpd_flags}" - echo -n "Starting bsnmpd" - su -m $user -c "$command ${rc_flags}" - echo "." -} +pidfile="/var/run/snmpd.pid" load_rc_config $name -user="${bsnmpd_username:-root}" -pidfile="${bsnmpd_pidfile:-/var/run/snmpd.pid}" run_rc_command "$1" From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 05:37:50 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 ESMTP id 929DB779; Mon, 19 Aug 2013 05:37:50 +0000 (UTC) (envelope-from peter@FreeBSD.org) 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 7F38B2322; Mon, 19 Aug 2013 05:37: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 r7J5bokg041651; Mon, 19 Aug 2013 05:37:50 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7J5bor6041650; Mon, 19 Aug 2013 05:37:50 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201308190537.r7J5bor6041650@svn.freebsd.org> From: Peter Wemm Date: Mon, 19 Aug 2013 05:37:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254511 - head/etc/rc.d 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.14 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, 19 Aug 2013 05:37:50 -0000 Author: peter Date: Mon Aug 19 05:37:49 2013 New Revision: 254511 URL: http://svnweb.freebsd.org/changeset/base/254511 Log: Pass pidfile to bsnmpd if it's been changed (parts cut/pasted from rc.d/rarpd and rc.d/wpa_supplicant) Modified: head/etc/rc.d/bsnmpd Modified: head/etc/rc.d/bsnmpd ============================================================================== --- head/etc/rc.d/bsnmpd Mon Aug 19 05:12:38 2013 (r254510) +++ head/etc/rc.d/bsnmpd Mon Aug 19 05:37:49 2013 (r254511) @@ -12,7 +12,8 @@ name="bsnmpd" rcvar="bsnmpd_enable" command="/usr/sbin/${name}" -pidfile="/var/run/snmpd.pid" load_rc_config $name +pidfile="${bsnmpd_pidfile:-/var/run/snmpd.pid}" +command_args="-p ${pidfile}" run_rc_command "$1" From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 05:48: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 ESMTP id 5D355C64; Mon, 19 Aug 2013 05:48:43 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) 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 311DC2393; Mon, 19 Aug 2013 05:48: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 r7J5mhaT051059; Mon, 19 Aug 2013 05:48:43 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7J5mgFr051058; Mon, 19 Aug 2013 05:48:42 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201308190548.r7J5mgFr051058@svn.freebsd.org> From: Rui Paulo Date: Mon, 19 Aug 2013 05:48:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254512 - head/sys/dev/sdhci 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.14 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, 19 Aug 2013 05:48:43 -0000 Author: rpaulo Date: Mon Aug 19 05:48:42 2013 New Revision: 254512 URL: http://svnweb.freebsd.org/changeset/base/254512 Log: Style changes and typos fixed. Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Mon Aug 19 05:37:49 2013 (r254511) +++ head/sys/dev/sdhci/sdhci.c Mon Aug 19 05:48:42 2013 (r254512) @@ -350,7 +350,7 @@ sdhci_read_block_pio(struct sdhci_slot * /* If we are too fast, broken controllers return zeroes. */ if (slot->quirks & SDHCI_QUIRK_BROKEN_TIMINGS) DELAY(10); - /* Handle unalligned and alligned buffer cases. */ + /* Handle unaligned and aligned buffer cases. */ if ((intptr_t)buffer & 3) { while (left > 3) { data = RD4(slot, SDHCI_BUFFER); @@ -390,7 +390,7 @@ sdhci_write_block_pio(struct sdhci_slot left = min(512, slot->curcmd->data->len - slot->offset); slot->offset += left; - /* Handle unalligned and alligned buffer cases. */ + /* Handle unaligned and aligned buffer cases. */ if ((intptr_t)buffer & 3) { while (left > 3) { data = buffer[0] + @@ -911,11 +911,14 @@ sdhci_start_data(struct sdhci_slot *slot /* Load DMA buffer. */ if (slot->flags & SDHCI_USE_DMA) { if (data->flags & MMC_DATA_READ) - bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(slot->dmatag, slot->dmamap, + BUS_DMASYNC_PREREAD); else { memcpy(slot->dmamem, data->data, - (data->len < DMA_BLOCK_SIZE)?data->len:DMA_BLOCK_SIZE); - bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_PREWRITE); + (data->len < DMA_BLOCK_SIZE) ? + data->len : DMA_BLOCK_SIZE); + bus_dmamap_sync(slot->dmatag, slot->dmamap, + BUS_DMASYNC_PREWRITE); } WR4(slot, SDHCI_DMA_ADDRESS, slot->paddr); /* Interrupt aggregation: Mask border interrupt @@ -942,7 +945,7 @@ sdhci_finish_data(struct sdhci_slot *slo slot->data_done = 1; /* Interrupt aggregation: Restore command interrupt. - * Auxillary restore point for the case when data interrupt + * Auxiliary restore point for the case when data interrupt * happened first. */ if (!slot->cmd_done) { WR4(slot, SDHCI_SIGNAL_ENABLE, @@ -952,11 +955,13 @@ sdhci_finish_data(struct sdhci_slot *slo if (slot->flags & SDHCI_USE_DMA) { if (data->flags & MMC_DATA_READ) { size_t left = data->len - slot->offset; - bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(slot->dmatag, slot->dmamap, + BUS_DMASYNC_POSTREAD); memcpy((u_char*)data->data + slot->offset, slot->dmamem, (left < DMA_BLOCK_SIZE)?left:DMA_BLOCK_SIZE); } else - bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_POSTWRITE); + bus_dmamap_sync(slot->dmatag, slot->dmamap, + BUS_DMASYNC_POSTWRITE); } /* If there was error - reset the host. */ if (slot->curcmd->error) { From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 08:28: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 ESMTP id F020250C; Mon, 19 Aug 2013 08:28:35 +0000 (UTC) (envelope-from andrew@FreeBSD.org) 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 DDA162A94; Mon, 19 Aug 2013 08:28:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7J8SZuv013033; Mon, 19 Aug 2013 08:28:35 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7J8SZbA013032; Mon, 19 Aug 2013 08:28:35 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201308190828.r7J8SZbA013032@svn.freebsd.org> From: Andrew Turner Date: Mon, 19 Aug 2013 08:28:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254514 - head/sys/arm/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.14 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, 19 Aug 2013 08:28:36 -0000 Author: andrew Date: Mon Aug 19 08:28:35 2013 New Revision: 254514 URL: http://svnweb.freebsd.org/changeset/base/254514 Log: Enable VFP on the Arndale Board. Modified: head/sys/arm/conf/ARNDALE Modified: head/sys/arm/conf/ARNDALE ============================================================================== --- head/sys/arm/conf/ARNDALE Mon Aug 19 07:00:13 2013 (r254513) +++ head/sys/arm/conf/ARNDALE Mon Aug 19 08:28:35 2013 (r254514) @@ -50,6 +50,7 @@ options _KPOSIX_PRIORITY_SCHEDULING #Po options KBD_INSTALL_CDEV options PREEMPTION options FREEBSD_BOOT_LOADER +options VFP # vfp/neon # Debugging makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 10:20:22 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 ESMTP id 4B5BBBC; Mon, 19 Aug 2013 10:20:22 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 3858821F4; Mon, 19 Aug 2013 10:20:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7JAKMY3014355; Mon, 19 Aug 2013 10:20:22 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JAKLoK014340; Mon, 19 Aug 2013 10:20:21 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308191020.r7JAKLoK014340@svn.freebsd.org> From: Andre Oppermann Date: Mon, 19 Aug 2013 10:20:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254516 - in head/sys/dev: bce bxe mge ti 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.14 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, 19 Aug 2013 10:20:22 -0000 Author: andre Date: Mon Aug 19 10:20:20 2013 New Revision: 254516 URL: http://svnweb.freebsd.org/changeset/base/254516 Log: Remove unused and incomplete support for delayed fragment checksums from bce(4), bxe(4), mge(4) and ti(4) drivers. Modified: head/sys/dev/bce/if_bce.c head/sys/dev/bxe/if_bxe.c head/sys/dev/mge/if_mge.c head/sys/dev/ti/if_ti.c Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Mon Aug 19 09:49:51 2013 (r254515) +++ head/sys/dev/bce/if_bce.c Mon Aug 19 10:20:20 2013 (r254516) @@ -9821,9 +9821,7 @@ bce_dump_mbuf(struct bce_softc *sc, stru if (mp->m_flags & M_PKTHDR) { BCE_PRINTF("- m_pkthdr: len = %d, flags = 0x%b, " "csum_flags = %b\n", mp->m_pkthdr.len, - mp->m_flags, "\20\12M_BCAST\13M_MCAST\14M_FRAG" - "\15M_FIRSTFRAG\16M_LASTFRAG\21M_VLANTAG" - "\22M_PROMISC\23M_NOFREE", + mp->m_flags, M_FLAG_PRINTF, mp->m_pkthdr.csum_flags, "\20\1CSUM_IP\2CSUM_TCP\3CSUM_UDP" "\5CSUM_FRAGMENT\6CSUM_TSO\11CSUM_IP_CHECKED" Modified: head/sys/dev/bxe/if_bxe.c ============================================================================== --- head/sys/dev/bxe/if_bxe.c Mon Aug 19 09:49:51 2013 (r254515) +++ head/sys/dev/bxe/if_bxe.c Mon Aug 19 10:20:20 2013 (r254516) @@ -16265,9 +16265,7 @@ void bxe_dump_mbuf(struct bxe_softc *sc, if (m->m_flags & M_PKTHDR) { BXE_PRINTF("- 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", + m->m_flags, M_FLAG_PRINTF, m->m_pkthdr.csum_flags, "\20\1CSUM_IP\2CSUM_TCP\3CSUM_UDP" "\5CSUM_FRAGMENT\6CSUM_TSO\11CSUM_IP_CHECKED" Modified: head/sys/dev/mge/if_mge.c ============================================================================== --- head/sys/dev/mge/if_mge.c Mon Aug 19 09:49:51 2013 (r254515) +++ head/sys/dev/mge/if_mge.c Mon Aug 19 10:20:20 2013 (r254516) @@ -1703,9 +1703,7 @@ mge_offload_setup_descriptor(struct mge_ ip = (struct ip *)(m0->m_data + ehlen); cmd_status |= MGE_TX_IP_HDR_SIZE(ip->ip_hl); - - if ((m0->m_flags & M_FRAG) == 0) - cmd_status |= MGE_TX_NOT_FRAGMENT; + cmd_status |= MGE_TX_NOT_FRAGMENT; } if (csum_flags & CSUM_IP) Modified: head/sys/dev/ti/if_ti.c ============================================================================== --- head/sys/dev/ti/if_ti.c Mon Aug 19 09:49:51 2013 (r254515) +++ head/sys/dev/ti/if_ti.c Mon Aug 19 10:20:20 2013 (r254516) @@ -3159,24 +3159,6 @@ ti_start_locked(struct ifnet *ifp) break; /* - * XXX - * safety overkill. If this is a fragmented packet chain - * with delayed TCP/UDP checksums, then only encapsulate - * it if we have enough descriptors to handle the entire - * chain at once. - * (paranoia -- may not actually be needed) - */ - if (m_head->m_flags & M_FIRSTFRAG && - m_head->m_pkthdr.csum_flags & (CSUM_DELAY_DATA)) { - if ((TI_TX_RING_CNT - sc->ti_txcnt) < - m_head->m_pkthdr.csum_data + 16) { - IFQ_DRV_PREPEND(&ifp->if_snd, m_head); - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - break; - } - } - - /* * Pack the data into the transmit ring. If we * don't have room, set the OACTIVE flag and wait * for the NIC to drain the ring. From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 10:30:16 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 ESMTP id AB32A2AE; Mon, 19 Aug 2013 10:30:16 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 98C1F2263; Mon, 19 Aug 2013 10:30: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 r7JAUG6O024867; Mon, 19 Aug 2013 10:30:16 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JAUGR6024866; Mon, 19 Aug 2013 10:30:16 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308191030.r7JAUGR6024866@svn.freebsd.org> From: Andre Oppermann Date: Mon, 19 Aug 2013 10:30:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254517 - 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.14 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, 19 Aug 2013 10:30:16 -0000 Author: andre Date: Mon Aug 19 10:30:15 2013 New Revision: 254517 URL: http://svnweb.freebsd.org/changeset/base/254517 Log: Remove unused M_FRAG, M_FIRSTFRAG and M_LASTFRAG tagging from ip_fragment(). There wasn't any real driver (and hardware) support for it. Modern hardware does full fragmentation/segmentation offload instead. Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Mon Aug 19 10:20:20 2013 (r254516) +++ head/sys/netinet/ip_output.c Mon Aug 19 10:30:15 2013 (r254517) @@ -784,7 +784,7 @@ smart_frag_failure: IPSTAT_INC(ips_odropped); goto done; } - m->m_flags |= (m0->m_flags & M_MCAST) | M_FRAG; + m->m_flags |= (m0->m_flags & M_MCAST); /* * In the first mbuf, leave room for the link header, then * copy the original IP header including options. The payload @@ -801,10 +801,9 @@ smart_frag_failure: m->m_len = mhlen; /* XXX do we need to add ip_off below ? */ mhip->ip_off = ((off - hlen) >> 3) + ip_off; - if (off + len >= ip_len) { /* last fragment */ + if (off + len >= ip_len) len = ip_len - off; - m->m_flags |= M_LASTFRAG; - } else + else mhip->ip_off |= IP_MF; mhip->ip_len = htons((u_short)(len + mhlen)); m->m_next = m_copym(m0, off, len, M_NOWAIT); @@ -831,10 +830,6 @@ smart_frag_failure: } IPSTAT_ADD(ips_ofragments, nfrags); - /* set first marker for fragment chain */ - m0->m_flags |= M_FIRSTFRAG | M_FRAG; - m0->m_pkthdr.csum_data = nfrags; - /* * Update first fragment by trimming what's been copied out * and updating header. From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 10:34:11 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 ESMTP id 8AE62464; Mon, 19 Aug 2013 10:34:11 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 7840122DC; Mon, 19 Aug 2013 10:34: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 r7JAYBcU027838; Mon, 19 Aug 2013 10:34:11 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JAYBxm027833; Mon, 19 Aug 2013 10:34:11 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308191034.r7JAYBxm027833@svn.freebsd.org> From: Andre Oppermann Date: Mon, 19 Aug 2013 10:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254518 - 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.14 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, 19 Aug 2013 10:34:11 -0000 Author: andre Date: Mon Aug 19 10:34:10 2013 New Revision: 254518 URL: http://svnweb.freebsd.org/changeset/base/254518 Log: Move ip_reassemble()'s use of the global M_FRAG mbuf flag to a protocol layer specific flag instead. The flag is only relevant while the packet stays in the IP reassembly queue. Discussed with: trociny, glebius Modified: head/sys/netinet/ip_input.c head/sys/netinet/ip_var.h Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Mon Aug 19 10:30:15 2013 (r254517) +++ head/sys/netinet/ip_input.c Mon Aug 19 10:34:10 2013 (r254518) @@ -911,9 +911,9 @@ found: IPSTAT_INC(ips_toosmall); /* XXX */ goto dropfrag; } - m->m_flags |= M_FRAG; + m->m_flags |= M_IP_FRAG; } else - m->m_flags &= ~M_FRAG; + m->m_flags &= ~M_IP_FRAG; ip->ip_off = htons(ntohs(ip->ip_off) << 3); /* @@ -1060,7 +1060,7 @@ found: next += ntohs(GETIP(q)->ip_len); } /* Make sure the last packet didn't have the IP_MF flag */ - if (p->m_flags & M_FRAG) { + if (p->m_flags & M_IP_FRAG) { if (fp->ipq_nfrags > V_maxfragsperpacket) { IPSTAT_ADD(ips_fragdropped, fp->ipq_nfrags); ip_freef(head, fp); Modified: head/sys/netinet/ip_var.h ============================================================================== --- head/sys/netinet/ip_var.h Mon Aug 19 10:30:15 2013 (r254517) +++ head/sys/netinet/ip_var.h Mon Aug 19 10:34:10 2013 (r254518) @@ -167,6 +167,7 @@ void kmod_ipstat_dec(int statnum); */ #define M_FASTFWD_OURS M_PROTO1 /* changed dst to local */ #define M_IP_NEXTHOP M_PROTO2 /* explicit ip nexthop */ +#define M_IP_FRAG M_PROTO4 /* fragment reassembly */ #ifdef __NO_STRICT_ALIGNMENT #define IP_HDR_ALIGNED_P(ip) 1 From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 11:08:37 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 ESMTP id 5D43560D; Mon, 19 Aug 2013 11:08:37 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 3BC532673; Mon, 19 Aug 2013 11:08: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 r7JB8bdT057786; Mon, 19 Aug 2013 11:08:37 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JB8aQ4057777; Mon, 19 Aug 2013 11:08:36 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308191108.r7JB8aQ4057777@svn.freebsd.org> From: Andre Oppermann Date: Mon, 19 Aug 2013 11:08:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254519 - in head/sys: netinet netinet6 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.14 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, 19 Aug 2013 11:08:37 -0000 Author: andre Date: Mon Aug 19 11:08:36 2013 New Revision: 254519 URL: http://svnweb.freebsd.org/changeset/base/254519 Log: Move the global M_SKIP_FIREWALL mbuf flags to a protocol layer specific flag instead. The flag is only used within the IP and IPv6 layer 3 protocols. Because some firewall packages treat IPv4 and IPv6 packets the same the flag should have the same value for both. Discussed with: trociny, glebius Modified: head/sys/netinet/ip_var.h head/sys/netinet6/ip6_var.h head/sys/sys/mbuf.h Modified: head/sys/netinet/ip_var.h ============================================================================== --- head/sys/netinet/ip_var.h Mon Aug 19 10:34:10 2013 (r254518) +++ head/sys/netinet/ip_var.h Mon Aug 19 11:08:36 2013 (r254519) @@ -163,10 +163,12 @@ void kmod_ipstat_dec(int statnum); #define IP_ALLOWBROADCAST SO_BROADCAST /* 0x20 can send broadcast packets */ /* - * mbuf flag used by ip_fastfwd + * IPv4 protocol layer specific mbuf flags. */ #define M_FASTFWD_OURS M_PROTO1 /* changed dst to local */ #define M_IP_NEXTHOP M_PROTO2 /* explicit ip nexthop */ +#define M_SKIP_FIREWALL M_PROTO3 /* skip firewall processing, + keep in sync with IP6 */ #define M_IP_FRAG M_PROTO4 /* fragment reassembly */ #ifdef __NO_STRICT_ALIGNMENT Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Mon Aug 19 10:34:10 2013 (r254518) +++ head/sys/netinet6/ip6_var.h Mon Aug 19 11:08:36 2013 (r254519) @@ -293,7 +293,12 @@ struct ip6aux { #define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */ #define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */ -#define M_IP6_NEXTHOP M_PROTO7 /* explicit ip nexthop */ +/* + * IPv6 protocol layer specific mbuf flags. + */ +#define M_IP6_NEXTHOP M_PROTO2 /* explicit ip nexthop */ +#define M_SKIP_FIREWALL M_PROTO3 /* skip firewall processing, + keep in sync with IPv4 */ #ifdef __NO_STRICT_ALIGNMENT #define IP6_HDR_ALIGNED_P(ip) 1 Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Mon Aug 19 10:34:10 2013 (r254518) +++ head/sys/sys/mbuf.h Mon Aug 19 11:08:36 2013 (r254519) @@ -196,7 +196,7 @@ struct mbuf { #define M_FRAG 0x00000800 /* packet is a fragment of a larger packet */ #define M_FIRSTFRAG 0x00001000 /* packet is first fragment */ #define M_LASTFRAG 0x00002000 /* packet is last fragment */ -#define M_SKIP_FIREWALL 0x00004000 /* skip firewall processing */ + /* 0x00004000 free */ /* 0x00008000 free */ #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ #define M_PROMISC 0x00020000 /* packet was not for us */ @@ -253,7 +253,7 @@ struct mbuf { * Flags preserved when copying m_pkthdr. */ #define M_COPYFLAGS \ - (M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_SKIP_FIREWALL|M_BCAST|M_MCAST|\ + (M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_BCAST|M_MCAST|\ M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG|M_PROMISC|M_HASHTYPEBITS) /* From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 11:16: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 ESMTP id DDD279E8; Mon, 19 Aug 2013 11:16:54 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 B98952728; Mon, 19 Aug 2013 11:16:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7JBGsfu065805; Mon, 19 Aug 2013 11:16:54 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JBGsc6065793; Mon, 19 Aug 2013 11:16:54 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308191116.r7JBGsc6065793@svn.freebsd.org> From: Andre Oppermann Date: Mon, 19 Aug 2013 11:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254520 - in head/sys: kern 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.14 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, 19 Aug 2013 11:16:55 -0000 Author: andre Date: Mon Aug 19 11:16:53 2013 New Revision: 254520 URL: http://svnweb.freebsd.org/changeset/base/254520 Log: Remove the unused M_NOFREE mbuf flag. It didn't have any in-tree users for a very long time, if ever. Should such a functionality ever be needed again the appropriate and much better way to do it is through a custom EXT_SOMETHING external mbuf type together with a dedicated *ext_free function. Discussed with: trociny, glebius Modified: head/sys/kern/kern_mbuf.c head/sys/kern/uipc_mbuf.c head/sys/sys/mbuf.h Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Mon Aug 19 11:08:36 2013 (r254519) +++ head/sys/kern/kern_mbuf.c Mon Aug 19 11:16:53 2013 (r254520) @@ -474,7 +474,6 @@ mb_dtor_mbuf(void *mem, int size, void * if ((flags & MB_NOTAGS) == 0 && (m->m_flags & M_PKTHDR) != 0) m_tag_delete_chain(m, NULL); KASSERT((m->m_flags & M_EXT) == 0, ("%s: M_EXT set", __func__)); - KASSERT((m->m_flags & M_NOFREE) == 0, ("%s: M_NOFREE set", __func__)); #ifdef INVARIANTS trash_dtor(mem, size, arg); #endif Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Mon Aug 19 11:08:36 2013 (r254519) +++ head/sys/kern/uipc_mbuf.c Mon Aug 19 11:16:53 2013 (r254520) @@ -278,17 +278,10 @@ m_extadd(struct mbuf *mb, caddr_t buf, u void mb_free_ext(struct mbuf *m) { - int skipmbuf; KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", __func__)); KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", __func__)); - - /* - * check if the header is embedded in the cluster - */ - skipmbuf = (m->m_flags & M_NOFREE); - /* Free attached storage if this mbuf is the only reference to it. */ if (*(m->m_ext.ref_cnt) == 1 || atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) { @@ -329,8 +322,6 @@ mb_free_ext(struct mbuf *m) ("%s: unknown ext_type", __func__)); } } - if (skipmbuf) - return; /* * Free this mbuf back to the mbuf zone with all m_ext @@ -395,7 +386,7 @@ m_demote(struct mbuf *m0, int all) m_freem(m->m_nextpkt); m->m_nextpkt = NULL; } - m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_NOFREE); + m->m_flags = m->m_flags & (M_EXT|M_RDONLY); } } Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Mon Aug 19 11:08:36 2013 (r254519) +++ head/sys/sys/mbuf.h Mon Aug 19 11:16:53 2013 (r254520) @@ -200,7 +200,7 @@ struct mbuf { /* 0x00008000 free */ #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ #define M_PROMISC 0x00020000 /* packet was not for us */ -#define M_NOFREE 0x00040000 /* do not free mbuf, embedded in cluster */ + /* 0x00040000 free */ #define M_PROTO6 0x00080000 /* protocol-specific */ #define M_PROTO7 0x00100000 /* protocol-specific */ #define M_PROTO8 0x00200000 /* protocol-specific */ @@ -515,7 +515,7 @@ m_free(struct mbuf *m) if (m->m_flags & M_EXT) mb_free_ext(m); - else if ((m->m_flags & M_NOFREE) == 0) + else uma_zfree(zone_mbuf, m); return (n); } From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 11:23:39 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 ESMTP id 75C9AD26; Mon, 19 Aug 2013 11:23:39 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vc0-x232.google.com (mail-vc0-x232.google.com [IPv6:2607:f8b0:400c:c03::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F2C7D2799; Mon, 19 Aug 2013 11:23:38 +0000 (UTC) Received: by mail-vc0-f178.google.com with SMTP id ha12so2890004vcb.37 for ; Mon, 19 Aug 2013 04:23:38 -0700 (PDT) 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=1I5XMmkdC5W6EQp1dtooni+gFizXIw1sDnzb/+Q8Oxc=; b=j6OZeyKmYAutDLEopLzcm7GqB+usm4PTf0uJ6Dw7MfRYD3ABX6q1SCenEpzWrMLuAD Pnnkb5Z9sVq4GA8QMexjduH9yKwagS8Gmg4VzLeRItvr8WwlUYnmkr6wPHmgZ7aPczBx ewZHoyGsSLxvtNahBdV3d8Kbp/H60SJLkgrguKt6g/aM/4A2pUpuqvThXYk7imhRg/rs ObnjoXxNShQDILvXZ51hZFfxb9DnaqbIE76AZeznSNMAATK1Ch9DHmjC375rutmpTCKn r12d6qkB9TkAI8+xF7kmV3UcOBcm3Nq+uaOIoSMBwyLaNpB8/PeVu9km91G1ccjn+1zM Atfw== MIME-Version: 1.0 X-Received: by 10.52.103.35 with SMTP id ft3mr11128463vdb.5.1376911418024; Mon, 19 Aug 2013 04:23:38 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.220.21.140 with HTTP; Mon, 19 Aug 2013 04:23:37 -0700 (PDT) In-Reply-To: <201308191116.r7JBGsc6065793@svn.freebsd.org> References: <201308191116.r7JBGsc6065793@svn.freebsd.org> Date: Mon, 19 Aug 2013 13:23:37 +0200 X-Google-Sender-Auth: jAOYSwQBxGZ_iwqjFqX3qcFwND4 Message-ID: Subject: Re: svn commit: r254520 - in head/sys: kern sys From: Davide Italiano To: Andre Oppermann 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.14 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, 19 Aug 2013 11:23:39 -0000 On Mon, Aug 19, 2013 at 1:16 PM, Andre Oppermann wrote: > Author: andre > Date: Mon Aug 19 11:16:53 2013 > New Revision: 254520 > URL: http://svnweb.freebsd.org/changeset/base/254520 > > Log: > Remove the unused M_NOFREE mbuf flag. It didn't have any in-tree users > for a very long time, if ever. > > Should such a functionality ever be needed again the appropriate and > much better way to do it is through a custom EXT_SOMETHING external mbuf > type together with a dedicated *ext_free function. > > Discussed with: trociny, glebius > > Modified: > head/sys/kern/kern_mbuf.c > head/sys/kern/uipc_mbuf.c > head/sys/sys/mbuf.h > > Modified: head/sys/kern/kern_mbuf.c > ============================================================================== > --- head/sys/kern/kern_mbuf.c Mon Aug 19 11:08:36 2013 (r254519) > +++ head/sys/kern/kern_mbuf.c Mon Aug 19 11:16:53 2013 (r254520) > @@ -474,7 +474,6 @@ mb_dtor_mbuf(void *mem, int size, void * > if ((flags & MB_NOTAGS) == 0 && (m->m_flags & M_PKTHDR) != 0) > m_tag_delete_chain(m, NULL); > KASSERT((m->m_flags & M_EXT) == 0, ("%s: M_EXT set", __func__)); > - KASSERT((m->m_flags & M_NOFREE) == 0, ("%s: M_NOFREE set", __func__)); > #ifdef INVARIANTS > trash_dtor(mem, size, arg); > #endif > > Modified: head/sys/kern/uipc_mbuf.c > ============================================================================== > --- head/sys/kern/uipc_mbuf.c Mon Aug 19 11:08:36 2013 (r254519) > +++ head/sys/kern/uipc_mbuf.c Mon Aug 19 11:16:53 2013 (r254520) > @@ -278,17 +278,10 @@ m_extadd(struct mbuf *mb, caddr_t buf, u > void > mb_free_ext(struct mbuf *m) > { > - int skipmbuf; > > KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", __func__)); > KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", __func__)); > > - > - /* > - * check if the header is embedded in the cluster > - */ > - skipmbuf = (m->m_flags & M_NOFREE); > - > /* Free attached storage if this mbuf is the only reference to it. */ > if (*(m->m_ext.ref_cnt) == 1 || > atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) { > @@ -329,8 +322,6 @@ mb_free_ext(struct mbuf *m) > ("%s: unknown ext_type", __func__)); > } > } > - if (skipmbuf) > - return; > > /* > * Free this mbuf back to the mbuf zone with all m_ext > @@ -395,7 +386,7 @@ m_demote(struct mbuf *m0, int all) > m_freem(m->m_nextpkt); > m->m_nextpkt = NULL; > } > - m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_NOFREE); > + m->m_flags = m->m_flags & (M_EXT|M_RDONLY); > } > } > > > Modified: head/sys/sys/mbuf.h > ============================================================================== > --- head/sys/sys/mbuf.h Mon Aug 19 11:08:36 2013 (r254519) > +++ head/sys/sys/mbuf.h Mon Aug 19 11:16:53 2013 (r254520) > @@ -200,7 +200,7 @@ struct mbuf { > /* 0x00008000 free */ > #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ > #define M_PROMISC 0x00020000 /* packet was not for us */ > -#define M_NOFREE 0x00040000 /* do not free mbuf, embedded in cluster */ > + /* 0x00040000 free */ I think you should just use M_UNUSED or something similar here for consistency, like it's happening in td_pflags (sys/sys/proc.h), e.g.: #define TDP_UNUSED9 0x00000100 /* --available-- */ > #define M_PROTO6 0x00080000 /* protocol-specific */ > #define M_PROTO7 0x00100000 /* protocol-specific */ > #define M_PROTO8 0x00200000 /* protocol-specific */ > @@ -515,7 +515,7 @@ m_free(struct mbuf *m) > > if (m->m_flags & M_EXT) > mb_free_ext(m); > - else if ((m->m_flags & M_NOFREE) == 0) > + else > uma_zfree(zone_mbuf, m); > return (n); > } -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 11:44:12 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 ESMTP id 0D737370; Mon, 19 Aug 2013 11:44:12 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 02DCE289A; Mon, 19 Aug 2013 11:44:10 +0000 (UTC) Received: from alph.d.allbsd.org (p2049-ipbf1102funabasi.chiba.ocn.ne.jp [122.26.101.49]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id r7JBhpnt099200 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 19 Aug 2013 20:44:01 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.d.allbsd.org (8.14.5/8.14.5) with ESMTP id r7JBhpkN082851; Mon, 19 Aug 2013 20:43:51 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Mon, 19 Aug 2013 20:43:30 +0900 (JST) Message-Id: <20130819.204330.2144498109880721402.hrs@allbsd.org> To: pjd@FreeBSD.org Subject: Re: svn commit: r254484 - head/lib/libc/net From: Hiroki Sato In-Reply-To: <201308181038.r7IAcxkM008487@svn.freebsd.org> References: <201308181038.r7IAcxkM008487@svn.freebsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Mon_Aug_19_20_43_30_2013_401)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Mon, 19 Aug 2013 20:44:02 +0900 (JST) X-Spam-Status: No, score=-90.6 required=13.0 tests=CONTENT_TYPE_PRESENT, DIRECTOCNDYN,DYN_PBL,RCVD_IN_PBL,SPF_SOFTFAIL,USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org 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.14 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, 19 Aug 2013 11:44:12 -0000 ----Security_Multipart(Mon_Aug_19_20_43_30_2013_401)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Pawel Jakub Dawidek wrote in <201308181038.r7IAcxkM008487@svn.freebsd.org>: pj> Author: pjd pj> Date: Sun Aug 18 10:38:59 2013 pj> New Revision: 254484 pj> URL: http://svnweb.freebsd.org/changeset/base/254484 pj> pj> Log: pj> Consistently use 'af' as an argument name for address family. pj> Now both gethostbyname2(3) and gethostbyaddr(3) use the same argument name. pj> The same argument name is also used in implementations of those functions. pj> pj> Modified: pj> head/lib/libc/net/gethostbyname.3 pj> pj> Modified: head/lib/libc/net/gethostbyname.3 pj> ============================================================================== pj> --- head/lib/libc/net/gethostbyname.3 Sun Aug 18 10:33:46 2013 (r254483) pj> +++ head/lib/libc/net/gethostbyname.3 Sun Aug 18 10:38:59 2013 (r254484) pj> @@ -51,7 +51,7 @@ pj> .Ft struct hostent * pj> .Fn gethostbyname2 "const char *name" "int af" pj> .Ft struct hostent * pj> -.Fn gethostbyaddr "const void *addr" "socklen_t len" "int type" pj> +.Fn gethostbyaddr "const void *addr" "socklen_t len" "int af" pj> .Ft struct hostent * pj> .Fn gethostent void pj> .Ft void pj> @@ -107,7 +107,7 @@ in binary form pj> .Tn ASCII pj> form). pj> The pj> -.Fa type pj> +.Fa af pj> argument specifies the address family pj> (e.g.\& pj> .Dv AF_INET , AF_INET6 , I do not think we need to change this for consistency between the manual page and its implementation. gethostbyaddr()'s "int type" appears literally in POSIX and almost all systems have used that definition for a long time. -- Hiroki ----Security_Multipart(Mon_Aug_19_20_43_30_2013_401)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (FreeBSD) iEYEABECAAYFAlISBOIACgkQTyzT2CeTzy2TzgCggcC9opOtNYppEufIHGVM4UCK tIUAn23y+5/RmqL9A53XWYZeUpiTEKwT =ATQ/ -----END PGP SIGNATURE----- ----Security_Multipart(Mon_Aug_19_20_43_30_2013_401)---- From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 12:13:36 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 ESMTP id BA9A9E18 for ; Mon, 19 Aug 2013 12:13:36 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2D40C2A71 for ; Mon, 19 Aug 2013 12:13:35 +0000 (UTC) Received: (qmail 66615 invoked from network); 19 Aug 2013 12:57:03 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 19 Aug 2013 12:57:03 -0000 Message-ID: <52120BEC.4050604@freebsd.org> Date: Mon, 19 Aug 2013 14:13:32 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Davide Italiano Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@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.14 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, 19 Aug 2013 12:13:36 -0000 On 19.08.2013 13:23, Davide Italiano wrote: > On Mon, Aug 19, 2013 at 1:16 PM, Andre Oppermann wrote: >> Modified: head/sys/sys/mbuf.h >> ============================================================================== >> --- head/sys/sys/mbuf.h Mon Aug 19 11:08:36 2013 (r254519) >> +++ head/sys/sys/mbuf.h Mon Aug 19 11:16:53 2013 (r254520) >> @@ -200,7 +200,7 @@ struct mbuf { >> /* 0x00008000 free */ >> #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ >> #define M_PROMISC 0x00020000 /* packet was not for us */ >> -#define M_NOFREE 0x00040000 /* do not free mbuf, embedded in cluster */ >> + /* 0x00040000 free */ > > I think you should just use M_UNUSED or something similar here for > consistency, like it's happening in td_pflags (sys/sys/proc.h), e.g.: > > #define TDP_UNUSED9 0x00000100 /* --available-- */ There's a couple of more changes upcoming that will take care of it. -- Andre From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 12:30:19 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 ESMTP id 55F562E4; Mon, 19 Aug 2013 12:30:19 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 431F62B33; Mon, 19 Aug 2013 12:30:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7JCUJjb030500; Mon, 19 Aug 2013 12:30:19 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JCUIJF030496; Mon, 19 Aug 2013 12:30:18 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308191230.r7JCUIJF030496@svn.freebsd.org> From: Andre Oppermann Date: Mon, 19 Aug 2013 12:30:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254521 - in head/sys: netinet 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.14 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, 19 Aug 2013 12:30:19 -0000 Author: andre Date: Mon Aug 19 12:30:18 2013 New Revision: 254521 URL: http://svnweb.freebsd.org/changeset/base/254521 Log: Move the SCTP specific definition of M_NOTIFICATION onto a protocol specific mbuf flag from sys/mbuf.h to netinet/sctp_os_bsd.h. It is only relevant within SCTP. Discussed with: tuexen Modified: head/sys/netinet/sctp_os_bsd.h head/sys/sys/mbuf.h Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Mon Aug 19 11:16:53 2013 (r254520) +++ head/sys/netinet/sctp_os_bsd.h Mon Aug 19 12:30:18 2013 (r254521) @@ -429,6 +429,11 @@ typedef struct rtentry sctp_rtentry_t; #define SCTP_ZERO_COPY_SENDQ_EVENT(inp, so) /* + * SCTP protocol specific mbuf flags. + */ +#define M_NOTIFICATION M_PROTO5 /* SCTP notification */ + +/* * IP output routines */ #define SCTP_IP_OUTPUT(result, o_pak, ro, stcb, vrf_id) \ Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Mon Aug 19 11:16:53 2013 (r254520) +++ head/sys/sys/mbuf.h Mon Aug 19 12:30:18 2013 (r254521) @@ -207,8 +207,6 @@ struct mbuf { #define M_FLOWID 0x00400000 /* deprecated: flowid is valid */ #define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid hash type */ -#define M_NOTIFICATION M_PROTO5 /* SCTP notification */ - /* * Flags to purge when crossing layers. */ From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 12:37:14 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 ESMTP id DD5208D7; Mon, 19 Aug 2013 12:37:14 +0000 (UTC) (envelope-from theraven@FreeBSD.org) 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 BBB832BBF; Mon, 19 Aug 2013 12:37:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7JCbEnv037363; Mon, 19 Aug 2013 12:37:14 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JCbDGH037353; Mon, 19 Aug 2013 12:37:14 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201308191237.r7JCbDGH037353@svn.freebsd.org> From: David Chisnall Date: Mon, 19 Aug 2013 12:37:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254522 - head/usr.bin/dtc 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.14 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, 19 Aug 2013 12:37:15 -0000 Author: theraven Date: Mon Aug 19 12:37:13 2013 New Revision: 254522 URL: http://svnweb.freebsd.org/changeset/base/254522 Log: Add support for parameterised device tree sources to the device tree compiler. Reviewed by: brooks Sponsored by: DARPA, AFRL Modified: head/usr.bin/dtc/dtc.1 head/usr.bin/dtc/dtc.cc head/usr.bin/dtc/fdt.cc head/usr.bin/dtc/fdt.hh Modified: head/usr.bin/dtc/dtc.1 ============================================================================== --- head/usr.bin/dtc/dtc.1 Mon Aug 19 12:30:18 2013 (r254521) +++ head/usr.bin/dtc/dtc.1 Mon Aug 19 12:37:13 2013 (r254522) @@ -51,6 +51,7 @@ .Op Fl p Ar bytes .Op Fl V Ar blob_version .Op Fl W Ar [no-]checker_name +.Op Fl P Ar predefined_properties .Ar input_file .Sh DESCRIPTION The @@ -132,6 +133,22 @@ The ASCII representation of the FDT. .El .It Fl o Ar output_file The file to which to write the output. +.It Fl P Ar predefined_macro +Defines a macro, in the form +.Ar name=value +or +.Ar name +to be used for device tree source files that contain conditional components. +This tool supports two extensions to the standard to support conditional +compilation of device trees. +The first is an +.Ar /include/if [property]/ "file.dts" +directive that is allowed at the start of a file and which will only include +the specified file if it the specified property is passed with this flag. +The second is the +.Ar $NAME +format for property values. +These allow property value to be specified on the command line. .It Fl R Ar entries The number of empty reservation table entries to pad the table with. This is Modified: head/usr.bin/dtc/dtc.cc ============================================================================== --- head/usr.bin/dtc/dtc.cc Mon Aug 19 12:30:18 2013 (r254521) +++ head/usr.bin/dtc/dtc.cc Mon Aug 19 12:37:13 2013 (r254522) @@ -100,7 +100,7 @@ main(int argc, char **argv) clock_t c0 = clock(); class device_tree tree; fdt::checking::check_manager checks; - const char *options = "hqI:O:o:V:d:R:S:p:b:fisvH:W:E:D"; + const char *options = "hqI:O:o:V:d:R:S:p:b:fisvH:W:E:DP:"; // Don't forget to update the man page if any more options are added. while ((ch = getopt(argc, argv, options)) != -1) @@ -267,6 +267,13 @@ main(int argc, char **argv) case 'p': tree.set_blob_padding(strtoll(optarg, 0, 10)); break; + case 'P': + if (!tree.parse_define(optarg)) + { + fprintf(stderr, "Invalid predefine value %s\n", + optarg); + } + break; default: fprintf(stderr, "Unknown option %c\n", ch); return EXIT_FAILURE; Modified: head/usr.bin/dtc/fdt.cc ============================================================================== --- head/usr.bin/dtc/fdt.cc Mon Aug 19 12:30:18 2013 (r254521) +++ head/usr.bin/dtc/fdt.cc Mon Aug 19 12:37:13 2013 (r254522) @@ -382,13 +382,45 @@ property::property(input_buffer &structs values.push_back(v); } -property::property(input_buffer &input, string k, string l) : key(k), label(l), - valid(true) +void property::parse_define(input_buffer &input, define_map *defines) +{ + input.consume('$'); + if (!defines) + { + input.parse_error("No predefined properties to match name\n"); + valid = false; + return; + } + string name = string::parse_property_name(input); + define_map::iterator found; + if ((name == string()) || + ((found = defines->find(name)) == defines->end())) + { + input.parse_error("Undefined property name\n"); + valid = false; + return; + } + values.push_back((*found).second->values[0]); +} + +property::property(input_buffer &input, + string k, + string l, + bool semicolonTerminated, + define_map *defines) : key(k), label(l), valid(true) { do { input.next_token(); switch (input[0]) { + case '$': + { + parse_define(input, defines); + if (valid) + { + break; + } + } default: input.parse_error("Invalid property value."); valid = false; @@ -412,7 +444,7 @@ property::property(input_buffer &input, } input.next_token(); } while (input.consume(',')); - if (!input.consume(';')) + if (semicolonTerminated && !input.consume(';')) { input.parse_error("Expected ; at end of property"); valid = false; @@ -432,9 +464,10 @@ property::parse_dtb(input_buffer &struct } property* -property::parse(input_buffer &input, string key, string label) +property::parse(input_buffer &input, string key, string label, + bool semicolonTerminated, define_map *defines) { - property *p = new property(input, key, label); + property *p = new property(input, key, label, semicolonTerminated, defines); if (!p->valid) { delete p; @@ -591,7 +624,7 @@ node::node(input_buffer &structs, input_ return; } -node::node(input_buffer &input, string n, string l, string a) : +node::node(input_buffer &input, string n, string l, string a, define_map *defines) : label(l), name(n), unit_address(a), valid(true) { if (!input.consume('{')) @@ -628,7 +661,7 @@ node::node(input_buffer &input, string n if (input.consume('=')) { property *p= property::parse(input, child_name, - child_label); + child_label, true, defines); if (p == 0) { valid = false; @@ -641,7 +674,7 @@ node::node(input_buffer &input, string n else if (!is_property && input[0] == ('{')) { node *child = node::parse(input, child_name, - child_label, child_address); + child_label, child_address, defines); if (child) { children.push_back(child); @@ -693,9 +726,13 @@ node::sort() } node* -node::parse(input_buffer &input, string name, string label, string address) +node::parse(input_buffer &input, + string name, + string label, + string address, + define_map *defines) { - node *n = new node(input, name, label, address); + node *n = new node(input, name, label, address, defines); if (!n->valid) { delete n; @@ -1008,7 +1045,7 @@ device_tree::parse_roots(input_buffer &i while (valid && input.consume('/')) { input.next_token(); - node *n = node::parse(input, string("", 1)); + node *n = node::parse(input, string("", 1), string(), string(), &defines); if (n) { roots.push_back(n); @@ -1241,6 +1278,18 @@ device_tree::parse_dts(const char *fn, F input.next_token(); while(input.consume("/include/")) { + bool reallyInclude = true; + if (input.consume("if ")) + { + input.next_token(); + string name = string::parse_property_name(input); + // XXX: Error handling + if (defines.find(name) == defines.end()) + { + reallyInclude = false; + } + input.consume('/'); + } input.next_token(); if (!input.consume('"')) { @@ -1259,6 +1308,14 @@ device_tree::parse_dts(const char *fn, F include_file[dir_length] = '/'; memcpy(include_file+dir_length+1, file, length); include_file[dir_length+length+1] = 0; + + input.consume(include_file+dir_length+1); + input.consume('"'); + if (!reallyInclude) + { + continue; + } + input_buffer *include_buffer = buffer_for_file(include_file); if (include_buffer == 0) @@ -1292,8 +1349,6 @@ device_tree::parse_dts(const char *fn, F return; } input_buffer &include = *include_buffer; - input.consume(include_file+dir_length+1); - input.consume('"'); free((void*)include_file); if (!read_header) @@ -1361,6 +1416,33 @@ device_tree::~device_tree() delete buffers.back(); buffers.pop_back(); } + for (define_map::iterator i=defines.begin(), e=defines.end() ; + i!=e ; ++i) + { + delete i->second; + } +} + +bool device_tree::parse_define(const char *def) +{ + char *val = strchr(def, '='); + if (!val) + { + if (strlen(def) != 0) + { + string name(def); + defines[name]; + return true; + } + return false; + } + string name(def, val-def); + val++; + input_buffer in = input_buffer(val, strlen(val)); + property *p = property::parse(in, name, string(), false); + if (p) + defines[name] = p; + return p; } } // namespace fdt Modified: head/usr.bin/dtc/fdt.hh ============================================================================== --- head/usr.bin/dtc/fdt.hh Mon Aug 19 12:30:18 2013 (r254521) +++ head/usr.bin/dtc/fdt.hh Mon Aug 19 12:37:13 2013 (r254522) @@ -48,6 +48,8 @@ class string_table; namespace fdt { +class property; +typedef std::map define_map; /** * Properties may contain a number of different value, each with a different * label. This class encapsulates a single value. @@ -263,6 +265,10 @@ class property */ void parse_reference(input_buffer &input); /** + * Parse a predefined macro definition for a property. + */ + void parse_define(input_buffer &input, define_map *defines); + /** * Constructs a new property from two input buffers, pointing to the * struct and strings tables in the device tree blob, respectively. * The structs input buffer is assumed to have just consumed the @@ -272,7 +278,11 @@ class property /** * Parses a new property from the input buffer. */ - property(input_buffer &input, string k, string l); + property(input_buffer &input, + string k, + string l, + bool terminated, + define_map *defines); public: /** * Creates an empty property. @@ -298,7 +308,9 @@ class property */ static property* parse(input_buffer &input, string key, - string label=string()); + string label=string(), + bool semicolonTerminated=true, + define_map *defines=0); /** * Iterator type used for accessing the values of a property. */ @@ -398,7 +410,7 @@ class node * node. The name, and optionally label and unit address, should have * already been parsed. */ - node(input_buffer &input, string n, string l, string a); + node(input_buffer &input, string n, string l, string a, define_map*); /** * Comparison function for properties, used when sorting the properties * vector. Orders the properties based on their names. @@ -476,7 +488,8 @@ class node static node* parse(input_buffer &input, string name, string label=string(), - string address=string()); + string address=string(), + define_map *defines=0); /** * Factory method for constructing a new node. Attempts to parse a * node in DTB format from the input, and returns it on success. On @@ -617,6 +630,10 @@ class device_tree */ std::vector include_paths; /** + * Dictionary of predefined macros provided on the command line. + */ + define_map defines; + /** * The default boot CPU, specified in the device tree header. */ uint32_t boot_cpu; @@ -773,6 +790,10 @@ class device_tree { blob_padding = p; } + /** + * Parses a predefined macro value. + */ + bool parse_define(const char *def); }; } // namespace fdt From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 12:41: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 ESMTP id 01C07DBD; Mon, 19 Aug 2013 12:41:13 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id BBB5E2C0C; Mon, 19 Aug 2013 12:41:12 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id E8B63BEF; Mon, 19 Aug 2013 14:35:49 +0200 (CEST) Date: Mon, 19 Aug 2013 14:42:07 +0200 From: Pawel Jakub Dawidek To: Hiroki Sato Subject: Re: svn commit: r254484 - head/lib/libc/net Message-ID: <20130819124206.GB1383@garage.freebsd.pl> References: <201308181038.r7IAcxkM008487@svn.freebsd.org> <20130819.204330.2144498109880721402.hrs@allbsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/NkBOFFp2J2Af1nK" Content-Disposition: inline In-Reply-To: <20130819.204330.2144498109880721402.hrs@allbsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 19 Aug 2013 12:41:13 -0000 --/NkBOFFp2J2Af1nK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 19, 2013 at 08:43:30PM +0900, Hiroki Sato wrote: > Pawel Jakub Dawidek wrote > in <201308181038.r7IAcxkM008487@svn.freebsd.org>: >=20 > pj> Author: pjd > pj> Date: Sun Aug 18 10:38:59 2013 > pj> New Revision: 254484 > pj> URL: http://svnweb.freebsd.org/changeset/base/254484 > pj> > pj> Log: > pj> Consistently use 'af' as an argument name for address family. > pj> Now both gethostbyname2(3) and gethostbyaddr(3) use the same argume= nt name. > pj> The same argument name is also used in implementations of those fun= ctions. > pj> > pj> Modified: > pj> head/lib/libc/net/gethostbyname.3 > pj> > pj> Modified: head/lib/libc/net/gethostbyname.3 > pj> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > pj> --- head/lib/libc/net/gethostbyname.3 Sun Aug 18 10:33:46 2013 (r2544= 83) > pj> +++ head/lib/libc/net/gethostbyname.3 Sun Aug 18 10:38:59 2013 (r2544= 84) > pj> @@ -51,7 +51,7 @@ > pj> .Ft struct hostent * > pj> .Fn gethostbyname2 "const char *name" "int af" > pj> .Ft struct hostent * > pj> -.Fn gethostbyaddr "const void *addr" "socklen_t len" "int type" > pj> +.Fn gethostbyaddr "const void *addr" "socklen_t len" "int af" > pj> .Ft struct hostent * > pj> .Fn gethostent void > pj> .Ft void > pj> @@ -107,7 +107,7 @@ in binary form > pj> .Tn ASCII > pj> form). > pj> The > pj> -.Fa type > pj> +.Fa af > pj> argument specifies the address family > pj> (e.g.\& > pj> .Dv AF_INET , AF_INET6 , >=20 > I do not think we need to change this for consistency between the > manual page and its implementation. gethostbyaddr()'s "int type" > appears literally in POSIX and almost all systems have used that > definition for a long time. The reason I noticed was that address family argument was named 'af' in gethostbyname2() above, but 'type' in gethostbyaddr() - the same argument, but two different names. Originally I changed 'af' to 'type' for gethostbyname2(), but then decided that 'type' is just too universal and that implementation is using 'af', so I ended up changing 'type' in gethostbyaddr() to 'af'. Is POSIX consistent with naming address family argument for gethostbyaddr() and gethostbyname2()? I'm happy to change those two to 'type', I just would like the name to be consistent between those two functions. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://mobter.com --/NkBOFFp2J2Af1nK Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iEYEARECAAYFAlISEp4ACgkQForvXbEpPzS2ngCgjvvLZbcfK+GD7mIdSj3v7/ib BdsAoNLSoG8Od04QLEHJ+NBG4AjodoX2 =pfS9 -----END PGP SIGNATURE----- --/NkBOFFp2J2Af1nK-- From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 13:27:36 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 ESMTP id 4DF04F3E; Mon, 19 Aug 2013 13:27:36 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 2BA3D2E79; Mon, 19 Aug 2013 13:27: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 r7JDRaFJ063750; Mon, 19 Aug 2013 13:27:36 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JDRXFD063735; Mon, 19 Aug 2013 13:27:33 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308191327.r7JDRXFD063735@svn.freebsd.org> From: Andre Oppermann Date: Mon, 19 Aug 2013 13:27:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254523 - in head/sys: net net80211 netinet netinet6 netpfil/pf ofed/drivers/infiniband/ulp/ipoib 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.14 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, 19 Aug 2013 13:27:36 -0000 Author: andre Date: Mon Aug 19 13:27:32 2013 New Revision: 254523 URL: http://svnweb.freebsd.org/changeset/base/254523 Log: Add m_clrprotoflags() to clear protocol specific mbuf flags at up and downwards layer crossings. Consistently use it within IP, IPv6 and ethernet protocols. Discussed with: trociny, glebius Modified: head/sys/net/if_ethersubr.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_input.c head/sys/netinet/if_ether.c head/sys/netinet/igmp.c head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_output.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet6/ip6_mroute.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6.c head/sys/netinet6/send.c head/sys/netpfil/pf/pf.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c head/sys/sys/mbuf.h Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/net/if_ethersubr.c Mon Aug 19 13:27:32 2013 (r254523) @@ -774,7 +774,7 @@ ether_demux(struct ifnet *ifp, struct mb * Strip off Ethernet header. */ m->m_flags &= ~M_VLANTAG; - m->m_flags &= ~(M_PROTOFLAGS); + m_clrprotoflags(m); m_adj(m, ETHER_HDR_LEN); /* Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/net80211/ieee80211_hostap.c Mon Aug 19 13:27:32 2013 (r254523) @@ -355,7 +355,8 @@ hostap_deliver_data(struct ieee80211vap struct ifnet *ifp = vap->iv_ifp; /* clear driver/net80211 flags before passing up */ - m->m_flags &= ~(M_80211_RX | M_MCAST | M_BCAST); + m->m_flags &= ~(M_MCAST | M_BCAST); + m_clrprotoflags(m); KASSERT(vap->iv_opmode == IEEE80211_M_HOSTAP, ("gack, opmode %d", vap->iv_opmode)); Modified: head/sys/net80211/ieee80211_input.c ============================================================================== --- head/sys/net80211/ieee80211_input.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/net80211/ieee80211_input.c Mon Aug 19 13:27:32 2013 (r254523) @@ -250,7 +250,8 @@ ieee80211_deliver_data(struct ieee80211v struct ifnet *ifp = vap->iv_ifp; /* clear driver/net80211 flags before passing up */ - m->m_flags &= ~(M_80211_RX | M_MCAST | M_BCAST); + m->m_flags &= ~(M_MCAST | M_BCAST); + m_clrprotoflags(m); /* NB: see hostap_deliver_data, this path doesn't handle hostap */ KASSERT(vap->iv_opmode != IEEE80211_M_HOSTAP, ("gack, hostap")); Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/netinet/if_ether.c Mon Aug 19 13:27:32 2013 (r254523) @@ -281,6 +281,7 @@ arprequest(struct ifnet *ifp, const stru sa.sa_family = AF_ARP; sa.sa_len = 2; m->m_flags |= M_BCAST; + m_clrprotoflags(m); /* Avoid confusing lower layers. */ (*ifp->if_output)(ifp, m, &sa, NULL); ARPSTAT_INC(txrequests); } @@ -784,6 +785,8 @@ match: for (; m_hold != NULL; m_hold = m_hold_next) { m_hold_next = m_hold->m_nextpkt; m_hold->m_nextpkt = NULL; + /* Avoid confusing lower layers. */ + m_clrprotoflags(m_hold); (*ifp->if_output)(ifp, m_hold, &sa, NULL); } } else @@ -888,6 +891,7 @@ reply: m->m_pkthdr.rcvif = NULL; sa.sa_family = AF_ARP; sa.sa_len = 2; + m_clrprotoflags(m); /* Avoid confusing lower layers. */ (*ifp->if_output)(ifp, m, &sa, NULL); ARPSTAT_INC(txreplies); return; Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/netinet/igmp.c Mon Aug 19 13:27:32 2013 (r254523) @@ -3450,7 +3450,7 @@ igmp_intr(struct mbuf *m) } igmp_scrub_context(m0); - m->m_flags &= ~(M_PROTOFLAGS); + m_clrprotoflags(m); m0->m_pkthdr.rcvif = V_loif; #ifdef MAC mac_netinet_igmp_send(ifp, m0); Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/netinet/ip_fastfwd.c Mon Aug 19 13:27:32 2013 (r254523) @@ -525,6 +525,10 @@ passout: if (ip_len <= mtu || (ifp->if_hwassist & CSUM_FRAGMENT && (ip_off & IP_DF) == 0)) { /* + * Avoid confusing lower layers. + */ + m_clrprotoflags(m); + /* * Send off the packet via outgoing interface */ error = (*ifp->if_output)(ifp, m, @@ -553,6 +557,10 @@ passout: do { m0 = m->m_nextpkt; m->m_nextpkt = NULL; + /* + * Avoid confusing lower layers. + */ + m_clrprotoflags(m); error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, &ro); Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/netinet/ip_output.c Mon Aug 19 13:27:32 2013 (r254523) @@ -621,7 +621,7 @@ passout: * Reset layer specific mbuf flags * to avoid confusing lower layers. */ - m->m_flags &= ~(M_PROTOFLAGS); + m_clrprotoflags(m); error = (*ifp->if_output)(ifp, m, (const struct sockaddr *)gw, ro); goto done; @@ -654,7 +654,7 @@ passout: * Reset layer specific mbuf flags * to avoid confusing upper layers. */ - m->m_flags &= ~(M_PROTOFLAGS); + m_clrprotoflags(m); error = (*ifp->if_output)(ifp, m, (const struct sockaddr *)gw, ro); Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/netinet/sctp_os_bsd.h Mon Aug 19 13:27:32 2013 (r254523) @@ -444,12 +444,14 @@ typedef struct rtentry sctp_rtentry_t; local_stcb->sctp_ep && \ local_stcb->sctp_ep->sctp_socket) \ o_flgs |= local_stcb->sctp_ep->sctp_socket->so_options & SO_DONTROUTE; \ + m_clrprotoflags(o_pak); \ result = ip_output(o_pak, NULL, ro, o_flgs, 0, NULL); \ } #define SCTP_IP6_OUTPUT(result, o_pak, ro, ifp, stcb, vrf_id) \ { \ struct sctp_tcb *local_stcb = stcb; \ + m_clrprotoflags(o_pak); \ if (local_stcb && local_stcb->sctp_ep) \ result = ip6_output(o_pak, \ ((struct in6pcb *)(local_stcb->sctp_ep))->in6p_outputopts, \ Modified: head/sys/netinet6/ip6_mroute.c ============================================================================== --- head/sys/netinet6/ip6_mroute.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/netinet6/ip6_mroute.c Mon Aug 19 13:27:32 2013 (r254523) @@ -1648,6 +1648,7 @@ phyint_send(struct ip6_hdr *ip6, struct * We just call if_output instead of nd6_output here, since * we need no ND for a multicast forwarded packet...right? */ + m_clrprotoflags(m); /* Avoid confusing lower layers. */ error = (*ifp->if_output)(ifp, mb_copy, (struct sockaddr *)&dst6, NULL); #ifdef MRT6DEBUG Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/netinet6/mld6.c Mon Aug 19 13:27:32 2013 (r254523) @@ -3098,7 +3098,7 @@ mld_dispatch_packet(struct mbuf *m) } mld_scrub_context(m0); - m->m_flags &= ~(M_PROTOFLAGS); + m_clrprotoflags(m); m0->m_pkthdr.rcvif = V_loif; ip6 = mtod(m0, struct ip6_hdr *); Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/netinet6/nd6.c Mon Aug 19 13:27:32 2013 (r254523) @@ -2082,8 +2082,7 @@ nd6_output_lle(struct ifnet *ifp, struct } return (error); } - /* Reset layer specific mbuf flags to avoid confusing lower layers. */ - m->m_flags &= ~(M_PROTOFLAGS); + m_clrprotoflags(m); /* Avoid confusing lower layers. */ if ((ifp->if_flags & IFF_LOOPBACK) != 0) { return ((*ifp->if_output)(origifp, m, (struct sockaddr *)dst, NULL)); Modified: head/sys/netinet6/send.c ============================================================================== --- head/sys/netinet6/send.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/netinet6/send.c Mon Aug 19 13:27:32 2013 (r254523) @@ -180,6 +180,8 @@ send_output(struct mbuf *m, struct ifnet dst.sin6_len = sizeof(dst); dst.sin6_addr = ip6->ip6_dst; + m_clrprotoflags(m); /* Avoid confusing lower layers. */ + /* * Output the packet as nd6.c:nd6_output_lle() would do. * The mbuf is always consumed, so we do not have to care Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/netpfil/pf/pf.c Mon Aug 19 13:27:32 2013 (r254523) @@ -5310,7 +5310,7 @@ pf_route(struct mbuf **m, struct pf_rule ip->ip_sum = in_cksum(m0, ip->ip_hl << 2); m0->m_pkthdr.csum_flags &= ~CSUM_IP; } - m0->m_flags &= ~(M_PROTOFLAGS); + m_clrprotoflags(m0); /* Avoid confusing lower layers. */ error = (*ifp->if_output)(ifp, m0, sintosa(&dst), NULL); goto done; } @@ -5335,7 +5335,7 @@ pf_route(struct mbuf **m, struct pf_rule m1 = m0->m_nextpkt; m0->m_nextpkt = NULL; if (error == 0) { - m0->m_flags &= ~(M_PROTOFLAGS); + m_clrprotoflags(m0); error = (*ifp->if_output)(ifp, m0, sintosa(&dst), NULL); } else m_freem(m0); Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug 19 13:27:32 2013 (r254523) @@ -1442,7 +1442,7 @@ ipoib_input(struct ifnet *ifp, struct mb * Strip off Infiniband header. */ m->m_flags &= ~M_VLANTAG; - m->m_flags &= ~(M_PROTOFLAGS); + m_clrprotoflags(m); m_adj(m, IPOIB_HEADER_LEN); if (IPOIB_IS_MULTICAST(eh->hwaddr)) { Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Mon Aug 19 12:37:13 2013 (r254522) +++ head/sys/sys/mbuf.h Mon Aug 19 13:27:32 2013 (r254523) @@ -603,6 +603,13 @@ m_chtype(struct mbuf *m, short new_type) m->m_type = new_type; } +static __inline void +m_clrprotoflags(struct mbuf *m) +{ + + m->m_flags &= ~M_PROTOFLAGS; +} + static __inline struct mbuf * m_last(struct mbuf *m) { From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 13:56:14 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 ESMTP id C7F5298F; Mon, 19 Aug 2013 13:56:14 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 B52B42013; Mon, 19 Aug 2013 13:56:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7JDuEoV075074; Mon, 19 Aug 2013 13:56:14 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JDuELE075073; Mon, 19 Aug 2013 13:56:14 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308191356.r7JDuELE075073@svn.freebsd.org> From: Andre Oppermann Date: Mon, 19 Aug 2013 13:56:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254524 - 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.14 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, 19 Aug 2013 13:56:14 -0000 Author: andre Date: Mon Aug 19 13:56:14 2013 New Revision: 254524 URL: http://svnweb.freebsd.org/changeset/base/254524 Log: Add four additional M_PROTOFLAGS[9-12] for protocol specific use. Discussed with: trociny, glebius, adrian Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Mon Aug 19 13:27:32 2013 (r254523) +++ head/sys/sys/mbuf.h Mon Aug 19 13:56:14 2013 (r254524) @@ -196,22 +196,24 @@ struct mbuf { #define M_FRAG 0x00000800 /* packet is a fragment of a larger packet */ #define M_FIRSTFRAG 0x00001000 /* packet is first fragment */ #define M_LASTFRAG 0x00002000 /* packet is last fragment */ - /* 0x00004000 free */ - /* 0x00008000 free */ +#define M_PROTO9 0x00004000 /* protocol-specific */ +#define M_PROTO10 0x00008000 /* protocol-specific */ #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ #define M_PROMISC 0x00020000 /* packet was not for us */ - /* 0x00040000 free */ +#define M_PROTO11 0x00040000 /* protocol-specific */ #define M_PROTO6 0x00080000 /* protocol-specific */ #define M_PROTO7 0x00100000 /* protocol-specific */ #define M_PROTO8 0x00200000 /* protocol-specific */ #define M_FLOWID 0x00400000 /* deprecated: flowid is valid */ +#define M_PROTO12 0x00800000 /* protocol-specific */ #define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid hash type */ /* * Flags to purge when crossing layers. */ #define M_PROTOFLAGS \ - (M_PROTO1|M_PROTO2|M_PROTO3|M_PROTO4|M_PROTO5|M_PROTO6|M_PROTO7|M_PROTO8) + (M_PROTO1|M_PROTO2|M_PROTO3|M_PROTO4|M_PROTO5|M_PROTO6|M_PROTO7|M_PROTO8|\ + M_PROTO9|M_PROTO10|M_PROTO11|M_PROTO12) /* * Network interface cards are able to hash protocol fields (such as IPv4 From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 14: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 ESMTP id EA3A2C8A; Mon, 19 Aug 2013 14:04:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) 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 D7B7F20AD; Mon, 19 Aug 2013 14:04:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7JE4ZLh078798; Mon, 19 Aug 2013 14:04:35 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JE4ZhJ078797; Mon, 19 Aug 2013 14:04:35 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201308191404.r7JE4ZhJ078797@svn.freebsd.org> From: Glen Barber Date: Mon, 19 Aug 2013 14:04:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254525 - head/usr.sbin/pkg_install/add 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.14 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, 19 Aug 2013 14:04:36 -0000 Author: gjb Date: Mon Aug 19 14:04:35 2013 New Revision: 254525 URL: http://svnweb.freebsd.org/changeset/base/254525 Log: Add entry for packages-9.2-release directory. Approved by: re (implicit) Modified: head/usr.sbin/pkg_install/add/main.c Modified: head/usr.sbin/pkg_install/add/main.c ============================================================================== --- head/usr.sbin/pkg_install/add/main.c Mon Aug 19 13:56:14 2013 (r254524) +++ head/usr.sbin/pkg_install/add/main.c Mon Aug 19 14:04:35 2013 (r254525) @@ -90,6 +90,7 @@ struct { { 803000, 803499, "/packages-8.3-release" }, { 900000, 900499, "/packages-9.0-release" }, { 901000, 901499, "/packages-9.1-release" }, + { 902000, 902499, "/packages-9.2-release" }, { 300000, 399000, "/packages-3-stable" }, { 400000, 499000, "/packages-4-stable" }, { 502100, 502128, "/packages-5-current" }, From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 14:07: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 ESMTP id D2CA6DF3; Mon, 19 Aug 2013 14:07:32 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 A5A6720C9; Mon, 19 Aug 2013 14:07: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 r7JE7WD8079488; Mon, 19 Aug 2013 14:07:32 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JE7WI8079484; Mon, 19 Aug 2013 14:07:32 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308191407.r7JE7WI8079484@svn.freebsd.org> From: Andre Oppermann Date: Mon, 19 Aug 2013 14:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254526 - in head/sys: net80211 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.14 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, 19 Aug 2013 14:07:32 -0000 Author: andre Date: Mon Aug 19 14:07:31 2013 New Revision: 254526 URL: http://svnweb.freebsd.org/changeset/base/254526 Log: Migrate the net80211 protocol specific use of M_FRAG, M_FIRSTFRAG and M_LASTFRAG flags to protocol specific flags. Remove the now unused M_FRAG, M_FIRSTFRAG and M_LASTFRAG mbuf flags. Discussed with: trociny, glebius, adrian Modified: head/sys/net80211/ieee80211_freebsd.h head/sys/sys/mbuf.h Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Mon Aug 19 14:04:35 2013 (r254525) +++ head/sys/net80211/ieee80211_freebsd.h Mon Aug 19 14:07:31 2013 (r254526) @@ -234,9 +234,12 @@ struct mbuf *ieee80211_getmgtframe(uint8 #define M_FF M_PROTO6 /* fast frame */ #define M_TXCB M_PROTO7 /* do tx complete callback */ #define M_AMPDU_MPDU M_PROTO8 /* ok for A-MPDU aggregation */ +#define M_FRAG M_PROTO9 /* frame fragmentation */ +#define M_FIRSTFRAG M_PROTO10 /* first frame fragment */ +#define M_LASTFRAG M_PROTO11 /* last frame fragment */ #define M_80211_TX \ - (M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_ENCAP|M_EAPOL|M_PWR_SAV|\ - M_MORE_DATA|M_FF|M_TXCB|M_AMPDU_MPDU) + (M_ENCAP|M_EAPOL|M_PWR_SAV|M_MORE_DATA|M_FF|M_TXCB| \ + M_AMPDU_MPDU|M_FRAG|M_FIRSTFRAG|M_LASTFRAG) /* rx path usage */ #define M_AMPDU M_PROTO1 /* A-MPDU subframe */ Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Mon Aug 19 14:04:35 2013 (r254525) +++ head/sys/sys/mbuf.h Mon Aug 19 14:07:31 2013 (r254526) @@ -193,9 +193,9 @@ struct mbuf { #define M_PROTO5 0x00000100 /* protocol-specific */ #define M_BCAST 0x00000200 /* send/received as link-level broadcast */ #define M_MCAST 0x00000400 /* send/received as link-level multicast */ -#define M_FRAG 0x00000800 /* packet is a fragment of a larger packet */ -#define M_FIRSTFRAG 0x00001000 /* packet is first fragment */ -#define M_LASTFRAG 0x00002000 /* packet is last fragment */ + /* 0x00000800 free */ + /* 0x00001000 free */ + /* 0x00002000 free */ #define M_PROTO9 0x00004000 /* protocol-specific */ #define M_PROTO10 0x00008000 /* protocol-specific */ #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ @@ -254,7 +254,7 @@ struct mbuf { */ #define M_COPYFLAGS \ (M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_BCAST|M_MCAST|\ - M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG|M_PROMISC|M_HASHTYPEBITS) + M_VLANTAG|M_PROMISC|M_HASHTYPEBITS) /* * External buffer types: identify ext_buf type. From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 14:25: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 ESMTP id 0AC98429; Mon, 19 Aug 2013 14:25:13 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 DCE1B21F2; Mon, 19 Aug 2013 14:25: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 r7JEPC3d086848; Mon, 19 Aug 2013 14:25:12 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JEPCsT086845; Mon, 19 Aug 2013 14:25:12 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308191425.r7JEPCsT086845@svn.freebsd.org> From: Andre Oppermann Date: Mon, 19 Aug 2013 14:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254527 - in head/sys: net80211 netinet 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.14 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, 19 Aug 2013 14:25:13 -0000 Author: andre Date: Mon Aug 19 14:25:11 2013 New Revision: 254527 URL: http://svnweb.freebsd.org/changeset/base/254527 Log: Reorder the mbuf defines to make more sense and group related flags together. Add M_FLAG_PRINTF for use with printf(9) %b indentifier. Use the generic mbuf flags print names in the net80211 code and adjust the protocol specific bits for their new positions. Change SCTP M_PROTO mapping from 5 to 1 to fit within the 16bit field they use internally to store some additional information. Discussed with: trociny, glebius Modified: head/sys/net80211/ieee80211_freebsd.h head/sys/netinet/sctp_os_bsd.h head/sys/sys/mbuf.h Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Mon Aug 19 14:07:31 2013 (r254526) +++ head/sys/net80211/ieee80211_freebsd.h Mon Aug 19 14:25:11 2013 (r254527) @@ -250,16 +250,13 @@ struct mbuf *ieee80211_getmgtframe(uint8 #define M_80211_RX (M_AMPDU|M_WEP|M_AMPDU_MPDU) #define IEEE80211_MBUF_TX_FLAG_BITS \ - "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_ENCAP\6M_WEP\7M_EAPOL" \ - "\10M_PWR_SAV\11M_MORE_DATA\12M_BCAST\13M_MCAST\14M_FRAG\15M_FIRSTFRAG" \ - "\16M_LASTFRAG\17M_SKIP_FIREWALL\20M_FREELIST\21M_VLANTAG\22M_PROMISC" \ - "\23M_NOFREE\24M_FF\25M_TXCB\26M_AMPDU_MPDU\27M_FLOWID" + M_FLAG_BITS \ + "\15M_ENCAP\17M_EAPOL\20M_PWR_SAV\21M_MORE_DATA\22M_FF\23M_TXCB" \ + "\24M_AMPDU_MPDU\25M_FRAG\26M_FIRSTFRAG\27M_LASTFRAG" #define IEEE80211_MBUF_RX_FLAG_BITS \ - "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_AMPDU\6M_WEP\7M_PROTO3" \ - "\10M_PROTO4\11M_PROTO5\12M_BCAST\13M_MCAST\14M_FRAG\15M_FIRSTFRAG" \ - "\16M_LASTFRAG\17M_SKIP_FIREWALL\20M_FREELIST\21M_VLANTAG\22M_PROMISC" \ - "\23M_NOFREE\24M_PROTO6\25M_PROTO7\26M_AMPDU_MPDU\27M_FLOWID" + M_FLAG_BITS \ + "\15M_AMPDU\16M_WEP\24M_AMPDU_MPDU" /* * Store WME access control bits in the vlan tag. Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Mon Aug 19 14:07:31 2013 (r254526) +++ head/sys/netinet/sctp_os_bsd.h Mon Aug 19 14:25:11 2013 (r254527) @@ -431,7 +431,7 @@ typedef struct rtentry sctp_rtentry_t; /* * SCTP protocol specific mbuf flags. */ -#define M_NOTIFICATION M_PROTO5 /* SCTP notification */ +#define M_NOTIFICATION M_PROTO1 /* SCTP notification */ /* * IP output routines Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Mon Aug 19 14:07:31 2013 (r254526) +++ head/sys/sys/mbuf.h Mon Aug 19 14:25:11 2013 (r254527) @@ -186,26 +186,25 @@ struct mbuf { #define M_PKTHDR 0x00000002 /* start of record */ #define M_EOR 0x00000004 /* end of record */ #define M_RDONLY 0x00000008 /* associated data is marked read-only */ -#define M_PROTO1 0x00000010 /* protocol-specific */ -#define M_PROTO2 0x00000020 /* protocol-specific */ -#define M_PROTO3 0x00000040 /* protocol-specific */ -#define M_PROTO4 0x00000080 /* protocol-specific */ -#define M_PROTO5 0x00000100 /* protocol-specific */ -#define M_BCAST 0x00000200 /* send/received as link-level broadcast */ -#define M_MCAST 0x00000400 /* send/received as link-level multicast */ - /* 0x00000800 free */ - /* 0x00001000 free */ - /* 0x00002000 free */ -#define M_PROTO9 0x00004000 /* protocol-specific */ -#define M_PROTO10 0x00008000 /* protocol-specific */ -#define M_VLANTAG 0x00010000 /* ether_vtag is valid */ -#define M_PROMISC 0x00020000 /* packet was not for us */ -#define M_PROTO11 0x00040000 /* protocol-specific */ -#define M_PROTO6 0x00080000 /* protocol-specific */ -#define M_PROTO7 0x00100000 /* protocol-specific */ -#define M_PROTO8 0x00200000 /* protocol-specific */ -#define M_FLOWID 0x00400000 /* deprecated: flowid is valid */ +#define M_BCAST 0x00000010 /* send/received as link-level broadcast */ +#define M_MCAST 0x00000020 /* send/received as link-level multicast */ +#define M_PROMISC 0x00000040 /* packet was not for us */ +#define M_VLANTAG 0x00000080 /* ether_vtag is valid */ +#define M_FLOWID 0x00000100 /* deprecated: flowid is valid */ + +#define M_PROTO1 0x00001000 /* protocol-specific */ +#define M_PROTO2 0x00002000 /* protocol-specific */ +#define M_PROTO3 0x00004000 /* protocol-specific */ +#define M_PROTO4 0x00008000 /* protocol-specific */ +#define M_PROTO5 0x00010000 /* protocol-specific */ +#define M_PROTO6 0x00020000 /* protocol-specific */ +#define M_PROTO7 0x00040000 /* protocol-specific */ +#define M_PROTO8 0x00080000 /* protocol-specific */ +#define M_PROTO9 0x00100000 /* protocol-specific */ +#define M_PROTO10 0x00200000 /* protocol-specific */ +#define M_PROTO11 0x00400000 /* protocol-specific */ #define M_PROTO12 0x00800000 /* protocol-specific */ + #define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid hash type */ /* @@ -216,6 +215,18 @@ struct mbuf { M_PROTO9|M_PROTO10|M_PROTO11|M_PROTO12) /* + * Mbuf flag description for use with printf(9) %b identifier. + */ +#define M_FLAG_BITS \ + "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_BCAST\6M_MCAST" \ + "\7M_PROMISC\10M_VLANTAG\11M_FLOWID" +#define M_FLAG_PROTOBITS \ + "\15M_PROTO1\16M_PROTO2\17M_PROTO3\20M_PROTO4\21M_PROTO5" \ + "\22M_PROTO6\23M_PROTO7\24M_PROTO8\25M_PROTO9\26M_PROTO10" \ + "\27M_PROTO11\30M_PROTO12" +#define M_FLAG_PRINTF (M_FLAG_BITS M_FLAG_PROTOBITS) + +/* * Network interface cards are able to hash protocol fields (such as IPv4 * addresses and TCP port numbers) classify packets into flows. These flows * can then be used to maintain ordering while delivering packets to the OS @@ -253,8 +264,8 @@ struct mbuf { * Flags preserved when copying m_pkthdr. */ #define M_COPYFLAGS \ - (M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_BCAST|M_MCAST|\ - M_VLANTAG|M_PROMISC|M_HASHTYPEBITS) + (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_VLANTAG|M_PROMISC| \ + M_PROTOFLAGS|M_HASHTYPEBITS) /* * External buffer types: identify ext_buf type. From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 14:56: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 ESMTP id 7E609DE; Mon, 19 Aug 2013 14:56:18 +0000 (UTC) (envelope-from raj@FreeBSD.org) 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 6B4D223DC; Mon, 19 Aug 2013 14:56: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 r7JEuIa6098510; Mon, 19 Aug 2013 14:56:18 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JEuIwK098509; Mon, 19 Aug 2013 14:56:18 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201308191456.r7JEuIwK098509@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 19 Aug 2013 14:56:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254531 - head/sys/arm/arm 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.14 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, 19 Aug 2013 14:56:18 -0000 Author: raj Date: Mon Aug 19 14:56:17 2013 New Revision: 254531 URL: http://svnweb.freebsd.org/changeset/base/254531 Log: Simplify pv_entry removal or ARMv6/v7: - PGA_WRITEABLE indicates that there *might be* a writable mapping for the particular page, so to avoid frequent sweeping of the pv_entries whenever pmap_nuke_pv(), pmap_modify_pv(), etc. is called, it is sufficient to clear that flag if there are no managed mappings for that page anymore (notice that only pmap_enter is authorized to set this flag). - Avoid redundant checking for PVF_WIRED flag when this flag cannot be set anyway. - Clear PGA_WRITEABLE only once for each vm_page instead of multiple, redundant clearing it in loop when there are no writeable mappings to that page anymore. Submitted by: Zbigniew Bodek Reviewed by: gber Sponsored by: The FreeBSD Foundation, Semihalf Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Mon Aug 19 14:42:39 2013 (r254530) +++ head/sys/arm/arm/pmap-v6.c Mon Aug 19 14:56:17 2013 (r254531) @@ -1072,39 +1072,22 @@ pmap_set_prot(pt_entry_t *ptep, vm_prot_ * => caller should NOT adjust pmap's wire_count * => we return the removed pve */ - -static void -pmap_nuke_pv(struct vm_page *m, pmap_t pmap, struct pv_entry *pve) -{ - - rw_assert(&pvh_global_lock, RA_WLOCKED); - PMAP_ASSERT_LOCKED(pmap); - - TAILQ_REMOVE(&m->md.pv_list, pve, pv_list); - - if (pve->pv_flags & PVF_WIRED) - --pmap->pm_stats.wired_count; - - if (pve->pv_flags & PVF_WRITE) { - TAILQ_FOREACH(pve, &m->md.pv_list, pv_list) - if (pve->pv_flags & PVF_WRITE) - break; - if (!pve) { - vm_page_aflag_clear(m, PGA_WRITEABLE); - } - } -} - static struct pv_entry * pmap_remove_pv(struct vm_page *m, pmap_t pmap, vm_offset_t va) { struct pv_entry *pve; rw_assert(&pvh_global_lock, RA_WLOCKED); + PMAP_ASSERT_LOCKED(pmap); pve = pmap_find_pv(m, pmap, va); /* find corresponding pve */ - if (pve != NULL) - pmap_nuke_pv(m, pmap, pve); + if (pve != NULL) { + TAILQ_REMOVE(&m->md.pv_list, pve, pv_list); + if (pve->pv_flags & PVF_WIRED) + --pmap->pm_stats.wired_count; + } + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_aflag_clear(m, PGA_WRITEABLE); return(pve); /* return removed pve */ } @@ -1143,14 +1126,6 @@ pmap_modify_pv(struct vm_page *m, pmap_t else --pmap->pm_stats.wired_count; } - if ((oflags & PVF_WRITE) && !(flags & PVF_WRITE)) { - TAILQ_FOREACH(npv, &m->md.pv_list, pv_list) { - if (npv->pv_flags & PVF_WRITE) - break; - } - if (!npv) - vm_page_aflag_clear(m, PGA_WRITEABLE); - } return (oflags); } @@ -2062,7 +2037,9 @@ pmap_remove_pages(pmap_t pmap) pv_entry_count--; pmap->pm_stats.resident_count--; pc->pc_map[field] |= bitmask; - pmap_nuke_pv(m, pmap, pv); + TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_aflag_clear(m, PGA_WRITEABLE); pmap_free_l2_bucket(pmap, l2b, 1); } } @@ -2458,7 +2435,9 @@ pmap_remove_all(vm_page_t m) PTE_SYNC(ptep); pmap_free_l2_bucket(pmap, l2b, 1); pmap->pm_stats.resident_count--; - pmap_nuke_pv(m, pmap, pv); + TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); + if (pv->pv_flags & PVF_WIRED) + pmap->pm_stats.wired_count--; pmap_free_pv_entry(pmap, pv); PMAP_UNLOCK(pmap); } @@ -2469,6 +2448,7 @@ pmap_remove_all(vm_page_t m) else cpu_tlb_flushD(); } + vm_page_aflag_clear(m, PGA_WRITEABLE); rw_wunlock(&pvh_global_lock); } @@ -3338,7 +3318,9 @@ pmap_pv_reclaim(pmap_t locked_pmap) "va %x pte %x", va, *ptep)); *ptep = 0; PTE_SYNC(ptep); - pmap_nuke_pv(m, pmap, pv); + TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_aflag_clear(m, PGA_WRITEABLE); pc->pc_map[field] |= 1UL << bit; freed++; } From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 15:12: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 ESMTP id 71716533; Mon, 19 Aug 2013 15:12:37 +0000 (UTC) (envelope-from raj@FreeBSD.org) 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 5EB5D24C7; Mon, 19 Aug 2013 15:12: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 r7JFCbqK005938; Mon, 19 Aug 2013 15:12:37 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JFCb32005933; Mon, 19 Aug 2013 15:12:37 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201308191512.r7JFCb32005933@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 19 Aug 2013 15:12:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254532 - in head/sys/arm: arm include 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.14 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, 19 Aug 2013 15:12:37 -0000 Author: raj Date: Mon Aug 19 15:12:36 2013 New Revision: 254532 URL: http://svnweb.freebsd.org/changeset/base/254532 Log: Clear all L2 PTE protection bits before their configuration. Revise L2_S_PROT_MASK to include all of the protection bits. Notice that clearing these bits does not always take away the corresponding permissions (for example, permission is granted when the bit is cleared). The bits are cleared but are to be set or left cleared accordingly in pmap_set_prot(), pmap_enter_locked(), etc. Clear L2_XN along with L2_S_PROT_MASK in pmap_set_prot() so that all permissions related bits are cleared before actual configuration. Submitted by: Zbigniew Bodek Reviewed by: gber Sponsored by: The FreeBSD Foundation, Semihalf Modified: head/sys/arm/arm/pmap-v6.c head/sys/arm/include/pmap.h Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Mon Aug 19 14:56:17 2013 (r254531) +++ head/sys/arm/arm/pmap-v6.c Mon Aug 19 15:12:36 2013 (r254532) @@ -1046,7 +1046,7 @@ static void pmap_set_prot(pt_entry_t *ptep, vm_prot_t prot, uint8_t user) { - *ptep &= ~L2_S_PROT_MASK; + *ptep &= ~(L2_S_PROT_MASK | L2_XN); if (!(prot & VM_PROT_EXECUTE)) *ptep |= L2_XN; Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Mon Aug 19 14:56:17 2013 (r254531) +++ head/sys/arm/include/pmap.h Mon Aug 19 15:12:36 2013 (r254532) @@ -390,7 +390,7 @@ extern int pmap_needs_pte_sync; #define L2_S_PROT_U (L2_AP0(2)) /* user read */ #define L2_S_REF (L2_AP0(1)) /* reference flag */ -#define L2_S_PROT_MASK (L2_S_PROT_U|L2_S_PROT_R) +#define L2_S_PROT_MASK (L2_S_PROT_U|L2_S_PROT_R|L2_APX) #define L2_S_EXECUTABLE(pte) (!(pte & L2_XN)) #define L2_S_WRITABLE(pte) (!(pte & L2_APX)) #define L2_S_REFERENCED(pte) (!!(pte & L2_S_REF)) From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 15:12: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 ESMTP id AA8A064D; Mon, 19 Aug 2013 15:12:45 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wg0-x22f.google.com (mail-wg0-x22f.google.com [IPv6:2a00:1450:400c:c00::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A7EEA24CC; Mon, 19 Aug 2013 15:12:44 +0000 (UTC) Received: by mail-wg0-f47.google.com with SMTP id j13so3549891wgh.26 for ; Mon, 19 Aug 2013 08:12:43 -0700 (PDT) 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=R/Dbo5dBY+GsgIMtEqjBOUt7KeLU4+TwhNB5Svvmb88=; b=SJP2fd8DFlD58Xm+DxOtxMYlmJEW/sGoILd99sC8pzJq+HuaECgFnMYBteWI37as9M O9qPB5TaNtHyrN/rNniV3yDeINpaO3QCmKoekc2q3hFpxHdnni6C631d6AsAlg1zDIqC iNy/5L/UdN0uEL+l8tykZiePVUINOTyFuOJ/hz4Zfu0zau69OXU8lQBUsc927QDoHlTO GBNmV/CkW+OpQ+KhG7IZAqAVuUV0O98r4z4AAWutDmMTTOUZTHUYJngfqodmQ1GnBG2F aQs4+4LhVde3FwaE2o/iGFvKttpTMtYa3SvDEW50F7NO48631tXOJ02lau4D8PJ1TNRk jvgg== MIME-Version: 1.0 X-Received: by 10.194.94.37 with SMTP id cz5mr1768346wjb.55.1376925162896; Mon, 19 Aug 2013 08:12:42 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.217.116.136 with HTTP; Mon, 19 Aug 2013 08:12:42 -0700 (PDT) In-Reply-To: <201308191425.r7JEPCsT086845@svn.freebsd.org> References: <201308191425.r7JEPCsT086845@svn.freebsd.org> Date: Mon, 19 Aug 2013 08:12:42 -0700 X-Google-Sender-Auth: scrp7RcDQRJ-FdxWaQR3-h84ROk Message-ID: Subject: Re: svn commit: r254527 - in head/sys: net80211 netinet sys From: Adrian Chadd To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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.14 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, 19 Aug 2013 15:12:45 -0000 Hi, Would you please bump FreeBSD_version ? I'd like to make the net80211 on -HEAD build on -9, and this is one of those changes that will break that. Thanks! -adrian On 19 August 2013 07:25, Andre Oppermann wrote: > Author: andre > Date: Mon Aug 19 14:25:11 2013 > New Revision: 254527 > URL: http://svnweb.freebsd.org/changeset/base/254527 > > Log: > Reorder the mbuf defines to make more sense and group related flags > together. > > Add M_FLAG_PRINTF for use with printf(9) %b indentifier. > > Use the generic mbuf flags print names in the net80211 code and adjust > the protocol specific bits for their new positions. > > Change SCTP M_PROTO mapping from 5 to 1 to fit within the 16bit field > they use internally to store some additional information. > > Discussed with: trociny, glebius > > Modified: > head/sys/net80211/ieee80211_freebsd.h > head/sys/netinet/sctp_os_bsd.h > head/sys/sys/mbuf.h > > Modified: head/sys/net80211/ieee80211_freebsd.h > > ============================================================================== > --- head/sys/net80211/ieee80211_freebsd.h Mon Aug 19 14:07:31 2013 > (r254526) > +++ head/sys/net80211/ieee80211_freebsd.h Mon Aug 19 14:25:11 2013 > (r254527) > @@ -250,16 +250,13 @@ struct mbuf *ieee80211_getmgtframe(uint8 > #define M_80211_RX (M_AMPDU|M_WEP|M_AMPDU_MPDU) > > #define IEEE80211_MBUF_TX_FLAG_BITS \ > - "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_ENCAP\6M_WEP\7M_EAPOL" \ > - > "\10M_PWR_SAV\11M_MORE_DATA\12M_BCAST\13M_MCAST\14M_FRAG\15M_FIRSTFRAG" \ > - > "\16M_LASTFRAG\17M_SKIP_FIREWALL\20M_FREELIST\21M_VLANTAG\22M_PROMISC" \ > - "\23M_NOFREE\24M_FF\25M_TXCB\26M_AMPDU_MPDU\27M_FLOWID" > + M_FLAG_BITS \ > + "\15M_ENCAP\17M_EAPOL\20M_PWR_SAV\21M_MORE_DATA\22M_FF\23M_TXCB" \ > + "\24M_AMPDU_MPDU\25M_FRAG\26M_FIRSTFRAG\27M_LASTFRAG" > > #define IEEE80211_MBUF_RX_FLAG_BITS \ > - "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_AMPDU\6M_WEP\7M_PROTO3" \ > - > "\10M_PROTO4\11M_PROTO5\12M_BCAST\13M_MCAST\14M_FRAG\15M_FIRSTFRAG" \ > - > "\16M_LASTFRAG\17M_SKIP_FIREWALL\20M_FREELIST\21M_VLANTAG\22M_PROMISC" \ > - "\23M_NOFREE\24M_PROTO6\25M_PROTO7\26M_AMPDU_MPDU\27M_FLOWID" > + M_FLAG_BITS \ > + "\15M_AMPDU\16M_WEP\24M_AMPDU_MPDU" > > /* > * Store WME access control bits in the vlan tag. > > Modified: head/sys/netinet/sctp_os_bsd.h > > ============================================================================== > --- head/sys/netinet/sctp_os_bsd.h Mon Aug 19 14:07:31 2013 > (r254526) > +++ head/sys/netinet/sctp_os_bsd.h Mon Aug 19 14:25:11 2013 > (r254527) > @@ -431,7 +431,7 @@ typedef struct rtentry sctp_rtentry_t; > /* > * SCTP protocol specific mbuf flags. > */ > -#define M_NOTIFICATION M_PROTO5 /* SCTP > notification */ > +#define M_NOTIFICATION M_PROTO1 /* SCTP > notification */ > > /* > * IP output routines > > Modified: head/sys/sys/mbuf.h > > ============================================================================== > --- head/sys/sys/mbuf.h Mon Aug 19 14:07:31 2013 (r254526) > +++ head/sys/sys/mbuf.h Mon Aug 19 14:25:11 2013 (r254527) > @@ -186,26 +186,25 @@ struct mbuf { > #define M_PKTHDR 0x00000002 /* start of record */ > #define M_EOR 0x00000004 /* end of record */ > #define M_RDONLY 0x00000008 /* associated data is marked > read-only */ > -#define M_PROTO1 0x00000010 /* protocol-specific */ > -#define M_PROTO2 0x00000020 /* protocol-specific */ > -#define M_PROTO3 0x00000040 /* protocol-specific */ > -#define M_PROTO4 0x00000080 /* protocol-specific */ > -#define M_PROTO5 0x00000100 /* protocol-specific */ > -#define M_BCAST 0x00000200 /* send/received as link-level > broadcast */ > -#define M_MCAST 0x00000400 /* send/received as link-level > multicast */ > - /* 0x00000800 free */ > - /* 0x00001000 free */ > - /* 0x00002000 free */ > -#define M_PROTO9 0x00004000 /* protocol-specific */ > -#define M_PROTO10 0x00008000 /* protocol-specific */ > -#define M_VLANTAG 0x00010000 /* ether_vtag is valid */ > -#define M_PROMISC 0x00020000 /* packet was not for us */ > -#define M_PROTO11 0x00040000 /* protocol-specific */ > -#define M_PROTO6 0x00080000 /* protocol-specific */ > -#define M_PROTO7 0x00100000 /* protocol-specific */ > -#define M_PROTO8 0x00200000 /* protocol-specific */ > -#define M_FLOWID 0x00400000 /* deprecated: flowid is valid > */ > +#define M_BCAST 0x00000010 /* send/received as link-level > broadcast */ > +#define M_MCAST 0x00000020 /* send/received as link-level > multicast */ > +#define M_PROMISC 0x00000040 /* packet was not for us */ > +#define M_VLANTAG 0x00000080 /* ether_vtag is valid */ > +#define M_FLOWID 0x00000100 /* deprecated: flowid is valid > */ > + > +#define M_PROTO1 0x00001000 /* protocol-specific */ > +#define M_PROTO2 0x00002000 /* protocol-specific */ > +#define M_PROTO3 0x00004000 /* protocol-specific */ > +#define M_PROTO4 0x00008000 /* protocol-specific */ > +#define M_PROTO5 0x00010000 /* protocol-specific */ > +#define M_PROTO6 0x00020000 /* protocol-specific */ > +#define M_PROTO7 0x00040000 /* protocol-specific */ > +#define M_PROTO8 0x00080000 /* protocol-specific */ > +#define M_PROTO9 0x00100000 /* protocol-specific */ > +#define M_PROTO10 0x00200000 /* protocol-specific */ > +#define M_PROTO11 0x00400000 /* protocol-specific */ > #define M_PROTO12 0x00800000 /* protocol-specific */ > + > #define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid > hash type */ > > /* > @@ -216,6 +215,18 @@ struct mbuf { > M_PROTO9|M_PROTO10|M_PROTO11|M_PROTO12) > > /* > + * Mbuf flag description for use with printf(9) %b identifier. > + */ > +#define M_FLAG_BITS \ > + "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_BCAST\6M_MCAST" \ > + "\7M_PROMISC\10M_VLANTAG\11M_FLOWID" > +#define M_FLAG_PROTOBITS \ > + "\15M_PROTO1\16M_PROTO2\17M_PROTO3\20M_PROTO4\21M_PROTO5" \ > + "\22M_PROTO6\23M_PROTO7\24M_PROTO8\25M_PROTO9\26M_PROTO10" \ > + "\27M_PROTO11\30M_PROTO12" > +#define M_FLAG_PRINTF (M_FLAG_BITS M_FLAG_PROTOBITS) > + > +/* > * Network interface cards are able to hash protocol fields (such as IPv4 > * addresses and TCP port numbers) classify packets into flows. These > flows > * can then be used to maintain ordering while delivering packets to the > OS > @@ -253,8 +264,8 @@ struct mbuf { > * Flags preserved when copying m_pkthdr. > */ > #define M_COPYFLAGS \ > - (M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_BCAST|M_MCAST|\ > - M_VLANTAG|M_PROMISC|M_HASHTYPEBITS) > + (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_VLANTAG|M_PROMISC| \ > + M_PROTOFLAGS|M_HASHTYPEBITS) > > /* > * External buffer types: identify ext_buf type. > From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 15:36: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 ESMTP id 3464354D; Mon, 19 Aug 2013 15:36:24 +0000 (UTC) (envelope-from raj@FreeBSD.org) 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 21421262E; Mon, 19 Aug 2013 15:36: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 r7JFaNBu014366; Mon, 19 Aug 2013 15:36:23 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JFaNek014365; Mon, 19 Aug 2013 15:36:23 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201308191536.r7JFaNek014365@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 19 Aug 2013 15:36:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254533 - head/sys/arm/arm 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.14 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, 19 Aug 2013 15:36:24 -0000 Author: raj Date: Mon Aug 19 15:36:23 2013 New Revision: 254533 URL: http://svnweb.freebsd.org/changeset/base/254533 Log: Fix ARMv6/v7 mapping's wired status. Last input argument in pmap_modify_pv() should be a mask of flags to be set. In pmap_change_wiring() however, the straight wired status was used, which does not represent valid flags (and is of type boolean). This commit fixes the issue so that wired flag is passed to pmap_modify_pv() properly. Submitted by: Zbigniew Bodek Reviewed by: gber Sponsored by: The FreeBSD Foundation, Semihalf Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Mon Aug 19 15:12:36 2013 (r254532) +++ head/sys/arm/arm/pmap-v6.c Mon Aug 19 15:36:23 2013 (r254533) @@ -2932,7 +2932,8 @@ pmap_change_wiring(pmap_t pmap, vm_offse pte = *ptep; m = PHYS_TO_VM_PAGE(l2pte_pa(pte)); if (m != NULL) - pmap_modify_pv(m, pmap, va, PVF_WIRED, wired); + pmap_modify_pv(m, pmap, va, PVF_WIRED, + wired == TRUE ? PVF_WIRED : 0); rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 15:51: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 ESMTP id 607C1E65; Mon, 19 Aug 2013 15:51:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 3385D2705; Mon, 19 Aug 2013 15:51: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 r7JFpVIQ021010; Mon, 19 Aug 2013 15:51:31 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JFpUIY021004; Mon, 19 Aug 2013 15:51:30 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308191551.r7JFpUIY021004@svn.freebsd.org> From: Ian Lepore Date: Mon, 19 Aug 2013 15:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254534 - in head/sys: conf dev/uart 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.14 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, 19 Aug 2013 15:51:31 -0000 Author: ian Date: Mon Aug 19 15:51:30 2013 New Revision: 254534 URL: http://svnweb.freebsd.org/changeset/base/254534 Log: Allow UART_POLL_FREQ to be set as a kernel option as well as via tunable (the code was already set up for this, just needs to be in conf/options). Also, if reporting that polling is being used, report the frequency too. Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/dev/uart/uart_core.c Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Aug 19 15:36:23 2013 (r254533) +++ head/sys/conf/NOTES Mon Aug 19 15:51:30 2013 (r254534) @@ -1801,6 +1801,8 @@ device uart # Options for uart(4) options UART_PPS_ON_CTS # Do time pulse capturing using CTS # instead of DCD. +options UART_POLL_FREQ # Set polling rate, used when hw has + # no interrupt support (50 Hz default). # The following hint should only be used for pure ISA devices. It is not # needed otherwise. Use of hints is strongly discouraged. Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Aug 19 15:36:23 2013 (r254533) +++ head/sys/conf/options Mon Aug 19 15:51:30 2013 (r254534) @@ -641,8 +641,9 @@ BKTR_SIS_VIA_MODE opt_bktr.h BKTR_USE_FREEBSD_SMBUS opt_bktr.h BKTR_NEW_MSP34XX_DRIVER opt_bktr.h -# Options to support PPS +# Options for uart(4) UART_PPS_ON_CTS opt_uart.h +UART_POLL_FREQ opt_uart.h # options for bus/device framework BUS_DEBUG opt_bus.h Modified: head/sys/dev/uart/uart_core.c ============================================================================== --- head/sys/dev/uart/uart_core.c Mon Aug 19 15:36:23 2013 (r254533) +++ head/sys/dev/uart/uart_core.c Mon Aug 19 15:51:30 2013 (r254534) @@ -537,7 +537,7 @@ uart_bus_attach(device_t dev) sep = ", "; } if (sc->sc_polled) { - printf("%spolled mode", sep); + printf("%spolled mode (%dHz)", sep, uart_poll_freq); sep = ", "; } printf("\n"); From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 15:58:40 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 ESMTP id 48731263; Mon, 19 Aug 2013 15:58:40 +0000 (UTC) (envelope-from raj@FreeBSD.org) 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 35A6F2745; Mon, 19 Aug 2013 15:58:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7JFweBF022366; Mon, 19 Aug 2013 15:58:40 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JFweiw022365; Mon, 19 Aug 2013 15:58:40 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201308191558.r7JFweiw022365@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 19 Aug 2013 15:58:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254535 - head/sys/arm/arm 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.14 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, 19 Aug 2013 15:58:40 -0000 Author: raj Date: Mon Aug 19 15:58:39 2013 New Revision: 254535 URL: http://svnweb.freebsd.org/changeset/base/254535 Log: Simplify and clean up pmap_clearbit() There is no need for calling vm_page_dirty() when clearing "modified" flag as it is already set for that page in pmap_fault_fixup() or pmap_enter() thanks to "modified" bit emulation. Also, there is no need for checking PTE "referenced" or "writeable" flags. If there is a request to clear a particular flag we should just do it. Submitted by: Zbigniew Bodek Reviewed by: gber Sponsored by: The FreeBSD Foundation, Semihalf Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Mon Aug 19 15:51:30 2013 (r254534) +++ head/sys/arm/arm/pmap-v6.c Mon Aug 19 15:58:39 2013 (r254535) @@ -900,9 +900,6 @@ pmap_clearbit(struct vm_page *m, u_int m rw_wlock(&pvh_global_lock); - if (maskbits & PVF_WRITE) - maskbits |= PVF_MOD; - if (TAILQ_EMPTY(&m->md.pv_list)) { rw_wunlock(&pvh_global_lock); return (0); @@ -924,14 +921,12 @@ pmap_clearbit(struct vm_page *m, u_int m ptep = &l2b->l2b_kva[l2pte_index(va)]; npte = opte = *ptep; - if ((maskbits & (PVF_WRITE|PVF_MOD)) && L2_S_WRITABLE(opte)) { - vm_page_dirty(m); - + if (maskbits & (PVF_WRITE | PVF_MOD)) { /* make the pte read only */ npte |= L2_APX; } - if ((maskbits & PVF_REF) && L2_S_REFERENCED(opte)) { + if (maskbits & PVF_REF) { /* * Clear referenced flag in PTE so that we * will take a flag fault the next time the mapping From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 16:16: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 ESMTP id DC4FA884; Mon, 19 Aug 2013 16:16:49 +0000 (UTC) (envelope-from raj@FreeBSD.org) 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 C9324286A; Mon, 19 Aug 2013 16:16: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 r7JGGnbO030226; Mon, 19 Aug 2013 16:16:49 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JGGnDm030224; Mon, 19 Aug 2013 16:16:49 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201308191616.r7JGGnDm030224@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 19 Aug 2013 16:16:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254536 - in head/sys/arm: arm include 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.14 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, 19 Aug 2013 16:16:49 -0000 Author: raj Date: Mon Aug 19 16:16:49 2013 New Revision: 254536 URL: http://svnweb.freebsd.org/changeset/base/254536 Log: Do not use pv_kva on ARMv6/v7 and save some space on each vm_page. It's only relevant for older ARM variants (with virtual cache). Submitted by: Zbigniew Bodek Reviewed by: gber Sponsored by: The FreeBSD Foundation, Semihalf Modified: head/sys/arm/arm/pmap-v6.c head/sys/arm/include/pmap.h Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Mon Aug 19 15:58:39 2013 (r254535) +++ head/sys/arm/arm/pmap-v6.c Mon Aug 19 16:16:49 2013 (r254536) @@ -4365,6 +4365,6 @@ pmap_page_set_memattr(vm_page_t m, vm_me * uncacheable, being careful to sync caches and PTEs (and maybe * invalidate TLB?) for any current mapping it modifies. */ - if (m->md.pv_kva != 0 || TAILQ_FIRST(&m->md.pv_list) != NULL) + if (TAILQ_FIRST(&m->md.pv_list) != NULL) panic("Can't change memattr on page with existing mappings"); } Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Mon Aug 19 15:58:39 2013 (r254535) +++ head/sys/arm/include/pmap.h Mon Aug 19 16:16:49 2013 (r254536) @@ -121,7 +121,9 @@ struct pv_chunk; struct md_page { int pvh_attrs; vm_memattr_t pv_memattr; +#if (ARM_MMU_V6 + ARM_MMU_V7) == 0 vm_offset_t pv_kva; /* first kernel VA mapping */ +#endif TAILQ_HEAD(,pv_entry) pv_list; }; From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 16:47: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 ESMTP id 343FF448; Mon, 19 Aug 2013 16:47:07 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 215E72A19; Mon, 19 Aug 2013 16:47: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 r7JGl6ii041772; Mon, 19 Aug 2013 16:47:06 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JGl6N0041771; Mon, 19 Aug 2013 16:47:06 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308191647.r7JGl6N0041771@svn.freebsd.org> From: Andre Oppermann Date: Mon, 19 Aug 2013 16:47:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254537 - 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.14 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, 19 Aug 2013 16:47:07 -0000 Author: andre Date: Mon Aug 19 16:47:06 2013 New Revision: 254537 URL: http://svnweb.freebsd.org/changeset/base/254537 Log: Bump __FreeBSD_version to 1000046 after the addition of M_PROTO[9-12] and removal of M_NOFREE|M_FRAG|M_FIRSTFRAG|M_LASTFRAG mbuf flags. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Aug 19 16:16:49 2013 (r254536) +++ head/sys/sys/param.h Mon Aug 19 16:47:06 2013 (r254537) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000045 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000046 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 17:09:14 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 ESMTP id BE8A0C47; Mon, 19 Aug 2013 17:09:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) 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 AA8BB2B5C; Mon, 19 Aug 2013 17:09:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7JH9ELd049366; Mon, 19 Aug 2013 17:09:14 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JH9ELD049365; Mon, 19 Aug 2013 17:09:14 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201308191709.r7JH9ELD049365@svn.freebsd.org> From: John Baldwin Date: Mon, 19 Aug 2013 17:09:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254538 - head/usr.bin/truss 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.14 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, 19 Aug 2013 17:09:14 -0000 Author: jhb Date: Mon Aug 19 17:09:14 2013 New Revision: 254538 URL: http://svnweb.freebsd.org/changeset/base/254538 Log: Remove incorrect 'const' qualifier from pointers to dynamic string buffers I added in the previous commit. Pointy hat to: jhb MFC after: 1 month Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Mon Aug 19 16:47:06 2013 (r254537) +++ head/usr.bin/truss/syscalls.c Mon Aug 19 17:09:14 2013 (r254538) @@ -894,7 +894,7 @@ print_arg(struct syscall_args *sc, unsig tmp = strdup(xlookup_bits(mprot_flags, args[sc->offset])); break; case Mmapflags: { - const char *base, *alignstr; + char *base, *alignstr; int align, flags; /* From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 17:33: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 ESMTP id A407E2C8; Mon, 19 Aug 2013 17:33:06 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pa0-x233.google.com (mail-pa0-x233.google.com [IPv6:2607:f8b0:400e:c03::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6C3ED2CCA; Mon, 19 Aug 2013 17:33:06 +0000 (UTC) Received: by mail-pa0-f51.google.com with SMTP id lf1so4891675pab.10 for ; Mon, 19 Aug 2013 10:33:06 -0700 (PDT) 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=m4jqV48frauhdoi402GQZ01mWn62cuorOFwNNL8c9zM=; b=tO+cF5lWzKlIWQsqm8r2ROJJCkQ8yaQmJcWDRPF0dHpbxDNz0bccC/noxyUkcxTsCt 09ChQA9WDS3Aszr+Rr3R9tjbnpCB39w9mq90qv+5RX5tF/Mszqq0ckHcOql5T5qHSu1L naV7zg45VJOkhtzNGXRUOQe7pHmujbEvu9glv8nyiwiRiC0pIriKTyxF+8oP4Jgq7/Cq A/BInIaW/CA5pruRAA+fh5hhUynaUF/t4vraz9I4wR6wL0lYHHy6cIufRdjj+GCWbO+H rqHqwYvaSrLMVm0Ig1hjP7gLSbNMHs1kpeGuwkGwYjSvhTSzZIZ6tJ1/Uxe1o+20jf/Y K0sg== X-Received: by 10.66.171.13 with SMTP id aq13mr5684391pac.30.1376933586128; Mon, 19 Aug 2013 10:33:06 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id nj9sm16325367pbc.13.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 10:33:04 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <521256CE.6070706@FreeBSD.org> Date: Mon, 19 Aug 2013 10:33:02 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130819 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> In-Reply-To: <201308191116.r7JBGsc6065793@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 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.14 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, 19 Aug 2013 17:33:06 -0000 On 08/19/13 04:16, Andre Oppermann wrote: > Author: andre > Date: Mon Aug 19 11:16:53 2013 > New Revision: 254520 > URL: http://svnweb.freebsd.org/changeset/base/254520 > > Log: > Remove the unused M_NOFREE mbuf flag. It didn't have any in-tree users > for a very long time, if ever. > > Should such a functionality ever be needed again the appropriate and > much better way to do it is through a custom EXT_SOMETHING external mbuf > type together with a dedicated *ext_free function. > > Discussed with: trociny, glebius > > Modified: > head/sys/kern/kern_mbuf.c > head/sys/kern/uipc_mbuf.c > head/sys/sys/mbuf.h > Hello Andre, Is this just garbage collection or is there some other reason for this? I recently tried some experiments to reduce the number of mbuf and cluster allocations in a 40G NIC driver. M_NOFREE and EXT_EXTREF proved very useful and the code changes to the kernel were minimal. See user/np/cxl_tuning. The experiment was quite successful and I was planning to bring in most of those changes to HEAD. I was hoping to get some runtime mileage on the approach in general before tweaking the ctors/dtors for jumpbo, jumbo9, jumbo16 to allow for an mbuf+refcnt within the cluster. But now M_NOFREE has vanished without a warning... Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 17:34: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 ESMTP id 3F498414 for ; Mon, 19 Aug 2013 17:34:45 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C7DC12CDB for ; Mon, 19 Aug 2013 17:34:44 +0000 (UTC) Received: (qmail 75817 invoked from network); 19 Aug 2013 18:18:09 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 19 Aug 2013 18:18:09 -0000 Message-ID: <52125731.1030401@freebsd.org> Date: Mon, 19 Aug 2013 19:34:41 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r254527 - in head/sys: net80211 netinet sys References: <201308191425.r7JEPCsT086845@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.14 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, 19 Aug 2013 17:34:45 -0000 On 19.08.2013 17:12, Adrian Chadd wrote: > Hi, > > Would you please bump FreeBSD_version ? Done: New Revision: 254537 URL: http://svnweb.freebsd.org/changeset/base/254537 Log: Bump __FreeBSD_version to 1000046 after the addition of M_PROTO[9-12] and removal of M_NOFREE|M_FRAG|M_FIRSTFRAG|M_LASTFRAG mbuf flags. -- Andre From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 17:37: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 ESMTP id BF17D7F7; Mon, 19 Aug 2013 17:37:41 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pb0-x230.google.com (mail-pb0-x230.google.com [IPv6:2607:f8b0:400e:c01::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 86BB22D01; Mon, 19 Aug 2013 17:37:41 +0000 (UTC) Received: by mail-pb0-f48.google.com with SMTP id ma3so5206793pbc.21 for ; Mon, 19 Aug 2013 10:37:41 -0700 (PDT) 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=EwU1E7rKPB581mQyuiimB4kvArzxRtNXrK72mgnjJDs=; b=JO11yV0ptfFscJLnPCYNgafjljI5p0Q91v/0vSSoh2xzcg8zOVeGW7FL7aXNzHDO6s +YUqUd3ZZHhsi1gj8ofTGNsELiCji6D5FK+irwb9JLmJlVQumQgYq3hwF7lDUcRkSzM9 SAnePzZwbPRl+azKp1whGpjBgwwJZ2zkv/N5cyJKuvEenvKPYRWNLpTNQEAKCRsyKSp4 NOco4osik6kHWlqvmQh1njVh2Y1XCONrFGkr0jbHzui7MjTOwQTr/sj8UGs32W3skVsL eEue/VQYIWSBFnm9KbsvVhe6PlO9hTlNQQX7+/oggjYMbKpIwsSFCQH4jgDWeUm9n8+v M9Qw== X-Received: by 10.68.13.132 with SMTP id h4mr14420201pbc.99.1376933861235; Mon, 19 Aug 2013 10:37:41 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id om2sm16328739pbc.30.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 10:37:40 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <521257E2.4020502@FreeBSD.org> Date: Mon, 19 Aug 2013 10:37:38 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130819 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r254524 - head/sys/sys References: <201308191356.r7JDuELE075073@svn.freebsd.org> In-Reply-To: <201308191356.r7JDuELE075073@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 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.14 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, 19 Aug 2013 17:37:41 -0000 On 08/19/13 06:56, Andre Oppermann wrote: > Author: andre > Date: Mon Aug 19 13:56:14 2013 > New Revision: 254524 > URL: http://svnweb.freebsd.org/changeset/base/254524 > > Log: > Add four additional M_PROTOFLAGS[9-12] for protocol specific use. > > Discussed with: trociny, glebius, adrian > > Modified: > head/sys/sys/mbuf.h > > Modified: head/sys/sys/mbuf.h > ============================================================================== > --- head/sys/sys/mbuf.h Mon Aug 19 13:27:32 2013 (r254523) > +++ head/sys/sys/mbuf.h Mon Aug 19 13:56:14 2013 (r254524) > @@ -196,22 +196,24 @@ struct mbuf { > #define M_FRAG 0x00000800 /* packet is a fragment of a larger packet */ > #define M_FIRSTFRAG 0x00001000 /* packet is first fragment */ > #define M_LASTFRAG 0x00002000 /* packet is last fragment */ > - /* 0x00004000 free */ > - /* 0x00008000 free */ > +#define M_PROTO9 0x00004000 /* protocol-specific */ > +#define M_PROTO10 0x00008000 /* protocol-specific */ > #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ > #define M_PROMISC 0x00020000 /* packet was not for us */ > - /* 0x00040000 free */ > +#define M_PROTO11 0x00040000 /* protocol-specific */ > #define M_PROTO6 0x00080000 /* protocol-specific */ > #define M_PROTO7 0x00100000 /* protocol-specific */ > #define M_PROTO8 0x00200000 /* protocol-specific */ > #define M_FLOWID 0x00400000 /* deprecated: flowid is valid */ > +#define M_PROTO12 0x00800000 /* protocol-specific */ > #define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid hash type */ Why reuse the freed up bits so soon (at least one of which I think was prematurely GC'ed -- see my other email on M_NOFREE). There was room beyond M_HASHTYPEBITS, no? Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 17:40: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 ESMTP id 097EEAA9; Mon, 19 Aug 2013 17:40:16 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id BD0972D45; Mon, 19 Aug 2013 17:40:15 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id E633012373; Tue, 20 Aug 2013 03:40:13 +1000 (EST) Received: from Peter-Grehans-MacBook-Pro-2.local (c-69-181-164-196.hsd1.ca.comcast.net [69.181.164.196]) by dommail.onthenet.com.au (MOS 4.2.4-GA) with ESMTP id BOB56127 (AUTH peterg@ptree32.com.au); Tue, 20 Aug 2013 03:40:12 +1000 Message-ID: <5212587A.2080202@freebsd.org> Date: Mon, 19 Aug 2013 10:40:10 -0700 From: Peter Grehan User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> In-Reply-To: <521256CE.6070706@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 19 Aug 2013 17:40:16 -0000 > I recently tried some experiments to reduce the number of mbuf and > cluster allocations in a 40G NIC driver. M_NOFREE and EXT_EXTREF proved > very useful and the code changes to the kernel were minimal. See > user/np/cxl_tuning. The experiment was quite successful and I was > planning to bring in most of those changes to HEAD. I was hoping to get > some runtime mileage on the approach in general before tweaking the > ctors/dtors for jumpbo, jumbo9, jumbo16 to allow for an mbuf+refcnt > within the cluster. But now M_NOFREE has vanished without a warning... I also had a virtualization work-in-progress where static mbufs were allocated in the kernel and M_NOFREE set. Might be worth sending a prior heads-up for these type of changes. later, Peter. From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 17:44:19 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 ESMTP id E3776D09; Mon, 19 Aug 2013 17:44:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) 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 D06B02DB2; Mon, 19 Aug 2013 17:44:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7JHiJ3f063825; Mon, 19 Aug 2013 17:44:19 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JHiJ00063824; Mon, 19 Aug 2013 17:44:19 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201308191744.r7JHiJ00063824@svn.freebsd.org> From: Andrew Turner Date: Mon, 19 Aug 2013 17:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254539 - head/usr.bin 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.14 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, 19 Aug 2013 17:44:20 -0000 Author: andrew Date: Mon Aug 19 17:44:19 2013 New Revision: 254539 URL: http://svnweb.freebsd.org/changeset/base/254539 Log: Subversion requires atomic functions we only support on arm with clang. Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Mon Aug 19 17:09:14 2013 (r254538) +++ head/usr.bin/Makefile Mon Aug 19 17:44:19 2013 (r254539) @@ -366,7 +366,9 @@ SUBDIR+= users SUBDIR+= who .endif -.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64" || ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "armv6" +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64" || \ + ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "i386" || \ + (${MACHINE_ARCH} == "armv6" && ${COMPILER_TYPE} == "clang") .if ${MK_SVN} == "yes" || ${MK_SVNLITE} == "yes" SUBDIR+= svn .endif From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 18:45: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 ESMTP id C97D2BD2; Mon, 19 Aug 2013 18:45:36 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: from mail-bk0-x22b.google.com (mail-bk0-x22b.google.com [IPv6:2a00:1450:4008: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 CCE27215A; Mon, 19 Aug 2013 18:45:35 +0000 (UTC) Received: by mail-bk0-f43.google.com with SMTP id mz13so1523592bkb.2 for ; Mon, 19 Aug 2013 11:45:34 -0700 (PDT) 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; bh=OrhYuwj13dxVpqVdsjDBpCrTRaXXPkXUJDzfr4QhjGI=; b=g775faM1OUG3x6PW/9/1V16N2qfLF/GXkwlYDmmIMiI6Av3z6GHfxbM5w7Q+QwPUDY OcbM32zNSxlX9fivIJYM/kjceOn+mLTZtGcLPOJsjEkhR+rDSgBtrBcdk/SLCyhQZPN8 vyTggHb3CZSY31EL+ZS0P0x9ed8uYrrOyZjk3na2A7Mi4t+nJduIUz8JxW0okKASincO 27GkaAVFrqJCn0rhj2YfX94nZavw4sJITyeP4pV4qnumvuYJIrm+XMU5V/hFdaB6U2nI av732zUwXxjH+srnk8sOgobJ1kJl+4kmd0CzRjB2cc0pbP3l79CaUiF6ulRpbQsH2vIX Vigg== X-Received: by 10.205.7.6 with SMTP id om6mr9056417bkb.18.1376937934002; Mon, 19 Aug 2013 11:45:34 -0700 (PDT) Received: from [192.168.0.10] (89-67-85-20.dynamic.chello.pl. [89.67.85.20]) by mx.google.com with ESMTPSA id d8sm2137563bkj.6.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 11:45:33 -0700 (PDT) Sender: Mario Oshogbo Message-ID: <521267C2.60001@FreeBSD.org> Date: Mon, 19 Aug 2013 20:45:22 +0200 From: Mario Oshogbo User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 MIME-Version: 1.0 To: Hiroki Sato Subject: Re: svn commit: r254440 - head/usr.sbin/rwhod References: <201308170712.r7H7CrYi089636@svn.freebsd.org> In-Reply-To: <201308170712.r7H7CrYi089636@svn.freebsd.org> X-Enigmail-Version: 1.5.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="64VWb3C3MNmmuEwkUchIEgpeenqcTK6PI" 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.14 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, 19 Aug 2013 18:45:37 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --64VWb3C3MNmmuEwkUchIEgpeenqcTK6PI Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thank you for your commit and sorry for not repair this problem earlier. > @@ -274,6 +274,15 @@ main(int argc, char *argv[]) > exit(1); > if (!quiet_mode) { > pid_child_receiver =3D pdfork(&fdp, 0); > + if (pid_child_receiver =3D=3D -1) { > + if (errno !=3D ENOSYS) { > + syslog(LOG_ERR, "pdfork: %m"); > + exit(1); > + } else { > + pid_child_receiver =3D fork(); > + fdp =3D -1; > + } > + } We can't do it this way. pdfork() is used there to prevent killing only one process. If we use fork() and we kill parent process the second process (child process) will become a zombie process. I suggest to revert this change. The changes that Pawel commit (r254486 (thx jilles!!!) and r254480) should resolve all problems. Cheers, oshogbo --64VWb3C3MNmmuEwkUchIEgpeenqcTK6PI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBAgAGBQJSEmfKAAoJECRkYejLhN/j110P+wSFH6758IUP7EpStQ3vNAtR k1+bjZo/nLnhP3uu2UlBrYhurNmIh3ch4lkdnn/ah5PlzUUBugdHKuTJP68cWND4 2Ks1H5gK0zucnJDdnvFeBwOdbGFXEdzv2otO7vm6bULe1AgtaHFNGCkmhlMZLaY+ 4K9CmzePOAmwuN2BKkv810F013lcX7jh8910hZrwSlgFkICDwdzX2BVou4mmAhIb 3oHgvNG9bE87377D2UYjn4teN+/Saa0BLqtrujuVF8rF4XHpT469cLTVCHs/7CPz cD5CtWyEHQvGgBvssEB//dZ7+j7Q11u+UJ118ZoCruH3mpTfbHyE6L75evTQzoX2 /reDeIydpWn6xtZz2bd0XOWjDA8PQej6DdmLt1wwiOfrRpiDabSduXE++flcuPwr 5T6eJGu68IedxE+O4mFU131FT1Gq+olT8X0I+C+K9Hc63gVPXZE0vfaR5epAGWlx lvMLTKZ6bJn7p5uy5yetgulcxxrY73u0ha20OVgIZ9jOiW55e6f9CgfAALG0aqiZ 0G7cSwNwkpzQ63tdO705vHfjjxI72Pgr53UyXaou5M9DTBOhTNHzBA4ffkIZhbVy j/3dAsvRCnbFbb+8+4rnxP+YEiHdzsAFPqnNaLePziE8MZBWYCVPtFyRdOU2LzBt gBk+3kglVFTwBLJFk5U+ =R5sD -----END PGP SIGNATURE----- --64VWb3C3MNmmuEwkUchIEgpeenqcTK6PI-- From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 19:42:43 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 ESMTP id 30C67C23; Mon, 19 Aug 2013 19:42:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B62F32483; Mon, 19 Aug 2013 19:42:42 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6438FB922; Mon, 19 Aug 2013 15:42:40 -0400 (EDT) From: John Baldwin To: Mark Johnston Subject: Re: svn commit: r254309 - in head: share/man/man9 sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/dev/dtrace sys/cddl/dev/sdt sys/kern sys/sys Date: Mon, 19 Aug 2013 15:42:30 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p28; KDE/4.5.5; amd64; ; ) References: <201308140042.r7E0gMtf054550@svn.freebsd.org> <20130816174131.GB1888@charmander.sandvine.com> In-Reply-To: <20130816174131.GB1888@charmander.sandvine.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201308191542.30797.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 19 Aug 2013 15:42:40 -0400 (EDT) Cc: Davide Italiano , 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.14 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, 19 Aug 2013 19:42:43 -0000 On Friday, August 16, 2013 1:41:31 pm Mark Johnston wrote: > On Fri, Aug 16, 2013 at 07:13:16PM +0200, Davide Italiano wrote: > > [trim old mails] > > > > > diff --git a/sys/sys/pmckern.h b/sys/sys/pmckern.h > > > index e3e18a6..90585de 100644 > > > --- a/sys/sys/pmckern.h > > > +++ b/sys/sys/pmckern.h > > > @@ -51,13 +51,11 @@ > > > #define PMC_FN_CSW_IN 2 > > > #define PMC_FN_CSW_OUT 3 > > > #define PMC_FN_DO_SAMPLES 4 > > > -#define PMC_FN_KLD_LOAD 5 > > > -#define PMC_FN_KLD_UNLOAD 6 > > > -#define PMC_FN_MMAP 7 > > > -#define PMC_FN_MUNMAP 8 > > > -#define PMC_FN_USER_CALLCHAIN 9 > > > -#define PMC_FN_USER_CALLCHAIN_SOFT 10 > > > -#define PMC_FN_SOFT_SAMPLING 11 > > > +#define PMC_FN_MMAP 5 > > > +#define PMC_FN_MUNMAP 6 > > > +#define PMC_FN_USER_CALLCHAIN 7 > > > +#define PMC_FN_USER_CALLCHAIN_SOFT 8 > > > +#define PMC_FN_SOFT_SAMPLING 9 > > > > > > > I've skimmed over your patch quickly so I could miss something, but I > > worry about this change breaking the KBI. > > Does this make sense for you? > > I think you're right. I considered this last night, but it didn't occur > to me that external modules might try to invoke these hooks. I'm not > sure if such modules exist, but it's better to be safe. I updated the > patch here: > > http://people.freebsd.org/~markj/patches/hwpmc-eh/hwpmc-eh-3.diff This generally looks correct. I would probably not call it KLD_LOCK_ASSERT_READ() as it asserts any lock (not specifically a read lock). Normally I would use macros like this: KLD_WLOCK/WUNLOCK KLD_RLOCK/RUNLOCK KLD_ASSERT_LOCKED/KLD_ASSERT_WLOCKED However, the existing macros all were named to not assume read locking and then some read locking was added on the side. I'm not sure exactly what macro name makes the most sense, and would in fact be tempted to just retire all the KLD_* macros for locking and use sx(9) directly, but that is a fairly minor point. (And if done should be a separate commit). Thanks for doing this! -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 19:45: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 ESMTP id A2DB1F0E; Mon, 19 Aug 2013 19:45:05 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 78D01249B; Mon, 19 Aug 2013 19:45:04 +0000 (UTC) Received: from alph.d.allbsd.org (p2049-ipbf1102funabasi.chiba.ocn.ne.jp [122.26.101.49]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id r7JJiidV053184 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 Aug 2013 04:44:54 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.d.allbsd.org (8.14.5/8.14.5) with ESMTP id r7JJigML088411; Tue, 20 Aug 2013 04:44:44 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Tue, 20 Aug 2013 04:36:42 +0900 (JST) Message-Id: <20130820.043642.437041865864892383.hrs@allbsd.org> To: oshogbo@FreeBSD.org Subject: Re: svn commit: r254440 - head/usr.sbin/rwhod From: Hiroki Sato In-Reply-To: <521267C2.60001@FreeBSD.org> References: <201308170712.r7H7CrYi089636@svn.freebsd.org> <521267C2.60001@FreeBSD.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Tue_Aug_20_04_36_42_2013_561)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Tue, 20 Aug 2013 04:44:54 +0900 (JST) X-Spam-Status: No, score=-90.6 required=13.0 tests=CONTENT_TYPE_PRESENT, DIRECTOCNDYN,DYN_PBL,RCVD_IN_PBL,SPF_SOFTFAIL,USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org 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.14 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, 19 Aug 2013 19:45:05 -0000 ----Security_Multipart(Tue_Aug_20_04_36_42_2013_561)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mario Oshogbo wrote in <521267C2.60001@FreeBSD.org>: os> Thank you for your commit and sorry for not repair this problem earlier. os> os> > @@ -274,6 +274,15 @@ main(int argc, char *argv[]) os> > exit(1); os> > if (!quiet_mode) { os> > pid_child_receiver = pdfork(&fdp, 0); os> > + if (pid_child_receiver == -1) { os> > + if (errno != ENOSYS) { os> > + syslog(LOG_ERR, "pdfork: %m"); os> > + exit(1); os> > + } else { os> > + pid_child_receiver = fork(); os> > + fdp = -1; os> > + } os> > + } os> os> We can't do it this way. pdfork() is used there to prevent killing only os> one process. If we use fork() and we kill parent process the second os> process (child process) will become a zombie process. I suggest to os> revert this change. The changes that Pawel commit (r254486 (thx os> jilles!!!) and r254480) should resolve all problems. When the parent process is killed, the child process will be an child process of init, not a zombie, and init calls waitpid() when it terminates (by SIGTERM, for example). I agree that this should be improved, but I do not think removing fallback to fork(2) is a good idea if PROCDESC is still a kernel option. Reverting will not solve the problem that it does not work with a kernel without PROCDESC. -- Hiroki ----Security_Multipart(Tue_Aug_20_04_36_42_2013_561)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (FreeBSD) iEYEABECAAYFAlISc8oACgkQTyzT2CeTzy1DXwCeKf8XqVVIqZWS8YPQf55/x1gS 2SsAoMddmWcqlffhb1IEHatYtH4WBSbh =V7YU -----END PGP SIGNATURE----- ----Security_Multipart(Tue_Aug_20_04_36_42_2013_561)---- From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 19:52:58 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 ESMTP id 0D81D171; Mon, 19 Aug 2013 19:52:58 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: from mail-bk0-x22a.google.com (mail-bk0-x22a.google.com [IPv6:2a00:1450:4008:c01::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0F9C62508; Mon, 19 Aug 2013 19:52:56 +0000 (UTC) Received: by mail-bk0-f42.google.com with SMTP id my10so1599883bkb.15 for ; Mon, 19 Aug 2013 12:52:55 -0700 (PDT) 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; bh=O61FRprS9EwXLYFEujBfLdWHv1d6nmK0h3jFg15g4mw=; b=SP9a0C7fwWrEpFlQRzIfe/mByfbdnR87It9o8MObKgGhJ5lkWC/j+xHBu/cQUlvOhz ROg9fMgb/HGr/8DZtSw7hogDZxygtm9zOuFHDXhnVI+DAMMopanW2Isq/rMuiTBMzGD/ 2TnKuw7MXxXGShcWJ4gkctCTREFw73QkEI0iNVlOOACJUdHmG3ec/bzMi0y1v3on++Tp seBtvKR3MA3UoVUAp2ALql9JnMqsz+nybsGn4R3Sd0wUF0jthHPKM8eq7vJ5Gs9evdWp oQASRxs69Q7RYImrC/fMp9UjFxvpRH4KI/sYjDVCgUXABaYaGyc8U5gLhbRX9Ltu3dJM Pm+g== X-Received: by 10.205.7.6 with SMTP id om6mr9235309bkb.18.1376941975187; Mon, 19 Aug 2013 12:52:55 -0700 (PDT) Received: from [192.168.0.10] (89-67-85-20.dynamic.chello.pl. [89.67.85.20]) by mx.google.com with ESMTPSA id pn6sm2190121bkb.14.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 12:52:54 -0700 (PDT) Sender: Mario Oshogbo Message-ID: <5212778E.6030305@FreeBSD.org> Date: Mon, 19 Aug 2013 21:52:46 +0200 From: Mario Oshogbo User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 MIME-Version: 1.0 To: Hiroki Sato Subject: Re: svn commit: r254440 - head/usr.sbin/rwhod References: <201308170712.r7H7CrYi089636@svn.freebsd.org> <521267C2.60001@FreeBSD.org> <20130820.043642.437041865864892383.hrs@allbsd.org> In-Reply-To: <20130820.043642.437041865864892383.hrs@allbsd.org> X-Enigmail-Version: 1.5.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Wlw3elAvpMBp8gVornO6mgUH2iDnqsKTj" 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.14 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, 19 Aug 2013 19:52:58 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Wlw3elAvpMBp8gVornO6mgUH2iDnqsKTj Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > When the parent process is killed, the child process will be an child > process of init, not a zombie, and init calls waitpid() when it > terminates (by SIGTERM, for example). I agree that this should be > improved, but I do not think removing fallback to fork(2) is a good > idea if PROCDESC is still a kernel option. Reverting will not solve > the problem that it does not work with a kernel without PROCDESC. >=20 > -- Hiroki >=20 Yes, but Pawel add PROCDESC to GENERIC in commit r254480. --Wlw3elAvpMBp8gVornO6mgUH2iDnqsKTj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBAgAGBQJSEneUAAoJECRkYejLhN/jQz8P+wT7cEbrxvBbQokdL8Hnwpzj 81iS2qq7RqudCV7MgZxQM+YpmRta0TjnRzMmBE1lM6WKvtE6WX9IMiiVojQuqQBd cGzBVTY+ubtittiWsTf93SQ7Ha1H9pKYbDRsmtSRhk4KqaeXOa6dMy7XOuGma5zO 0n46o4IhJImoBwiXy5NqxKMs1qL8pWXv9azbAvcnJUZL34PHOCNDxJ58S3LIfoWH A1A97REwiMEy8tMWYbfy+cOMg1K1JL0sguIzRqBj1ueKXCIzYB2IH7cqnXbsJIc9 BqA1/Df0iJrjH/vbOpv52WKBzwFOLmg2PVG1JZlndqz24n4PucqKYoXxQRpO+kay 35tAzlxsJDrxOHrtTERMH6DA9bWeywZqv/aAMVrMdmnE/Jg80325SXaggyBKBX9c fI/48yYxL4gfbyX+HVuYC39HW5Au4AAznVK60gJIwihE67r7iBk5+vdDJ1iKUfWw 9H6C9Rl298C3QxthVYGE3YTCagpO/4lVLQfbg/2j+bFPh8GQctcl3yfKGOlLNRhd EkOR93NCPISho5Vmy7RIRobYU46l4GQhgQhcBFKoFvP7ozCo+5YcRtBLsKPb1xYc 2WXvqbd91vgmG9s3SIiwQtGJEXR+W8WKsIiTKDgQIf3Qya5HUeoRyAfqEeawqncn lmbq6TaYl9QxvegtmTxu =FLbL -----END PGP SIGNATURE----- --Wlw3elAvpMBp8gVornO6mgUH2iDnqsKTj-- From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 20:14:03 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 ESMTP id 471B87B0; Mon, 19 Aug 2013 20:14:03 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qa0-x22a.google.com (mail-qa0-x22a.google.com [IPv6:2607:f8b0:400d:c00::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B4278266A; Mon, 19 Aug 2013 20:14:02 +0000 (UTC) Received: by mail-qa0-f42.google.com with SMTP id bv4so2079271qab.1 for ; Mon, 19 Aug 2013 13:14:01 -0700 (PDT) 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=ny/fjoQV2xtJGYZ59XB6ZrRjPd7Tk74j2v3sf8Cd47E=; b=OZMVF+cgz/Nqk/T8n4Y7hKSoP1pmIrZijyQr4Miai2HOl6rXPHcCeU19g5H740bVov LjQ+BngkxcY5ZZ8wOd8/J42ovo1DCQLfRgIt4gPhUZiouThXkF3+NPHo2uLQ7ziqYdDQ 0x8Xl1Vb8bNyyckAB9L0eHjV5UY9wDaDMqq3ng2SvdKlv5JGYyIWy25evu9KcbUY8ZPo IEbb+/8pJMLrBITZRhBdcF5w/GcrLqrGcDgxcPcM7fUj34eKXm9Akeo9W7R4S/CfqZgH gQQ6hz6hon4BWekKATMeW8YBO0Cmv/DjxB7huZAtrN8x6UJTYsDAx1vWd0bDD5dLQ080 Pl7g== X-Received: by 10.49.73.227 with SMTP id o3mr17741891qev.23.1376943241904; Mon, 19 Aug 2013 13:14:01 -0700 (PDT) Received: from charmander.sandvine.com ([64.7.137.182]) by mx.google.com with ESMTPSA id m5sm19002473qaa.13.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 13:14:01 -0700 (PDT) Sender: Mark Johnston Date: Mon, 19 Aug 2013 16:14:45 -0400 From: Mark Johnston To: John Baldwin Subject: Re: svn commit: r254309 - in head: share/man/man9 sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/dev/dtrace sys/cddl/dev/sdt sys/kern sys/sys Message-ID: <20130819201445.GB4765@charmander.sandvine.com> References: <201308140042.r7E0gMtf054550@svn.freebsd.org> <20130816174131.GB1888@charmander.sandvine.com> <201308191542.30797.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201308191542.30797.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Davide Italiano , 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.14 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, 19 Aug 2013 20:14:03 -0000 On Mon, Aug 19, 2013 at 03:42:30PM -0400, John Baldwin wrote: > On Friday, August 16, 2013 1:41:31 pm Mark Johnston wrote: > > On Fri, Aug 16, 2013 at 07:13:16PM +0200, Davide Italiano wrote: > > > [trim old mails] > > > > > > > diff --git a/sys/sys/pmckern.h b/sys/sys/pmckern.h > > > > index e3e18a6..90585de 100644 > > > > --- a/sys/sys/pmckern.h > > > > +++ b/sys/sys/pmckern.h > > > > @@ -51,13 +51,11 @@ > > > > #define PMC_FN_CSW_IN 2 > > > > #define PMC_FN_CSW_OUT 3 > > > > #define PMC_FN_DO_SAMPLES 4 > > > > -#define PMC_FN_KLD_LOAD 5 > > > > -#define PMC_FN_KLD_UNLOAD 6 > > > > -#define PMC_FN_MMAP 7 > > > > -#define PMC_FN_MUNMAP 8 > > > > -#define PMC_FN_USER_CALLCHAIN 9 > > > > -#define PMC_FN_USER_CALLCHAIN_SOFT 10 > > > > -#define PMC_FN_SOFT_SAMPLING 11 > > > > +#define PMC_FN_MMAP 5 > > > > +#define PMC_FN_MUNMAP 6 > > > > +#define PMC_FN_USER_CALLCHAIN 7 > > > > +#define PMC_FN_USER_CALLCHAIN_SOFT 8 > > > > +#define PMC_FN_SOFT_SAMPLING 9 > > > > > > > > > > I've skimmed over your patch quickly so I could miss something, but I > > > worry about this change breaking the KBI. > > > Does this make sense for you? > > > > I think you're right. I considered this last night, but it didn't occur > > to me that external modules might try to invoke these hooks. I'm not > > sure if such modules exist, but it's better to be safe. I updated the > > patch here: > > > > http://people.freebsd.org/~markj/patches/hwpmc-eh/hwpmc-eh-3.diff > > This generally looks correct. I would probably not call it > KLD_LOCK_ASSERT_READ() as it asserts any lock (not specifically a > read lock). Normally I would use macros like this: > > KLD_WLOCK/WUNLOCK > KLD_RLOCK/RUNLOCK > KLD_ASSERT_LOCKED/KLD_ASSERT_WLOCKED > > However, the existing macros all were named to not assume read > locking and then some read locking was added on the side. I'm > not sure exactly what macro name makes the most sense, and would > in fact be tempted to just retire all the KLD_* macros for locking > and use sx(9) directly, but that is a fairly minor point. (And if > done should be a separate commit). Yeah, KLD_LOCK_ASSERT_READ() is awkward, but I couldn't come up with anything better without renaming the existing macros. I'm fine with getting rid of them and using the sx_* calls directly; it'll be the same amount of churn as changing the macro names anyway. So how about this: I'll get rid of the macros in one commit, change the locking rules for linker_file_lookup_set() using my existing patch but without the KLD lock macros, and then convert the hwpmc(4) hooks to use the new event handlers (making sure to avoid breaking the KBI as Davide pointed out). -Mark From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 20:58:55 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 ESMTP id BAFEF13A for ; Mon, 19 Aug 2013 20:58:55 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1ECC92854 for ; Mon, 19 Aug 2013 20:58:54 +0000 (UTC) Received: (qmail 76532 invoked from network); 19 Aug 2013 21:42:18 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 19 Aug 2013 21:42:18 -0000 Message-ID: <5212870A.50105@freebsd.org> Date: Mon, 19 Aug 2013 22:58:50 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Navdeep Parhar Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> In-Reply-To: <521256CE.6070706@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; 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.14 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, 19 Aug 2013 20:58:55 -0000 On 19.08.2013 19:33, Navdeep Parhar wrote: > On 08/19/13 04:16, Andre Oppermann wrote: >> Author: andre >> Date: Mon Aug 19 11:16:53 2013 >> New Revision: 254520 >> URL: http://svnweb.freebsd.org/changeset/base/254520 >> >> Log: >> Remove the unused M_NOFREE mbuf flag. It didn't have any in-tree users >> for a very long time, if ever. >> >> Should such a functionality ever be needed again the appropriate and >> much better way to do it is through a custom EXT_SOMETHING external mbuf >> type together with a dedicated *ext_free function. >> >> Discussed with: trociny, glebius >> >> Modified: >> head/sys/kern/kern_mbuf.c >> head/sys/kern/uipc_mbuf.c >> head/sys/sys/mbuf.h >> > > Hello Andre, > > Is this just garbage collection or is there some other reason for this? This is garbage collection and removal of not quite right, rotten, functionality. > I recently tried some experiments to reduce the number of mbuf and > cluster allocations in a 40G NIC driver. M_NOFREE and EXT_EXTREF proved > very useful and the code changes to the kernel were minimal. See > user/np/cxl_tuning. The experiment was quite successful and I was > planning to bring in most of those changes to HEAD. I was hoping to get > some runtime mileage on the approach in general before tweaking the > ctors/dtors for jumpbo, jumbo9, jumbo16 to allow for an mbuf+refcnt > within the cluster. But now M_NOFREE has vanished without a warning... I'm looking through your experimental code and that is some really good numbers you're achieving there! However a couple things don't feel quite right, hackish even, and not fit for HEAD. This is a bit the same situation we had with some of the first 1GigE cards quite a number of years back (mostly ti(4)). There we ended up with a couple of just good enough hacks to make it fast. Most of the remains I've collected today. I believe most of the improvements you've shown can be implemented in a more generic and safe way into the mbuf system. Also a number of things in your experimental code may have side-effects in situations other than netperf runs. To summarize what I get from your experimental branch commits: - the Chelsio T4/T5 card can DMA multiple ethernet frames (packets) into a single memory buffer, provided it is large enough. - you make use of that feature and point multiple m_ext mbufs into that buffer to separate the packets and send them up the stack. - you embed the m_ext refcount into the single memory buffer as well. - you recycle mbufs? (I'm not entirely clear on that as I'm not familiar with the cxgbe code) Lets examine and discuss these parts: - M_NOFREE wasn't really safe with bpf anyway at least for packets going down the stack. - Instead of M_NOFREE a custom *ext_free should be used that has the same and even more functionality. - Recycling mbufs may cause imbalances to the mbuf pool with multiple cores and possibly NUMA in the future. Not that we are very good with it at the moment but bypassing the mbuf allocator shouldn't become the norm. If it is a problem/bottleneck again it should be fixed, not worked around and copy-pasted n-times in so many drivers. - jumbo9 and jumbo16 mbufs should not be used because they are more special than necessary with being KVM and physically contiguous. This probably isn't necessary for the T4/T5 cards and any other modern DMA engine. Under heavy diverse network the kernel memory becomes fragmented and can't find memory fulfilling both criteria anymore. In fact both are an artifact of the early GigE hacks when high speed DMA engines were in their infancy. Both jumbo9 and jumbo16 should go away without direct replacement. In your T4/T5 case the alternative would be either to a) allocate your own memory directly from KVM with the necessary properties (KVM and/or phys contig); b) have such a generic kernel mbuf type fulfilling the same role. There may be some cache line issues on non-x86 systems that have to be though and taken care of. - Refcounts should have the option of being separately allocated. It was mandatory to use the refcount zone so far because there wasn't any other type of refcount. Now that we have one we should revisit the issue. Actually the entire mbuf allocation and initialization could be streamlined as a whole. On a side note a different mbuf handling for the RX DMA rings may give some significant improvements as well: allocate just a cluster without a mbuf through m_cljget() and put it into the RX ring. Only when the DMA has put a packet into it allocated attach the mbuf (in the drivers RX function). This avoids the cache pollution from touching the mbuf fields during initial allocation, including the refcount. Another nice trick would be to shorten the mbuf by 4 bytes (in ext_size) and put the refcount there. Lets work on these together. -- Andre From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 21:08: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 ESMTP id 6C3F83A0 for ; Mon, 19 Aug 2013 21:08:11 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D249C28D2 for ; Mon, 19 Aug 2013 21:08:10 +0000 (UTC) Received: (qmail 76569 invoked from network); 19 Aug 2013 21:51:34 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 19 Aug 2013 21:51:34 -0000 Message-ID: <52128937.1010407@freebsd.org> Date: Mon, 19 Aug 2013 23:08:07 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Peter Grehan Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> In-Reply-To: <5212587A.2080202@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 19 Aug 2013 21:08:11 -0000 On 19.08.2013 19:40, Peter Grehan wrote: >> I recently tried some experiments to reduce the number of mbuf and >> cluster allocations in a 40G NIC driver. M_NOFREE and EXT_EXTREF proved >> very useful and the code changes to the kernel were minimal. See >> user/np/cxl_tuning. The experiment was quite successful and I was >> planning to bring in most of those changes to HEAD. I was hoping to get >> some runtime mileage on the approach in general before tweaking the >> ctors/dtors for jumpbo, jumbo9, jumbo16 to allow for an mbuf+refcnt >> within the cluster. But now M_NOFREE has vanished without a warning... > > I also had a virtualization work-in-progress where static mbufs were allocated in the kernel and > M_NOFREE set. > > Might be worth sending a prior heads-up for these type of changes. I'm sorry for ambushing but this stuff has to be done. I have provided an alternative way of handling it and I'm happy to help you with your use case to make it good for you and to prevent the mbuf system from getting bloated and hackish again. Mbuf is a core system for the kernel and we should avoid to kitchen-sink it again while at the same time to keep speedy enough to keep up with the speed requirements. I believe it would be bad to have Navdeep, you and others invent their own network buffer management routines over again in slightly different ways tailored to each immediate use case. Can you please describe your intended use of M_NOFREE to better understand the shortcomings of the current mbuf systems and the additional advantages of the M_NOFREE case? -- Andre From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 21:41:52 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 ESMTP id 3F372CA3; Mon, 19 Aug 2013 21:41:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wi0-x231.google.com (mail-wi0-x231.google.com [IPv6:2a00:1450:400c:c05::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 028C02A9F; Mon, 19 Aug 2013 21:41:50 +0000 (UTC) Received: by mail-wi0-f177.google.com with SMTP id hq12so3500626wib.4 for ; Mon, 19 Aug 2013 14:41:49 -0700 (PDT) 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=xbb2/2QlO6p/gnegfxkEZxaZRMgdensFPCAixbk+lWs=; b=DdP4yMYKFne9mh2U1/Fmv8mDPoBvqdfEvpd4vzDLN6Z+nOgvphv938iFXZWPqFZo9o Qb5f8hbvyNGzgKrWNjpVCgWs+TcDSCdeR4p8M6kOprYsx0m3PnfGzf5ZuEq45gL3LhCk PHBqWXaAafexYujVFuOiy6lOy0Pg++FgLSoWHPkKfNsuZ0qAyNgOI35CzEbikq55bukM 0B3/enbQ3uUDYX8D8ipMCB+k0brWkTobldbFXIMWbe+r7IFJXo1hYpntBDq21m/FKC/2 iv/2wTwoyVXFvsCnE6oZfmWBCsVIBp+IWF4JC2tJU/YsEp1uuLuTgwymfbstO0gkDJJw ra7A== MIME-Version: 1.0 X-Received: by 10.180.211.206 with SMTP id ne14mr9964441wic.30.1376948509314; Mon, 19 Aug 2013 14:41:49 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.217.116.136 with HTTP; Mon, 19 Aug 2013 14:41:49 -0700 (PDT) In-Reply-To: <52128937.1010407@freebsd.org> References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> Date: Mon, 19 Aug 2013 14:41:49 -0700 X-Google-Sender-Auth: qCfNg0q-81bHua1GbU9INcUbbKY Message-ID: Subject: Re: svn commit: r254520 - in head/sys: kern sys From: Adrian Chadd To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Navdeep Parhar , Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 19 Aug 2013 21:41:52 -0000 fwiw - +1 on everything you've said to date about this. -adrian From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 21:45: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 ESMTP id BB304EDA; Mon, 19 Aug 2013 21:45:24 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pa0-x232.google.com (mail-pa0-x232.google.com [IPv6:2607:f8b0:400e:c03::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 825012AD9; Mon, 19 Aug 2013 21:45:24 +0000 (UTC) Received: by mail-pa0-f50.google.com with SMTP id fb10so533253pad.37 for ; Mon, 19 Aug 2013 14:45:24 -0700 (PDT) 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=iCQlYnHaeuHWrLnqjEuOagNdbVT9w4H5X9BNTSOgj9A=; b=0Z8UMaU62G6+58Pi2Okm4x2LwvdZAd031xGkEg4vAejV1WE2Mj6GL3zebUnNFLwq2x LNBTp3cutdns0bjhNtm5Mi+NL03utFbhFnAVPAZThmRsZxhqZ6qNPAD1+2SSmZDNu2qb U2hIoMI+QYHY2qDcHkFsiyDdUq+l3A8NCiUD6ujSEI/OQCtw8OiPMfaaPb9Na6LcLUG5 w8zO/1Lug52UDW/okHdx5qwal06A/zn3HqkgxwoKlBbMlfJMWARW+EoUdGxA4bSixWRf JJif0JRwaSpiiMXknN72yKxvNpXRPL3pYX4KBkTDXJR46qyWbNer6at0Ij7Z4LZkVPNL /+3Q== X-Received: by 10.68.134.65 with SMTP id pi1mr15466643pbb.59.1376948723964; Mon, 19 Aug 2013 14:45:23 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id ts6sm17149865pbc.12.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 14:45:22 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <521291F1.8060500@FreeBSD.org> Date: Mon, 19 Aug 2013 14:45:21 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130819 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212870A.50105@freebsd.org> In-Reply-To: <5212870A.50105@freebsd.org> Content-Type: text/plain; charset=UTF-8 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.14 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, 19 Aug 2013 21:45:24 -0000 On 08/19/13 13:58, Andre Oppermann wrote: > On 19.08.2013 19:33, Navdeep Parhar wrote: >> On 08/19/13 04:16, Andre Oppermann wrote: >>> Author: andre >>> Date: Mon Aug 19 11:16:53 2013 >>> New Revision: 254520 >>> URL: http://svnweb.freebsd.org/changeset/base/254520 >>> >>> Log: >>> Remove the unused M_NOFREE mbuf flag. It didn't have any in-tree >>> users >>> for a very long time, if ever. >>> >>> Should such a functionality ever be needed again the appropriate and >>> much better way to do it is through a custom EXT_SOMETHING >>> external mbuf >>> type together with a dedicated *ext_free function. >>> >>> Discussed with: trociny, glebius >>> >>> Modified: >>> head/sys/kern/kern_mbuf.c >>> head/sys/kern/uipc_mbuf.c >>> head/sys/sys/mbuf.h >>> >> >> Hello Andre, >> >> Is this just garbage collection or is there some other reason for this? > > This is garbage collection and removal of not quite right, rotten, > functionality. > >> I recently tried some experiments to reduce the number of mbuf and >> cluster allocations in a 40G NIC driver. M_NOFREE and EXT_EXTREF proved >> very useful and the code changes to the kernel were minimal. See >> user/np/cxl_tuning. The experiment was quite successful and I was >> planning to bring in most of those changes to HEAD. I was hoping to get >> some runtime mileage on the approach in general before tweaking the >> ctors/dtors for jumpbo, jumbo9, jumbo16 to allow for an mbuf+refcnt >> within the cluster. But now M_NOFREE has vanished without a warning... > > I'm looking through your experimental code and that is some really good > numbers you're achieving there! > > However a couple things don't feel quite right, hackish even, and not > fit for HEAD. This is a bit the same situation we had with some of the > first 1GigE cards quite a number of years back (mostly ti(4)). There > we ended up with a couple of just good enough hacks to make it fast. > Most of the remains I've collected today. If M_NOFREE and EXT_EXTREF are properly supported in the tree (and I'm arguing that they were, before r254520) then the changes are perfectly legitimate. The only hackish part was that I was getting the cluster from the jumbop zone while bypassing its normal refcnt mechanism. This I did so as to use the same zone as m_uiotombuf to keep it "hot" for all consumers (driver + network stack). > I believe most of the improvements you've shown can be implemented in > a more generic and safe way into the mbuf system. Also a number of things > in your experimental code may have side-effects in situations other than > netperf runs. Agreed. As I mentioned my long term plan was to tweak the jumboX zones to allow them to allocate cluster with embedded mbuf + refcount. The M_NOFREE+EXT_EXTREF approach is the perfect bridge from here to there. It is non-intrusive and lends itself well to experimentation. > > To summarize what I get from your experimental branch commits: > - the Chelsio T4/T5 card can DMA multiple ethernet frames (packets) into > a single memory buffer, provided it is large enough. > - you make use of that feature and point multiple m_ext mbufs into that > buffer to separate the packets and send them up the stack. > - you embed the m_ext refcount into the single memory buffer as well. yes, yes, and yes. > - you recycle mbufs? (I'm not entirely clear on that as I'm not familiar > with the cxgbe code) I recycle the cluster (and the embedded mbuf in it) when possible. All depends on whether it's still in use by the time the rx queue needs it back. > > Lets examine and discuss these parts: > - M_NOFREE wasn't really safe with bpf anyway at least for packets going > down the stack. I see. Can you point out the parts of bpf unable to deal with M_NOFREE? > - Instead of M_NOFREE a custom *ext_free should be used that has the same > and even more functionality. Yes, that's what I was planning too, with the jumboX zone changes. It would be faster than running the m_ext's free function (which is a function dereference+call). > - Recycling mbufs may cause imbalances to the mbuf pool with multiple cores > and possibly NUMA in the future. Not that we are very good with it at > the moment but bypassing the mbuf allocator shouldn't become the norm. > If it is a problem/bottleneck again it should be fixed, not worked around > and copy-pasted n-times in so many drivers. If/when a cluster is recycled, it is given back to the same rx ithread that originally allocated it, and not not any other queue. If the ithread stays in the same NUMA domain (and it really should) then recycling the cluster in the same queue really shouldn't cause imbalances. > - jumbo9 and jumbo16 mbufs should not be used because they are more special > than necessary with being KVM and physically contiguous. This probably > isn't necessary for the T4/T5 cards and any other modern DMA engine. > Under heavy diverse network the kernel memory becomes fragmented and > can't > find memory fulfilling both criteria anymore. In fact both are an > artifact > of the early GigE hacks when high speed DMA engines were in their > infancy. > Both jumbo9 and jumbo16 should go away without direct replacement. The devices I deal will be able to cope, but I suspect this will be disruptive (for not enough reason to justify the disruption, imho) to others. That's a separate discussion anyway. > In your T4/T5 case the alternative would be either to a) allocate your > own memory directly from KVM with the necessary properties (KVM and/or > phys > contig); b) have such a generic kernel mbuf type fulfilling the same > role. > There may be some cache line issues on non-x86 systems that have to be > though and taken care of. > - Refcounts should have the option of being separately allocated. It was > mandatory to use the refcount zone so far because there wasn't any other > type of refcount. Now that we have one we should revisit the issue. > Actually the entire mbuf allocation and initialization could be > streamlined > as a whole. > > On a side note a different mbuf handling for the RX DMA rings may give some > significant improvements as well: allocate just a cluster without a mbuf > through > m_cljget() and put it into the RX ring. Only when the DMA has put a > packet into > it allocated attach the mbuf (in the drivers RX function). This avoids > the cache > pollution from touching the mbuf fields during initial allocation, > including the > refcount. Er, this is pretty much how cxgbe(4) has always done it. A cluster is allocated with m_cljget, an mbuf is allocated with MT_NOINIT to avoid touching any line in the mbuf. m_init is called later in the rx ithread. > > Another nice trick would be to shorten the mbuf by 4 bytes (in ext_size) > and put > the refcount there. > > Lets work on these together. Yes. I think we agree on the long term optimization, or are at least headed in the same general direction. But removing M_NOFREE removed a dirt-cheap way to test and exercise the approach without implementing the "real thing." Why not just let it be? Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 22:03: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 ESMTP id A6A3056D; Mon, 19 Aug 2013 22:03:36 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pd0-x231.google.com (mail-pd0-x231.google.com [IPv6:2607:f8b0:400e:c02::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 68C9F2BCC; Mon, 19 Aug 2013 22:03:36 +0000 (UTC) Received: by mail-pd0-f177.google.com with SMTP id y10so5791485pdj.36 for ; Mon, 19 Aug 2013 15:03:36 -0700 (PDT) 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=gZ+LY82r/XKH1Vg5YMnKQd56dRuNzynCfNvW3/ZNdhw=; b=gzLXrppjUI3XLAKfPs2QIonW4sXEpAXs3XiA+lNDFbOcT0xXKt3ZPZf/q0Ol7hLXqf bEuliNEr1h5RvvcYeXrbpKwelacEkivwLk6Knk3tqgyfgP3lSA5xAfcCOY5Ze1cA4sWn vO1kz8uo/tbsfy5e45/BsIocCcxaP5NKQSLtcpeXBo6i/9xA5Iqcs6V4q2z6y4F7vXVm IYROG4NQf7NmGKAqjteE3WyzYv719W+ZBT7trb6bqAqR2QymhtRsa8rYPsxojyidfh22 FrzUPWWlRIHOHbT2SK2bSu6ce7eN7FelTfaDfA3AvJ1JuKb82c4dLvDk/tS9Uj79Dr2P O//w== X-Received: by 10.68.228.201 with SMTP id sk9mr15493204pbc.4.1376949816097; Mon, 19 Aug 2013 15:03:36 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id mr3sm17191807pbb.27.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 15:03:34 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <52129634.7000509@FreeBSD.org> Date: Mon, 19 Aug 2013 15:03:32 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130819 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> In-Reply-To: <52128937.1010407@freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 19 Aug 2013 22:03:36 -0000 On 08/19/13 14:08, Andre Oppermann wrote: > On 19.08.2013 19:40, Peter Grehan wrote: >>> I recently tried some experiments to reduce the number of mbuf and >>> cluster allocations in a 40G NIC driver. M_NOFREE and EXT_EXTREF proved >>> very useful and the code changes to the kernel were minimal. See >>> user/np/cxl_tuning. The experiment was quite successful and I was >>> planning to bring in most of those changes to HEAD. I was hoping to get >>> some runtime mileage on the approach in general before tweaking the >>> ctors/dtors for jumpbo, jumbo9, jumbo16 to allow for an mbuf+refcnt >>> within the cluster. But now M_NOFREE has vanished without a warning... >> >> I also had a virtualization work-in-progress where static mbufs were >> allocated in the kernel and >> M_NOFREE set. >> >> Might be worth sending a prior heads-up for these type of changes. > > I'm sorry for ambushing but this stuff has to be done. I have provided > an alternative way of handling it and I'm happy to help you with your > use case to make it good for you and to prevent the mbuf system from > getting bloated and hackish again. I don't know what Peter's use case is but I'm curious about the already-available alternative to M_NOFREE, if that's what you meant. Can you please elaborate? Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 22:25: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 ESMTP id 33A2EA50; Mon, 19 Aug 2013 22:25:37 +0000 (UTC) (envelope-from andrew@FreeBSD.org) 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 2131B2CD4; Mon, 19 Aug 2013 22:25: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 r7JMPanF073988; Mon, 19 Aug 2013 22:25:37 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JMPaR9073987; Mon, 19 Aug 2013 22:25:36 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201308192225.r7JMPaR9073987@svn.freebsd.org> From: Andrew Turner Date: Mon, 19 Aug 2013 22:25:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254542 - head/sys/arm/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.14 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, 19 Aug 2013 22:25:37 -0000 Author: andrew Date: Mon Aug 19 22:25:36 2013 New Revision: 254542 URL: http://svnweb.freebsd.org/changeset/base/254542 Log: Enable VFP on the Zedboard. Modified: head/sys/arm/conf/ZEDBOARD Modified: head/sys/arm/conf/ZEDBOARD ============================================================================== --- head/sys/arm/conf/ZEDBOARD Mon Aug 19 20:46:14 2013 (r254541) +++ head/sys/arm/conf/ZEDBOARD Mon Aug 19 22:25:36 2013 (r254542) @@ -52,6 +52,7 @@ options SYSVMSG #SYSV-style message q options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options FREEBSD_BOOT_LOADER +options VFP # vfp/neon # Debugging makeoptions DEBUG=-g From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 22:38: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 ESMTP id 7D622CDB; Mon, 19 Aug 2013 22:38:18 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 3B1252D71; Mon, 19 Aug 2013 22:38:17 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id 81EF611E4C; Tue, 20 Aug 2013 08:38:16 +1000 (EST) Received: from Peter-Grehans-MacBook-Pro-2.local ([64.245.0.210]) by dommail.onthenet.com.au (MOS 4.2.4-GA) with ESMTP id BOB63025 (AUTH peterg@ptree32.com.au); Tue, 20 Aug 2013 08:38:15 +1000 Message-ID: <52129E55.30803@freebsd.org> Date: Mon, 19 Aug 2013 15:38:13 -0700 From: Peter Grehan User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> In-Reply-To: <52128937.1010407@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 19 Aug 2013 22:38:18 -0000 Hi Andre, (moving to the more appropriate freebsd-net) > I'm sorry for ambushing but this stuff has to be done. I have provided > an alternative way of handling it and I'm happy to help you with your > use case to make it good for you and to prevent the mbuf system from > getting bloated and hackish again. Sure. I'm not really upset since my code wasn't too far along, but with any API, you never know who consumers might be so it's always worth being proactive about announcing it's removal. > Can you please describe your intended use of M_NOFREE to better understand > the shortcomings of the current mbuf systems and the additional advantages > of the M_NOFREE case? I was looking at something similar to Linux's vhost-net, where a guest's virtio ring would be processed in-kernel. An mbuf chain with external buffers would be used to pass guest tx buffer/len segments directly into FreeBSD drivers. The intent of M_NOFREE was to avoid small mbuf allocations/frees in what is a hot path. This code was intended to run at 10/40G. Note this code isn't really generic - it would require interfaces to be 'owned' by the guest, except that direct PCI-level pass-through wouldn't be needed. If there's an alternative to M_NOFREE, I'd be more than happy to use that. later, Peter. From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 23:02:40 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 ESMTP id C5A77151; Mon, 19 Aug 2013 23:02:40 +0000 (UTC) (envelope-from jeff@FreeBSD.org) 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 97D522EB7; Mon, 19 Aug 2013 23:02:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7JN2eMv088399; Mon, 19 Aug 2013 23:02:40 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JN2eLq088397; Mon, 19 Aug 2013 23:02:40 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201308192302.r7JN2eLq088397@svn.freebsd.org> From: Jeff Roberson Date: Mon, 19 Aug 2013 23:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254543 - in head/sys: kern 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.14 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, 19 Aug 2013 23:02:40 -0000 Author: jeff Date: Mon Aug 19 23:02:39 2013 New Revision: 254543 URL: http://svnweb.freebsd.org/changeset/base/254543 Log: - Use an arbitrary but reasonably large import size for kva on architectures that don't support superpages. This keeps the number of spans and internal fragmentation lower. - When the user asks for alignment from vmem_xalloc adjust the imported size by 2*align to be certain we can satisfy the allocation. This comes at the expense of potential failures when the backend can't supply enough memory but could supply the requested size and alignment. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/subr_vmem.c head/sys/vm/vm_init.c Modified: head/sys/kern/subr_vmem.c ============================================================================== --- head/sys/kern/subr_vmem.c Mon Aug 19 22:25:36 2013 (r254542) +++ head/sys/kern/subr_vmem.c Mon Aug 19 23:02:39 2013 (r254543) @@ -758,6 +758,7 @@ vmem_add1(vmem_t *vm, vmem_addr_t addr, bt_t *btfree; MPASS(type == BT_TYPE_SPAN || type == BT_TYPE_SPAN_STATIC); + MPASS((size & vm->vm_quantum_mask) == 0); btspan = bt_alloc(vm); btspan->bt_type = type; @@ -805,7 +806,7 @@ vmem_destroy1(vmem_t *vm) } static int -vmem_import(vmem_t *vm, vmem_size_t size, int flags) +vmem_import(vmem_t *vm, vmem_size_t size, vmem_size_t align, int flags) { vmem_addr_t addr; int error; @@ -813,6 +814,12 @@ vmem_import(vmem_t *vm, vmem_size_t size if (vm->vm_importfn == NULL) return EINVAL; + /* + * To make sure we get a span that meets the alignment we double it + * and add the size to the tail. This slightly overestimates. + */ + if (align != vm->vm_quantum_mask + 1) + size = (align * 2) + size; size = roundup(size, vm->vm_import_quantum); /* @@ -1157,7 +1164,7 @@ vmem_xalloc(vmem_t *vm, const vmem_size_ * imported region. It is up to the user to specify the * import quantum such that it can satisfy any allocation. */ - if (vmem_import(vm, size, flags) == 0) + if (vmem_import(vm, size, align, flags) == 0) continue; /* Modified: head/sys/vm/vm_init.c ============================================================================== --- head/sys/vm/vm_init.c Mon Aug 19 22:25:36 2013 (r254542) +++ head/sys/vm/vm_init.c Mon Aug 19 23:02:39 2013 (r254543) @@ -156,7 +156,8 @@ vm_mem_init(dummy) #if VM_NRESERVLEVEL > 0 1 << (VM_LEVEL_0_ORDER + PAGE_SHIFT)); #else - PAGE_SIZE); + /* On non-superpage architectures want large import sizes. */ + PAGE_SIZE * 1024); #endif kmem_init_zero_region(); From owner-svn-src-head@FreeBSD.ORG Mon Aug 19 23:54: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 ESMTP id 4FEBD81D; Mon, 19 Aug 2013 23:54:25 +0000 (UTC) (envelope-from jeff@FreeBSD.org) 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 228492104; Mon, 19 Aug 2013 23:54: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 r7JNsPci007504; Mon, 19 Aug 2013 23:54:25 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7JNsPD1007503; Mon, 19 Aug 2013 23:54:25 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201308192354.r7JNsPD1007503@svn.freebsd.org> From: Jeff Roberson Date: Mon, 19 Aug 2013 23:54:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254544 - 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.14 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, 19 Aug 2013 23:54:25 -0000 Author: jeff Date: Mon Aug 19 23:54:24 2013 New Revision: 254544 URL: http://svnweb.freebsd.org/changeset/base/254544 Log: - Increase the active lru refresh interval to 10 minutes. This has been shown to negatively impact some workloads and the goal is only to eliminate worst case behaviors for very long periods of paging inactivity. Eventually we should determine a more complex scaling factor for this feature. - Rate limit low memory callback handlers to limit thrashing. Set the default to 10 seconds. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Mon Aug 19 23:02:39 2013 (r254543) +++ head/sys/vm/vm_pageout.c Mon Aug 19 23:54:24 2013 (r254544) @@ -159,6 +159,8 @@ static int vm_max_launder = 32; static int vm_pageout_update_period; static int defer_swap_pageouts; static int disable_swap_pageouts; +static int lowmem_period = 10; +static int lowmem_ticks; #if defined(NO_SWAPPING) static int vm_swap_enabled = 0; @@ -179,6 +181,9 @@ SYSCTL_INT(_vm, OID_AUTO, pageout_update CTLFLAG_RW, &vm_pageout_update_period, 0, "Maximum active LRU update period"); +SYSCTL_INT(_vm, OID_AUTO, lowmem_period, CTLFLAG_RW, &lowmem_period, 0, + "Low memory callback period"); + #if defined(NO_SWAPPING) SYSCTL_INT(_vm, VM_SWAPPING_ENABLED, swap_enabled, CTLFLAG_RD, &vm_swap_enabled, 0, "Enable entire process swapout"); @@ -901,9 +906,10 @@ vm_pageout_scan(struct vm_domain *vmd, i /* * If we need to reclaim memory ask kernel caches to return - * some. + * some. We rate limit to avoid thrashing. */ - if (pass > 0) { + if (vmd == &vm_dom[0] && pass > 0 && + lowmem_ticks + (lowmem_period * hz) < ticks) { /* * Decrease registered cache sizes. */ @@ -913,6 +919,7 @@ vm_pageout_scan(struct vm_domain *vmd, i * drained above. */ uma_reclaim(); + lowmem_ticks = ticks; } /* @@ -1680,10 +1687,11 @@ vm_pageout(void) /* * Set interval in seconds for active scan. We want to visit each - * page at least once a minute. + * page at least once every ten minutes. This is to prevent worst + * case paging behaviors with stale active LRU. */ if (vm_pageout_update_period == 0) - vm_pageout_update_period = 60; + vm_pageout_update_period = 600; /* XXX does not really belong here */ if (vm_page_max_wired == 0) From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 02:09: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 ESMTP id DBB13141; Tue, 20 Aug 2013 02:09:26 +0000 (UTC) (envelope-from neel@FreeBSD.org) 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 AEE88271C; Tue, 20 Aug 2013 02:09: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 r7K29QLp061211; Tue, 20 Aug 2013 02:09:26 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7K29QHY061210; Tue, 20 Aug 2013 02:09:26 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201308200209.r7K29QHY061210@svn.freebsd.org> From: Neel Natu Date: Tue, 20 Aug 2013 02:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254547 - 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.14 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, 20 Aug 2013 02:09:26 -0000 Author: neel Date: Tue Aug 20 02:09:26 2013 New Revision: 254547 URL: http://svnweb.freebsd.org/changeset/base/254547 Log: Fix breakage caused by r254466 in minidumpsys(). r254466 increased the KVA from 512GB to 2TB which requires 4 PDP pages as opposed to a single one before the change. This broke minidumpsys() since it assumed that the entire KVA could be addressed via a single PDP page. Fix this by obtaining the address of the PDP page from the PML4 entry associated with the KVA being dumped. Reported by: pho Submitted by: kib Pointy hat to: neel Modified: head/sys/amd64/amd64/minidump_machdep.c Modified: head/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- head/sys/amd64/amd64/minidump_machdep.c Tue Aug 20 01:14:16 2013 (r254546) +++ head/sys/amd64/amd64/minidump_machdep.c Tue Aug 20 02:09:26 2013 (r254547) @@ -221,8 +221,8 @@ minidumpsys(struct dumperinfo *di) vm_offset_t va; int error; uint64_t bits; - uint64_t *pdp, *pd, *pt, pa; - int i, j, k, n, bit; + uint64_t *pml4, *pdp, *pd, *pt, pa; + int i, ii, j, k, n, bit; int retry_count; struct minidumphdr mdhdr; @@ -232,7 +232,6 @@ minidumpsys(struct dumperinfo *di) counter = 0; /* Walk page table pages, set bits in vm_page_dump */ pmapsize = 0; - pdp = (uint64_t *)PHYS_TO_DMAP(KPDPphys); for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR, kernel_vm_end); ) { /* @@ -240,6 +239,9 @@ minidumpsys(struct dumperinfo *di) * page written corresponds to 1GB of space */ pmapsize += PAGE_SIZE; + ii = (va >> PML4SHIFT) & ((1ul << NPML4EPGSHIFT) - 1); + pml4 = (uint64_t *)PHYS_TO_DMAP(KPML4phys) + ii; + pdp = (uint64_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME); i = (va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1); if ((pdp[i] & PG_V) == 0) { va += NBPDP; @@ -364,9 +366,11 @@ minidumpsys(struct dumperinfo *di) /* Dump kernel page directory pages */ bzero(fakepd, sizeof(fakepd)); - pdp = (uint64_t *)PHYS_TO_DMAP(KPDPphys); for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR, kernel_vm_end); va += NBPDP) { + ii = (va >> PML4SHIFT) & ((1ul << NPML4EPGSHIFT) - 1); + pml4 = (uint64_t *)PHYS_TO_DMAP(KPML4phys) + ii; + pdp = (uint64_t *)PHYS_TO_DMAP(*pml4 & PG_FRAME); i = (va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1); /* We always write a page, even if it is zero */ From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 03:05:08 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 ESMTP id 2BBC0977; Tue, 20 Aug 2013 03:05:08 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (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 08D0029E3; Tue, 20 Aug 2013 03:05:07 +0000 (UTC) Received: from Julian-MBP3.local (etroy.elischer.org [121.45.226.51]) (authenticated bits=0) by vps1.elischer.org (8.14.7/8.14.6) with ESMTP id r7K351Qq003361 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 19 Aug 2013 20:05:04 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <5212DCD8.4050004@freebsd.org> Date: Tue, 20 Aug 2013 11:04:56 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r254519 - in head/sys: netinet netinet6 sys References: <201308191108.r7JB8aQ4057777@svn.freebsd.org> In-Reply-To: <201308191108.r7JB8aQ4057777@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; 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.14 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, 20 Aug 2013 03:05:08 -0000 On 8/19/13 7:08 PM, Andre Oppermann wrote: > Author: andre > Date: Mon Aug 19 11:08:36 2013 > New Revision: 254519 > URL: http://svnweb.freebsd.org/changeset/base/254519 > > Log: > Move the global M_SKIP_FIREWALL mbuf flags to a protocol layer specific > flag instead. The flag is only used within the IP and IPv6 layer 3 > protocols. weeeeelllll, "maybe" Layer 2 usage of ipfw could make use of this flag as well. Cisco were using L2 ipfw some years back. I don't know if this affects them at all. > > Because some firewall packages treat IPv4 and IPv6 packets the same the > flag should have the same value for both. > > Discussed with: trociny, glebius > > Modified: > head/sys/netinet/ip_var.h > head/sys/netinet6/ip6_var.h > head/sys/sys/mbuf.h > > Modified: head/sys/netinet/ip_var.h > ============================================================================== > --- head/sys/netinet/ip_var.h Mon Aug 19 10:34:10 2013 (r254518) > +++ head/sys/netinet/ip_var.h Mon Aug 19 11:08:36 2013 (r254519) > @@ -163,10 +163,12 @@ void kmod_ipstat_dec(int statnum); > #define IP_ALLOWBROADCAST SO_BROADCAST /* 0x20 can send broadcast packets */ > > /* > - * mbuf flag used by ip_fastfwd > + * IPv4 protocol layer specific mbuf flags. > */ > #define M_FASTFWD_OURS M_PROTO1 /* changed dst to local */ > #define M_IP_NEXTHOP M_PROTO2 /* explicit ip nexthop */ > +#define M_SKIP_FIREWALL M_PROTO3 /* skip firewall processing, > + keep in sync with IP6 */ > #define M_IP_FRAG M_PROTO4 /* fragment reassembly */ > > #ifdef __NO_STRICT_ALIGNMENT > > Modified: head/sys/netinet6/ip6_var.h > ============================================================================== > --- head/sys/netinet6/ip6_var.h Mon Aug 19 10:34:10 2013 (r254518) > +++ head/sys/netinet6/ip6_var.h Mon Aug 19 11:08:36 2013 (r254519) > @@ -293,7 +293,12 @@ struct ip6aux { > #define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */ > #define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */ > > -#define M_IP6_NEXTHOP M_PROTO7 /* explicit ip nexthop */ > +/* > + * IPv6 protocol layer specific mbuf flags. > + */ > +#define M_IP6_NEXTHOP M_PROTO2 /* explicit ip nexthop */ > +#define M_SKIP_FIREWALL M_PROTO3 /* skip firewall processing, > + keep in sync with IPv4 */ > > #ifdef __NO_STRICT_ALIGNMENT > #define IP6_HDR_ALIGNED_P(ip) 1 > > Modified: head/sys/sys/mbuf.h > ============================================================================== > --- head/sys/sys/mbuf.h Mon Aug 19 10:34:10 2013 (r254518) > +++ head/sys/sys/mbuf.h Mon Aug 19 11:08:36 2013 (r254519) > @@ -196,7 +196,7 @@ struct mbuf { > #define M_FRAG 0x00000800 /* packet is a fragment of a larger packet */ > #define M_FIRSTFRAG 0x00001000 /* packet is first fragment */ > #define M_LASTFRAG 0x00002000 /* packet is last fragment */ > -#define M_SKIP_FIREWALL 0x00004000 /* skip firewall processing */ > + /* 0x00004000 free */ > /* 0x00008000 free */ > #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ > #define M_PROMISC 0x00020000 /* packet was not for us */ > @@ -253,7 +253,7 @@ struct mbuf { > * Flags preserved when copying m_pkthdr. > */ > #define M_COPYFLAGS \ > - (M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_SKIP_FIREWALL|M_BCAST|M_MCAST|\ > + (M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_BCAST|M_MCAST|\ > M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG|M_PROMISC|M_HASHTYPEBITS) > > /* > > From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 03:13:54 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 ESMTP id 5271FD3A; Tue, 20 Aug 2013 03:13:54 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (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 06FEC2A67; Tue, 20 Aug 2013 03:13:53 +0000 (UTC) Received: from Julian-MBP3.local (etroy.elischer.org [121.45.226.51]) (authenticated bits=0) by vps1.elischer.org (8.14.7/8.14.6) with ESMTP id r7K3Dn7N003398 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 19 Aug 2013 20:13:51 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <5212DEE7.6060804@freebsd.org> Date: Tue, 20 Aug 2013 11:13:43 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Peter Grehan Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> In-Reply-To: <52129E55.30803@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Andre Oppermann , Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 20 Aug 2013 03:13:54 -0000 On 8/20/13 6:38 AM, Peter Grehan wrote: > Hi Andre, > > (moving to the more appropriate freebsd-net) > >> I'm sorry for ambushing but this stuff has to be done. I have >> provided >> an alternative way of handling it and I'm happy to help you with your >> use case to make it good for you and to prevent the mbuf system from >> getting bloated and hackish again. > > Sure. I'm not really upset since my code wasn't too far along, but > with any API, you never know who consumers might be so it's always > worth being proactive about announcing it's removal. > >> Can you please describe your intended use of M_NOFREE to better >> understand >> the shortcomings of the current mbuf systems and the additional >> advantages >> of the M_NOFREE case? > > I was looking at something similar to Linux's vhost-net, where a > guest's virtio ring would be processed in-kernel. An mbuf chain with > external buffers would be used to pass guest tx buffer/len segments > directly into FreeBSD drivers. > > The intent of M_NOFREE was to avoid small mbuf allocations/frees in > what is a hot path. This code was intended to run at 10/40G. > > Note this code isn't really generic - it would require interfaces > to be 'owned' by the guest, except that direct PCI-level > pass-through wouldn't be needed. > > If there's an alternative to M_NOFREE, I'd be more than happy to > use that. I think an alternative would be a reference counted version. we used to have that and NetBSD had a quite sophisticated mbuf system where there were multiple owners of mbufs.. they wouldn't be freed until the last one freed it but I don't remember the details. > > later, > > Peter. > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > > From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 04:44: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 ESMTP id 35CABC80; Tue, 20 Aug 2013 04:44:31 +0000 (UTC) (envelope-from scott4long@yahoo.com) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D49112F14; Tue, 20 Aug 2013 04:44:30 +0000 (UTC) Received: from [127.0.0.1] (Scott4long@pooker.samsco.org [168.103.85.57]) (authenticated bits=0) by pooker.samsco.org (8.14.5/8.14.5) with ESMTP id r7K4iNAd036856; Mon, 19 Aug 2013 22:44:23 -0600 (MDT) (envelope-from scott4long@yahoo.com) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: svn commit: r254544 - head/sys/vm From: Scott Long In-Reply-To: <201308192354.r7JNsPD1007503@svn.freebsd.org> Date: Mon, 19 Aug 2013 22:44:23 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <16628F63-B2B5-42C5-A537-4AD87456C2F2@yahoo.com> References: <201308192354.r7JNsPD1007503@svn.freebsd.org> To: Jeff Roberson X-Mailer: Apple Mail (2.1508) 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.14 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, 20 Aug 2013 04:44:31 -0000 On Aug 19, 2013, at 5:54 PM, Jeff Roberson wrote: > Author: jeff > Date: Mon Aug 19 23:54:24 2013 > New Revision: 254544 > URL: http://svnweb.freebsd.org/changeset/base/254544 >=20 > Log: > - Increase the active lru refresh interval to 10 minutes. This has = been > shown to negatively impact some workloads and the goal is only to > eliminate worst case behaviors for very long periods of paging > inactivity. Eventually we should determine a more complex scaling > factor for this feature. > - Rate limit low memory callback handlers to limit thrashing. Set = the > default to 10 seconds. A more primitive version of this was tested at Netflix and found to be = very advantageous. Thanks for turning it into a more polished thing. Scott From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 06:20: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 ESMTP id D3C1AE6D; Tue, 20 Aug 2013 06:20:05 +0000 (UTC) (envelope-from neel@FreeBSD.org) 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 C12B6256A; Tue, 20 Aug 2013 06:20: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 r7K6K5Lh058716; Tue, 20 Aug 2013 06:20:05 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7K6K5wZ058715; Tue, 20 Aug 2013 06:20:05 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201308200620.r7K6K5wZ058715@svn.freebsd.org> From: Neel Natu Date: Tue, 20 Aug 2013 06:20:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254548 - head/sys/amd64/vmm/intel 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.14 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, 20 Aug 2013 06:20:05 -0000 Author: neel Date: Tue Aug 20 06:20:05 2013 New Revision: 254548 URL: http://svnweb.freebsd.org/changeset/base/254548 Log: Extract the location of the remapping hardware units from the ACPI DMAR table. Submitted by: Gopakumar T (gopakumar_thekkedath@yahoo.co.in) Modified: head/sys/amd64/vmm/intel/vtd.c Modified: head/sys/amd64/vmm/intel/vtd.c ============================================================================== --- head/sys/amd64/vmm/intel/vtd.c Tue Aug 20 02:09:26 2013 (r254547) +++ head/sys/amd64/vmm/intel/vtd.c Tue Aug 20 06:20:05 2013 (r254548) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "io/iommu.h" @@ -123,60 +123,6 @@ static uint64_t ctx_tables[256][PAGE_SIZ static MALLOC_DEFINE(M_VTD, "vtd", "vtd"); -/* - * Config space register definitions from the "Intel 5520 and 5500" datasheet. - */ -static int -tylersburg_vtd_ident(void) -{ - int units, nlbus; - uint16_t did, vid; - uint32_t miscsts, vtbar; - - const int bus = 0; - const int slot = 20; - const int func = 0; - - units = 0; - - vid = pci_cfgregread(bus, slot, func, PCIR_VENDOR, 2); - did = pci_cfgregread(bus, slot, func, PCIR_DEVICE, 2); - if (vid != 0x8086 || did != 0x342E) - goto done; - - /* - * Check if this is a dual IOH configuration. - */ - miscsts = pci_cfgregread(bus, slot, func, 0x9C, 4); - if (miscsts & (1 << 25)) - nlbus = pci_cfgregread(bus, slot, func, 0x160, 1); - else - nlbus = -1; - - vtbar = pci_cfgregread(bus, slot, func, 0x180, 4); - if (vtbar & 0x1) { - vtdmaps[units++] = (struct vtdmap *) - PHYS_TO_DMAP(vtbar & 0xffffe000); - } else if (bootverbose) - printf("VT-d unit in legacy IOH is disabled!\n"); - - if (nlbus != -1) { - vtbar = pci_cfgregread(nlbus, slot, func, 0x180, 4); - if (vtbar & 0x1) { - vtdmaps[units++] = (struct vtdmap *) - PHYS_TO_DMAP(vtbar & 0xffffe000); - } else if (bootverbose) - printf("VT-d unit in non-legacy IOH is disabled!\n"); - } -done: - return (units); -} - -static drhd_ident_func_t drhd_ident_funcs[] = { - tylersburg_vtd_ident, - NULL -}; - static int vtd_max_domains(struct vtdmap *vtdmap) { @@ -291,19 +237,67 @@ vtd_translation_disable(struct vtdmap *v static int vtd_init(void) { - int i, units; + int i, units, remaining; struct vtdmap *vtdmap; vm_paddr_t ctx_paddr; - - for (i = 0; drhd_ident_funcs[i] != NULL; i++) { - units = (*drhd_ident_funcs[i])(); - if (units > 0) + char *end, envname[32]; + unsigned long mapaddr; + ACPI_STATUS status; + ACPI_TABLE_DMAR *dmar; + ACPI_DMAR_HEADER *hdr; + ACPI_DMAR_HARDWARE_UNIT *drhd; + + /* + * Allow the user to override the ACPI DMAR table by specifying the + * physical address of each remapping unit. + * + * The following example specifies two remapping units at + * physical addresses 0xfed90000 and 0xfeda0000 respectively. + * set vtd.regmap.0.addr=0xfed90000 + * set vtd.regmap.1.addr=0xfeda0000 + */ + for (units = 0; units < DRHD_MAX_UNITS; units++) { + snprintf(envname, sizeof(envname), "vtd.regmap.%d.addr", units); + if (getenv_ulong(envname, &mapaddr) == 0) + break; + vtdmaps[units] = (struct vtdmap *)PHYS_TO_DMAP(mapaddr); + } + + if (units > 0) + goto skip_dmar; + + /* Search for DMAR table. */ + status = AcpiGetTable(ACPI_SIG_DMAR, 0, (ACPI_TABLE_HEADER **)&dmar); + if (ACPI_FAILURE(status)) + return (ENXIO); + + end = (char *)dmar + dmar->Header.Length; + remaining = dmar->Header.Length - sizeof(ACPI_TABLE_DMAR); + while (remaining > sizeof(ACPI_DMAR_HEADER)) { + hdr = (ACPI_DMAR_HEADER *)(end - remaining); + if (hdr->Length > remaining) + break; + /* + * From Intel VT-d arch spec, version 1.3: + * BIOS implementations must report mapping structures + * in numerical order, i.e. All remapping structures of + * type 0 (DRHD) enumerated before remapping structures of + * type 1 (RMRR) and so forth. + */ + if (hdr->Type != ACPI_DMAR_TYPE_HARDWARE_UNIT) + break; + + drhd = (ACPI_DMAR_HARDWARE_UNIT *)hdr; + vtdmaps[units++] = (struct vtdmap *)PHYS_TO_DMAP(drhd->Address); + if (units >= DRHD_MAX_UNITS) break; + remaining -= hdr->Length; } if (units <= 0) return (ENXIO); +skip_dmar: drhd_num = units; vtdmap = vtdmaps[0]; From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 06:46: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 ESMTP id 4605F3BF; Tue, 20 Aug 2013 06:46:41 +0000 (UTC) (envelope-from neel@FreeBSD.org) 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 33A67269F; Tue, 20 Aug 2013 06:46: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 r7K6kfjK067845; Tue, 20 Aug 2013 06:46:41 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7K6kf0Q067844; Tue, 20 Aug 2013 06:46:41 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201308200646.r7K6kf0Q067844@svn.freebsd.org> From: Neel Natu Date: Tue, 20 Aug 2013 06:46:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254549 - head/sys/amd64/vmm/intel 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.14 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, 20 Aug 2013 06:46:41 -0000 Author: neel Date: Tue Aug 20 06:46:40 2013 New Revision: 254549 URL: http://svnweb.freebsd.org/changeset/base/254549 Log: Do not create superpage mappings in the iommu. This is a workaround to hide the fact that we do not have any code to demote a superpage mapping before we unmap a single page that is part of the superpage. Modified: head/sys/amd64/vmm/intel/vtd.c Modified: head/sys/amd64/vmm/intel/vtd.c ============================================================================== --- head/sys/amd64/vmm/intel/vtd.c Tue Aug 20 06:20:05 2013 (r254548) +++ head/sys/amd64/vmm/intel/vtd.c Tue Aug 20 06:46:40 2013 (r254549) @@ -611,13 +611,30 @@ vtd_create_domain(vm_paddr_t maxaddr) dom = malloc(sizeof(struct domain), M_VTD, M_ZERO | M_WAITOK); dom->pt_levels = pt_levels; dom->addrwidth = addrwidth; - dom->spsmask = VTD_CAP_SPS(vtdmap->cap); dom->id = domain_id(); dom->maxaddr = maxaddr; dom->ptp = malloc(PAGE_SIZE, M_VTD, M_ZERO | M_WAITOK); if ((uintptr_t)dom->ptp & PAGE_MASK) panic("vtd_create_domain: ptp (%p) not page aligned", dom->ptp); +#ifdef notyet + /* + * XXX superpage mappings for the iommu do not work correctly. + * + * By default all physical memory is mapped into the host_domain. + * When a VM is allocated wired memory the pages belonging to it + * are removed from the host_domain and added to the vm's domain. + * + * If the page being removed was mapped using a superpage mapping + * in the host_domain then we need to demote the mapping before + * removing the page. + * + * There is not any code to deal with the demotion at the moment + * so we disable superpage mappings altogether. + */ + dom->spsmask = VTD_CAP_SPS(vtdmap->cap); +#endif + SLIST_INSERT_HEAD(&domhead, dom, next); return (dom); From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 07:19:59 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 ESMTP id 1D09DDA1; Tue, 20 Aug 2013 07:19:59 +0000 (UTC) (envelope-from des@FreeBSD.org) 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 0B1082840; Tue, 20 Aug 2013 07:19:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7K7Jw1Q080409; Tue, 20 Aug 2013 07:19:58 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7K7JwQh080408; Tue, 20 Aug 2013 07:19:58 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201308200719.r7K7JwQh080408@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Tue, 20 Aug 2013 07:19:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254553 - 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.14 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, 20 Aug 2013 07:19:59 -0000 Author: des Date: Tue Aug 20 07:19:58 2013 New Revision: 254553 URL: http://svnweb.freebsd.org/changeset/base/254553 Log: Fix the zeroing loop. I must have been drunk when I wrote this... MFC after: 3 days Modified: head/sbin/fsck_ffs/fsutil.c Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Tue Aug 20 07:15:16 2013 (r254552) +++ head/sbin/fsck_ffs/fsutil.c Tue Aug 20 07:19:58 2013 (r254553) @@ -629,6 +629,10 @@ blerase(int fd, ufs2_daddr_t blk, long s return; } +/* + * Fill a contiguous region with all-zeroes. Note ZEROBUFSIZE is by + * definition a multiple of dev_bsize. + */ void blzero(int fd, ufs2_daddr_t blk, long size) { @@ -637,9 +641,8 @@ blzero(int fd, ufs2_daddr_t blk, long si if (fd < 0) return; - len = ZEROBUFSIZE; if (zero == NULL) { - zero = calloc(len, 1); + zero = calloc(ZEROBUFSIZE, 1); if (zero == NULL) errx(EEXIT, "cannot allocate buffer pool"); } @@ -647,10 +650,7 @@ blzero(int fd, ufs2_daddr_t blk, long si if (lseek(fd, offset, 0) < 0) rwerror("SEEK BLK", blk); while (size > 0) { - if (size > len) - size = len; - else - len = size; + len = size > ZEROBUFSIZE ? ZEROBUFSIZE : size; if (write(fd, zero, len) != len) rwerror("WRITE BLK", blk); blk += len / dev_bsize; From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 11:06:57 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 ESMTP id 83ED8CF6; Tue, 20 Aug 2013 11:06:57 +0000 (UTC) (envelope-from pho@FreeBSD.org) 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 7194F25CB; Tue, 20 Aug 2013 11:06:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7KB6v0M067985; Tue, 20 Aug 2013 11:06:57 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KB6vB7067983; Tue, 20 Aug 2013 11:06:57 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201308201106.r7KB6vB7067983@svn.freebsd.org> From: Peter Holm Date: Tue, 20 Aug 2013 11:06:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254558 - 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.14 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, 20 Aug 2013 11:06:57 -0000 Author: pho Date: Tue Aug 20 11:06:56 2013 New Revision: 254558 URL: http://svnweb.freebsd.org/changeset/base/254558 Log: Added sysctl to turn off calls to vmem_check(). Sponsored by: EMC / Isilon storage division Discussed with: jeff Modified: head/sys/kern/subr_vmem.c Modified: head/sys/kern/subr_vmem.c ============================================================================== --- head/sys/kern/subr_vmem.c Tue Aug 20 07:48:20 2013 (r254557) +++ head/sys/kern/subr_vmem.c Tue Aug 20 11:06:56 2013 (r254558) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -167,6 +168,9 @@ struct vmem_btag { #define BT_END(bt) ((bt)->bt_start + (bt)->bt_size - 1) #if defined(DIAGNOSTIC) +static int enable_vmem_check = 1; +SYSCTL_INT(_debug, OID_AUTO, vmem_check, CTLFLAG_RW, + &enable_vmem_check, 0, "Enable vmem check"); static void vmem_check(vmem_t *); #endif @@ -720,9 +724,11 @@ vmem_periodic(void *unused, int pending) LIST_FOREACH(vm, &vmem_list, vm_alllist) { #ifdef DIAGNOSTIC /* Convenient time to verify vmem state. */ - VMEM_LOCK(vm); - vmem_check(vm); - VMEM_UNLOCK(vm); + if (enable_vmem_check == 1) { + VMEM_LOCK(vm); + vmem_check(vm); + VMEM_UNLOCK(vm); + } #endif desired = 1 << flsl(vm->vm_nbusytag); desired = MIN(MAX(desired, VMEM_HASHSIZE_MIN), From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 12:33:36 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 ESMTP id A10005D5; Tue, 20 Aug 2013 12:33:36 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 80D6D2B94; Tue, 20 Aug 2013 12:33: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 r7KCXakM002833; Tue, 20 Aug 2013 12:33:36 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KCXZ3p002825; Tue, 20 Aug 2013 12:33:35 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308201233.r7KCXZ3p002825@svn.freebsd.org> From: Ian Lepore Date: Tue, 20 Aug 2013 12:33:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254559 - in head/sys: arm/conf arm/ti arm/ti/am335x boot/fdt/dts dev/mmc 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.14 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, 20 Aug 2013 12:33:36 -0000 Author: ian Date: Tue Aug 20 12:33:35 2013 New Revision: 254559 URL: http://svnweb.freebsd.org/changeset/base/254559 Log: Make the standard sdhci(4) driver work for the TI OMAP family SoCs. The MMCHS hardware is pretty much a standard SDHCI v2.0 controller with a couple quirks, which are now supported by sdhci(4) as of r254507. This should work for all TI SoCs that use the MMCHS hardware, but it has only been tested on AM335x right now, so this enables it on those platforms but leaves the existing ti_mmchs driver in place for other OMAP variants until they can be tested. This initial incarnation lacks DMA support (coming soon). Even without it this improves performance pretty noticibly over the ti_mmchs driver, primarily because it now does multiblock IO. Added: head/sys/arm/ti/ti_sdhci.c (contents, props changed) Modified: head/sys/arm/conf/BEAGLEBONE head/sys/arm/ti/am335x/files.am335x head/sys/boot/fdt/dts/am335x.dtsi head/sys/dev/mmc/mmc.c Modified: head/sys/arm/conf/BEAGLEBONE ============================================================================== --- head/sys/arm/conf/BEAGLEBONE Tue Aug 20 11:06:56 2013 (r254558) +++ head/sys/arm/conf/BEAGLEBONE Tue Aug 20 12:33:35 2013 (r254559) @@ -80,6 +80,7 @@ options NFSLOCKD # MMC/SD/SDIO card slot support device mmc # mmc/sd bus device mmcsd # mmc/sd flash cards +device sdhci # mmc/sd host controller # Boot device is 2nd slice on MMC/SD card options ROOTDEVNAME=\"ufs:mmcsd0s2\" Modified: head/sys/arm/ti/am335x/files.am335x ============================================================================== --- head/sys/arm/ti/am335x/files.am335x Tue Aug 20 11:06:56 2013 (r254558) +++ head/sys/arm/ti/am335x/files.am335x Tue Aug 20 12:33:35 2013 (r254559) @@ -9,5 +9,6 @@ arm/ti/am335x/am335x_lcd_syscons.c optio arm/ti/am335x/am335x_pwm.c standard arm/ti/am335x/am335x_usbss.c optional musb fdt arm/ti/ti_edma3.c standard -arm/ti/ti_mmchs.c optional mmc +arm/ti/ti_sdhci.c optional sdhci +#arm/ti/ti_mmchs.c optional mmc arm/ti/cpsw/if_cpsw.c optional cpsw Added: head/sys/arm/ti/ti_sdhci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/ti/ti_sdhci.c Tue Aug 20 12:33:35 2013 (r254559) @@ -0,0 +1,565 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * Copyright (c) 2011 Ben Gray . + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include "sdhci_if.h" + +#include +#include +#include "gpio_if.h" + +struct ti_sdhci_softc { + device_t dev; + device_t gpio_dev; + struct resource * mem_res; + struct resource * irq_res; + void * intr_cookie; + struct sdhci_slot slot; + uint32_t mmchs_device_id; + uint32_t mmchs_reg_off; + uint32_t sdhci_reg_off; + uint32_t baseclk_hz; + uint32_t wp_gpio_pin; + uint32_t cmd_and_mode; + uint32_t sdhci_clkdiv; +}; + +/* + * The MMCHS hardware has a few control and status registers at the beginning of + * the device's memory map, followed by the standard sdhci register block. + * Different SoCs have the register blocks at different offsets from the + * beginning of the device. Define some constants to map out the registers we + * access, and the various per-SoC offsets. The SDHCI_REG_OFFSET is how far + * beyond the MMCHS block the SDHCI block is found; it's the same on all SoCs. + */ +#define OMAP3_MMCHS_REG_OFFSET 0x000 +#define OMAP4_MMCHS_REG_OFFSET 0x100 +#define AM335X_MMCHS_REG_OFFSET 0x100 +#define SDHCI_REG_OFFSET 0x100 + +#define MMCHS_SYSCONFIG 0x010 +#define MMCHS_SYSCONFIG_RESET (1 << 1) +#define MMCHS_SYSSTATUS 0x014 +#define MMCHS_CON 0x02C +#define MMCHS_CON_DW8 (1 << 5) +#define MMCHS_CON_DVAL_8_4MS (3 << 9) + +static inline uint32_t +ti_mmchs_read_4(struct ti_sdhci_softc *sc, bus_size_t off) +{ + + return (bus_read_4(sc->mem_res, off + sc->mmchs_reg_off)); +} + +static inline void +ti_mmchs_write_4(struct ti_sdhci_softc *sc, bus_size_t off, uint32_t val) +{ + + bus_write_4(sc->mem_res, off + sc->mmchs_reg_off, val); +} + +static inline uint32_t +RD4(struct ti_sdhci_softc *sc, bus_size_t off) +{ + + return (bus_read_4(sc->mem_res, off + sc->sdhci_reg_off)); +} + +static inline void +WR4(struct ti_sdhci_softc *sc, bus_size_t off, uint32_t val) +{ + + bus_write_4(sc->mem_res, off + sc->sdhci_reg_off, val); +} + +static uint8_t +ti_sdhci_read_1(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct ti_sdhci_softc *sc = device_get_softc(dev); + + return ((RD4(sc, off & ~3) >> (off & 3) * 8) & 0xff); +} + +static uint16_t +ti_sdhci_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct ti_sdhci_softc *sc = device_get_softc(dev); + uint32_t clkdiv, val32; + + /* + * The MMCHS hardware has a non-standard interpretation of the sdclock + * divisor bits. It uses the same bit positions as SDHCI 3.0 (15..6) + * but doesn't split them into low:high fields. Instead they're a + * single number in the range 0..1023 and the number is exactly the + * clock divisor (with 0 and 1 both meaning divide by 1). The SDHCI + * driver code expects a v2.0 divisor (value N is power of two in the + * range 0..128 and clock is divided by 2N). The shifting and masking + * here extracts the MMCHS representation from the hardware word, cleans + * those bits out, applies the 2N adjustment, and plugs that into the + * bit positions for the 2.0 divisor in the returned register value. The + * ti_sdhci_write_2() routine performs the opposite transformation when + * the SDHCI driver writes to the register. + */ + if (off == SDHCI_CLOCK_CONTROL) { + val32 = RD4(sc, SDHCI_CLOCK_CONTROL); + clkdiv = (val32 >> SDHCI_DIVIDER_HI_SHIFT) & 0xff; + val32 &= ~(0xff << SDHCI_DIVIDER_HI_SHIFT); + val32 |= (clkdiv / 2) << SDHCI_DIVIDER_SHIFT; + return (val32 & 0xffff); + } + + /* + * Standard 32-bit handling of command and transfer mode. + */ + if (off == SDHCI_TRANSFER_MODE) { + return (sc->cmd_and_mode >> 16); + } else if (off == SDHCI_COMMAND_FLAGS) { + return (sc->cmd_and_mode & 0x0000ffff); + } + + return ((RD4(sc, off & ~3) >> (off & 3) * 8) & 0xffff); +} + +static uint32_t +ti_sdhci_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off) +{ + struct ti_sdhci_softc *sc = device_get_softc(dev); + + return (RD4(sc, off)); +} + +static void +ti_sdhci_read_multi_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint32_t *data, bus_size_t count) +{ + struct ti_sdhci_softc *sc = device_get_softc(dev); + + bus_read_multi_4(sc->mem_res, off + sc->sdhci_reg_off, data, count); +} + +static void +ti_sdhci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint8_t val) +{ + struct ti_sdhci_softc *sc = device_get_softc(dev); + uint32_t val32; + + val32 = RD4(sc, off & ~3); + val32 &= ~(0xff << (off & 3) * 8); + val32 |= (val << (off & 3) * 8); + + WR4(sc, off & ~3, val32); +} + +static void +ti_sdhci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint16_t val) +{ + struct ti_sdhci_softc *sc = device_get_softc(dev); + uint32_t clkdiv, val32; + + /* + * Translate between the hardware and SDHCI 2.0 representations of the + * clock divisor. See the comments in ti_sdhci_read_2() for details. + */ + if (off == SDHCI_CLOCK_CONTROL) { + clkdiv = (val >> SDHCI_DIVIDER_SHIFT) & SDHCI_DIVIDER_MASK; + val32 = RD4(sc, SDHCI_CLOCK_CONTROL); + val32 &= 0xffff0000; + val32 |= val & ~(SDHCI_DIVIDER_MASK << SDHCI_DIVIDER_SHIFT); + val32 |= (clkdiv * 2) << SDHCI_DIVIDER_HI_SHIFT; + WR4(sc, SDHCI_CLOCK_CONTROL, val32); + return; + } + + /* + * Standard 32-bit handling of command and transfer mode. + */ + if (off == SDHCI_TRANSFER_MODE) { + sc->cmd_and_mode = (sc->cmd_and_mode & 0xffff0000) | + ((uint32_t)val & 0x0000ffff); + return; + } else if (off == SDHCI_COMMAND_FLAGS) { + sc->cmd_and_mode = (sc->cmd_and_mode & 0x0000ffff) | + ((uint32_t)val << 16); + WR4(sc, SDHCI_TRANSFER_MODE, sc->cmd_and_mode); + return; + } + + val32 = RD4(sc, off & ~3); + val32 &= ~(0xffff << (off & 3) * 8); + val32 |= ((val & 0xffff) << (off & 3) * 8); + WR4(sc, off & ~3, val32); +} + +static void +ti_sdhci_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint32_t val) +{ + struct ti_sdhci_softc *sc = device_get_softc(dev); + + WR4(sc, off, val); +} + +static void +ti_sdhci_write_multi_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint32_t *data, bus_size_t count) +{ + struct ti_sdhci_softc *sc = device_get_softc(dev); + + bus_write_multi_4(sc->mem_res, off + sc->sdhci_reg_off, data, count); +} + +static void +ti_sdhci_intr(void *arg) +{ + struct ti_sdhci_softc *sc = arg; + + sdhci_generic_intr(&sc->slot); +} + +static int +ti_sdhci_update_ios(device_t brdev, device_t reqdev) +{ + struct ti_sdhci_softc *sc = device_get_softc(brdev); + struct sdhci_slot *slot; + struct mmc_ios *ios; + uint32_t val32; + + slot = device_get_ivars(reqdev); + ios = &slot->host.ios; + + /* + * There is an 8-bit-bus bit in the MMCHS control register which, when + * set, overrides the 1 vs 4 bit setting in the standard SDHCI + * registers. Set that bit first according to whether an 8-bit bus is + * requested, then let the standard driver handle everything else. + */ + val32 = ti_mmchs_read_4(sc, MMCHS_CON); + if (ios->bus_width == bus_width_8) + ti_mmchs_write_4(sc, MMCHS_CON, val32 | MMCHS_CON_DW8); + else + ti_mmchs_write_4(sc, MMCHS_CON, val32 & ~MMCHS_CON_DW8); + + return (sdhci_generic_update_ios(brdev, reqdev)); +} + +static int +ti_sdhci_get_ro(device_t brdev, device_t reqdev) +{ + struct ti_sdhci_softc *sc = device_get_softc(brdev); + unsigned int readonly = 0; + + /* If a gpio pin is configured, read it. */ + if (sc->gpio_dev != NULL) { + GPIO_PIN_GET(sc->gpio_dev, sc->wp_gpio_pin, &readonly); + } + + return (readonly); +} + +static int +ti_sdhci_detach(device_t dev) +{ + + return (EBUSY); +} + +static void +ti_sdhci_hw_init(device_t dev) +{ + struct ti_sdhci_softc *sc = device_get_softc(dev); + clk_ident_t clk; + unsigned long timeout; + + /* Enable the controller and interface/functional clocks */ + clk = MMC0_CLK + sc->mmchs_device_id; + if (ti_prcm_clk_enable(clk) != 0) { + device_printf(dev, "Error: failed to enable MMC clock\n"); + return; + } + + /* Get the frequency of the source clock */ + if (ti_prcm_clk_get_source_freq(clk, &sc->baseclk_hz) != 0) { + device_printf(dev, "Error: failed to get source clock freq\n"); + return; + } + + /* Issue a softreset to the controller */ + ti_mmchs_write_4(sc, MMCHS_SYSCONFIG, MMCHS_SYSCONFIG_RESET); + timeout = 1000; + while ((ti_mmchs_read_4(sc, MMCHS_SYSSTATUS) & MMCHS_SYSCONFIG_RESET)) { + if (--timeout == 0) { + device_printf(dev, "Error: Controller reset operation timed out\n"); + break; + } + DELAY(100); + } + + /* Reset both the command and data state machines */ + ti_sdhci_write_1(dev, NULL, SDHCI_SOFTWARE_RESET, SDHCI_RESET_ALL); + timeout = 1000; + while ((ti_sdhci_read_1(dev, NULL, SDHCI_SOFTWARE_RESET) & SDHCI_RESET_ALL)) { + if (--timeout == 0) { + device_printf(dev, "Error: Software reset operation timed out\n"); + break; + } + DELAY(100); + } + + /* Set initial host configuration (1-bit, std speed, pwr off). */ + ti_sdhci_write_1(dev, NULL, SDHCI_HOST_CONTROL, 0); + ti_sdhci_write_1(dev, NULL, SDHCI_POWER_CONTROL, 0); + + /* Set the initial controller configuration. */ + ti_mmchs_write_4(sc, MMCHS_CON, MMCHS_CON_DVAL_8_4MS); +} + +static int +ti_sdhci_attach(device_t dev) +{ + struct ti_sdhci_softc *sc = device_get_softc(dev); + int rid, err; + pcell_t prop; + phandle_t node; + + sc->dev = dev; + + /* + * Get the MMCHS device id from FDT. If it's not there use the newbus + * unit number (which will work as long as the devices are in order and + * none are skipped in the fdt). + */ + node = ofw_bus_get_node(dev); + if ((OF_getprop(node, "mmchs-device-id", &prop, sizeof(prop))) <= 0) { + sc->mmchs_device_id = device_get_unit(dev); + device_printf(dev, "missing mmchs-device-id attribute in FDT, " + "using unit number (%d)", sc->mmchs_device_id); + } else + sc->mmchs_device_id = fdt32_to_cpu(prop); + + /* See if we've got a GPIO-based write detect pin. */ + if ((OF_getprop(node, "mmchs-wp-gpio-pin", &prop, sizeof(prop))) <= 0) + sc->wp_gpio_pin = 0xffffffff; + else + sc->wp_gpio_pin = fdt32_to_cpu(prop); + + if (sc->wp_gpio_pin != 0xffffffff) { + sc->gpio_dev = devclass_get_device(devclass_find("gpio"), 0); + if (sc->gpio_dev == NULL) + device_printf(dev, "Error: No GPIO device, " + "Write Protect pin will not function\n"); + else + GPIO_PIN_SETFLAGS(sc->gpio_dev, sc->wp_gpio_pin, + GPIO_PIN_INPUT); + } + + /* + * Set the offset from the device's memory start to the MMCHS registers. + * + * XXX A better way to handle this would be to have separate memory + * resources for the sdhci registers and the mmchs registers. That + * requires changing everyone's DTS files. + */ + if (ti_chip() == CHIP_OMAP_3) + sc->mmchs_reg_off = OMAP3_MMCHS_REG_OFFSET; + else if (ti_chip() == CHIP_OMAP_4) + sc->mmchs_reg_off = OMAP4_MMCHS_REG_OFFSET; + else if (ti_chip() == CHIP_AM335X) + sc->mmchs_reg_off = AM335X_MMCHS_REG_OFFSET; + else + panic("Unknown OMAP device\n"); + + /* + * The standard SDHCI registers are at a fixed offset (the same on all + * SoCs) beyond the MMCHS registers. + */ + sc->sdhci_reg_off = sc->mmchs_reg_off + SDHCI_REG_OFFSET; + + /* Resource setup. */ + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->mem_res) { + device_printf(dev, "cannot allocate memory window\n"); + err = ENXIO; + goto fail; + } + + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (!sc->irq_res) { + device_printf(dev, "cannot allocate interrupt\n"); + err = ENXIO; + goto fail; + } + + if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, ti_sdhci_intr, sc, &sc->intr_cookie)) { + device_printf(dev, "cannot setup interrupt handler\n"); + err = ENXIO; + goto fail; + } + + /* Initialise the MMCHS hardware. */ + ti_sdhci_hw_init(dev); + + /* + * The capabilities register can only express base clock frequencies in + * the range of 0-63MHz for a v2.0 controller. Since our clock runs + * faster than that, the hardware sets the frequency to zero in the + * register. When the register contains zero, the sdhci driver expects + * slot.max_clk to already have the right value in it. + */ + sc->slot.max_clk = sc->baseclk_hz; + + /* + * The MMCHS timeout counter is based on the output sdclock. Tell the + * sdhci driver to recalculate the timeout clock whenever the output + * sdclock frequency changes. + */ + sc->slot.quirks |= SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK; + + /* + * The MMCHS hardware shifts the 136-bit response data (in violation of + * the spec), so tell the sdhci driver not to do the same in software. + */ + sc->slot.quirks |= SDHCI_QUIRK_DONT_SHIFT_RESPONSE; + + /* + * DMA is not really broken, I just haven't implemented it yet. + */ + sc->slot.quirks |= SDHCI_QUIRK_BROKEN_DMA; + + /* Set up the hardware and go. */ + sdhci_init_slot(dev, &sc->slot, 0); + + /* + * The SDHCI controller doesn't realize it, but we support 8-bit even + * though we're not a v3.0 controller. Advertise the ability. + */ + sc->slot.host.caps |= MMC_CAP_8_BIT_DATA; + + bus_generic_probe(dev); + bus_generic_attach(dev); + + sdhci_start_slot(&sc->slot); + + return (0); + +fail: + if (sc->intr_cookie) + bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie); + if (sc->irq_res) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); + if (sc->mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); + + return (err); +} + +static int +ti_sdhci_probe(device_t dev) +{ + + if (!ofw_bus_is_compatible(dev, "ti,mmchs")) { + return (ENXIO); + } + + device_set_desc(dev, "TI MMCHS (SDHCI 2.0)"); + + return (BUS_PROBE_DEFAULT); +} + +static device_method_t ti_sdhci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ti_sdhci_probe), + DEVMETHOD(device_attach, ti_sdhci_attach), + DEVMETHOD(device_detach, ti_sdhci_detach), + + /* Bus interface */ + DEVMETHOD(bus_read_ivar, sdhci_generic_read_ivar), + DEVMETHOD(bus_write_ivar, sdhci_generic_write_ivar), + DEVMETHOD(bus_print_child, bus_generic_print_child), + + /* MMC bridge interface */ + DEVMETHOD(mmcbr_update_ios, ti_sdhci_update_ios), + DEVMETHOD(mmcbr_request, sdhci_generic_request), + DEVMETHOD(mmcbr_get_ro, ti_sdhci_get_ro), + DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), + DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), + + /* SDHCI registers accessors */ + DEVMETHOD(sdhci_read_1, ti_sdhci_read_1), + DEVMETHOD(sdhci_read_2, ti_sdhci_read_2), + DEVMETHOD(sdhci_read_4, ti_sdhci_read_4), + DEVMETHOD(sdhci_read_multi_4, ti_sdhci_read_multi_4), + DEVMETHOD(sdhci_write_1, ti_sdhci_write_1), + DEVMETHOD(sdhci_write_2, ti_sdhci_write_2), + DEVMETHOD(sdhci_write_4, ti_sdhci_write_4), + DEVMETHOD(sdhci_write_multi_4, ti_sdhci_write_multi_4), + + DEVMETHOD_END +}; + +static devclass_t ti_sdhci_devclass; + +static driver_t ti_sdhci_driver = { + "sdhci_ti", + ti_sdhci_methods, + sizeof(struct ti_sdhci_softc), +}; + +DRIVER_MODULE(sdhci_ti, simplebus, ti_sdhci_driver, ti_sdhci_devclass, 0, 0); +MODULE_DEPEND(sdhci_ti, sdhci, 1, 1, 1); Modified: head/sys/boot/fdt/dts/am335x.dtsi ============================================================================== --- head/sys/boot/fdt/dts/am335x.dtsi Tue Aug 20 11:06:56 2013 (r254558) +++ head/sys/boot/fdt/dts/am335x.dtsi Tue Aug 20 12:33:35 2013 (r254559) @@ -112,6 +112,7 @@ interrupts = <64>; interrupt-parent = <&AINTC>; mmchs-device-id = <0>; + mmchs-wp-gpio-pin = <0xffffffff>; }; mmchs1@481D8000 { @@ -120,6 +121,7 @@ interrupts = <28>; interrupt-parent = <&AINTC>; mmchs-device-id = <1>; + mmchs-wp-gpio-pin = <0xffffffff>; status = "disabled"; }; Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Tue Aug 20 11:06:56 2013 (r254558) +++ head/sys/dev/mmc/mmc.c Tue Aug 20 12:33:35 2013 (r254559) @@ -1761,3 +1761,4 @@ DRIVER_MODULE(mmc, at91_mci, mmc_driver, DRIVER_MODULE(mmc, sdhci_pci, mmc_driver, mmc_devclass, NULL, NULL); DRIVER_MODULE(mmc, sdhci_bcm, mmc_driver, mmc_devclass, NULL, NULL); DRIVER_MODULE(mmc, sdhci_fdt, mmc_driver, mmc_devclass, NULL, NULL); +DRIVER_MODULE(mmc, sdhci_ti, mmc_driver, mmc_devclass, NULL, NULL); From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 13:50:58 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 ESMTP id 3AFDF53E; Tue, 20 Aug 2013 13:50:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0BDC6209A; Tue, 20 Aug 2013 13:50:58 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 52AA5B924; Tue, 20 Aug 2013 09:50:55 -0400 (EDT) From: John Baldwin To: Mark Johnston Subject: Re: svn commit: r254309 - in head: share/man/man9 sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/dev/dtrace sys/cddl/dev/sdt sys/kern sys/sys Date: Tue, 20 Aug 2013 08:14:26 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p28; KDE/4.5.5; amd64; ; ) References: <201308140042.r7E0gMtf054550@svn.freebsd.org> <201308191542.30797.jhb@freebsd.org> <20130819201445.GB4765@charmander.sandvine.com> In-Reply-To: <20130819201445.GB4765@charmander.sandvine.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201308200814.26924.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 20 Aug 2013 09:50:55 -0400 (EDT) Cc: Davide Italiano , 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.14 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, 20 Aug 2013 13:50:58 -0000 On Monday, August 19, 2013 4:14:45 pm Mark Johnston wrote: > On Mon, Aug 19, 2013 at 03:42:30PM -0400, John Baldwin wrote: > > On Friday, August 16, 2013 1:41:31 pm Mark Johnston wrote: > > > On Fri, Aug 16, 2013 at 07:13:16PM +0200, Davide Italiano wrote: > > > > [trim old mails] > > > > > > > > > diff --git a/sys/sys/pmckern.h b/sys/sys/pmckern.h > > > > > index e3e18a6..90585de 100644 > > > > > --- a/sys/sys/pmckern.h > > > > > +++ b/sys/sys/pmckern.h > > > > > @@ -51,13 +51,11 @@ > > > > > #define PMC_FN_CSW_IN 2 > > > > > #define PMC_FN_CSW_OUT 3 > > > > > #define PMC_FN_DO_SAMPLES 4 > > > > > -#define PMC_FN_KLD_LOAD 5 > > > > > -#define PMC_FN_KLD_UNLOAD 6 > > > > > -#define PMC_FN_MMAP 7 > > > > > -#define PMC_FN_MUNMAP 8 > > > > > -#define PMC_FN_USER_CALLCHAIN 9 > > > > > -#define PMC_FN_USER_CALLCHAIN_SOFT 10 > > > > > -#define PMC_FN_SOFT_SAMPLING 11 > > > > > +#define PMC_FN_MMAP 5 > > > > > +#define PMC_FN_MUNMAP 6 > > > > > +#define PMC_FN_USER_CALLCHAIN 7 > > > > > +#define PMC_FN_USER_CALLCHAIN_SOFT 8 > > > > > +#define PMC_FN_SOFT_SAMPLING 9 > > > > > > > > > > > > > I've skimmed over your patch quickly so I could miss something, but I > > > > worry about this change breaking the KBI. > > > > Does this make sense for you? > > > > > > I think you're right. I considered this last night, but it didn't occur > > > to me that external modules might try to invoke these hooks. I'm not > > > sure if such modules exist, but it's better to be safe. I updated the > > > patch here: > > > > > > http://people.freebsd.org/~markj/patches/hwpmc-eh/hwpmc-eh-3.diff > > > > This generally looks correct. I would probably not call it > > KLD_LOCK_ASSERT_READ() as it asserts any lock (not specifically a > > read lock). Normally I would use macros like this: > > > > KLD_WLOCK/WUNLOCK > > KLD_RLOCK/RUNLOCK > > KLD_ASSERT_LOCKED/KLD_ASSERT_WLOCKED > > > > However, the existing macros all were named to not assume read > > locking and then some read locking was added on the side. I'm > > not sure exactly what macro name makes the most sense, and would > > in fact be tempted to just retire all the KLD_* macros for locking > > and use sx(9) directly, but that is a fairly minor point. (And if > > done should be a separate commit). > > Yeah, KLD_LOCK_ASSERT_READ() is awkward, but I couldn't come up with > anything better without renaming the existing macros. I'm fine with > getting rid of them and using the sx_* calls directly; it'll be the same > amount of churn as changing the macro names anyway. > > So how about this: I'll get rid of the macros in one commit, change the > locking rules for linker_file_lookup_set() using my existing patch but > without the KLD lock macros, and then convert the hwpmc(4) hooks to use > the new event handlers (making sure to avoid breaking the KBI as Davide > pointed out). That sounds great to me. Thanks! -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 14:35: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 ESMTP id 878F782B; Tue, 20 Aug 2013 14:35:18 +0000 (UTC) (envelope-from bz@FreeBSD.org) 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 759AA244A; Tue, 20 Aug 2013 14:35: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 r7KEZIHS057043; Tue, 20 Aug 2013 14:35:18 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KEZIKV057042; Tue, 20 Aug 2013 14:35:18 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201308201435.r7KEZIKV057042@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 20 Aug 2013 14:35:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254569 - 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.14 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, 20 Aug 2013 14:35:18 -0000 Author: bz Date: Tue Aug 20 14:35:17 2013 New Revision: 254569 URL: http://svnweb.freebsd.org/changeset/base/254569 Log: After r241616 properly export ifi_baudrate_pf in the 32bit compat case. MFC after: 3 days Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Tue Aug 20 14:29:43 2013 (r254568) +++ head/sys/net/rtsock.c Tue Aug 20 14:35:17 2013 (r254569) @@ -86,7 +86,7 @@ struct if_data32 { uint8_t ifi_hdrlen; uint8_t ifi_link_state; uint8_t ifi_vhid; - uint8_t ifi_spare_char2; + uint8_t ifi_baudrate_pf; uint8_t ifi_datalen; uint32_t ifi_mtu; uint32_t ifi_metric; @@ -1629,6 +1629,7 @@ copy_ifdata32(struct if_data *src, struc CP(*src, *dst, ifi_hdrlen); CP(*src, *dst, ifi_link_state); CP(*src, *dst, ifi_vhid); + CP(*src, *dst, ifi_baudrate_pf); dst->ifi_datalen = sizeof(struct if_data32); CP(*src, *dst, ifi_mtu); CP(*src, *dst, ifi_metric); From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 14:37: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 ESMTP id B8FE59A0; Tue, 20 Aug 2013 14:37:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) 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 A6A752469; Tue, 20 Aug 2013 14:37: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 r7KEb6u7057381; Tue, 20 Aug 2013 14:37:06 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KEb6Po057380; Tue, 20 Aug 2013 14:37:06 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201308201437.r7KEb6Po057380@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 20 Aug 2013 14:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254570 - head/tools/tools/ifinfo 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.14 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, 20 Aug 2013 14:37:06 -0000 Author: bz Date: Tue Aug 20 14:37:06 2013 New Revision: 254570 URL: http://svnweb.freebsd.org/changeset/base/254570 Log: Catch up with various changes to if_data and make this compile again on HEAD. Seems to be one of the the only tools giving us access to ifi_baudrate and ifi_baudrate_pf values. MFC after: 3 days Modified: head/tools/tools/ifinfo/ifinfo.c Modified: head/tools/tools/ifinfo/ifinfo.c ============================================================================== --- head/tools/tools/ifinfo/ifinfo.c Tue Aug 20 14:35:17 2013 (r254569) +++ head/tools/tools/ifinfo/ifinfo.c Tue Aug 20 14:37:06 2013 (r254570) @@ -169,8 +169,11 @@ printit(const struct ifmibdata *ifmd, co ifmd->ifmd_data.ifi_physical)); printf("\taddress length: %d\n", ifmd->ifmd_data.ifi_addrlen); printf("\theader length: %d\n", ifmd->ifmd_data.ifi_hdrlen); - printf("\treceive spare char1: %u\n", ifmd->ifmd_data.ifi_spare_char1); - printf("\ttransmit spare char2: %u\n", ifmd->ifmd_data.ifi_spare_char2); + printf("\tlink state: %u\n", ifmd->ifmd_data.ifi_link_state); + printf("\tvhid: %u\n", ifmd->ifmd_data.ifi_vhid); + printf("\tbaudrate power factor: %u\n", + ifmd->ifmd_data.ifi_baudrate_pf); + printf("\tdatalen: %u\n", ifmd->ifmd_data.ifi_datalen); printf("\tmtu: %lu\n", ifmd->ifmd_data.ifi_mtu); printf("\tmetric: %lu\n", ifmd->ifmd_data.ifi_metric); printf("\tline rate: %lu bit/s\n", ifmd->ifmd_data.ifi_baudrate); @@ -186,6 +189,10 @@ printit(const struct ifmibdata *ifmd, co printf("\tinput queue drops: %lu\n", ifmd->ifmd_data.ifi_iqdrops); printf("\tpackets for unknown protocol: %lu\n", ifmd->ifmd_data.ifi_noproto); + printf("\tHW offload capabilities: 0x%lx\n", + ifmd->ifmd_data.ifi_hwassist); + printf("\tuptime at attach or stat reset: %lu\n", + ifmd->ifmd_data.ifi_epoch); #ifdef notdef printf("\treceive timing: %lu usec\n", ifmd->ifmd_data.ifi_recvtiming); printf("\ttransmit timing: %lu usec\n", From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 14:59: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 ESMTP id A6F49DB2; Tue, 20 Aug 2013 14:59:31 +0000 (UTC) (envelope-from bz@FreeBSD.org) 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 94FD325CC; Tue, 20 Aug 2013 14:59: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 r7KExVYg064938; Tue, 20 Aug 2013 14:59:31 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KExVIp064937; Tue, 20 Aug 2013 14:59:31 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201308201459.r7KExVIp064937@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 20 Aug 2013 14:59:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254571 - head/sys/dev/hwpmc 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.14 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, 20 Aug 2013 14:59:31 -0000 Author: bz Date: Tue Aug 20 14:59:31 2013 New Revision: 254571 URL: http://svnweb.freebsd.org/changeset/base/254571 Log: Correct a typo in the event mask mnemonic. Reviewed by: gnn MFC after: 3 days Modified: head/sys/dev/hwpmc/pmc_events.h Modified: head/sys/dev/hwpmc/pmc_events.h ============================================================================== --- head/sys/dev/hwpmc/pmc_events.h Tue Aug 20 14:37:06 2013 (r254570) +++ head/sys/dev/hwpmc/pmc_events.h Tue Aug 20 14:59:31 2013 (r254571) @@ -3185,7 +3185,7 @@ __PMC_EV_ALIAS("LOCK_CYCLES.SPLIT_LOCK_U IAP_EVENT_63H_01H) \ __PMC_EV_ALIAS("LOCK_CYCLES.CACHE_LOCK_DURATION", IAP_EVENT_63H_02H) \ __PMC_EV_ALIAS("IDQ.EMPTY", IAP_EVENT_79H_02H) \ -__PMC_EV_ALIAS("IQD.MITE_UOPS", IAP_EVENT_79H_04H) \ +__PMC_EV_ALIAS("IDQ.MITE_UOPS", IAP_EVENT_79H_04H) \ __PMC_EV_ALIAS("IDQ.DSB_UOPS", IAP_EVENT_79H_08H) \ __PMC_EV_ALIAS("IDQ.MS_DSB_UOPS", IAP_EVENT_79H_10H) \ __PMC_EV_ALIAS("IDQ.MS_MITE_UOPS", IAP_EVENT_79H_20H) \ From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 16:21: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 ESMTP id 9BFDC59B; Tue, 20 Aug 2013 16:21:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) 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 8A0CD2B50; Tue, 20 Aug 2013 16:21: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 r7KGL5O1098882; Tue, 20 Aug 2013 16:21:05 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KGL5T4098881; Tue, 20 Aug 2013 16:21:05 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201308201621.r7KGL5T4098881@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 20 Aug 2013 16:21:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254572 - head/sys/dev/usb/input 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.14 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, 20 Aug 2013 16:21:05 -0000 Author: hselasky Date: Tue Aug 20 16:21:05 2013 New Revision: 254572 URL: http://svnweb.freebsd.org/changeset/base/254572 Log: Force keyboards which don't have the required HID fields to use the USB BOOT protocol for now. PR: usb/181425 Submitted by: Andrey Zholos MFC after: 4 weeks Modified: head/sys/dev/usb/input/ukbd.c Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Tue Aug 20 14:59:31 2013 (r254571) +++ head/sys/dev/usb/input/ukbd.c Tue Aug 20 16:21:05 2013 (r254572) @@ -1130,8 +1130,12 @@ ukbd_parse_hid(struct ukbd_softc *sc, co HID_USAGE2(HUP_KEYBOARD, 0x00), hid_input, 0, &sc->sc_loc_events, &flags, &sc->sc_id_events)) { - sc->sc_flags |= UKBD_FLAG_EVENTS; - DPRINTFN(1, "Found keyboard events\n"); + if (flags & HIO_VARIABLE) { + DPRINTFN(1, "Ignoring keyboard event control\n"); + } else { + sc->sc_flags |= UKBD_FLAG_EVENTS; + DPRINTFN(1, "Found keyboard event array\n"); + } } /* figure out leds on keyboard */ From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 17:43:04 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 ESMTP id 239528EC for ; Tue, 20 Aug 2013 17:43:04 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 70C952FE7 for ; Tue, 20 Aug 2013 17:43:03 +0000 (UTC) Received: (qmail 66588 invoked from network); 20 Aug 2013 18:26:17 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 20 Aug 2013 18:26:17 -0000 Message-ID: <5213AAA1.6020700@freebsd.org> Date: Tue, 20 Aug 2013 19:42:57 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Navdeep Parhar Subject: Re: svn commit: r254524 - head/sys/sys References: <201308191356.r7JDuELE075073@svn.freebsd.org> <521257E2.4020502@FreeBSD.org> In-Reply-To: <521257E2.4020502@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; 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.14 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, 20 Aug 2013 17:43:04 -0000 On 19.08.2013 19:37, Navdeep Parhar wrote: > On 08/19/13 06:56, Andre Oppermann wrote: >> Author: andre >> Date: Mon Aug 19 13:56:14 2013 >> New Revision: 254524 >> URL: http://svnweb.freebsd.org/changeset/base/254524 >> >> Log: >> Add four additional M_PROTOFLAGS[9-12] for protocol specific use. >> >> Discussed with: trociny, glebius, adrian >> >> Modified: >> head/sys/sys/mbuf.h >> >> Modified: head/sys/sys/mbuf.h >> ============================================================================== >> --- head/sys/sys/mbuf.h Mon Aug 19 13:27:32 2013 (r254523) >> +++ head/sys/sys/mbuf.h Mon Aug 19 13:56:14 2013 (r254524) >> @@ -196,22 +196,24 @@ struct mbuf { >> #define M_FRAG 0x00000800 /* packet is a fragment of a larger packet */ >> #define M_FIRSTFRAG 0x00001000 /* packet is first fragment */ >> #define M_LASTFRAG 0x00002000 /* packet is last fragment */ >> - /* 0x00004000 free */ >> - /* 0x00008000 free */ >> +#define M_PROTO9 0x00004000 /* protocol-specific */ >> +#define M_PROTO10 0x00008000 /* protocol-specific */ >> #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ >> #define M_PROMISC 0x00020000 /* packet was not for us */ >> - /* 0x00040000 free */ >> +#define M_PROTO11 0x00040000 /* protocol-specific */ >> #define M_PROTO6 0x00080000 /* protocol-specific */ >> #define M_PROTO7 0x00100000 /* protocol-specific */ >> #define M_PROTO8 0x00200000 /* protocol-specific */ >> #define M_FLOWID 0x00400000 /* deprecated: flowid is valid */ >> +#define M_PROTO12 0x00800000 /* protocol-specific */ >> #define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid hash type */ > > Why reuse the freed up bits so soon (at least one of which I think was > prematurely GC'ed -- see my other email on M_NOFREE). There was room > beyond M_HASHTYPEBITS, no? This is HEAD where kernel and modules have to be (re)compiled together at any point in time. On stable this reuse would not have been possible. In a subsequent commit I compacted and ordered the flags. There's a couple of free ones remaining. I have some additional mbuf changes coming up to be posted for possible objections later today. The close HEAD freeze deadline has got me rushed a bit to allow 10.x backporting of the checksum/offload overhaul. -- Andre From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 18:08:07 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 ESMTP id 67A972B3; Tue, 20 Aug 2013 18:08:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) 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 559D62161; Tue, 20 Aug 2013 18:08: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 r7KI87m2040015; Tue, 20 Aug 2013 18:08:07 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KI87bw040014; Tue, 20 Aug 2013 18:08:07 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201308201808.r7KI87bw040014@svn.freebsd.org> From: John Baldwin Date: Tue, 20 Aug 2013 18:08:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254576 - head/sys/ofed/drivers/infiniband/ulp/ipoib 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.14 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, 20 Aug 2013 18:08:07 -0000 Author: jhb Date: Tue Aug 20 18:08:06 2013 New Revision: 254576 URL: http://svnweb.freebsd.org/changeset/base/254576 Log: Stop an ipoib interface before detaching it. PR: kern/181225 Submitted by: Shahar Klein Obtained from: Mellanox MFC after: 1 week Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Tue Aug 20 18:06:18 2013 (r254575) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Tue Aug 20 18:08:06 2013 (r254576) @@ -1073,6 +1073,8 @@ ipoib_remove_one(struct ib_device *devic if (rdma_port_get_link_layer(device, priv->port) != IB_LINK_LAYER_INFINIBAND) continue; + ipoib_stop(priv); + ib_unregister_event_handler(&priv->event_handler); /* dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP); */ From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 18:13:16 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 ESMTP id 056DC695; Tue, 20 Aug 2013 18:13:16 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vc0-x229.google.com (mail-vc0-x229.google.com [IPv6:2607:f8b0:400c:c03::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7007721DA; Tue, 20 Aug 2013 18:13:15 +0000 (UTC) Received: by mail-vc0-f169.google.com with SMTP id ib11so577894vcb.28 for ; Tue, 20 Aug 2013 11:13:14 -0700 (PDT) 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=knnUfl9PHVgzFl530Cf1XsprQlZbeAc9JoeL/KZH2pI=; b=kI7C1H9UTvlGqi6FQVxP29ISEmowiAgX2opRYjMKuly/tfvkgPguAYe5ziU/u++jcO WiMpmExjVYqFYPa8O26zG+FxukrWP8VAwmLTuYiqB3mRQQKfd7GqSQJDJ3akmhoxirzg yrslyL0pSLNvFYp0rKmJVmvCDDEkgzYATgv+Q/gQ9KKHb6wWaU3tz/LKb8g7R7LxIQfb l1Xhaq07RjIA+zGVy1B52yCk+OYsEFsHfdU93VYtc0wHLeg9+q4xLFpHLqBuj1KjGMBR mbQRt4PqxlQiZGHTtEikGq4B6X6uLwaQZZRw64TFPzKd31XeISC7q0ELE3rkbGtjMcgv 0uYw== MIME-Version: 1.0 X-Received: by 10.52.120.114 with SMTP id lb18mr1949741vdb.23.1377022394391; Tue, 20 Aug 2013 11:13:14 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.220.65.132 with HTTP; Tue, 20 Aug 2013 11:13:14 -0700 (PDT) In-Reply-To: <5213AAA1.6020700@freebsd.org> References: <201308191356.r7JDuELE075073@svn.freebsd.org> <521257E2.4020502@FreeBSD.org> <5213AAA1.6020700@freebsd.org> Date: Tue, 20 Aug 2013 20:13:14 +0200 X-Google-Sender-Auth: G2g3t799u9D7qeP8IaWnee0SxNo Message-ID: Subject: Re: svn commit: r254524 - head/sys/sys From: Davide Italiano To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 20 Aug 2013 18:13:16 -0000 On Tue, Aug 20, 2013 at 7:42 PM, Andre Oppermann wrote: > On 19.08.2013 19:37, Navdeep Parhar wrote: >> >> On 08/19/13 06:56, Andre Oppermann wrote: >>> >>> Author: andre >>> Date: Mon Aug 19 13:56:14 2013 >>> New Revision: 254524 >>> URL: http://svnweb.freebsd.org/changeset/base/254524 >>> >>> Log: >>> Add four additional M_PROTOFLAGS[9-12] for protocol specific use. >>> >>> Discussed with: trociny, glebius, adrian >>> >>> Modified: >>> head/sys/sys/mbuf.h >>> >>> Modified: head/sys/sys/mbuf.h >>> >>> ============================================================================== >>> --- head/sys/sys/mbuf.h Mon Aug 19 13:27:32 2013 (r254523) >>> +++ head/sys/sys/mbuf.h Mon Aug 19 13:56:14 2013 (r254524) >>> @@ -196,22 +196,24 @@ struct mbuf { >>> #define M_FRAG 0x00000800 /* packet is a fragment of a >>> larger packet */ >>> #define M_FIRSTFRAG 0x00001000 /* packet is first fragment */ >>> #define M_LASTFRAG 0x00002000 /* packet is last fragment */ >>> - /* 0x00004000 free */ >>> - /* 0x00008000 free */ >>> +#define M_PROTO9 0x00004000 /* protocol-specific */ >>> +#define M_PROTO10 0x00008000 /* protocol-specific */ >>> #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ >>> #define M_PROMISC 0x00020000 /* packet was not for us */ >>> - /* 0x00040000 free */ >>> +#define M_PROTO11 0x00040000 /* protocol-specific */ >>> #define M_PROTO6 0x00080000 /* protocol-specific */ >>> #define M_PROTO7 0x00100000 /* protocol-specific */ >>> #define M_PROTO8 0x00200000 /* protocol-specific */ >>> #define M_FLOWID 0x00400000 /* deprecated: flowid is valid >>> */ >>> +#define M_PROTO12 0x00800000 /* protocol-specific */ >>> #define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid >>> hash type */ >> >> >> Why reuse the freed up bits so soon (at least one of which I think was >> prematurely GC'ed -- see my other email on M_NOFREE). There was room >> beyond M_HASHTYPEBITS, no? > > > This is HEAD where kernel and modules have to be (re)compiled together > at any point in time. On stable this reuse would not have been possible. > > In a subsequent commit I compacted and ordered the flags. There's a couple > of free ones remaining. > > I have some additional mbuf changes coming up to be posted for possible > objections later today. The close HEAD freeze deadline has got me rushed > a bit to allow 10.x backporting of the checksum/offload overhaul. > > -- > Andre > In my opinion the possibility we have about breaking KPI/KBI should not be abused, even if it's allowed in HEAD. In other words,people should go for preserving it when (as in this case) it's easy and without additional costs. Your point about "this is HEAD, it can be broken at any time" makes relatively little sense to me. Note that in the worst case such KPI/KBI breakages are annoying for $VENDORS who maintain out-of-tree code, which need to rebuild/change their code, or, if they get pissed off, drop FreeBSD support. In your case, it's just a matter of "code cleaness" about few lines, which, IMHO and always IMHO, doesn't justify the breakage. Thanks, -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 18:22: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 ESMTP id 3D65AA57; Tue, 20 Aug 2013 18:22:05 +0000 (UTC) (envelope-from np@FreeBSD.org) 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 2B6B2228D; Tue, 20 Aug 2013 18:22: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 r7KIM5da046847; Tue, 20 Aug 2013 18:22:05 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KIM5Un046846; Tue, 20 Aug 2013 18:22:05 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201308201822.r7KIM5Un046846@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 20 Aug 2013 18:22:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254577 - head/sys/dev/cxgbe 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.14 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, 20 Aug 2013 18:22:05 -0000 Author: np Date: Tue Aug 20 18:22:04 2013 New Revision: 254577 URL: http://svnweb.freebsd.org/changeset/base/254577 Log: Display P/N information in the description. Submitted by: gnn MFC after: 3 days Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Aug 20 18:08:06 2013 (r254576) +++ head/sys/dev/cxgbe/t4_main.c Tue Aug 20 18:22:04 2013 (r254577) @@ -2549,9 +2549,9 @@ t4_set_desc(struct adapter *sc) char buf[128]; struct adapter_params *p = &sc->params; - snprintf(buf, sizeof(buf), "Chelsio %s %sNIC (rev %d), S/N:%s, E/C:%s", - p->vpd.id, is_offload(sc) ? "R" : "", chip_rev(sc), p->vpd.sn, - p->vpd.ec); + snprintf(buf, sizeof(buf), "Chelsio %s %sNIC (rev %d), S/N:%s, " + "P/N:%s, E/C:%s", p->vpd.id, is_offload(sc) ? "R" : "", + chip_rev(sc), p->vpd.sn, p->vpd.pn, p->vpd.ec); device_set_desc_copy(sc->dev, buf); } From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 20:40: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 ESMTP id B693DEE8; Tue, 20 Aug 2013 20:40:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) 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 89F4A2B00; Tue, 20 Aug 2013 20:40:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7KKeKCY009164; Tue, 20 Aug 2013 20:40:20 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KKeK2A009163; Tue, 20 Aug 2013 20:40:20 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201308202040.r7KKeK2A009163@svn.freebsd.org> From: Andrew Turner Date: Tue, 20 Aug 2013 20:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254580 - head/sys/arm/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.14 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, 20 Aug 2013 20:40:20 -0000 Author: andrew Date: Tue Aug 20 20:40:20 2013 New Revision: 254580 URL: http://svnweb.freebsd.org/changeset/base/254580 Log: Enable VFP on ARMADA XP. Modified: head/sys/arm/conf/ARMADAXP Modified: head/sys/arm/conf/ARMADAXP ============================================================================== --- head/sys/arm/conf/ARMADAXP Tue Aug 20 19:17:01 2013 (r254579) +++ head/sys/arm/conf/ARMADAXP Tue Aug 20 20:40:20 2013 (r254580) @@ -37,6 +37,7 @@ options MUTEX_NOINLINE options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT options NO_SWAPPING +options VFP options SMP From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 20:46: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 ESMTP id 9F8F5244; Tue, 20 Aug 2013 20:46:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) 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 8C6062B77; Tue, 20 Aug 2013 20:46: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 r7KKkTA1011367; Tue, 20 Aug 2013 20:46:29 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KKkT8S011366; Tue, 20 Aug 2013 20:46:29 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201308202046.r7KKkT8S011366@svn.freebsd.org> From: Dimitry Andric Date: Tue, 20 Aug 2013 20:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254581 - head/contrib/llvm/tools/clang/lib/Sema 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.14 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, 20 Aug 2013 20:46:29 -0000 Author: dim Date: Tue Aug 20 20:46:29 2013 New Revision: 254581 URL: http://svnweb.freebsd.org/changeset/base/254581 Log: Pull in r188716 from upstream clang trunk: PR16727: don't try to evaluate a potentially value-dependent expression when checking for missing parens in &&/|| expressions. This fixes an assertion encountered when building the lang/sdcc port. Reported by: kwm Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp Tue Aug 20 20:40:20 2013 (r254580) +++ head/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp Tue Aug 20 20:46:29 2013 (r254581) @@ -8884,14 +8884,16 @@ EmitDiagnosticForLogicalAndInLogicalOr(S /// 'true'. static bool EvaluatesAsTrue(Sema &S, Expr *E) { bool Res; - return E->EvaluateAsBooleanCondition(Res, S.getASTContext()) && Res; + return !E->isValueDependent() && + E->EvaluateAsBooleanCondition(Res, S.getASTContext()) && Res; } /// \brief Returns true if the given expression can be evaluated as a constant /// 'false'. static bool EvaluatesAsFalse(Sema &S, Expr *E) { bool Res; - return E->EvaluateAsBooleanCondition(Res, S.getASTContext()) && !Res; + return !E->isValueDependent() && + E->EvaluateAsBooleanCondition(Res, S.getASTContext()) && !Res; } /// \brief Look for '&&' in the left hand of a '||' expr. From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 20:51: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 ESMTP id 11B90411; Tue, 20 Aug 2013 20:51:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) 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 D9A862BEB; Tue, 20 Aug 2013 20:51: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 r7KKpWtq014991; Tue, 20 Aug 2013 20:51:32 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KKpWHJ014990; Tue, 20 Aug 2013 20:51:32 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201308202051.r7KKpWHJ014990@svn.freebsd.org> From: Dimitry Andric Date: Tue, 20 Aug 2013 20:51:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254582 - head/contrib/llvm/tools/clang/lib/Sema 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.14 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, 20 Aug 2013 20:51:33 -0000 Author: dim Date: Tue Aug 20 20:51:32 2013 New Revision: 254582 URL: http://svnweb.freebsd.org/changeset/base/254582 Log: Pull in r182983 from upstream clang trunk: Fix handling of braced-init-list as reference initializer within aggregate initialization. Previously we would incorrectly require an extra set of braces around such initializers. Pull in r188718 from upstream clang trunk: Handle init lists and _Atomic fields. Fixes PR16931. These fixes are needed for the atomic_flag type to work correctly in our stdatomic.h. Requested by: theraven Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Tue Aug 20 20:46:29 2013 (r254581) +++ head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp Tue Aug 20 20:51:32 2013 (r254582) @@ -774,6 +774,11 @@ void InitListChecker::CheckSubElementTyp InitListExpr *StructuredList, unsigned &StructuredIndex) { Expr *expr = IList->getInit(Index); + + if (ElemType->isReferenceType()) + return CheckReferenceType(Entity, IList, ElemType, Index, + StructuredList, StructuredIndex); + if (InitListExpr *SubInitList = dyn_cast(expr)) { if (!ElemType->isRecordType() || ElemType->isAggregateType()) { unsigned newIndex = 0; @@ -793,13 +798,13 @@ void InitListChecker::CheckSubElementTyp // C++ initialization is handled later. } - if (ElemType->isScalarType()) { + // FIXME: Need to handle atomic aggregate types with implicit init lists. + if (ElemType->isScalarType() || ElemType->isAtomicType()) return CheckScalarType(Entity, IList, ElemType, Index, StructuredList, StructuredIndex); - } else if (ElemType->isReferenceType()) { - return CheckReferenceType(Entity, IList, ElemType, Index, - StructuredList, StructuredIndex); - } + + assert((ElemType->isRecordType() || ElemType->isVectorType() || + ElemType->isArrayType()) && "Unexpected type"); if (const ArrayType *arrayType = SemaRef.Context.getAsArrayType(ElemType)) { // arrayType can be incomplete if we're initializing a flexible From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 22:27: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 ESMTP id 0CCB07C0; Tue, 20 Aug 2013 22:27:07 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from aslan.scsiguy.com (mail.scsiguy.com [70.89.174.89]) (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 C91042159; Tue, 20 Aug 2013 22:27:06 +0000 (UTC) Received: from [192.168.6.147] (207-225-98-3.dia.static.qwest.net [207.225.98.3]) (authenticated bits=0) by aslan.scsiguy.com (8.14.7/8.14.5) with ESMTP id r7KMR4jh007017 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 20 Aug 2013 22:27:05 GMT (envelope-from gibbs@FreeBSD.org) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: svn commit: r254138 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/dev/agp sys/dev/drm2/i915 sys/dev/drm2/ttm sys/dev/md sys/fs/fuse sys/fs... From: "Justin T. Gibbs" In-Reply-To: Date: Tue, 20 Aug 2013 16:26:59 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201308091111.r79BBCbY095386@svn.freebsd.org> <20130813142230.GE54133@acme.spoerlein.net> To: attilio@FreeBSD.org X-Mailer: Apple Mail (2.1508) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (aslan.scsiguy.com [70.89.174.89]); Tue, 20 Aug 2013 22:27:05 +0000 (UTC) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, =?iso-8859-1?Q?Ulrich_Sp=F6rlein?= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 20 Aug 2013 22:27:07 -0000 On Aug 13, 2013, at 8:59 AM, Attilio Rao wrote: > On Tue, Aug 13, 2013 at 4:22 PM, Ulrich Sp=F6rlein = wrote: >> On Fri, 2013-08-09 at 11:11:12 +0000, Attilio Rao wrote: >>> Author: attilio >>> Date: Fri Aug 9 11:11:11 2013 >>> New Revision: 254138 >>> URL: http://svnweb.freebsd.org/changeset/base/254138 >>>=20 >>> Log: >>> The soft and hard busy mechanism rely on the vm object lock to = work. >>> Unify the 2 concept into a real, minimal, sxlock where the shared >>> acquisition represent the soft busy and the exclusive acquisition >>> represent the hard busy. >>> The old VPO_WANTED mechanism becames the hard-path for this new = lock >>> and it becomes per-page rather than per-object. >>> The vm_object lock becames an interlock for this functionality: >>> it can be held in both read or write mode. >>> However, if the vm_object lock is held in read mode while acquiring >>> or releasing the busy state, the thread owner cannot make any >>> assumption on the busy state unless it is also busying it. >>>=20 >>> Also: >>> - Add a new flag to directly shared busy pages while vm_page_alloc >>> and vm_page_grab are being executed. This will be very helpful >>> once these functions happen under a read object lock. >>> - Move the swapping sleep into its own per-object flag >>>=20 >>> The KPI is heavilly changed this is why the version is bumped. >>> It is very likely that some VM ports users will need to change >>> their own code. >>>=20 >>> Sponsored by: EMC / Isilon storage division >>> Discussed with: alc >>> Reviewed by: jeff, kib >>> Tested by: gavin, bapt (older version) >>> Tested by: pho, scottl >>=20 >> The changes to sys/vm/vm_fault.c introduce a call to >> vm_page_sleep_if_busy() where the return code is not checked. The = other >> 5 places in the tree check the return code, please fix this here too. >> It's CID 1062398, and I would encourage folks to get an account with >> scan.coverity.com and have an eye on newly found defects. >=20 > Not true. > The same call existed also before with exactly the same semantic. > The trick there is that it is not important to check for the return > value because we are going to retry the operation anyway. > The code looks ok to me. >=20 > Attilio If this is the case, perhaps the call should be prefixed with "(void)". That would at least tell the next person reading the code that this is intentional. -- Justin= From owner-svn-src-head@FreeBSD.ORG Tue Aug 20 22:31:14 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 ESMTP id 55856942; Tue, 20 Aug 2013 22:31:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) 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 2809421A2; Tue, 20 Aug 2013 22:31:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7KMVEGw068301; Tue, 20 Aug 2013 22:31:14 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7KMVERi068300; Tue, 20 Aug 2013 22:31:14 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201308202231.r7KMVERi068300@svn.freebsd.org> From: Xin LI Date: Tue, 20 Aug 2013 22:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254585 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.14 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, 20 Aug 2013 22:31:14 -0000 Author: delphij Date: Tue Aug 20 22:31:13 2013 New Revision: 254585 URL: http://svnweb.freebsd.org/changeset/base/254585 Log: MFV r254220: Illumos ZFS issues: 4039 zfs_rename()/zfs_link() needs stronger test for XDEV Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Aug 20 21:47:07 2013 (r254584) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Aug 20 22:31:13 2013 (r254585) @@ -21,6 +21,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. */ /* Portions Copyright 2007 Jeremy Teo */ @@ -3727,13 +3728,18 @@ zfs_rename(vnode_t *sdvp, char *snm, vno if (VOP_REALVP(tdvp, &realvp, ct) == 0) tdvp = realvp; - if (tdvp->v_vfsp != sdvp->v_vfsp || zfsctl_is_node(tdvp)) { + tdzp = VTOZ(tdvp); + ZFS_VERIFY_ZP(tdzp); + + /* + * We check z_zfsvfs rather than v_vfsp here, because snapshots and the + * ctldir appear to have the same v_vfsp. + */ + if (tdzp->z_zfsvfs != zfsvfs || zfsctl_is_node(tdvp)) { ZFS_EXIT(zfsvfs); return (SET_ERROR(EXDEV)); } - tdzp = VTOZ(tdvp); - ZFS_VERIFY_ZP(tdzp); if (zfsvfs->z_utf8 && u8_validate(tnm, strlen(tnm), NULL, U8_VALIDATE_ENTIRE, &error) < 0) { ZFS_EXIT(zfsvfs); @@ -4293,14 +4299,18 @@ zfs_link(vnode_t *tdvp, vnode_t *svp, ch return (SET_ERROR(EPERM)); } - if (svp->v_vfsp != tdvp->v_vfsp || zfsctl_is_node(svp)) { + szp = VTOZ(svp); + ZFS_VERIFY_ZP(szp); + + /* + * We check z_zfsvfs rather than v_vfsp here, because snapshots and the + * ctldir appear to have the same v_vfsp. + */ + if (szp->z_zfsvfs != zfsvfs || zfsctl_is_node(svp)) { ZFS_EXIT(zfsvfs); return (SET_ERROR(EXDEV)); } - szp = VTOZ(svp); - ZFS_VERIFY_ZP(szp); - /* Prevent links to .zfs/shares files */ if ((error = sa_lookup(szp->z_sa_hdl, SA_ZPL_PARENT(zfsvfs), From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 00:04: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 ESMTP id 983452E1; Wed, 21 Aug 2013 00:04:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) 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 8333D2554; Wed, 21 Aug 2013 00:04: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 r7L04XpY016498; Wed, 21 Aug 2013 00:04:33 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7L04W3l016438; Wed, 21 Aug 2013 00:04:32 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201308210004.r7L04W3l016438@svn.freebsd.org> From: Xin LI Date: Wed, 21 Aug 2013 00:04:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254587 - in head: cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris... 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 00:04:33 -0000 Author: delphij Date: Wed Aug 21 00:04:31 2013 New Revision: 254587 URL: http://svnweb.freebsd.org/changeset/base/254587 Log: MFV r254421: Illumos ZFS issues: 3996 want a libzfs_core API to rollback to latest snapshot Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Aug 20 22:53:06 2013 (r254586) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Wed Aug 21 00:04:31 2013 (r254587) @@ -3572,7 +3572,6 @@ zfs_rollback(zfs_handle_t *zhp, zfs_hand { rollback_data_t cb = { 0 }; int err; - zfs_cmd_t zc = { 0 }; boolean_t restore_resv = 0; uint64_t old_volsize, new_volsize; zfs_prop_t resv_prop; @@ -3604,22 +3603,15 @@ zfs_rollback(zfs_handle_t *zhp, zfs_hand (old_volsize == zfs_prop_get_int(zhp, resv_prop)); } - (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); - - if (ZFS_IS_VOLUME(zhp)) - zc.zc_objset_type = DMU_OST_ZVOL; - else - zc.zc_objset_type = DMU_OST_ZFS; - /* * We rely on zfs_iter_children() to verify that there are no * newer snapshots for the given dataset. Therefore, we can * simply pass the name on to the ioctl() call. There is still * an unlikely race condition where the user has taken a * snapshot since we verified that this was the most recent. - * */ - if ((err = zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_ROLLBACK, &zc)) != 0) { + err = lzc_rollback(zhp->zfs_name, NULL, 0); + if (err != 0) { (void) zfs_standard_error_fmt(zhp->zfs_hdl, errno, dgettext(TEXT_DOMAIN, "cannot rollback '%s'"), zhp->zfs_name); Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Tue Aug 20 22:53:06 2013 (r254586) +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Wed Aug 21 00:04:31 2013 (r254587) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. */ @@ -628,3 +628,27 @@ out: free((void*)(uintptr_t)zc.zc_nvlist_dst); return (error); } + +/* + * Roll back this filesystem or volume to its most recent snapshot. + * If snapnamebuf is not NULL, it will be filled in with the name + * of the most recent snapshot. + * + * Return 0 on success or an errno on failure. + */ +int +lzc_rollback(const char *fsname, char *snapnamebuf, int snapnamelen) +{ + nvlist_t *args; + nvlist_t *result; + int err; + + args = fnvlist_alloc(); + err = lzc_ioctl(ZFS_IOC_ROLLBACK, fsname, args, &result); + nvlist_free(args); + if (err == 0 && snapnamebuf != NULL) { + const char *snapname = fnvlist_lookup_string(result, "target"); + (void) strlcpy(snapnamebuf, snapname, snapnamelen); + } + return (err); +} Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Tue Aug 20 22:53:06 2013 (r254586) +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Wed Aug 21 00:04:31 2013 (r254587) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2013 by Martin Matuska . All rights reserved. */ @@ -59,6 +59,7 @@ int lzc_send_space(const char *snapname, boolean_t lzc_exists(const char *dataset); +int lzc_rollback(const char *fsname, char *snapnamebuf, int snapnamelen); #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Tue Aug 20 22:53:06 2013 (r254586) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Wed Aug 21 00:04:31 2013 (r254587) @@ -1802,6 +1802,7 @@ dsl_dataset_handoff_check(dsl_dataset_t typedef struct dsl_dataset_rollback_arg { const char *ddra_fsname; void *ddra_owner; + nvlist_t *ddra_result; } dsl_dataset_rollback_arg_t; static int @@ -1873,9 +1874,13 @@ dsl_dataset_rollback_sync(void *arg, dmu dsl_pool_t *dp = dmu_tx_pool(tx); dsl_dataset_t *ds, *clone; uint64_t cloneobj; + char namebuf[ZFS_MAXNAMELEN]; VERIFY0(dsl_dataset_hold(dp, ddra->ddra_fsname, FTAG, &ds)); + dsl_dataset_name(ds->ds_prev, namebuf); + fnvlist_add_string(ddra->ddra_result, "target", namebuf); + cloneobj = dsl_dataset_create_sync(ds->ds_dir, "%rollback", ds->ds_prev, DS_CREATE_FLAG_NODIRTY, kcred, tx); @@ -1891,8 +1896,11 @@ dsl_dataset_rollback_sync(void *arg, dmu } /* - * If owner != NULL: + * Rolls back the given filesystem or volume to the most recent snapshot. + * The name of the most recent snapshot will be returned under key "target" + * in the result nvlist. * + * If owner != NULL: * - The existing dataset MUST be owned by the specified owner at entry * - Upon return, dataset will still be held by the same owner, whether we * succeed or not. @@ -1901,15 +1909,16 @@ dsl_dataset_rollback_sync(void *arg, dmu * notes above zfs_suspend_fs() for further details. */ int -dsl_dataset_rollback(const char *fsname, void *owner) +dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result) { dsl_dataset_rollback_arg_t ddra; ddra.ddra_fsname = fsname; ddra.ddra_owner = owner; + ddra.ddra_result = result; return (dsl_sync_task(fsname, dsl_dataset_rollback_check, - dsl_dataset_rollback_sync, (void *)&ddra, 1)); + dsl_dataset_rollback_sync, &ddra, 1)); } struct promotenode { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Tue Aug 20 22:53:06 2013 (r254586) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Wed Aug 21 00:04:31 2013 (r254587) @@ -265,7 +265,7 @@ int dsl_dataset_snap_lookup(dsl_dataset_ int dsl_dataset_snap_remove(dsl_dataset_t *ds, const char *name, dmu_tx_t *tx); void dsl_dataset_set_refreservation_sync_impl(dsl_dataset_t *ds, zprop_source_t source, uint64_t value, dmu_tx_t *tx); -int dsl_dataset_rollback(const char *fsname, void *owner); +int dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result); #ifdef ZFS_DEBUG #define dprintf_ds(ds, fmt, ...) do { \ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Aug 20 22:53:06 2013 (r254586) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Aug 21 00:04:31 2013 (r254587) @@ -3550,29 +3550,32 @@ zfs_ioc_destroy(zfs_cmd_t *zc) } /* - * inputs: - * zc_name name of dataset to rollback (to most recent snapshot) + * fsname is name of dataset to rollback (to most recent snapshot) * - * outputs: none + * innvl is not used. + * + * outnvl: "target" -> name of most recent snapshot + * } */ +/* ARGSUSED */ static int -zfs_ioc_rollback(zfs_cmd_t *zc) +zfs_ioc_rollback(const char *fsname, nvlist_t *args, nvlist_t *outnvl) { zfsvfs_t *zfsvfs; int error; - if (getzfsvfs(zc->zc_name, &zfsvfs) == 0) { + if (getzfsvfs(fsname, &zfsvfs) == 0) { error = zfs_suspend_fs(zfsvfs); if (error == 0) { int resume_err; - error = dsl_dataset_rollback(zc->zc_name, zfsvfs); - resume_err = zfs_resume_fs(zfsvfs, zc->zc_name); + error = dsl_dataset_rollback(fsname, zfsvfs, outnvl); + resume_err = zfs_resume_fs(zfsvfs, fsname); error = error ? error : resume_err; } VFS_RELE(zfsvfs->z_vfs); } else { - error = dsl_dataset_rollback(zc->zc_name, NULL); + error = dsl_dataset_rollback(fsname, NULL, outnvl); } return (error); } @@ -5446,6 +5449,10 @@ zfs_ioctl_init(void) zfs_ioc_get_holds, zfs_secpolicy_read, DATASET_NAME, POOL_CHECK_SUSPENDED, B_FALSE, B_FALSE); + zfs_ioctl_register("rollback", ZFS_IOC_ROLLBACK, + zfs_ioc_rollback, zfs_secpolicy_rollback, DATASET_NAME, + POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_FALSE, B_TRUE); + /* IOCTLS that use the legacy function signature */ zfs_ioctl_register_legacy(ZFS_IOC_POOL_FREEZE, zfs_ioc_pool_freeze, @@ -5557,8 +5564,6 @@ zfs_ioctl_init(void) zfs_secpolicy_none); zfs_ioctl_register_dataset_modify(ZFS_IOC_DESTROY, zfs_ioc_destroy, zfs_secpolicy_destroy); - zfs_ioctl_register_dataset_modify(ZFS_IOC_ROLLBACK, zfs_ioc_rollback, - zfs_secpolicy_rollback); zfs_ioctl_register_dataset_modify(ZFS_IOC_RENAME, zfs_ioc_rename, zfs_secpolicy_rename); zfs_ioctl_register_dataset_modify(ZFS_IOC_RECV, zfs_ioc_recv, From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 04:05: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 ESMTP id DC843242; Wed, 21 Aug 2013 04:05:06 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 CA4C521F2; Wed, 21 Aug 2013 04:05: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 r7L456Md044144; Wed, 21 Aug 2013 04:05:06 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7L456DY044143; Wed, 21 Aug 2013 04:05:06 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308210405.r7L456DY044143@svn.freebsd.org> From: Ian Lepore Date: Wed, 21 Aug 2013 04:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254589 - head/sys/dev/uart 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 04:05:06 -0000 Author: ian Date: Wed Aug 21 04:05:06 2013 New Revision: 254589 URL: http://svnweb.freebsd.org/changeset/base/254589 Log: Check for generic ns16550 after all other types. A device may be compatible with 16550 but also have a more specific/capable driver earlier in the list. Modified: head/sys/dev/uart/uart_bus_fdt.c Modified: head/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- head/sys/dev/uart/uart_bus_fdt.c Wed Aug 21 02:14:23 2013 (r254588) +++ head/sys/dev/uart/uart_bus_fdt.c Wed Aug 21 04:05:06 2013 (r254589) @@ -101,9 +101,7 @@ uart_fdt_probe(device_t dev) int err; sc = device_get_softc(dev); - if (ofw_bus_is_compatible(dev, "ns16550")) - sc->sc_class = &uart_ns8250_class; - else if (ofw_bus_is_compatible(dev, "lpc,uart")) + if (ofw_bus_is_compatible(dev, "lpc,uart")) sc->sc_class = &uart_lpc_class; else if (ofw_bus_is_compatible(dev, "fsl,imx-uart")) sc->sc_class = &uart_imx_class; @@ -113,6 +111,8 @@ uart_fdt_probe(device_t dev) sc->sc_class = &uart_s3c2410_class; else if (ofw_bus_is_compatible(dev, "cadence,uart")) sc->sc_class = &uart_cdnc_class; + else if (ofw_bus_is_compatible(dev, "ns16550")) + sc->sc_class = &uart_ns8250_class; else return (ENXIO); From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 04:08: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 ESMTP id B9BB03B9; Wed, 21 Aug 2013 04:08:58 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 A7132220A; Wed, 21 Aug 2013 04:08: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 r7L48w15045490; Wed, 21 Aug 2013 04:08:58 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7L48w2X045489; Wed, 21 Aug 2013 04:08:58 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308210408.r7L48w2X045489@svn.freebsd.org> From: Ian Lepore Date: Wed, 21 Aug 2013 04:08:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254590 - head/sys/dev/uart 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 04:08:58 -0000 Author: ian Date: Wed Aug 21 04:08:58 2013 New Revision: 254590 URL: http://svnweb.freebsd.org/changeset/base/254590 Log: Use an if/else sequence rather than unrelated if statements, so that a device compatible with multiple drivers matches the more specific driver first and doesn't overwrite it later with the more generic. Move the generic ns16550 to the end of the list. Modified: head/sys/dev/uart/uart_cpu_fdt.c Modified: head/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- head/sys/dev/uart/uart_cpu_fdt.c Wed Aug 21 04:05:06 2013 (r254589) +++ head/sys/dev/uart/uart_cpu_fdt.c Wed Aug 21 04:08:58 2013 (r254590) @@ -141,18 +141,18 @@ uart_cpu_getdev(int devtype, struct uart */ if (fdt_is_compatible(node, "fsl,imx-uart")) class = &uart_imx_class; - if (fdt_is_compatible(node, "quicc")) + else if (fdt_is_compatible(node, "quicc")) class = &uart_quicc_class; - if (fdt_is_compatible(node, "lpc")) + else if (fdt_is_compatible(node, "lpc")) class = &uart_lpc_class; - if (fdt_is_compatible(node, "ns16550")) - class = &uart_ns8250_class; - if (fdt_is_compatible(node, "arm,pl011")) + else if (fdt_is_compatible(node, "arm,pl011")) class = &uart_pl011_class; - if (fdt_is_compatible(node, "exynos")) + else if (fdt_is_compatible(node, "exynos")) class = &uart_s3c2410_class; - if (fdt_is_compatible(node, "cadence,uart")) + else if (fdt_is_compatible(node, "cadence,uart")) class = &uart_cdnc_class; + else if (fdt_is_compatible(node, "ns16550")) + class = &uart_ns8250_class; di->bas.chan = 0; di->bas.regshft = (u_int)shift; From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 04:10:30 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 ESMTP id A6DB46FF; Wed, 21 Aug 2013 04:10:30 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) 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 918A72224; Wed, 21 Aug 2013 04:10: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 r7L4AUmg047835; Wed, 21 Aug 2013 04:10:30 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7L4APrN047641; Wed, 21 Aug 2013 04:10:25 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201308210410.r7L4APrN047641@svn.freebsd.org> From: "Justin T. Gibbs" Date: Wed, 21 Aug 2013 04:10:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254591 - in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/commo... 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 04:10:30 -0000 Author: gibbs Date: Wed Aug 21 04:10:24 2013 New Revision: 254591 URL: http://svnweb.freebsd.org/changeset/base/254591 Log: Enhance the ZFS vdev layer to maintain both a logical and a physical minimum allocation size for devices. Use this information to automatically increase ZFS's minimum allocation size for new top-level vdevs to a value that more closely matches the optimum device allocation size. Use GEOM's stripesize attribute, if set, as the physical sector size of the GEOM. Calculate the minimum blocksize of each metaslab class. Use the calculated value instead of SPA_MINBLOCKSIZE (512b) when determining the likelyhood of compression yeilding a reduction in physical space usage. Report devices with sub-optimal block size configuration in "zpool status". Also properly fail attempts to attach devices with a logical block size greater than 8kB, since this will cause corruption to ZFS's label area. Sponsored by: Spectra Logic Corporaion MFC after: 2 weeks Background ========== Many modern devices use physical allocation units that are much larger than the minimum logical allocation size accessible by external commands. Two prevalent examples of this are 512e disk drives (512b logical sector, 4K physical sector) and flash devices (512b logical sector, 4K or larger allocation block size, and 128k or larger erase block size). Operations that modify less than the physical sector size result in a costly read-modify-write or garbage collection sequence on these devices. Simply exporting the true physical sector of the device to ZFS would yield optimal performance, but has two serious drawbacks: 1) Existing pools created with devices that have different logical and physical block sizes, but were configured to use the logical block size (e.g. because the OS version used for pool construction reported the logical block size instead of the physical block size) will suddenly find that the vdev allocation size has increased. This can be easily tolerated for active members of the array, but ZFS would prevent replacement of a vdev with another identical device because it now appears that the smaller allocation size required by the pool is not supported by the new device. 2) The device's physical block size may be too large to be supported by ZFS. The optimal allocation size for the vdev may be quite large. For example, a RAID controller may export a vdev that requires read-modify-write cycles unless accessed using 64k aligned/sized requests. ZFS currently has an 8k minimum block size limit. Reporting both the logical and physical allocation sizes for vdevs solves these problems. A device may be used so long as the logical block size is compatible with the configuration. By comparing the logical and physical block sizes, new configurations can be optimized and administrators can be notified of any existing pools that are sub-optimal. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h: Add the SPA_ASHIFT constant. ZFS currently has a hard upper limit of 13 (8k) for ashift and this constant is used to both document and enforce this limit. sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h: Add the VDEV_AUX_ASHIFT_TOO_BIG error code. Add fields for exporting the configured, logical, and physical ashift to the vdev_stat_t structure. Add VDEV_STAT_VALID() macro which can be used to verify the presence of required vdev_stat_t fields in nvlist data. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c: Provide a SYSCTL_PROC handler for "max_auto_ashift". Since the limit is only referenced long after boot when a create operation occurs, there's no compelling need for it to be a boot time configurable tunable. This also allows the validation code for the max_auto_ashift value to be contained within the sysctl handler. Populate the new fields in the vdev_stat_t structure. Fail vdev opens if the vdev reports an ashift larger than SPA_MAXASHIFT. Propogate vdev_logical_ashift and vdev_physical_ashift between child and parent vdevs as is done for vdev_ashift. In vdev_open(), restore code that fails opens for devices where vdev_ashift grows. This can only happen now if the device's logical ashift grows, which means it really isn't safe to use the device. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c: Update the vdev_open() API so that both logical (what was just ashift before) and physical ashift are reported. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h: Add two new fields, vdev_physical_ashift and vdev_logical_ashift, to vdev_t. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c: Add vdev_ashift_optimize(). Call it anytime a new top-level vdev is allocated. cddl/contrib/opensolaris/cmd/zpool/zpool_main.c: Add text for the VDEV_AUX_ASHIFT_TOO_BIG error. For each sub-optimally configured leaf vdev, report configured and native block sizes. cddl/contrib/opensolaris/cmd/zpool/zpool_main.c: cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c: Introduce a new zpool status: ZPOOL_STATUS_NON_NATIVE_ASHIFT. This status is reported on healthy pools containing vdevs configured to use a block size smaller than their reported physical block size. cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c: Update find_vdev_problem() and supporting functions to provide the full vdev_stat_t structure to problem checking routines, and to allow decent into replacing vdevs. Add a vdev_non_native_ashift() validator which is used on the full vdev tree to check for ZPOOL_STATUS_NON_NATIVE_ASHIFT. cddl/contrib/opensolaris/lib/libzpool/common/kernel.c: cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h: Enhance sysctl userland stubs now that a SYSCTL_PROC handler is used in vdev.c. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h: When the group membership of a metaslab class changes (i.e. when a vdev is added or removed from a pool), walk the group list to determine the smallest block size currently available and record this in the metaslab class. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c: Add the metaslab_class_get_minblocksize() accessor. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c: In zio_compress_data(), take the minimum blocksize as an input parameter instead of assuming SPA_MINBLOCKSIZE. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c: In l2arc_compress_buf(), pass SPA_MINBLOCKSIZE as the minimum blocksize of the device. The l2arc code performs has it's own code for deciding if compression is worth while, so this effectively disables zio_compress_data() from second guessing the original decision. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c: In zio_write_bp_init(), use the minimum blocksize of the normal metaslab class when compressing data. Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.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/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed Aug 21 04:10:24 2013 (r254591) @@ -1295,12 +1295,13 @@ print_status_config(zpool_handle_t *zhp, int namewidth, int depth, boolean_t isspare) { nvlist_t **child; - uint_t c, children; + uint_t c, vsc, children; pool_scan_stat_t *ps = NULL; vdev_stat_t *vs; char rbuf[6], wbuf[6], cbuf[6]; char *vname; uint64_t notpresent; + uint64_t ashift; spare_cbdata_t cb; const char *state; @@ -1309,7 +1310,7 @@ print_status_config(zpool_handle_t *zhp, children = 0; verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, - (uint64_t **)&vs, &c) == 0); + (uint64_t **)&vs, &vsc) == 0); state = zpool_state_to_name(vs->vs_state, vs->vs_aux); if (isspare) { @@ -1363,6 +1364,10 @@ print_status_config(zpool_handle_t *zhp, (void) printf(gettext("unsupported feature(s)")); break; + case VDEV_AUX_ASHIFT_TOO_BIG: + (void) printf(gettext("unsupported minimum blocksize")); + break; + case VDEV_AUX_SPARED: verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &cb.cb_guid) == 0); @@ -1405,6 +1410,12 @@ print_status_config(zpool_handle_t *zhp, (void) printf(gettext("corrupted data")); break; } + } else if (children == 0 && !isspare && + VDEV_STAT_VALID(vs_physical_ashift, vsc) && + vs->vs_configured_ashift < vs->vs_physical_ashift) { + (void) printf( + gettext(" block size: %dB configured, %dB native"), + 1 << vs->vs_configured_ashift, 1 << vs->vs_physical_ashift); } (void) nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_SCAN_STATS, @@ -4268,6 +4279,15 @@ status_callback(zpool_handle_t *zhp, voi "'zpool clear'.\n")); break; + case ZPOOL_STATUS_NON_NATIVE_ASHIFT: + (void) printf(gettext("status: One or more devices are " + "configured to use a non-native block size.\n" + "\tExpect reduced performance.\n")); + (void) printf(gettext("action: Replace affected devices with " + "devices that support the\n\tconfigured block size, or " + "migrate data to a properly configured\n\tpool.\n")); + break; + default: /* * The remaining errors can't actually be generated, yet. Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Aug 21 04:08:58 2013 (r254590) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Wed Aug 21 04:10:24 2013 (r254591) @@ -326,6 +326,7 @@ typedef enum { ZPOOL_STATUS_RESILVERING, /* device being resilvered */ ZPOOL_STATUS_OFFLINE_DEV, /* device online */ ZPOOL_STATUS_REMOVED_DEV, /* removed device */ + ZPOOL_STATUS_NON_NATIVE_ASHIFT, /* (e.g. 512e dev with ashift of 9) */ /* * Finally, the following indicates a healthy pool. Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Wed Aug 21 04:10:24 2013 (r254591) @@ -73,57 +73,66 @@ static char *zfs_msgid_table[] = { /* ARGSUSED */ static int -vdev_missing(uint64_t state, uint64_t aux, uint64_t errs) +vdev_missing(vdev_stat_t *vs, uint_t vsc) { - return (state == VDEV_STATE_CANT_OPEN && - aux == VDEV_AUX_OPEN_FAILED); + return (vs->vs_state == VDEV_STATE_CANT_OPEN && + vs->vs_aux == VDEV_AUX_OPEN_FAILED); } /* ARGSUSED */ static int -vdev_faulted(uint64_t state, uint64_t aux, uint64_t errs) +vdev_faulted(vdev_stat_t *vs, uint_t vsc) { - return (state == VDEV_STATE_FAULTED); + return (vs->vs_state == VDEV_STATE_FAULTED); } /* ARGSUSED */ static int -vdev_errors(uint64_t state, uint64_t aux, uint64_t errs) +vdev_errors(vdev_stat_t *vs, uint_t vsc) { - return (state == VDEV_STATE_DEGRADED || errs != 0); + return (vs->vs_state == VDEV_STATE_DEGRADED || + vs->vs_read_errors != 0 || vs->vs_write_errors != 0 || + vs->vs_checksum_errors != 0); } /* ARGSUSED */ static int -vdev_broken(uint64_t state, uint64_t aux, uint64_t errs) +vdev_broken(vdev_stat_t *vs, uint_t vsc) { - return (state == VDEV_STATE_CANT_OPEN); + return (vs->vs_state == VDEV_STATE_CANT_OPEN); } /* ARGSUSED */ static int -vdev_offlined(uint64_t state, uint64_t aux, uint64_t errs) +vdev_offlined(vdev_stat_t *vs, uint_t vsc) { - return (state == VDEV_STATE_OFFLINE); + return (vs->vs_state == VDEV_STATE_OFFLINE); } /* ARGSUSED */ static int -vdev_removed(uint64_t state, uint64_t aux, uint64_t errs) +vdev_removed(vdev_stat_t *vs, uint_t vsc) { - return (state == VDEV_STATE_REMOVED); + return (vs->vs_state == VDEV_STATE_REMOVED); +} + +static int +vdev_non_native_ashift(vdev_stat_t *vs, uint_t vsc) +{ + return (VDEV_STAT_VALID(vs_physical_ashift, vsc) && + vs->vs_configured_ashift < vs->vs_physical_ashift); } /* * Detect if any leaf devices that have seen errors or could not be opened. */ static boolean_t -find_vdev_problem(nvlist_t *vdev, int (*func)(uint64_t, uint64_t, uint64_t)) +find_vdev_problem(nvlist_t *vdev, int (*func)(vdev_stat_t *, uint_t), + boolean_t ignore_replacing) { nvlist_t **child; vdev_stat_t *vs; - uint_t c, children; - char *type; + uint_t c, vsc, children; /* * Ignore problems within a 'replacing' vdev, since we're presumably in @@ -131,23 +140,25 @@ find_vdev_problem(nvlist_t *vdev, int (* * out again. We'll pick up the fact that a resilver is happening * later. */ - verify(nvlist_lookup_string(vdev, ZPOOL_CONFIG_TYPE, &type) == 0); - if (strcmp(type, VDEV_TYPE_REPLACING) == 0) - return (B_FALSE); + if (ignore_replacing == B_TRUE) { + char *type; + + verify(nvlist_lookup_string(vdev, ZPOOL_CONFIG_TYPE, + &type) == 0); + if (strcmp(type, VDEV_TYPE_REPLACING) == 0) + return (B_FALSE); + } if (nvlist_lookup_nvlist_array(vdev, ZPOOL_CONFIG_CHILDREN, &child, &children) == 0) { for (c = 0; c < children; c++) - if (find_vdev_problem(child[c], func)) + if (find_vdev_problem(child[c], func, ignore_replacing)) return (B_TRUE); } else { verify(nvlist_lookup_uint64_array(vdev, ZPOOL_CONFIG_VDEV_STATS, - (uint64_t **)&vs, &c) == 0); + (uint64_t **)&vs, &vsc) == 0); - if (func(vs->vs_state, vs->vs_aux, - vs->vs_read_errors + - vs->vs_write_errors + - vs->vs_checksum_errors)) + if (func(vs, vsc) != 0) return (B_TRUE); } @@ -157,7 +168,7 @@ find_vdev_problem(nvlist_t *vdev, int (* if (nvlist_lookup_nvlist_array(vdev, ZPOOL_CONFIG_L2CACHE, &child, &children) == 0) { for (c = 0; c < children; c++) - if (find_vdev_problem(child[c], func)) + if (find_vdev_problem(child[c], func, ignore_replacing)) return (B_TRUE); } @@ -270,15 +281,15 @@ check_status(nvlist_t *config, boolean_t * Bad devices in non-replicated config. */ if (vs->vs_state == VDEV_STATE_CANT_OPEN && - find_vdev_problem(nvroot, vdev_faulted)) + find_vdev_problem(nvroot, vdev_faulted, B_TRUE)) return (ZPOOL_STATUS_FAULTED_DEV_NR); if (vs->vs_state == VDEV_STATE_CANT_OPEN && - find_vdev_problem(nvroot, vdev_missing)) + find_vdev_problem(nvroot, vdev_missing, B_TRUE)) return (ZPOOL_STATUS_MISSING_DEV_NR); if (vs->vs_state == VDEV_STATE_CANT_OPEN && - find_vdev_problem(nvroot, vdev_broken)) + find_vdev_problem(nvroot, vdev_broken, B_TRUE)) return (ZPOOL_STATUS_CORRUPT_LABEL_NR); /* @@ -300,32 +311,38 @@ check_status(nvlist_t *config, boolean_t /* * Missing devices in a replicated config. */ - if (find_vdev_problem(nvroot, vdev_faulted)) + if (find_vdev_problem(nvroot, vdev_faulted, B_TRUE)) return (ZPOOL_STATUS_FAULTED_DEV_R); - if (find_vdev_problem(nvroot, vdev_missing)) + if (find_vdev_problem(nvroot, vdev_missing, B_TRUE)) return (ZPOOL_STATUS_MISSING_DEV_R); - if (find_vdev_problem(nvroot, vdev_broken)) + if (find_vdev_problem(nvroot, vdev_broken, B_TRUE)) return (ZPOOL_STATUS_CORRUPT_LABEL_R); /* * Devices with errors */ - if (!isimport && find_vdev_problem(nvroot, vdev_errors)) + if (!isimport && find_vdev_problem(nvroot, vdev_errors, B_TRUE)) return (ZPOOL_STATUS_FAILING_DEV); /* * Offlined devices */ - if (find_vdev_problem(nvroot, vdev_offlined)) + if (find_vdev_problem(nvroot, vdev_offlined, B_TRUE)) return (ZPOOL_STATUS_OFFLINE_DEV); /* * Removed device */ - if (find_vdev_problem(nvroot, vdev_removed)) + if (find_vdev_problem(nvroot, vdev_removed, B_TRUE)) return (ZPOOL_STATUS_REMOVED_DEV); /* + * Suboptimal, but usable, ashift configuration. + */ + if (find_vdev_problem(nvroot, vdev_non_native_ashift, B_FALSE)) + return (ZPOOL_STATUS_NON_NATIVE_ASHIFT); + + /* * Outdated, but usable, version */ if (SPA_VERSION_IS_SUPPORTED(version) && version != SPA_VERSION) Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Wed Aug 21 04:10:24 2013 (r254591) @@ -591,6 +591,12 @@ dprintf_setup(int *argc, char **argv) dprintf_print_all = 1; } +int +sysctl_handle_64(SYSCTL_HANDLER_ARGS) +{ + return (0); +} + /* * ========================================================================= * debug printfs Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Wed Aug 21 04:08:58 2013 (r254590) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Wed Aug 21 04:10:24 2013 (r254591) @@ -659,11 +659,55 @@ typedef uint32_t idmap_rid_t; #define SX_SYSINIT(name, lock, desc) +#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \ + intptr_t arg2, struct sysctl_req *req + +/* + * This describes the access space for a sysctl request. This is needed + * so that we can use the interface from the kernel or from user-space. + */ +struct sysctl_req { + struct thread *td; /* used for access checking */ + int lock; /* wiring state */ + void *oldptr; + size_t oldlen; + size_t oldidx; + int (*oldfunc)(struct sysctl_req *, const void *, size_t); + void *newptr; + size_t newlen; + size_t newidx; + int (*newfunc)(struct sysctl_req *, void *, size_t); + size_t validlen; + int flags; +}; + +SLIST_HEAD(sysctl_oid_list, sysctl_oid); + +/* + * This describes one "oid" in the MIB tree. Potentially more nodes can + * be hidden behind it, expanded by the handler. + */ +struct sysctl_oid { + struct sysctl_oid_list *oid_parent; + SLIST_ENTRY(sysctl_oid) oid_link; + int oid_number; + u_int oid_kind; + void *oid_arg1; + intptr_t oid_arg2; + const char *oid_name; + int (*oid_handler)(SYSCTL_HANDLER_ARGS); + const char *oid_fmt; + int oid_refcnt; + u_int oid_running; + const char *oid_descr; +}; + #define SYSCTL_DECL(...) #define SYSCTL_NODE(...) #define SYSCTL_INT(...) #define SYSCTL_UINT(...) #define SYSCTL_ULONG(...) +#define SYSCTL_PROC(...) #define SYSCTL_QUAD(...) #define SYSCTL_UQUAD(...) #ifdef TUNABLE_INT @@ -675,6 +719,8 @@ typedef uint32_t idmap_rid_t; #define TUNABLE_ULONG(...) #define TUNABLE_QUAD(...) +int sysctl_handle_64(SYSCTL_HANDLER_ARGS); + /* Errors */ #ifndef ERESTART Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Aug 21 04:10:24 2013 (r254591) @@ -5147,7 +5147,7 @@ l2arc_compress_buf(l2arc_buf_hdr_t *l2hd len = l2hdr->b_asize; cdata = zio_data_buf_alloc(len); csize = zio_compress_data(ZIO_COMPRESS_LZ4, l2hdr->b_tmp_cdata, - cdata, l2hdr->b_asize); + cdata, l2hdr->b_asize, (size_t)SPA_MINBLOCKSIZE); if (csize == 0) { /* zero block, indicate that there's nothing to write */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Wed Aug 21 04:10:24 2013 (r254591) @@ -180,6 +180,27 @@ metaslab_class_space_update(metaslab_cla atomic_add_64(&mc->mc_dspace, dspace_delta); } +void +metaslab_class_minblocksize_update(metaslab_class_t *mc) +{ + metaslab_group_t *mg; + vdev_t *vd; + uint64_t minashift = UINT64_MAX; + + if ((mg = mc->mc_rotor) == NULL) { + mc->mc_minblocksize = SPA_MINBLOCKSIZE; + return; + } + + do { + vd = mg->mg_vd; + if (vd->vdev_ashift < minashift) + minashift = vd->vdev_ashift; + } while ((mg = mg->mg_next) != mc->mc_rotor); + + mc->mc_minblocksize = 1ULL << minashift; +} + uint64_t metaslab_class_get_alloc(metaslab_class_t *mc) { @@ -204,6 +225,12 @@ metaslab_class_get_dspace(metaslab_class return (spa_deflate(mc->mc_spa) ? mc->mc_dspace : mc->mc_space); } +uint64_t +metaslab_class_get_minblocksize(metaslab_class_t *mc) +{ + return (mc->mc_minblocksize); +} + /* * ========================================================================== * Metaslab groups @@ -295,6 +322,7 @@ metaslab_group_activate(metaslab_group_t mgnext->mg_prev = mg; } mc->mc_rotor = mg; + metaslab_class_minblocksize_update(mc); } void @@ -326,6 +354,7 @@ metaslab_group_passivate(metaslab_group_ mg->mg_prev = NULL; mg->mg_next = NULL; + metaslab_class_minblocksize_update(mc); } static void Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Aug 21 04:10:24 2013 (r254591) @@ -3424,6 +3424,7 @@ spa_create(const char *pool, nvlist_t *n (error = spa_validate_aux(spa, nvroot, txg, VDEV_ALLOC_ADD)) == 0) { for (int c = 0; c < rvd->vdev_children; c++) { + vdev_ashift_optimize(rvd->vdev_child[c]); vdev_metaslab_set_size(rvd->vdev_child[c]); vdev_expand(rvd->vdev_child[c], txg); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Wed Aug 21 04:10:24 2013 (r254591) @@ -519,8 +519,10 @@ spa_config_update(spa_t *spa, int what) */ for (c = 0; c < rvd->vdev_children; c++) { vdev_t *tvd = rvd->vdev_child[c]; - if (tvd->vdev_ms_array == 0) + if (tvd->vdev_ms_array == 0) { + vdev_ashift_optimize(tvd); vdev_metaslab_set_size(tvd); + } vdev_expand(tvd, txg); } } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h Wed Aug 21 04:10:24 2013 (r254591) @@ -70,6 +70,7 @@ extern uint64_t metaslab_class_get_alloc extern uint64_t metaslab_class_get_space(metaslab_class_t *mc); extern uint64_t metaslab_class_get_dspace(metaslab_class_t *mc); extern uint64_t metaslab_class_get_deferred(metaslab_class_t *mc); +extern uint64_t metaslab_class_get_minblocksize(metaslab_class_t *mc); extern metaslab_group_t *metaslab_group_create(metaslab_class_t *mc, vdev_t *vd); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Wed Aug 21 04:10:24 2013 (r254591) @@ -49,6 +49,7 @@ struct metaslab_class { uint64_t mc_deferred; /* total deferred frees */ uint64_t mc_space; /* total space (alloc + free) */ uint64_t mc_dspace; /* total deflated space */ + uint64_t mc_minblocksize; }; struct metaslab_group { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Wed Aug 21 04:10:24 2013 (r254591) @@ -93,6 +93,17 @@ struct dsl_dataset; #define SPA_BLOCKSIZES (SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1) /* + * Maximum supported logical ashift. + * + * The current 8k allocation block size limit is due to the 8k + * aligned/sized operations performed by vdev_probe() on + * vdev_label->vl_pad2. Using another "safe region" for these tests + * would allow the limit to be raised to 16k, at the expense of + * only having 8 available uberblocks in the label area. + */ +#define SPA_MAXASHIFT 13 + +/* * Size of block to hold the configuration data (a packed nvlist) */ #define SPA_CONFIG_BLOCKSIZE (1ULL << 14) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Wed Aug 21 04:10:24 2013 (r254591) @@ -78,6 +78,7 @@ extern void vdev_rele(vdev_t *); extern int vdev_metaslab_init(vdev_t *vd, uint64_t txg); extern void vdev_metaslab_fini(vdev_t *vd); extern void vdev_metaslab_set_size(vdev_t *); +extern void vdev_ashift_optimize(vdev_t *); extern void vdev_expand(vdev_t *vd, uint64_t txg); extern void vdev_split(vdev_t *vd); extern void vdev_deadman(vdev_t *vd); 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 Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Wed Aug 21 04:10:24 2013 (r254591) @@ -57,7 +57,7 @@ typedef struct vdev_cache_entry vdev_cac * Virtual device operations */ typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *max_size, - uint64_t *ashift); + uint64_t *logical_ashift, uint64_t *physical_ashift); typedef void vdev_close_func_t(vdev_t *vd); typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize); typedef int vdev_io_start_func_t(zio_t *zio); @@ -123,6 +123,24 @@ struct vdev { uint64_t vdev_min_asize; /* min acceptable asize */ uint64_t vdev_max_asize; /* max acceptable asize */ uint64_t vdev_ashift; /* block alignment shift */ + /* + * Logical block alignment shift + * + * The smallest sized/aligned I/O supported by the device. + */ + uint64_t vdev_logical_ashift; + /* + * Physical block alignment shift + * + * The device supports logical I/Os with vdev_logical_ashift + * size/alignment, but optimum performance will be achieved by + * aligning/sizing requests to vdev_physical_ashift. Smaller + * requests may be inflated or incur device level read-modify-write + * operations. + * + * May be 0 to indicate no preference (i.e. use vdev_logical_ashift). + */ + uint64_t vdev_physical_ashift; uint64_t vdev_state; /* see VDEV_STATE_* #defines */ uint64_t vdev_prevstate; /* used when reopening a vdev */ vdev_ops_t *vdev_ops; /* vdev operations */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Wed Aug 21 04:10:24 2013 (r254591) @@ -79,7 +79,7 @@ extern int lz4_decompress(void *src, voi * Compress and decompress data if necessary. */ extern size_t zio_compress_data(enum zio_compress c, void *src, void *dst, - size_t s_len); + size_t s_len, size_t minblocksize); extern int zio_decompress_data(enum zio_compress c, void *src, void *dst, size_t s_len, size_t d_len); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Aug 21 04:10:24 2013 (r254591) @@ -52,6 +52,51 @@ SYSCTL_NODE(_vfs_zfs, OID_AUTO, vdev, CT * Virtual device management. */ +/** + * The limit for ZFS to automatically increase a top-level vdev's ashift + * from logical ashift to physical ashift. + * + * Example: one or more 512B emulation child vdevs + * child->vdev_ashift = 9 (512 bytes) + * child->vdev_physical_ashift = 12 (4096 bytes) + * zfs_max_auto_ashift = 11 (2048 bytes) + * + * On pool creation or the addition of a new top-leve vdev, ZFS will + * bump the ashift of the top-level vdev to 2048. + * + * Example: one or more 512B emulation child vdevs + * child->vdev_ashift = 9 (512 bytes) + * child->vdev_physical_ashift = 12 (4096 bytes) + * zfs_max_auto_ashift = 13 (8192 bytes) + * + * On pool creation or the addition of a new top-leve vdev, ZFS will + * bump the ashift of the top-level vdev to 4096. + */ +static uint64_t zfs_max_auto_ashift = SPA_MAXASHIFT; + +static int +sysctl_vfs_zfs_max_auto_ashift(SYSCTL_HANDLER_ARGS) +{ + uint64_t val; + int err; + + val = zfs_max_auto_ashift; + err = sysctl_handle_64(oidp, &val, 0, req); + if (err != 0 || req->newptr == NULL) + return (err); + + if (val > SPA_MAXASHIFT) + val = SPA_MAXASHIFT; + + zfs_max_auto_ashift = val; + + return (0); +} +SYSCTL_PROC(_vfs_zfs, OID_AUTO, max_auto_ashift, + CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(uint64_t), + sysctl_vfs_zfs_max_auto_ashift, "QU", + "Cap on logical -> physical ashift adjustment on new top-level vdevs."); + static vdev_ops_t *vdev_ops_table[] = { &vdev_root_ops, &vdev_raidz_ops, @@ -746,6 +791,8 @@ vdev_add_parent(vdev_t *cvd, vdev_ops_t mvd->vdev_min_asize = cvd->vdev_min_asize; mvd->vdev_max_asize = cvd->vdev_max_asize; mvd->vdev_ashift = cvd->vdev_ashift; + mvd->vdev_logical_ashift = cvd->vdev_logical_ashift; + mvd->vdev_physical_ashift = cvd->vdev_physical_ashift; mvd->vdev_state = cvd->vdev_state; mvd->vdev_crtxg = cvd->vdev_crtxg; @@ -777,6 +824,8 @@ vdev_remove_parent(vdev_t *cvd) mvd->vdev_ops == &vdev_replacing_ops || mvd->vdev_ops == &vdev_spare_ops); cvd->vdev_ashift = mvd->vdev_ashift; + cvd->vdev_logical_ashift = mvd->vdev_logical_ashift; + cvd->vdev_physical_ashift = mvd->vdev_physical_ashift; vdev_remove_child(mvd, cvd); vdev_remove_child(pvd, mvd); @@ -1120,7 +1169,8 @@ vdev_open(vdev_t *vd) uint64_t osize = 0; uint64_t max_osize = 0; uint64_t asize, max_asize, psize; - uint64_t ashift = 0; + uint64_t logical_ashift = 0; + uint64_t physical_ashift = 0; ASSERT(vd->vdev_open_thread == curthread || spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL); @@ -1150,7 +1200,8 @@ vdev_open(vdev_t *vd) return (SET_ERROR(ENXIO)); } - error = vd->vdev_ops->vdev_op_open(vd, &osize, &max_osize, &ashift); + error = vd->vdev_ops->vdev_op_open(vd, &osize, &max_osize, + &logical_ashift, &physical_ashift); /* * Reset the vdev_reopening flag so that we actually close @@ -1248,6 +1299,17 @@ vdev_open(vdev_t *vd) return (SET_ERROR(EINVAL)); } + vd->vdev_physical_ashift = + MAX(physical_ashift, vd->vdev_physical_ashift); + vd->vdev_logical_ashift = MAX(logical_ashift, vd->vdev_logical_ashift); + vd->vdev_ashift = MAX(vd->vdev_logical_ashift, vd->vdev_ashift); + + if (vd->vdev_logical_ashift > SPA_MAXASHIFT) { + vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN, + VDEV_AUX_ASHIFT_TOO_BIG); + return (EINVAL); + } + if (vd->vdev_asize == 0) { /* * This is the first-ever open, so use the computed values. @@ -1255,19 +1317,15 @@ vdev_open(vdev_t *vd) */ vd->vdev_asize = asize; vd->vdev_max_asize = max_asize; - vd->vdev_ashift = MAX(ashift, vd->vdev_ashift); } else { /* - * Detect if the alignment requirement has increased. - * We don't want to make the pool unavailable, just - * issue a warning instead. + * Make sure the alignment requirement hasn't increased. */ - if (ashift > vd->vdev_top->vdev_ashift && + if (vd->vdev_ashift > vd->vdev_top->vdev_ashift && vd->vdev_ops->vdev_op_leaf) { - cmn_err(CE_WARN, - "Disk, '%s', has a block alignment that is " - "larger than the pool's alignment\n", - vd->vdev_path); + vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN, + VDEV_AUX_BAD_LABEL); + return (EINVAL); } vd->vdev_max_asize = max_asize; } @@ -1577,6 +1635,23 @@ vdev_metaslab_set_size(vdev_t *vd) vd->vdev_ms_shift = MAX(vd->vdev_ms_shift, SPA_MAXBLOCKSHIFT); } +/* + * Maximize performance by inflating the configured ashift for + * top level vdevs to be as close to the physical ashift as + * possible without exceeding the administrator specified + * limit. + */ +void +vdev_ashift_optimize(vdev_t *vd) +{ + if (vd == vd->vdev_top && + (vd->vdev_ashift < vd->vdev_physical_ashift) && + (vd->vdev_ashift < zfs_max_auto_ashift)) { + vd->vdev_ashift = MIN(zfs_max_auto_ashift, + vd->vdev_physical_ashift); + } +} + void vdev_dirty(vdev_t *vd, int flags, void *arg, uint64_t txg) { @@ -2595,6 +2670,10 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t * if (vd->vdev_ops->vdev_op_leaf) vs->vs_rsize += VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; vs->vs_esize = vd->vdev_max_asize - vd->vdev_asize; + vs->vs_configured_ashift = vd->vdev_top != NULL + ? vd->vdev_top->vdev_ashift : vd->vdev_ashift; + vs->vs_logical_ashift = vd->vdev_logical_ashift; + vs->vs_physical_ashift = vd->vdev_physical_ashift; mutex_exit(&vd->vdev_stat_lock); /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Wed Aug 21 04:10:24 2013 (r254591) @@ -49,7 +49,7 @@ vdev_file_rele(vdev_t *vd) static int vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, - uint64_t *ashift) + uint64_t *logical_ashift, uint64_t *physical_ashift) { vdev_file_t *vf; vnode_t *vp; @@ -130,7 +130,8 @@ skip_open: } *max_psize = *psize = vattr.va_size; - *ashift = SPA_MINBLOCKSHIFT; + *logical_ashift = SPA_MINBLOCKSHIFT; + *physical_ashift = SPA_MINBLOCKSHIFT; return (0); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Aug 21 04:10:24 2013 (r254591) @@ -576,7 +576,7 @@ vdev_geom_open_by_path(vdev_t *vd, int c static int vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, - uint64_t *ashift) + uint64_t *logical_ashift, uint64_t *physical_ashift) { struct g_provider *pp; struct g_consumer *cp; @@ -662,9 +662,13 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi *max_psize = *psize = pp->mediasize; /* - * Determine the device's minimum transfer size. + * Determine the device's minimum transfer size and preferred + * transfer size. */ - *ashift = highbit(MAX(pp->sectorsize, SPA_MINBLOCKSIZE)) - 1; + *logical_ashift = highbit(MAX(pp->sectorsize, SPA_MINBLOCKSIZE)) - 1; + *physical_ashift = 0; + if (pp->stripesize) + *physical_ashift = highbit(pp->stripesize) - 1; /* * Clear the nowritecache settings, so that on a vdev_reopen() Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Wed Aug 21 04:10:24 2013 (r254591) @@ -132,7 +132,7 @@ vdev_mirror_map_alloc(zio_t *zio) static int vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, - uint64_t *ashift) + uint64_t *logical_ashift, uint64_t *physical_ashift) { int numerrors = 0; int lasterror = 0; @@ -155,7 +155,9 @@ vdev_mirror_open(vdev_t *vd, uint64_t *a *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1; *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1; - *ashift = MAX(*ashift, cvd->vdev_ashift); + *logical_ashift = MAX(*logical_ashift, cvd->vdev_ashift); + *physical_ashift = MAX(*physical_ashift, + cvd->vdev_physical_ashift); } if (numerrors == vd->vdev_children) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Wed Aug 21 04:10:24 2013 (r254591) @@ -45,7 +45,7 @@ /* ARGSUSED */ static int vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, - uint64_t *ashift) + uint64_t *logical_ashift, uint64_t *physical_ashift) { /* * Really this should just fail. But then the root vdev will be in the @@ -55,7 +55,8 @@ vdev_missing_open(vdev_t *vd, uint64_t * */ *psize = 0; *max_psize = 0; - *ashift = 0; + *logical_ashift = 0; + *physical_ashift = 0; return (0); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Wed Aug 21 04:10:24 2013 (r254591) @@ -1478,7 +1478,7 @@ vdev_raidz_reconstruct(raidz_map_t *rm, static int vdev_raidz_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, - uint64_t *ashift) + uint64_t *logical_ashift, uint64_t *physical_ashift) { vdev_t *cvd; uint64_t nparity = vd->vdev_nparity; @@ -1507,7 +1507,9 @@ vdev_raidz_open(vdev_t *vd, uint64_t *as *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1; *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1; - *ashift = MAX(*ashift, cvd->vdev_ashift); + *logical_ashift = MAX(*logical_ashift, cvd->vdev_ashift); + *physical_ashift = MAX(*physical_ashift, + cvd->vdev_physical_ashift); } *asize *= vd->vdev_children; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c Wed Aug 21 04:10:24 2013 (r254591) @@ -55,7 +55,7 @@ too_many_errors(vdev_t *vd, int numerror static int vdev_root_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, - uint64_t *ashift) + uint64_t *logical_ashift, uint64_t *physical_ashift) { int lasterror = 0; int numerrors = 0; @@ -83,7 +83,8 @@ vdev_root_open(vdev_t *vd, uint64_t *asi *asize = 0; *max_asize = 0; - *ashift = 0; + *logical_ashift = 0; + *physical_ashift = 0; return (0); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Wed Aug 21 04:10:24 2013 (r254591) @@ -1137,8 +1137,10 @@ zio_write_bp_init(zio_t *zio) } if (compress != ZIO_COMPRESS_OFF) { + metaslab_class_t *mc = spa_normal_class(spa); void *cbuf = zio_buf_alloc(lsize); - psize = zio_compress_data(compress, zio->io_data, cbuf, lsize); + psize = zio_compress_data(compress, zio->io_data, cbuf, lsize, + (size_t)metaslab_class_get_minblocksize(mc)); if (psize == 0 || psize == lsize) { compress = ZIO_COMPRESS_OFF; zio_buf_free(cbuf, lsize); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Wed Aug 21 04:10:24 2013 (r254591) @@ -77,7 +77,8 @@ zio_compress_select(enum zio_compress ch } size_t -zio_compress_data(enum zio_compress c, void *src, void *dst, size_t s_len) +zio_compress_data(enum zio_compress c, void *src, void *dst, size_t s_len, + size_t minblocksize) { uint64_t *word, *word_end; size_t c_len, d_len, r_len; @@ -102,7 +103,7 @@ zio_compress_data(enum zio_compress c, v return (s_len); /* Compress at least 12.5% */ - d_len = P2ALIGN(s_len - (s_len >> 3), (size_t)SPA_MINBLOCKSIZE); + d_len = P2ALIGN(s_len - (s_len >> 3), minblocksize); if (d_len == 0) return (s_len); @@ -115,14 +116,14 @@ zio_compress_data(enum zio_compress c, v * Cool. We compressed at least as much as we were hoping to. * For both security and repeatability, pad out the last sector. */ - r_len = P2ROUNDUP(c_len, (size_t)SPA_MINBLOCKSIZE); + r_len = P2ROUNDUP(c_len, minblocksize); if (r_len > c_len) { bzero((char *)dst + c_len, r_len - c_len); c_len = r_len; } ASSERT3U(c_len, <=, d_len); - ASSERT(P2PHASE(c_len, (size_t)SPA_MINBLOCKSIZE) == 0); + ASSERT(P2PHASE(c_len, minblocksize) == 0); return (c_len); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Wed Aug 21 04:08:58 2013 (r254590) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Wed Aug 21 04:10:24 2013 (r254591) @@ -621,7 +621,8 @@ typedef enum vdev_aux { VDEV_AUX_IO_FAILURE, /* experienced I/O failure */ VDEV_AUX_BAD_LOG, /* cannot read log chain(s) */ VDEV_AUX_EXTERNAL, /* external diagnosis */ - VDEV_AUX_SPLIT_POOL /* vdev was split off into another pool */ + VDEV_AUX_SPLIT_POOL, /* vdev was split off into another pool */ + VDEV_AUX_ASHIFT_TOO_BIG /* vdev's min block size is too large */ } vdev_aux_t; /* @@ -715,7 +716,13 @@ typedef struct vdev_stat { uint64_t vs_self_healed; /* self-healed bytes */ uint64_t vs_scan_removing; /* removing? */ uint64_t vs_scan_processed; /* scan processed bytes */ + uint64_t vs_configured_ashift; /* TLV vdev_ashift */ + uint64_t vs_logical_ashift; /* vdev_logical_ashift */ + uint64_t vs_physical_ashift; /* vdev_physical_ashift */ } vdev_stat_t; +#define VDEV_STAT_VALID(field, uint64_t_field_count) \ + ((uint64_t_field_count * sizeof(uint64_t)) >= \ + (offsetof(vdev_stat_t, field) + sizeof(((vdev_stat_t *)NULL)->field))) /* * DDT statistics. Note: all fields should be 64-bit because this From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 04:20: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 ESMTP id 63D4B953; Wed, 21 Aug 2013 04:20:18 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 42D4022A3; Wed, 21 Aug 2013 04:20: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 r7L4KIvv051428; Wed, 21 Aug 2013 04:20:18 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7L4KHbE051426; Wed, 21 Aug 2013 04:20:17 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308210420.r7L4KHbE051426@svn.freebsd.org> From: Ian Lepore Date: Wed, 21 Aug 2013 04:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254592 - in head/sys/arm/ti: . am335x 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 04:20:18 -0000 Author: ian Date: Wed Aug 21 04:20:17 2013 New Revision: 254592 URL: http://svnweb.freebsd.org/changeset/base/254592 Log: Define the uart clocks so that they can be en/disabled at runtime. Modified: head/sys/arm/ti/am335x/am335x_prcm.c head/sys/arm/ti/ti_prcm.h Modified: head/sys/arm/ti/am335x/am335x_prcm.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_prcm.c Wed Aug 21 04:10:24 2013 (r254591) +++ head/sys/arm/ti/am335x/am335x_prcm.c Wed Aug 21 04:20:17 2013 (r254592) @@ -62,9 +62,14 @@ __FBSDID("$FreeBSD$"); #define CM_PER_LCDC_CLKCTRL (CM_PER + 0x018) #define CM_PER_USB0_CLKCTRL (CM_PER + 0x01C) #define CM_PER_TPTC0_CLKCTRL (CM_PER + 0x024) +#define CM_PER_UART5_CLKCTRL (CM_PER + 0x038) #define CM_PER_MMC0_CLKCTRL (CM_PER + 0x03C) #define CM_PER_I2C2_CLKCTRL (CM_PER + 0x044) #define CM_PER_I2C1_CLKCTRL (CM_PER + 0x048) +#define CM_PER_UART1_CLKCTRL (CM_PER + 0x06C) +#define CM_PER_UART2_CLKCTRL (CM_PER + 0x070) +#define CM_PER_UART3_CLKCTRL (CM_PER + 0x074) +#define CM_PER_UART4_CLKCTRL (CM_PER + 0x078) #define CM_PER_TIMER7_CLKCTRL (CM_PER + 0x07C) #define CM_PER_TIMER2_CLKCTRL (CM_PER + 0x080) #define CM_PER_TIMER3_CLKCTRL (CM_PER + 0x084) @@ -146,6 +151,9 @@ static int am335x_clk_musb0_activate(str static int am335x_clk_lcdc_activate(struct ti_clock_dev *clkdev); static int am335x_clk_pruss_activate(struct ti_clock_dev *clkdev); +#define AM335X_NOOP_CLOCK_DEV(i) \ + { .id = (i) } + #define AM335X_GENERIC_CLOCK_DEV(i) \ { .id = (i), \ .clk_activate = am335x_clk_generic_activate, \ @@ -217,6 +225,14 @@ struct ti_clock_dev ti_clk_devmap[] = { .clk_get_source_freq = am335x_clk_get_arm_disp_freq, }, + /* UART. Uart0 clock cannot be controlled. */ + AM335X_NOOP_CLOCK_DEV(UART0_CLK), + AM335X_GENERIC_CLOCK_DEV(UART1_CLK), + AM335X_GENERIC_CLOCK_DEV(UART2_CLK), + AM335X_GENERIC_CLOCK_DEV(UART3_CLK), + AM335X_GENERIC_CLOCK_DEV(UART4_CLK), + AM335X_GENERIC_CLOCK_DEV(UART5_CLK), + /* DMTimer */ AM335X_GENERIC_CLOCK_DEV(DMTIMER2_CLK), AM335X_GENERIC_CLOCK_DEV(DMTIMER3_CLK), @@ -286,6 +302,14 @@ struct am335x_clk_details { static struct am335x_clk_details g_am335x_clk_details[] = { + /* UART. UART0 clock not controllable. */ + _CLK_DETAIL(UART0_CLK, 0, 0), + _CLK_DETAIL(UART1_CLK, CM_PER_UART1_CLKCTRL, 0), + _CLK_DETAIL(UART2_CLK, CM_PER_UART2_CLKCTRL, 0), + _CLK_DETAIL(UART3_CLK, CM_PER_UART3_CLKCTRL, 0), + _CLK_DETAIL(UART4_CLK, CM_PER_UART4_CLKCTRL, 0), + _CLK_DETAIL(UART5_CLK, CM_PER_UART5_CLKCTRL, 0), + /* DMTimer modules */ _CLK_DETAIL(DMTIMER2_CLK, CM_PER_TIMER2_CLKCTRL, CLKSEL_TIMER2_CLK), _CLK_DETAIL(DMTIMER3_CLK, CM_PER_TIMER3_CLKCTRL, CLKSEL_TIMER3_CLK), Modified: head/sys/arm/ti/ti_prcm.h ============================================================================== --- head/sys/arm/ti/ti_prcm.h Wed Aug 21 04:10:24 2013 (r254591) +++ head/sys/arm/ti/ti_prcm.h Wed Aug 21 04:20:17 2013 (r254592) @@ -81,10 +81,15 @@ typedef enum { USBP2_HSIC_CLK, /* UART modules */ - UART1_CLK = 400, + UART0_CLK = 400, + UART1_CLK, UART2_CLK, UART3_CLK, UART4_CLK, + UART5_CLK, + UART6_CLK, + UART7_CLK, + UART8_CLK, /* General purpose timer modules */ GPTIMER1_CLK = 500, From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 04:49:58 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 ESMTP id D05FBD4D; Wed, 21 Aug 2013 04:49:58 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 A43AE23ED; Wed, 21 Aug 2013 04:49: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 r7L4nwHo066297; Wed, 21 Aug 2013 04:49:58 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7L4nwUS066296; Wed, 21 Aug 2013 04:49:58 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308210449.r7L4nwUS066296@svn.freebsd.org> From: Ian Lepore Date: Wed, 21 Aug 2013 04:49:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254593 - head/sys/arm/ti/am335x 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 04:49:58 -0000 Author: ian Date: Wed Aug 21 04:49:58 2013 New Revision: 254593 URL: http://svnweb.freebsd.org/changeset/base/254593 Log: Make the noop clock successfully do nothing, because doing nothing and returning an error status (which the NULL method pointers caused) isn't nearly as useful. Modified: head/sys/arm/ti/am335x/am335x_prcm.c Modified: head/sys/arm/ti/am335x/am335x_prcm.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_prcm.c Wed Aug 21 04:20:17 2013 (r254592) +++ head/sys/arm/ti/am335x/am335x_prcm.c Wed Aug 21 04:49:58 2013 (r254593) @@ -137,9 +137,12 @@ static struct resource_spec am335x_prcm_ static struct am335x_prcm_softc *am335x_prcm_sc = NULL; +static int am335x_clk_noop_activate(struct ti_clock_dev *clkdev); static int am335x_clk_generic_activate(struct ti_clock_dev *clkdev); static int am335x_clk_gpio_activate(struct ti_clock_dev *clkdev); +static int am335x_clk_noop_deactivate(struct ti_clock_dev *clkdev); static int am335x_clk_generic_deactivate(struct ti_clock_dev *clkdev); +static int am335x_clk_noop_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); static int am335x_clk_generic_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); static int am335x_clk_hsmmc_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); static int am335x_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); @@ -152,7 +155,13 @@ static int am335x_clk_lcdc_activate(stru static int am335x_clk_pruss_activate(struct ti_clock_dev *clkdev); #define AM335X_NOOP_CLOCK_DEV(i) \ - { .id = (i) } + { .id = (i), \ + .clk_activate = am335x_clk_noop_activate, \ + .clk_deactivate = am335x_clk_noop_deactivate, \ + .clk_set_source = am335x_clk_noop_set_source, \ + .clk_accessible = NULL, \ + .clk_get_source_freq = NULL \ + } #define AM335X_GENERIC_CLOCK_DEV(i) \ { .id = (i), \ @@ -430,6 +439,13 @@ am335x_clk_details(clk_ident_t id) } static int +am335x_clk_noop_activate(struct ti_clock_dev *clkdev) +{ + + return (0); +} + +static int am335x_clk_generic_activate(struct ti_clock_dev *clkdev) { struct am335x_prcm_softc *sc = am335x_prcm_sc; @@ -476,6 +492,13 @@ am335x_clk_gpio_activate(struct ti_clock } static int +am335x_clk_noop_deactivate(struct ti_clock_dev *clkdev) +{ + + return(0); +} + +static int am335x_clk_generic_deactivate(struct ti_clock_dev *clkdev) { struct am335x_prcm_softc *sc = am335x_prcm_sc; @@ -498,6 +521,13 @@ am335x_clk_generic_deactivate(struct ti_ } static int +am335x_clk_noop_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc) +{ + + return (0); +} + +static int am335x_clk_generic_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc) { struct am335x_prcm_softc *sc = am335x_prcm_sc; From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 05:52:28 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 ESMTP id 71EBA9E7 for ; Wed, 21 Aug 2013 05:52:28 +0000 (UTC) (envelope-from ray@ddteam.net) Received: from mail-ea0-f173.google.com (mail-ea0-f173.google.com [209.85.215.173]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 03E452845 for ; Wed, 21 Aug 2013 05:52:27 +0000 (UTC) Received: by mail-ea0-f173.google.com with SMTP id g10so590609eak.18 for ; Tue, 20 Aug 2013 22:52:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:user-agent:in-reply-to:references:mime-version :content-type:content-transfer-encoding:subject:from:date:to :message-id; bh=HLMv5mO3wcvTHB2yr/uFjcioHTC/ZW4PoxynRgnl3Gk=; b=lG57RakDWi/q+vfeMzDhFgClAQUsCJJSbfvB3tuNdBY6qbbUFNvSJGquKwIoQww1Is OlhWEFFU2s3zCzpZXUAvccLAqBnF2mJZRZ063AQ4quBAO5VmKqslHvBcp4KZT0OZeh63 wAy6Tg/93/flQtFsCCWWVbNmKS3+CscsSIvCG2wG/AASZJzkISdFVNz4DpuFVHc43gt8 M0LxPeJMNAvplzzguCaQxBSkp73lcYZfZA95mM+gO34u+JU33ekqNxX4t0Eqn46PquQd pl45SQs87eCO63NqEhgOwTwVdKr6Jv0aMJiG4hN3nwqaJzrOQF3LcfzLI/4/9uWSUXjx dd0w== X-Gm-Message-State: ALoCoQlbqrerg5lsvOIT+fIStuPigEBi69LQzKZeDsOC/D1w1NH1QFpyu4c3MIeQqE5Ik7fCJQR9 X-Received: by 10.15.64.1 with SMTP id n1mr7721600eex.15.1377063938872; Tue, 20 Aug 2013 22:45:38 -0700 (PDT) Received: from [159.160.207.62] ([159.160.207.62]) by mx.google.com with ESMTPSA id t6sm6903905eel.12.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 20 Aug 2013 22:45:37 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: <201308210408.r7L48w2X045489@svn.freebsd.org> References: <201308210408.r7L48w2X045489@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: svn commit: r254590 - head/sys/dev/uart From: Aleksandr Rybalko Date: Wed, 21 Aug 2013 08:45:25 +0300 To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 05:52:28 -0000 Ian Lepore написав(ла): >Author: ian >Date: Wed Aug 21 04:08:58 2013 >New Revision: 254590 >URL: http://svnweb.freebsd.org/changeset/base/254590 > >Log: > Use an if/else sequence rather than unrelated if statements, so that a >device compatible with multiple drivers matches the more specific >driver > first and doesn't overwrite it later with the more generic. Move the > generic ns16550 to the end of the list. > >Modified: > head/sys/dev/uart/uart_cpu_fdt.c > >Modified: head/sys/dev/uart/uart_cpu_fdt.c >============================================================================== >--- head/sys/dev/uart/uart_cpu_fdt.c Wed Aug 21 04:05:06 2013 (r254589) >+++ head/sys/dev/uart/uart_cpu_fdt.c Wed Aug 21 04:08:58 2013 (r254590) >@@ -141,18 +141,18 @@ uart_cpu_getdev(int devtype, struct uart > */ > if (fdt_is_compatible(node, "fsl,imx-uart")) > class = &uart_imx_class; >- if (fdt_is_compatible(node, "quicc")) >+ else if (fdt_is_compatible(node, "quicc")) > class = &uart_quicc_class; >- if (fdt_is_compatible(node, "lpc")) >+ else if (fdt_is_compatible(node, "lpc")) > class = &uart_lpc_class; >- if (fdt_is_compatible(node, "ns16550")) >- class = &uart_ns8250_class; >- if (fdt_is_compatible(node, "arm,pl011")) >+ else if (fdt_is_compatible(node, "arm,pl011")) > class = &uart_pl011_class; >- if (fdt_is_compatible(node, "exynos")) >+ else if (fdt_is_compatible(node, "exynos")) > class = &uart_s3c2410_class; >- if (fdt_is_compatible(node, "cadence,uart")) >+ else if (fdt_is_compatible(node, "cadence,uart")) > class = &uart_cdnc_class; >+ else if (fdt_is_compatible(node, "ns16550")) >+ class = &uart_ns8250_class; > > di->bas.chan = 0; > di->bas.regshft = (u_int)shift; Hi Ian! Correct order should be specified in compatible list, other thing must be covered by some quirks. Maybe inside driver or in machine/board specific fixup handler. Thanks. WBW ------ Aleksandr Rybalko From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 07:45: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 ESMTP id 2383F7D8; Wed, 21 Aug 2013 07:45:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) 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 1083C209D; Wed, 21 Aug 2013 07:45: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 r7L7jlSq058704; Wed, 21 Aug 2013 07:45:47 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7L7jlIZ058703; Wed, 21 Aug 2013 07:45:47 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201308210745.r7L7jlIZ058703@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 21 Aug 2013 07:45:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254595 - head/sys/cam/scsi 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 07:45:48 -0000 Author: trasz Date: Wed Aug 21 07:45:47 2013 New Revision: 254595 URL: http://svnweb.freebsd.org/changeset/base/254595 Log: Fix the (unused for now) SCSI_PROTO_iSCSI define to match style(9). Modified: head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Wed Aug 21 06:32:32 2013 (r254594) +++ head/sys/cam/scsi/scsi_all.h Wed Aug 21 07:45:47 2013 (r254595) @@ -1288,7 +1288,7 @@ struct scsi_vpd_id_descriptor #define SCSI_PROTO_SSA 0x02 #define SCSI_PROTO_1394 0x03 #define SCSI_PROTO_RDMA 0x04 -#define SCSI_PROTO_iSCSI 0x05 +#define SCSI_PROTO_ISCSI 0x05 #define SCSI_PROTO_SAS 0x06 #define SCSI_PROTO_ADT 0x07 #define SCSI_PROTO_ATA 0x08 From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 08:01:53 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 ESMTP id 8C96CC11; Wed, 21 Aug 2013 08:01:53 +0000 (UTC) (envelope-from uqs@FreeBSD.org) 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 78FEF2197; Wed, 21 Aug 2013 08:01:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7L81rnM068142; Wed, 21 Aug 2013 08:01:53 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7L81r4J068141; Wed, 21 Aug 2013 08:01:53 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201308210801.r7L81r4J068141@svn.freebsd.org> From: Ulrich Spoerlein Date: Wed, 21 Aug 2013 08:01:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254596 - head/sys/modules/vmm 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 08:01:53 -0000 Author: uqs Date: Wed Aug 21 08:01:52 2013 New Revision: 254596 URL: http://svnweb.freebsd.org/changeset/base/254596 Log: Fix 'make depend'. Modified: head/sys/modules/vmm/Makefile Modified: head/sys/modules/vmm/Makefile ============================================================================== --- head/sys/modules/vmm/Makefile Wed Aug 21 07:45:47 2013 (r254595) +++ head/sys/modules/vmm/Makefile Wed Aug 21 08:01:52 2013 (r254596) @@ -2,11 +2,11 @@ KMOD= vmm -SRCS= opt_ddb.h device_if.h bus_if.h pci_if.h +SRCS= opt_acpi.h opt_ddb.h device_if.h bus_if.h pci_if.h CFLAGS+= -DVMM_KEEP_STATS -DSMP -CFLAGS+= -I${.CURDIR}/../../amd64/vmm -CFLAGS+= -I${.CURDIR}/../../amd64/vmm/io +CFLAGS+= -I${.CURDIR}/../../amd64/vmm +CFLAGS+= -I${.CURDIR}/../../amd64/vmm/io CFLAGS+= -I${.CURDIR}/../../amd64/vmm/intel # generic vmm support From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 14:26:16 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 ESMTP id 083A56E7; Wed, 21 Aug 2013 14:26:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 E9C1F2F55; Wed, 21 Aug 2013 14:26: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 r7LEQFda075739; Wed, 21 Aug 2013 14:26:15 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LEQFL5075737; Wed, 21 Aug 2013 14:26:15 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308211426.r7LEQFL5075737@svn.freebsd.org> From: Ian Lepore Date: Wed, 21 Aug 2013 14:26:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254597 - head/sys/dev/uart 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 14:26:16 -0000 Author: ian Date: Wed Aug 21 14:26:15 2013 New Revision: 254597 URL: http://svnweb.freebsd.org/changeset/base/254597 Log: Make the uart ns8250 high-level interface public rather than static. This makes it easier to implement new drivers which are "mostly ns8250" but with some small difference such as needing to enable clocks or poke a non-standard register at probe or attach time. Added: head/sys/dev/uart/uart_dev_ns8250.h (contents, props changed) Modified: head/sys/dev/uart/uart_dev_ns8250.c Modified: head/sys/dev/uart/uart_dev_ns8250.c ============================================================================== --- head/sys/dev/uart/uart_dev_ns8250.c Wed Aug 21 08:01:52 2013 (r254596) +++ head/sys/dev/uart/uart_dev_ns8250.c Wed Aug 21 14:26:15 2013 (r254597) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -239,7 +240,7 @@ static void ns8250_putc(struct uart_bas static int ns8250_rxready(struct uart_bas *bas); static int ns8250_getc(struct uart_bas *bas, struct mtx *); -static struct uart_ops uart_ns8250_ops = { +struct uart_ops uart_ns8250_ops = { .probe = ns8250_probe, .init = ns8250_init, .term = ns8250_term, @@ -352,32 +353,6 @@ ns8250_getc(struct uart_bas *bas, struct return (c); } -/* - * High-level UART interface. - */ -struct ns8250_softc { - struct uart_softc base; - uint8_t fcr; - uint8_t ier; - uint8_t mcr; - - uint8_t ier_mask; - uint8_t ier_rxbits; - uint8_t busy_detect; -}; - -static int ns8250_bus_attach(struct uart_softc *); -static int ns8250_bus_detach(struct uart_softc *); -static int ns8250_bus_flush(struct uart_softc *, int); -static int ns8250_bus_getsig(struct uart_softc *); -static int ns8250_bus_ioctl(struct uart_softc *, int, intptr_t); -static int ns8250_bus_ipend(struct uart_softc *); -static int ns8250_bus_param(struct uart_softc *, int, int, int, int); -static int ns8250_bus_probe(struct uart_softc *); -static int ns8250_bus_receive(struct uart_softc *); -static int ns8250_bus_setsig(struct uart_softc *, int); -static int ns8250_bus_transmit(struct uart_softc *); - static kobj_method_t ns8250_methods[] = { KOBJMETHOD(uart_attach, ns8250_bus_attach), KOBJMETHOD(uart_detach, ns8250_bus_detach), @@ -409,7 +384,7 @@ struct uart_class uart_ns8250_class = { i = (i & s) ? (i & ~s) | d : i; \ } -static int +int ns8250_bus_attach(struct uart_softc *sc) { struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc; @@ -482,7 +457,7 @@ ns8250_bus_attach(struct uart_softc *sc) return (0); } -static int +int ns8250_bus_detach(struct uart_softc *sc) { struct ns8250_softc *ns8250; @@ -498,7 +473,7 @@ ns8250_bus_detach(struct uart_softc *sc) return (0); } -static int +int ns8250_bus_flush(struct uart_softc *sc, int what) { struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc; @@ -518,7 +493,7 @@ ns8250_bus_flush(struct uart_softc *sc, return (error); } -static int +int ns8250_bus_getsig(struct uart_softc *sc) { uint32_t new, old, sig; @@ -539,7 +514,7 @@ ns8250_bus_getsig(struct uart_softc *sc) return (sig); } -static int +int ns8250_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) { struct uart_bas *bas; @@ -612,7 +587,7 @@ ns8250_bus_ioctl(struct uart_softc *sc, return (error); } -static int +int ns8250_bus_ipend(struct uart_softc *sc) { struct uart_bas *bas; @@ -656,7 +631,7 @@ ns8250_bus_ipend(struct uart_softc *sc) return (ipend); } -static int +int ns8250_bus_param(struct uart_softc *sc, int baudrate, int databits, int stopbits, int parity) { @@ -670,7 +645,7 @@ ns8250_bus_param(struct uart_softc *sc, return (error); } -static int +int ns8250_bus_probe(struct uart_softc *sc) { struct ns8250_softc *ns8250; @@ -820,7 +795,7 @@ ns8250_bus_probe(struct uart_softc *sc) return (0); } -static int +int ns8250_bus_receive(struct uart_softc *sc) { struct uart_bas *bas; @@ -853,7 +828,7 @@ ns8250_bus_receive(struct uart_softc *sc return (0); } -static int +int ns8250_bus_setsig(struct uart_softc *sc, int sig) { struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc; @@ -885,7 +860,7 @@ ns8250_bus_setsig(struct uart_softc *sc, return (0); } -static int +int ns8250_bus_transmit(struct uart_softc *sc) { struct ns8250_softc *ns8250 = (struct ns8250_softc*)sc; Added: head/sys/dev/uart/uart_dev_ns8250.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/uart/uart_dev_ns8250.h Wed Aug 21 14:26:15 2013 (r254597) @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2003 Marcel Moolenaar + * 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. + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _DEV_UART_DEV_NS8250_H_ +#define _DEV_UART_DEV_NS8250_H_ + +/* + * High-level UART interface. + */ +struct ns8250_softc { + struct uart_softc base; + uint8_t fcr; + uint8_t ier; + uint8_t mcr; + + uint8_t ier_mask; + uint8_t ier_rxbits; + uint8_t busy_detect; +}; + +extern struct uart_ops uart_ns8250_ops; + +int ns8250_bus_attach(struct uart_softc *); +int ns8250_bus_detach(struct uart_softc *); +int ns8250_bus_flush(struct uart_softc *, int); +int ns8250_bus_getsig(struct uart_softc *); +int ns8250_bus_ioctl(struct uart_softc *, int, intptr_t); +int ns8250_bus_ipend(struct uart_softc *); +int ns8250_bus_param(struct uart_softc *, int, int, int, int); +int ns8250_bus_probe(struct uart_softc *); +int ns8250_bus_receive(struct uart_softc *); +int ns8250_bus_setsig(struct uart_softc *, int); +int ns8250_bus_transmit(struct uart_softc *); + +#endif /* _DEV_UART_DEV_NS8250_H_ */ From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 14:33:04 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 ESMTP id 92EAF954; Wed, 21 Aug 2013 14:33:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 7E6292FCD; Wed, 21 Aug 2013 14:33:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7LEX4Iq079884; Wed, 21 Aug 2013 14:33:04 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LEX35r079877; Wed, 21 Aug 2013 14:33:03 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308211433.r7LEX35r079877@svn.freebsd.org> From: Ian Lepore Date: Wed, 21 Aug 2013 14:33:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254598 - in head/sys: arm/ti boot/fdt/dts dev/uart 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 14:33:04 -0000 Author: ian Date: Wed Aug 21 14:33:02 2013 New Revision: 254598 URL: http://svnweb.freebsd.org/changeset/base/254598 Log: Add support for uarts other than the serial console in TI OMAP SoCs. The TI uart hardware is ns16550-compatible, except that before it can be used the clocks and power have to be enabled and a non-standard mode control register has to be set to put the device in uart mode (as opposed to irDa or other serial protocols). This adds the extra code in an extension to the standard ns8250 probe routine, and the rest of the driver is just the standard ns8250 code. Added: head/sys/dev/uart/uart_dev_ti8250.c (contents, props changed) Modified: head/sys/arm/ti/files.ti head/sys/boot/fdt/dts/am335x.dtsi head/sys/dev/uart/uart.h head/sys/dev/uart/uart_bus_fdt.c head/sys/dev/uart/uart_cpu_fdt.c Modified: head/sys/arm/ti/files.ti ============================================================================== --- head/sys/arm/ti/files.ti Wed Aug 21 14:26:15 2013 (r254597) +++ head/sys/arm/ti/files.ti Wed Aug 21 14:33:02 2013 (r254598) @@ -21,5 +21,6 @@ arm/ti/ti_gpio.c optional gpio arm/ti/ti_i2c.c optional ti_i2c dev/ofw/ofw_iicbus.c optional iicbus +dev/uart/uart_dev_ti8250.c optional uart dev/uart/uart_dev_ns8250.c optional uart Modified: head/sys/boot/fdt/dts/am335x.dtsi ============================================================================== --- head/sys/boot/fdt/dts/am335x.dtsi Wed Aug 21 14:26:15 2013 (r254597) +++ head/sys/boot/fdt/dts/am335x.dtsi Wed Aug 21 14:33:02 2013 (r254598) @@ -88,13 +88,69 @@ }; uart0: serial@44E09000 { - compatible = "ns16550"; + compatible = "ti,ns16550"; reg = <0x44E09000 0x1000>; reg-shift = <2>; interrupts = < 72 >; interrupt-parent = <&AINTC>; - clock-frequency = < 48000000 >; /* FIXME */ - }; + clock-frequency = < 48000000 >; + uart-device-id = < 0 >; + }; + + uart1: serial@48022000 { + compatible = "ti,ns16550"; + reg = <0x48022000 0x1000>; + reg-shift = <2>; + interrupts = < 73 >; + interrupt-parent = <&AINTC>; + clock-frequency = < 48000000 >; + uart-device-id = < 1 >; + status = "disabled"; + }; + + uart2: serial@48024000 { + compatible = "ti,ns16550"; + reg = <0x48024000 0x1000>; + reg-shift = <2>; + interrupts = < 74 >; + interrupt-parent = <&AINTC>; + clock-frequency = < 48000000 >; + uart-device-id = < 2 >; + status = "disabled"; + }; + + uart3: serial@481a6000 { + compatible = "ti,ns16550"; + reg = <0x481A6000 0x1000>; + reg-shift = <2>; + interrupts = < 44 >; + interrupt-parent = <&AINTC>; + clock-frequency = < 48000000 >; + uart-device-id = < 3 >; + status = "disabled"; + }; + + uart4: serial@481a8000 { + compatible = "ti,ns16550"; + reg = <0x481A8000 0x1000>; + reg-shift = <2>; + interrupts = < 45 >; + interrupt-parent = <&AINTC>; + clock-frequency = < 48000000 >; + uart-device-id = < 4 >; + status = "disabled"; + }; + + uart5: serial@481aa000 { + compatible = "ti,ns16550"; + reg = <0x481AA000 0x1000>; + reg-shift = <2>; + interrupts = < 46 >; + interrupt-parent = <&AINTC>; + clock-frequency = < 48000000 >; + uart-device-id = < 5 >; + status = "disabled"; + }; edma3@49000000 { compatible = "ti,edma3"; Modified: head/sys/dev/uart/uart.h ============================================================================== --- head/sys/dev/uart/uart.h Wed Aug 21 14:26:15 2013 (r254597) +++ head/sys/dev/uart/uart.h Wed Aug 21 14:33:02 2013 (r254598) @@ -74,6 +74,7 @@ extern struct uart_class uart_z8530_clas extern struct uart_class uart_lpc_class __attribute__((weak)); extern struct uart_class uart_pl011_class __attribute__((weak)); extern struct uart_class uart_cdnc_class __attribute__((weak)); +extern struct uart_class uart_ti8250_class __attribute__((weak)); #ifdef PC98 struct uart_class *uart_pc98_getdev(u_long port); Modified: head/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- head/sys/dev/uart/uart_bus_fdt.c Wed Aug 21 14:26:15 2013 (r254597) +++ head/sys/dev/uart/uart_bus_fdt.c Wed Aug 21 14:33:02 2013 (r254598) @@ -111,6 +111,8 @@ uart_fdt_probe(device_t dev) sc->sc_class = &uart_s3c2410_class; else if (ofw_bus_is_compatible(dev, "cadence,uart")) sc->sc_class = &uart_cdnc_class; + else if (ofw_bus_is_compatible(dev, "ti,ns16550")) + sc->sc_class = &uart_ti8250_class; else if (ofw_bus_is_compatible(dev, "ns16550")) sc->sc_class = &uart_ns8250_class; else Modified: head/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- head/sys/dev/uart/uart_cpu_fdt.c Wed Aug 21 14:26:15 2013 (r254597) +++ head/sys/dev/uart/uart_cpu_fdt.c Wed Aug 21 14:33:02 2013 (r254598) @@ -151,6 +151,8 @@ uart_cpu_getdev(int devtype, struct uart class = &uart_s3c2410_class; else if (fdt_is_compatible(node, "cadence,uart")) class = &uart_cdnc_class; + else if (fdt_is_compatible(node, "ti,ns16550")) + class = &uart_ti8250_class; else if (fdt_is_compatible(node, "ns16550")) class = &uart_ns8250_class; Added: head/sys/dev/uart/uart_dev_ti8250.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/uart/uart_dev_ti8250.c Wed Aug 21 14:33:02 2013 (r254598) @@ -0,0 +1,141 @@ +/*- + * Copyright (c) 2013 Ian Lepore + * 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. + * + * 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. + */ + +#include "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include "uart_if.h" + +/* + * High-level UART interface. + */ +struct ti8250_softc { + struct ns8250_softc ns8250_base; + /*uint32_t mystuff;*/ +}; + +#define MDR1_REG 8 +#define MDR1_MODE_UART 0 +#define MDR1_MODE_DISABLE 7 +#define SYSCC_REG 15 +#define SYSCC_SOFTRESET (1 << 1) +#define SYSS_REG 16 +#define SYSS_STATUS_RESETDONE (1 << 0) + +static int +ti8250_bus_probe(struct uart_softc *sc) +{ + int status; + int devid; + clk_ident_t clkid; + pcell_t prop; + phandle_t node; + + /* + * Get the device id from FDT. If it's not there we can't turn on the + * right clocks, so bail, unless we're doing unit 0. We assume that's + * the serial console, whose clock isn't controllable anyway, and we + * sure don't want to break the console because of a config error. + */ + node = ofw_bus_get_node(sc->sc_dev); + if ((OF_getprop(node, "uart-device-id", &prop, sizeof(prop))) <= 0) { + device_printf(sc->sc_dev, + "missing uart-device-id attribute in FDT\n"); + if (device_get_unit(sc->sc_dev) != 0) + return (ENXIO); + devid = 0; + } else + devid = fdt32_to_cpu(prop); + + /* Enable clocks for this device. We can't continue if that fails. */ + clkid = UART0_CLK + devid; + if ((status = ti_prcm_clk_enable(clkid)) != 0) + return (status); + + /* + * Set the hardware to disabled mode, do a full device reset, then set + * it to uart mode. Most devices will be reset-and-disabled already, + * but you never know what a bootloader might have done. + */ + uart_setreg(&sc->sc_bas, MDR1_REG, MDR1_MODE_DISABLE); + uart_setreg(&sc->sc_bas, SYSCC_REG, SYSCC_SOFTRESET); + while (uart_getreg(&sc->sc_bas, SYSS_REG) & SYSS_STATUS_RESETDONE) + continue; + uart_setreg(&sc->sc_bas, MDR1_REG, MDR1_MODE_UART); + + status = ns8250_bus_probe(sc); + if (status == 0) + device_set_desc(sc->sc_dev, "TI UART (16550 compatible)"); + + return (status); +} + +static kobj_method_t ti8250_methods[] = { + KOBJMETHOD(uart_probe, ti8250_bus_probe), + + KOBJMETHOD(uart_attach, ns8250_bus_attach), + KOBJMETHOD(uart_detach, ns8250_bus_detach), + KOBJMETHOD(uart_flush, ns8250_bus_flush), + KOBJMETHOD(uart_getsig, ns8250_bus_getsig), + KOBJMETHOD(uart_ioctl, ns8250_bus_ioctl), + KOBJMETHOD(uart_ipend, ns8250_bus_ipend), + KOBJMETHOD(uart_param, ns8250_bus_param), + KOBJMETHOD(uart_receive, ns8250_bus_receive), + KOBJMETHOD(uart_setsig, ns8250_bus_setsig), + KOBJMETHOD(uart_transmit, ns8250_bus_transmit), + KOBJMETHOD_END +}; + +struct uart_class uart_ti8250_class = { + "ti8250", + ti8250_methods, + sizeof(struct ti8250_softc), + .uc_ops = &uart_ns8250_ops, + .uc_range = 0x88, + .uc_rclk = 48000000 +}; + From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 14:59: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 ESMTP id 43B79C55 for ; Wed, 21 Aug 2013 14:59:52 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 59C6321B3 for ; Wed, 21 Aug 2013 14:59:51 +0000 (UTC) Received: (qmail 72615 invoked from network); 21 Aug 2013 15:42:55 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 15:42:55 -0000 Message-ID: <5214D5E0.9040002@freebsd.org> Date: Wed, 21 Aug 2013 16:59:44 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Navdeep Parhar Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212870A.50105@freebsd.org> <521291F1.8060500@FreeBSD.org> In-Reply-To: <521291F1.8060500@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 14:59:52 -0000 On 19.08.2013 23:45, Navdeep Parhar wrote: > On 08/19/13 13:58, Andre Oppermann wrote: >> On 19.08.2013 19:33, Navdeep Parhar wrote: >>> On 08/19/13 04:16, Andre Oppermann wrote: >>>> Author: andre >>>> Date: Mon Aug 19 11:16:53 2013 >>>> New Revision: 254520 >>>> URL: http://svnweb.freebsd.org/changeset/base/254520 >>>> >>>> Log: >>>> Remove the unused M_NOFREE mbuf flag. It didn't have any in-tree >>>> users >>>> for a very long time, if ever. >>>> >>>> Should such a functionality ever be needed again the appropriate and >>>> much better way to do it is through a custom EXT_SOMETHING >>>> external mbuf >>>> type together with a dedicated *ext_free function. >>>> >>>> Discussed with: trociny, glebius >>>> >>>> Modified: >>>> head/sys/kern/kern_mbuf.c >>>> head/sys/kern/uipc_mbuf.c >>>> head/sys/sys/mbuf.h >>>> >>> >>> Hello Andre, >>> >>> Is this just garbage collection or is there some other reason for this? >> >> This is garbage collection and removal of not quite right, rotten, >> functionality. >> >>> I recently tried some experiments to reduce the number of mbuf and >>> cluster allocations in a 40G NIC driver. M_NOFREE and EXT_EXTREF proved >>> very useful and the code changes to the kernel were minimal. See >>> user/np/cxl_tuning. The experiment was quite successful and I was >>> planning to bring in most of those changes to HEAD. I was hoping to get >>> some runtime mileage on the approach in general before tweaking the >>> ctors/dtors for jumpbo, jumbo9, jumbo16 to allow for an mbuf+refcnt >>> within the cluster. But now M_NOFREE has vanished without a warning... >> >> I'm looking through your experimental code and that is some really good >> numbers you're achieving there! >> >> However a couple things don't feel quite right, hackish even, and not >> fit for HEAD. This is a bit the same situation we had with some of the >> first 1GigE cards quite a number of years back (mostly ti(4)). There >> we ended up with a couple of just good enough hacks to make it fast. >> Most of the remains I've collected today. > > If M_NOFREE and EXT_EXTREF are properly supported in the tree (and I'm > arguing that they were, before r254520) then the changes are perfectly > legitimate. The only hackish part was that I was getting the cluster > from the jumbop zone while bypassing its normal refcnt mechanism. This > I did so as to use the same zone as m_uiotombuf to keep it "hot" for all > consumers (driver + network stack). If you insist I'll revert the commit removing M_NOFREE. EXT_EXTREF isn't touched yet, but should get better support. The hackish part for me is that the driver again manages its own memory pool. Windows works that way, NetBSD is moving towards it while FreeBSD has and remains at a central network memory pool. The latter (our current) way of doing it seems more efficient overall especially on heavily loaded networked machines. There may be significant queues building (think app blocked having many sockets buffer fill up) up delaying the freeing and returning of network memory resources. Together with fragmentation this can lead to bad very outcomes. Router applications with many interfaces also greatly benefit from central memory pools. So I'm really not sure that we should move back in the driver owned pool direction with lots of code duplication and copy-pasting (see NetBSD). Also it is kinda weird to have a kernel based pool for data going down the stack and another one in each driver for those going up. Actually I'm of the opinion that we should stay with the central memory pool and fix so that it works just as well for those cases a driver pool currently performs better. >> I believe most of the improvements you've shown can be implemented in >> a more generic and safe way into the mbuf system. Also a number of things >> in your experimental code may have side-effects in situations other than >> netperf runs. > > Agreed. As I mentioned my long term plan was to tweak the jumboX zones > to allow them to allocate cluster with embedded mbuf + refcount. The > M_NOFREE+EXT_EXTREF approach is the perfect bridge from here to there. > It is non-intrusive and lends itself well to experimentation. Agreed, full support on fixing the refcount issue. >> To summarize what I get from your experimental branch commits: >> - the Chelsio T4/T5 card can DMA multiple ethernet frames (packets) into >> a single memory buffer, provided it is large enough. >> - you make use of that feature and point multiple m_ext mbufs into that >> buffer to separate the packets and send them up the stack. >> - you embed the m_ext refcount into the single memory buffer as well. > > yes, yes, and yes. > >> - you recycle mbufs? (I'm not entirely clear on that as I'm not familiar >> with the cxgbe code) > > I recycle the cluster (and the embedded mbuf in it) when possible. All > depends on whether it's still in use by the time the rx queue needs it back. There's always a couple of problems with driver managed pools. Driver shutdown/ unloading requires all such managed mbufs to have returned before it can proceed. This may take a undetermined long time as mbufs are sitting in socket buffers or other queues. >> Lets examine and discuss these parts: >> - M_NOFREE wasn't really safe with bpf anyway at least for packets going >> down the stack. > > I see. Can you point out the parts of bpf unable to deal with M_NOFREE? Sorry, false alarm. >> - Instead of M_NOFREE a custom *ext_free should be used that has the same >> and even more functionality. > > Yes, that's what I was planning too, with the jumboX zone changes. It > would be faster than running the m_ext's free function (which is a > function dereference+call). It would be a bit faster but how do you know when an mbuf itself has been free'd and can be reused without notification? >> - Recycling mbufs may cause imbalances to the mbuf pool with multiple cores >> and possibly NUMA in the future. Not that we are very good with it at >> the moment but bypassing the mbuf allocator shouldn't become the norm. >> If it is a problem/bottleneck again it should be fixed, not worked around >> and copy-pasted n-times in so many drivers. > > If/when a cluster is recycled, it is given back to the same rx ithread > that originally allocated it, and not not any other queue. If the > ithread stays in the same NUMA domain (and it really should) then > recycling the cluster in the same queue really shouldn't cause imbalances. OK. (Side note at the moment the mbuf allocator isn't NUMA aware at all.) >> - jumbo9 and jumbo16 mbufs should not be used because they are more special >> than necessary with being KVM and physically contiguous. This probably >> isn't necessary for the T4/T5 cards and any other modern DMA engine. >> Under heavy diverse network the kernel memory becomes fragmented and >> can't >> find memory fulfilling both criteria anymore. In fact both are an >> artifact >> of the early GigE hacks when high speed DMA engines were in their >> infancy. >> Both jumbo9 and jumbo16 should go away without direct replacement. > > The devices I deal will be able to cope, but I suspect this will be > disruptive (for not enough reason to justify the disruption, imho) to > others. That's a separate discussion anyway. Again using the jumbo9 or jumbo16 doesn't scale. Wollman had it fail quite badly on his heavily loaded NFS server. The way to go should be 4K clusters as they are native to the architecture. IIRC a PCIe DMA can't cross a 4K boundary anyway, so it having a number of them together shouldn't have much of an impact except for consuming descriptors? On a well loaded system it's almost impossible to obtain physically contiguous pages after some time, except through pre-allocation. But then the pre-allocation has to be properly sized in advance and takes memory away from other uses. >> In your T4/T5 case the alternative would be either to a) allocate your >> own memory directly from KVM with the necessary properties (KVM and/or >> phys >> contig); b) have such a generic kernel mbuf type fulfilling the same >> role. >> There may be some cache line issues on non-x86 systems that have to be >> though and taken care of. >> - Refcounts should have the option of being separately allocated. It was >> mandatory to use the refcount zone so far because there wasn't any other >> type of refcount. Now that we have one we should revisit the issue. >> Actually the entire mbuf allocation and initialization could be >> streamlined >> as a whole. >> >> On a side note a different mbuf handling for the RX DMA rings may give some >> significant improvements as well: allocate just a cluster without a mbuf >> through >> m_cljget() and put it into the RX ring. Only when the DMA has put a >> packet into >> it allocated attach the mbuf (in the drivers RX function). This avoids >> the cache >> pollution from touching the mbuf fields during initial allocation, >> including the >> refcount. > > Er, this is pretty much how cxgbe(4) has always done it. A cluster is > allocated with m_cljget, an mbuf is allocated with MT_NOINIT to avoid > touching any line in the mbuf. m_init is called later in the rx ithread. Excellent. I haven't (yet) spent much time reading the cxgbe(4) code. >> Another nice trick would be to shorten the mbuf by 4 bytes (in ext_size) >> and put >> the refcount there. >> >> Lets work on these together. > > Yes. I think we agree on the long term optimization, or are at least > headed in the same general direction. But removing M_NOFREE removed a > dirt-cheap way to test and exercise the approach without implementing > the "real thing." Why not just let it be? I don't mind too much having M_NOFREE return but, while convenient, I'm not convinced at all that it is the right and best way of handling that use case. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 15:03:07 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 ESMTP id 4658EED8 for ; Wed, 21 Aug 2013 15:03:07 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ABA3F220D for ; Wed, 21 Aug 2013 15:03:06 +0000 (UTC) Received: (qmail 72647 invoked from network); 21 Aug 2013 15:46:11 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 15:46:11 -0000 Message-ID: <5214D6A3.608@freebsd.org> Date: Wed, 21 Aug 2013 17:02:59 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Navdeep Parhar Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129634.7000509@FreeBSD.org> In-Reply-To: <52129634.7000509@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 15:03:07 -0000 On 20.08.2013 00:03, Navdeep Parhar wrote: > On 08/19/13 14:08, Andre Oppermann wrote: >> On 19.08.2013 19:40, Peter Grehan wrote: >>>> I recently tried some experiments to reduce the number of mbuf and >>>> cluster allocations in a 40G NIC driver. M_NOFREE and EXT_EXTREF proved >>>> very useful and the code changes to the kernel were minimal. See >>>> user/np/cxl_tuning. The experiment was quite successful and I was >>>> planning to bring in most of those changes to HEAD. I was hoping to get >>>> some runtime mileage on the approach in general before tweaking the >>>> ctors/dtors for jumpbo, jumbo9, jumbo16 to allow for an mbuf+refcnt >>>> within the cluster. But now M_NOFREE has vanished without a warning... >>> >>> I also had a virtualization work-in-progress where static mbufs were >>> allocated in the kernel and >>> M_NOFREE set. >>> >>> Might be worth sending a prior heads-up for these type of changes. >> >> I'm sorry for ambushing but this stuff has to be done. I have provided >> an alternative way of handling it and I'm happy to help you with your >> use case to make it good for you and to prevent the mbuf system from >> getting bloated and hackish again. > > I don't know what Peter's use case is but I'm curious about the > already-available alternative to M_NOFREE, if that's what you meant. > Can you please elaborate? When you supply your own (*ext_free) function you can simply omit freeing the mbuf itself. Should make sure not to leak it though. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 15:03:43 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 ESMTP id 2A45DF0; Wed, 21 Aug 2013 15:03:43 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id DD947221A; Wed, 21 Aug 2013 15:03:42 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id 2E1EE1221E; Thu, 22 Aug 2013 01:03:42 +1000 (EST) Received: from Peter-Grehans-MacBook-Pro-2.local (c-67-161-27-37.hsd1.ca.comcast.net [67.161.27.37]) by dommail.onthenet.com.au (MOS 4.2.4-GA) with ESMTP id BOC73155 (AUTH peterg@ptree32.com.au); Thu, 22 Aug 2013 01:03:40 +1000 Message-ID: <5214D6CA.2040405@freebsd.org> Date: Wed, 21 Aug 2013 08:03:38 -0700 From: Peter Grehan User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212870A.50105@freebsd.org> <521291F1.8060500@FreeBSD.org> <5214D5E0.9040002@freebsd.org> In-Reply-To: <5214D5E0.9040002@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 15:03:43 -0000 > The way to go should be 4K clusters as they are native to the architecture. > IIRC a PCIe DMA can't cross a 4K boundary anyway That's a 4G boundary, for some devices. later, Peter. From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 15:08: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 ESMTP id 421E34D5 for ; Wed, 21 Aug 2013 15:08:32 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8D831227A for ; Wed, 21 Aug 2013 15:08:31 +0000 (UTC) Received: (qmail 72681 invoked from network); 21 Aug 2013 15:51:36 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 15:51:36 -0000 Message-ID: <5214D7E8.1080106@freebsd.org> Date: Wed, 21 Aug 2013 17:08:24 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Peter Grehan Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> In-Reply-To: <52129E55.30803@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 15:08:32 -0000 On 20.08.2013 00:38, Peter Grehan wrote: > Hi Andre, > > (moving to the more appropriate freebsd-net) > >> I'm sorry for ambushing but this stuff has to be done. I have provided >> an alternative way of handling it and I'm happy to help you with your >> use case to make it good for you and to prevent the mbuf system from >> getting bloated and hackish again. > > Sure. I'm not really upset since my code wasn't too far along, but with any API, you never know > who consumers might be so it's always worth being proactive about announcing it's removal. Agreed. OTOH there wasn't any in-tree user of it and posting before such removals always yields at least one obscure hand wavy use or potential use of it. So nothing ever happens. >> Can you please describe your intended use of M_NOFREE to better understand >> the shortcomings of the current mbuf systems and the additional advantages >> of the M_NOFREE case? > > I was looking at something similar to Linux's vhost-net, where a guest's virtio ring would be > processed in-kernel. An mbuf chain with external buffers would be used to pass guest tx buffer/len > segments directly into FreeBSD drivers. Is that like page flipping? > The intent of M_NOFREE was to avoid small mbuf allocations/frees in what is a hot path. This code > was intended to run at 10/40G. > > Note this code isn't really generic - it would require interfaces to be 'owned' by the guest, > except that direct PCI-level pass-through wouldn't be needed. Do you have some example code showing how that is or can be done? > If there's an alternative to M_NOFREE, I'd be more than happy to use that. Set up your own (*ext_free) function and omit freeing of the mbuf itself. Make sure to properly track your mbufs to avoid leaking them. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 15:13: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 ESMTP id 2F41F7D7 for ; Wed, 21 Aug 2013 15:13:46 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9544C2318 for ; Wed, 21 Aug 2013 15:13:45 +0000 (UTC) Received: (qmail 72728 invoked from network); 21 Aug 2013 15:56:50 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 15:56:50 -0000 Message-ID: <5214D922.6010208@freebsd.org> Date: Wed, 21 Aug 2013 17:13:38 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Julian Elischer Subject: Re: svn commit: r254519 - in head/sys: netinet netinet6 sys References: <201308191108.r7JB8aQ4057777@svn.freebsd.org> <5212DCD8.4050004@freebsd.org> In-Reply-To: <5212DCD8.4050004@freebsd.org> Content-Type: text/plain; charset=UTF-8; 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 15:13:46 -0000 On 20.08.2013 05:04, Julian Elischer wrote: > On 8/19/13 7:08 PM, Andre Oppermann wrote: >> Author: andre >> Date: Mon Aug 19 11:08:36 2013 >> New Revision: 254519 >> URL: http://svnweb.freebsd.org/changeset/base/254519 >> >> Log: >> Move the global M_SKIP_FIREWALL mbuf flags to a protocol layer specific >> flag instead. The flag is only used within the IP and IPv6 layer 3 >> protocols. > > weeeeelllll, "maybe" > Layer 2 usage of ipfw could make use of this flag as well. > Cisco were using L2 ipfw some years back. I don't know if this affects them at all. L2 firewalls are not affected directly. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 15:23:32 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 ESMTP id 4EC88BDA for ; Wed, 21 Aug 2013 15:23:32 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 96DCF23D3 for ; Wed, 21 Aug 2013 15:23:31 +0000 (UTC) Received: (qmail 72762 invoked from network); 21 Aug 2013 16:06:35 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 16:06:35 -0000 Message-ID: <5214DB6C.6060207@freebsd.org> Date: Wed, 21 Aug 2013 17:23:24 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Julian Elischer Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> <5212DEE7.6060804@freebsd.org> In-Reply-To: <5212DEE7.6060804@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Navdeep Parhar , Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 15:23:32 -0000 On 20.08.2013 05:13, Julian Elischer wrote: > On 8/20/13 6:38 AM, Peter Grehan wrote: >> Hi Andre, >> >> (moving to the more appropriate freebsd-net) >> >>> I'm sorry for ambushing but this stuff has to be done. I have provided >>> an alternative way of handling it and I'm happy to help you with your >>> use case to make it good for you and to prevent the mbuf system from >>> getting bloated and hackish again. >> >> Sure. I'm not really upset since my code wasn't too far along, but with any API, you never know >> who consumers might be so it's always worth being proactive about announcing it's removal. >> >>> Can you please describe your intended use of M_NOFREE to better understand >>> the shortcomings of the current mbuf systems and the additional advantages >>> of the M_NOFREE case? >> >> I was looking at something similar to Linux's vhost-net, where a guest's virtio ring would be >> processed in-kernel. An mbuf chain with external buffers would be used to pass guest tx buffer/len >> segments directly into FreeBSD drivers. >> >> The intent of M_NOFREE was to avoid small mbuf allocations/frees in what is a hot path. This code >> was intended to run at 10/40G. >> >> Note this code isn't really generic - it would require interfaces to be 'owned' by the guest, >> except that direct PCI-level pass-through wouldn't be needed. >> >> If there's an alternative to M_NOFREE, I'd be more than happy to use that. > > I think an alternative would be a reference counted version. we used to have that and NetBSD had a > quite sophisticated mbuf system where there were multiple owners of mbufs.. > they wouldn't be freed until the last one freed it but I don't remember the details. I just had a glance at the NetBSD mbuf system and it doesn't look convincing either. There may be some serious scalability issues with this "ownership" thing. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 15:31: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 ESMTP id 07688E86 for ; Wed, 21 Aug 2013 15:31:05 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 519EF246B for ; Wed, 21 Aug 2013 15:31:04 +0000 (UTC) Received: (qmail 72800 invoked from network); 21 Aug 2013 16:14:08 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 16:14:08 -0000 Message-ID: <5214DD31.6010205@freebsd.org> Date: Wed, 21 Aug 2013 17:30:57 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Davide Italiano Subject: Re: svn commit: r254524 - head/sys/sys References: <201308191356.r7JDuELE075073@svn.freebsd.org> <521257E2.4020502@FreeBSD.org> <5213AAA1.6020700@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, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 15:31:05 -0000 On 20.08.2013 20:13, Davide Italiano wrote: > On Tue, Aug 20, 2013 at 7:42 PM, Andre Oppermann wrote: >> On 19.08.2013 19:37, Navdeep Parhar wrote: >>> Why reuse the freed up bits so soon (at least one of which I think was >>> prematurely GC'ed -- see my other email on M_NOFREE). There was room >>> beyond M_HASHTYPEBITS, no? >> >> This is HEAD where kernel and modules have to be (re)compiled together >> at any point in time. On stable this reuse would not have been possible. >> >> In a subsequent commit I compacted and ordered the flags. There's a couple >> of free ones remaining. >> >> I have some additional mbuf changes coming up to be posted for possible >> objections later today. The close HEAD freeze deadline has got me rushed >> a bit to allow 10.x backporting of the checksum/offload overhaul. >> >> -- >> Andre >> > > In my opinion the possibility we have about breaking KPI/KBI should > not be abused, even if it's allowed in HEAD. In other words,people > should go for preserving it when (as in this case) it's easy and > without additional costs. Your point about "this is HEAD, it can be > broken at any time" makes relatively little sense to me. Note that in > the worst case such KPI/KBI breakages are annoying for $VENDORS who > maintain out-of-tree code, which need to rebuild/change their code, > or, if they get pissed off, drop FreeBSD support. > In your case, it's just a matter of "code cleaness" about few lines, > which, IMHO and always IMHO, doesn't justify the breakage. Preserving the API but having to recompile is always fair game in HEAD. In fact it happens all the time and the only supported way to track HEAD is to recompile kernel and modules together. For removing (crufty) functionality I agree that it shouldn't be done just for the sake of it and also shouldn't be done often. Sometimes it is necessary in the name of progress. Having to support old, crufty or broken ways of doing something is a waste of developer time too. It's always a judgement call. In this case there is a perfectly valid alternative way of doing that also is less dangerous to leak mbufs. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 15:31:44 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 ESMTP id 6F5A4FD9; Wed, 21 Aug 2013 15:31:44 +0000 (UTC) (envelope-from alc@FreeBSD.org) 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 5D0AD2478; Wed, 21 Aug 2013 15:31:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7LFVi3I013064; Wed, 21 Aug 2013 15:31:44 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LFVieh013063; Wed, 21 Aug 2013 15:31:44 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201308211531.r7LFVieh013063@svn.freebsd.org> From: Alan Cox Date: Wed, 21 Aug 2013 15:31:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254599 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 15:31:44 -0000 Author: alc Date: Wed Aug 21 15:31:43 2013 New Revision: 254599 URL: http://svnweb.freebsd.org/changeset/base/254599 Log: Addendum to r254141: Allow recursion on the free pages queues lock in vm_page_alloc_freelist(). Reported and tested by: sbruno Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Aug 21 14:33:02 2013 (r254598) +++ head/sys/vm/vm_page.c Wed Aug 21 15:31:43 2013 (r254599) @@ -1927,7 +1927,7 @@ vm_page_alloc_freelist(int flind, int re /* * Do not allocate reserved pages unless the req has asked for it. */ - mtx_lock(&vm_page_queue_free_mtx); + mtx_lock_flags(&vm_page_queue_free_mtx, MTX_RECURSE); if (cnt.v_free_count + cnt.v_cache_count > cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM && cnt.v_free_count + cnt.v_cache_count > cnt.v_interrupt_free_min) || From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 15:32:59 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 ESMTP id F0CF61FB for ; Wed, 21 Aug 2013 15:32:59 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8A730248B for ; Wed, 21 Aug 2013 15:32:59 +0000 (UTC) Received: (qmail 72831 invoked from network); 21 Aug 2013 16:16:03 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 16:16:03 -0000 Message-ID: <5214DDA4.4010504@freebsd.org> Date: Wed, 21 Aug 2013 17:32:52 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Peter Grehan Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212870A.50105@freebsd.org> <521291F1.8060500@FreeBSD.org> <5214D5E0.9040002@freebsd.org> <5214D6CA.2040405@freebsd.org> In-Reply-To: <5214D6CA.2040405@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 15:33:00 -0000 On 21.08.2013 17:03, Peter Grehan wrote: >> The way to go should be 4K clusters as they are native to the architecture. >> IIRC a PCIe DMA can't cross a 4K boundary anyway > > That's a 4G boundary, for some devices. I meant a single PCIe DMA transaction can be at most 4K before it has to set up another one? -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 15:53: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 ESMTP id CCEBFB9E; Wed, 21 Aug 2013 15:53:56 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 89A5725EA; Wed, 21 Aug 2013 15:53:56 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id 17B60121E5; Thu, 22 Aug 2013 01:53:55 +1000 (EST) Received: from Peter-Grehans-MacBook-Pro-2.local (c-67-161-27-37.hsd1.ca.comcast.net [67.161.27.37]) by dommail.onthenet.com.au (MOS 4.2.4-GA) with ESMTP id BOC74114 (AUTH peterg@ptree32.com.au); Thu, 22 Aug 2013 01:53:53 +1000 Message-ID: <5214E28F.2060703@freebsd.org> Date: Wed, 21 Aug 2013 08:53:51 -0700 From: Peter Grehan User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212870A.50105@freebsd.org> <521291F1.8060500@FreeBSD.org> <5214D5E0.9040002@freebsd.org> <5214D6CA.2040405@freebsd.org> <5214DDA4.4010504@freebsd.org> In-Reply-To: <5214DDA4.4010504@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 15:53:56 -0000 Hi Andre, > On 21.08.2013 17:03, Peter Grehan wrote: >>> The way to go should be 4K clusters as they are native to the >>> architecture. >>> IIRC a PCIe DMA can't cross a 4K boundary anyway >> >> That's a 4G boundary, for some devices. > > I meant a single PCIe DMA transaction can be at most 4K before it has to > set up another one? 4K is the maximum TLP size but that's rarely (ever?) used - 128 or 256 bytes is more common. A DMA operation is just a sequence of TLPs originating from the endpoint. later, Peter. From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 15:59:56 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 ESMTP id 48C83D64; Wed, 21 Aug 2013 15:59:56 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vc0-x234.google.com (mail-vc0-x234.google.com [IPv6:2607:f8b0:400c:c03::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B19992618; Wed, 21 Aug 2013 15:59:55 +0000 (UTC) Received: by mail-vc0-f180.google.com with SMTP id gf11so381706vcb.39 for ; Wed, 21 Aug 2013 08:59:54 -0700 (PDT) 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=Qa72VUObh0GwmtRyz0TDezMH0kApgjxNl7v47uAj+uE=; b=V3V+5Fvxe8waaEWkjw/CN++06HLOc5vLy+y2dKnFeKy0mrj6GW3eOljkLGFj8uwgx3 +etflA5v4sX8sTKuIAHOhPzQDcMVxigSxA1Ayr93SqIWlJLMh0IAURCRz0N9n0gva+UF FI2zlJpMmFFmAhYUQMjiwJrzSaT/sIgLkjaahzaGDMSMkQjaG9T6/1gYq6Fgw9j6aVvI 6YdJDmtUTpYT2Oh+aFHKw5Eh5Jnw5EhQDrdKhbhWQenviYrQQmQYn7S4VXf27W7ct9k2 g6dgx0R6TtDdYoUmDbvOD6/AjTO2eWxvn2iWA7pr5hvQEKWcSNF+3rVNm/AduG5uy1oI MopQ== MIME-Version: 1.0 X-Received: by 10.52.35.171 with SMTP id i11mr5982177vdj.4.1377100794500; Wed, 21 Aug 2013 08:59:54 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.220.65.132 with HTTP; Wed, 21 Aug 2013 08:59:54 -0700 (PDT) In-Reply-To: <5214DD31.6010205@freebsd.org> References: <201308191356.r7JDuELE075073@svn.freebsd.org> <521257E2.4020502@FreeBSD.org> <5213AAA1.6020700@freebsd.org> <5214DD31.6010205@freebsd.org> Date: Wed, 21 Aug 2013 17:59:54 +0200 X-Google-Sender-Auth: PbEb1t4qWmkwpbWsbTgslT_-VWo Message-ID: Subject: Re: svn commit: r254524 - head/sys/sys From: Davide Italiano To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 15:59:56 -0000 On Wed, Aug 21, 2013 at 5:30 PM, Andre Oppermann wrote: > On 20.08.2013 20:13, Davide Italiano wrote: >> >> On Tue, Aug 20, 2013 at 7:42 PM, Andre Oppermann >> wrote: >>> >>> On 19.08.2013 19:37, Navdeep Parhar wrote: >>>> >>>> Why reuse the freed up bits so soon (at least one of which I think was >>>> prematurely GC'ed -- see my other email on M_NOFREE). There was room >>>> beyond M_HASHTYPEBITS, no? >>> >>> >>> This is HEAD where kernel and modules have to be (re)compiled together >>> at any point in time. On stable this reuse would not have been possible. >>> >>> In a subsequent commit I compacted and ordered the flags. There's a >>> couple >>> of free ones remaining. >>> >>> I have some additional mbuf changes coming up to be posted for possible >>> objections later today. The close HEAD freeze deadline has got me rushed >>> a bit to allow 10.x backporting of the checksum/offload overhaul. >>> >>> -- >>> Andre >>> >> >> In my opinion the possibility we have about breaking KPI/KBI should >> not be abused, even if it's allowed in HEAD. In other words,people >> should go for preserving it when (as in this case) it's easy and >> without additional costs. Your point about "this is HEAD, it can be >> broken at any time" makes relatively little sense to me. Note that in >> the worst case such KPI/KBI breakages are annoying for $VENDORS who >> maintain out-of-tree code, which need to rebuild/change their code, >> or, if they get pissed off, drop FreeBSD support. >> In your case, it's just a matter of "code cleaness" about few lines, >> which, IMHO and always IMHO, doesn't justify the breakage. > > > Preserving the API but having to recompile is always fair game in HEAD. > In fact it happens all the time and the only supported way to track HEAD > is to recompile kernel and modules together. > > For removing (crufty) functionality I agree that it shouldn't be done > just for the sake of it and also shouldn't be done often. Sometimes it > is necessary in the name of progress. Having to support old, crufty or > broken ways of doing something is a waste of developer time too. > > It's always a judgement call. In this case there is a perfectly valid > alternative way of doing that also is less dangerous to leak mbufs. > > -- > Andre > I don't see in any way how flags reordering might be in any way connected to mbufs leaks, alas. There's a similar recent('ish) discussion and it was decided to not compact/reorder flags. See r253662/r253775 for references. So, I'm not sure what's the de-facto policy, but still, as a community FreeBSD should decide one strategy and be stuck with that. It's a matter of being consistent, which, IMHO, is something that should not be undervaluated. Thanks, -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 16:19:02 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 ESMTP id B5CD3523 for ; Wed, 21 Aug 2013 16:19:02 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 16A4D272C for ; Wed, 21 Aug 2013 16:19:01 +0000 (UTC) Received: (qmail 72994 invoked from network); 21 Aug 2013 17:02:05 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 17:02:05 -0000 Message-ID: <5214E86F.1060102@freebsd.org> Date: Wed, 21 Aug 2013 18:18:55 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Davide Italiano Subject: Re: svn commit: r254524 - head/sys/sys References: <201308191356.r7JDuELE075073@svn.freebsd.org> <521257E2.4020502@FreeBSD.org> <5213AAA1.6020700@freebsd.org> <5214DD31.6010205@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, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 16:19:02 -0000 On 21.08.2013 17:59, Davide Italiano wrote: > On Wed, Aug 21, 2013 at 5:30 PM, Andre Oppermann wrote: >> On 20.08.2013 20:13, Davide Italiano wrote: >>> >>> On Tue, Aug 20, 2013 at 7:42 PM, Andre Oppermann >>> wrote: >>>> >>>> On 19.08.2013 19:37, Navdeep Parhar wrote: >>>>> >>>>> Why reuse the freed up bits so soon (at least one of which I think was >>>>> prematurely GC'ed -- see my other email on M_NOFREE). There was room >>>>> beyond M_HASHTYPEBITS, no? >>>> >>>> >>>> This is HEAD where kernel and modules have to be (re)compiled together >>>> at any point in time. On stable this reuse would not have been possible. >>>> >>>> In a subsequent commit I compacted and ordered the flags. There's a >>>> couple >>>> of free ones remaining. >>>> >>>> I have some additional mbuf changes coming up to be posted for possible >>>> objections later today. The close HEAD freeze deadline has got me rushed >>>> a bit to allow 10.x backporting of the checksum/offload overhaul. >>>> >>>> -- >>>> Andre >>>> >>> >>> In my opinion the possibility we have about breaking KPI/KBI should >>> not be abused, even if it's allowed in HEAD. In other words,people >>> should go for preserving it when (as in this case) it's easy and >>> without additional costs. Your point about "this is HEAD, it can be >>> broken at any time" makes relatively little sense to me. Note that in >>> the worst case such KPI/KBI breakages are annoying for $VENDORS who >>> maintain out-of-tree code, which need to rebuild/change their code, >>> or, if they get pissed off, drop FreeBSD support. >>> In your case, it's just a matter of "code cleaness" about few lines, >>> which, IMHO and always IMHO, doesn't justify the breakage. >> >> >> Preserving the API but having to recompile is always fair game in HEAD. >> In fact it happens all the time and the only supported way to track HEAD >> is to recompile kernel and modules together. >> >> For removing (crufty) functionality I agree that it shouldn't be done >> just for the sake of it and also shouldn't be done often. Sometimes it >> is necessary in the name of progress. Having to support old, crufty or >> broken ways of doing something is a waste of developer time too. >> >> It's always a judgement call. In this case there is a perfectly valid >> alternative way of doing that also is less dangerous to leak mbufs. >> >> -- >> Andre >> > > I don't see in any way how flags reordering might be in any way > connected to mbufs leaks, alas. > There's a similar recent('ish) discussion and it was decided to not > compact/reorder flags. See r253662/r253775 for references. > So, I'm not sure what's the de-facto policy, but still, as a community > FreeBSD should decide one strategy and be stuck with that. It's a > matter of being consistent, which, IMHO, is something that should not > be undervaluated. I fail to see what problem you have with the flag reordering. Recompile and done. That's why we work with #defines instead of magic 0x1234 values. If someone outside the tree was using the spare bits for their own private purposes, yes, they would quickly have to check and possibly adjust them. That's trivial however and should be expected when tracking an OpenSource operating system. If you want total ABI stability then build on Windows but even they made a big break somewhere around NIDS5 or NDIS6. We can't get stuck on every bit because there may be someone somewhere out there we don't know about using it. On any x-stable such a reorder wouldn't be possible obviously because of the ABI preservation guarantee. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 16:29: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 ESMTP id D2C6B966; Wed, 21 Aug 2013 16:29:06 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vc0-x233.google.com (mail-vc0-x233.google.com [IPv6:2607:f8b0:400c:c03::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4730E27D4; Wed, 21 Aug 2013 16:29:06 +0000 (UTC) Received: by mail-vc0-f179.google.com with SMTP id ht10so410494vcb.38 for ; Wed, 21 Aug 2013 09:29:05 -0700 (PDT) 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=OATyy2cIS3/B4wcHvEJwr60gyz+5YW/KDz4u9yeDLP8=; b=bQXvG2DEpaAGz/PoJMrWmLNFLkibltPQCEiwdsRyHGM2sGHCDEGuKHJjSSjVfw1pFV U3OdnqfY+2BW/lEeAdFBJIW+Tt3lkpyTzxrxPopzMr8htD2XicKBFYRqqsuEV+Jyzlbj YlusCvUhb8Vtl0Y545+0So3KiRmPgiBpr5x7DkVgwOfDJb9oJSfU6GI9z7uaed1wdM1q Nvfip8x0NIXhkAZHfpjH7LYP7mSsgpkQUEt96QIBT70sLgdnTQxhgJnWMO7g57/DDgMH qPFK+bEUb3QRdcmnmg6QMz1XLj31q0JjeiJtbmZucdQYD813t9PA1cpJSt8xbdnQQ0MS ZAfg== MIME-Version: 1.0 X-Received: by 10.220.173.134 with SMTP id p6mr639664vcz.36.1377102544958; Wed, 21 Aug 2013 09:29:04 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.220.65.132 with HTTP; Wed, 21 Aug 2013 09:29:04 -0700 (PDT) In-Reply-To: <5214E86F.1060102@freebsd.org> References: <201308191356.r7JDuELE075073@svn.freebsd.org> <521257E2.4020502@FreeBSD.org> <5213AAA1.6020700@freebsd.org> <5214DD31.6010205@freebsd.org> <5214E86F.1060102@freebsd.org> Date: Wed, 21 Aug 2013 18:29:04 +0200 X-Google-Sender-Auth: TakbU2n9F97yv7dnQ3cwH6EfMLY Message-ID: Subject: Re: svn commit: r254524 - head/sys/sys From: Davide Italiano To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 16:29:06 -0000 On Wed, Aug 21, 2013 at 6:18 PM, Andre Oppermann wrote: > On 21.08.2013 17:59, Davide Italiano wrote: >> >> On Wed, Aug 21, 2013 at 5:30 PM, Andre Oppermann >> wrote: >>> >>> On 20.08.2013 20:13, Davide Italiano wrote: >>>> >>>> >>>> On Tue, Aug 20, 2013 at 7:42 PM, Andre Oppermann >>>> wrote: >>>>> >>>>> >>>>> On 19.08.2013 19:37, Navdeep Parhar wrote: >>>>>> >>>>>> >>>>>> Why reuse the freed up bits so soon (at least one of which I think was >>>>>> prematurely GC'ed -- see my other email on M_NOFREE). There was room >>>>>> beyond M_HASHTYPEBITS, no? >>>>> >>>>> >>>>> >>>>> This is HEAD where kernel and modules have to be (re)compiled together >>>>> at any point in time. On stable this reuse would not have been >>>>> possible. >>>>> >>>>> In a subsequent commit I compacted and ordered the flags. There's a >>>>> couple >>>>> of free ones remaining. >>>>> >>>>> I have some additional mbuf changes coming up to be posted for possible >>>>> objections later today. The close HEAD freeze deadline has got me >>>>> rushed >>>>> a bit to allow 10.x backporting of the checksum/offload overhaul. >>>>> >>>>> -- >>>>> Andre >>>>> >>>> >>>> In my opinion the possibility we have about breaking KPI/KBI should >>>> not be abused, even if it's allowed in HEAD. In other words,people >>>> should go for preserving it when (as in this case) it's easy and >>>> without additional costs. Your point about "this is HEAD, it can be >>>> broken at any time" makes relatively little sense to me. Note that in >>>> the worst case such KPI/KBI breakages are annoying for $VENDORS who >>>> maintain out-of-tree code, which need to rebuild/change their code, >>>> or, if they get pissed off, drop FreeBSD support. >>>> In your case, it's just a matter of "code cleaness" about few lines, >>>> which, IMHO and always IMHO, doesn't justify the breakage. >>> >>> >>> >>> Preserving the API but having to recompile is always fair game in HEAD. >>> In fact it happens all the time and the only supported way to track HEAD >>> is to recompile kernel and modules together. >>> >>> For removing (crufty) functionality I agree that it shouldn't be done >>> just for the sake of it and also shouldn't be done often. Sometimes it >>> is necessary in the name of progress. Having to support old, crufty or >>> broken ways of doing something is a waste of developer time too. >>> >>> It's always a judgement call. In this case there is a perfectly valid >>> alternative way of doing that also is less dangerous to leak mbufs. >>> >>> -- >>> Andre >>> >> >> I don't see in any way how flags reordering might be in any way >> connected to mbufs leaks, alas. >> There's a similar recent('ish) discussion and it was decided to not >> compact/reorder flags. See r253662/r253775 for references. >> So, I'm not sure what's the de-facto policy, but still, as a community >> FreeBSD should decide one strategy and be stuck with that. It's a >> matter of being consistent, which, IMHO, is something that should not >> be undervaluated. > > > I fail to see what problem you have with the flag reordering. Recompile That it broke KBI. Without any advantage, other than "compacting" things and making code a bit more readable. And without any real reason, as there's still room for new flags. I think Navdeep pointed out this as well. But I won't object anymore. Go for it. The reason why I replied is that I find silly doing something like this without real advantage. > and done. That's why we work with #defines instead of magic 0x1234 values. > If someone outside the tree was using the spare bits for their own private > purposes, yes, they would quickly have to check and possibly adjust them. > That's trivial however and should be expected when tracking an OpenSource > operating system. If you want total ABI stability then build on Windows > but even they made a big break somewhere around NIDS5 or NDIS6. We can't > get stuck on every bit because there may be someone somewhere out there > we don't know about using it. On any x-stable such a reorder wouldn't > be possible obviously because of the ABI preservation guarantee. > > -- > Andre > Thanks, -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 16:38:54 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 ESMTP id 19BB4D48; Wed, 21 Aug 2013 16:38:54 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pd0-x233.google.com (mail-pd0-x233.google.com [IPv6:2607:f8b0:400e:c02::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D51D8286D; Wed, 21 Aug 2013 16:38:53 +0000 (UTC) Received: by mail-pd0-f179.google.com with SMTP id v10so642220pde.24 for ; Wed, 21 Aug 2013 09:38:53 -0700 (PDT) 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=0BaJzeWwOAtERSTpKcWJ+/6YLC+LI0MiLigdI2syJk8=; b=TAhH/NFombUzciYBVWHiZAkc4zr9l850nLTFdAxZPG/VfqUxUY5Q1TbVPt1Xn6GEmp NU3SI6qMppueoRRtSRa4go5tDxE8U9othESQiHjESrVQQgRL5d4gnMXPy6r+YxNM1vkK yMiqX2Ij/4u8hLJ19k6hjWiVKyOj0ukLofiOLEHXAEr9LG/hmBtiPyjyvBvciWtQw9YR do2ZdQyufy7i2Vb/QC2dSegdyMvH8k/LJtPzrznoVPMxnvKZRl6Ph6nS47cbAFihAiSg gmmj7CguXAVqb19AMk+ZIHJyy2/O1p5XiXQt1zM6UJ8BuKA+Z/BZylfNn4XsqEaCt7Ol bB8g== X-Received: by 10.66.248.161 with SMTP id yn1mr10606337pac.0.1377103133500; Wed, 21 Aug 2013 09:38:53 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id vz4sm11145045pab.11.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 09:38:52 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <5214ED19.40907@FreeBSD.org> Date: Wed, 21 Aug 2013 09:38:49 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130819 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> <5214D7E8.1080106@freebsd.org> In-Reply-To: <5214D7E8.1080106@freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 16:38:54 -0000 On 08/21/13 08:08, Andre Oppermann wrote: > On 20.08.2013 00:38, Peter Grehan wrote: > >> If there's an alternative to M_NOFREE, I'd be more than happy to use >> that. > > Set up your own (*ext_free) function and omit freeing of the mbuf > itself. Make > sure to properly track your mbufs to avoid leaking them. > How is this an alternate to M_NOFREE? Your suggestion indicates that you may have removed M_NOFREE thinking it did something other than what it actually did. And this suggestion doesn't even work -- note the uma_zfree(zone_mbuf, m) at the end of mb_free_ext that would run after any custom ext_free. To recap: M_NOFREE was the way to tell the mbuf subsystem that the mbuf does not come from zone_mbuf. Nothing more and nothing less. The mbuf was in other ways like any other mbuf and could have a pkthdr (or not), internal storage (or not), external cluster (or not), etc. etc. Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 16:46:07 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 ESMTP id 26CA6D5; Wed, 21 Aug 2013 16:46:07 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) 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 1494E28E4; Wed, 21 Aug 2013 16:46: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 r7LGk6LH051216; Wed, 21 Aug 2013 16:46:06 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LGk6eV051215; Wed, 21 Aug 2013 16:46:06 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201308211646.r7LGk6eV051215@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 21 Aug 2013 16:46:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254600 - head/lib/libutil 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 16:46:07 -0000 Author: pluknet Date: Wed Aug 21 16:46:06 2013 New Revision: 254600 URL: http://svnweb.freebsd.org/changeset/base/254600 Log: Check strtoumax(3) for ERANGE in case of non-prefixed string. OK'd by: silence on current@ MFC after: 1 week Modified: head/lib/libutil/expand_number.c Modified: head/lib/libutil/expand_number.c ============================================================================== --- head/lib/libutil/expand_number.c Wed Aug 21 15:31:43 2013 (r254599) +++ head/lib/libutil/expand_number.c Wed Aug 21 16:46:06 2013 (r254600) @@ -55,6 +55,10 @@ expand_number(const char *buf, uint64_t number = strtoumax(buf, &endptr, 0); + if (number == UINTMAX_MAX && errno == ERANGE) { + return (-1); + } + if (endptr == buf) { /* No valid digits. */ errno = EINVAL; From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 17:09: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 ESMTP id 2F5C3B1B; Wed, 21 Aug 2013 17:09:24 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id E13632A5E; Wed, 21 Aug 2013 17:09:23 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id 08A1C12269; Thu, 22 Aug 2013 03:09:23 +1000 (EST) Received: from Peter-Grehans-MacBook-Pro-2.local (c-69-181-164-196.hsd1.ca.comcast.net [69.181.164.196]) by dommail.onthenet.com.au (MOS 4.2.4-GA) with ESMTP id BOC75693 (AUTH peterg@ptree32.com.au); Thu, 22 Aug 2013 03:09:21 +1000 Message-ID: <5214F43F.8040201@freebsd.org> Date: Wed, 21 Aug 2013 10:09:19 -0700 From: Peter Grehan User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> <5214D7E8.1080106@freebsd.org> In-Reply-To: <5214D7E8.1080106@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 17:09:24 -0000 >> If there's an alternative to M_NOFREE, I'd be more than happy to use >> that. > > Set up your own (*ext_free) function and omit freeing of the mbuf > itself. Make sure to properly track your mbufs to avoid leaking them. Doesn't work: there's an unconditional free of the small mbuf. That's why I used M_NOFREE. later, Peter. From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 17:21:52 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 ESMTP id 2599B33E for ; Wed, 21 Aug 2013 17:21:52 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ABBB22B53 for ; Wed, 21 Aug 2013 17:21:51 +0000 (UTC) Received: by mail-ee0-f53.google.com with SMTP id b15so416428eek.40 for ; Wed, 21 Aug 2013 10:21:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:openpgp:content-type :content-transfer-encoding; bh=CLtk3dJZ2ZFtIbX/Ci55xMIMcmhgl0jyYmyiVX0BSL8=; b=EwRWocaN3Yqd0pmkEvYxB8jaUhXYzYw02O467kZd8RGET9Qz/n8un0leOqjq/b6anN dSMX+MWPsuZAYUZn1HqIbVhJZSvyps3+VRiQkc9I+naz9oaQJFvKo9SF+/G0YEh0r/jF +CbJHoDwB/Em0wF3HY0HpSGcvPt8jaWIUD55vFfaRQKDLV9Tjy3AvdR1dJkxiLfE4cyt mnJT4O8tyL3wM6KI6xXINPpLldvmpr0cqfVwCrF7ljZvgh1GSBekmueCLXlHJ+4i07xS NTV2G+sm+X6/6EwohgnOGibsqkToVsyeEHfvgQwCXliyN7Vpjq6WfOuiAkgNY+/Rxw4C 32yw== X-Gm-Message-State: ALoCoQmUKjCknVzx5k81OFqzNoXjoSWDCAUdqYWlXjbdYtNzQW40RE4VW0mWNNxpJv/mlWUqcmO0 X-Received: by 10.15.43.13 with SMTP id w13mr11887326eev.37.1377105709628; Wed, 21 Aug 2013 10:21:49 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id a1sm11309096eem.1.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 10:21:49 -0700 (PDT) Message-ID: <5214F72B.7070006@freebsd.org> Date: Wed, 21 Aug 2013 21:21:47 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Sergey Kandaurov Subject: Re: svn commit: r254600 - head/lib/libutil References: <201308211646.r7LGk6eV051215@svn.freebsd.org> In-Reply-To: <201308211646.r7LGk6eV051215@svn.freebsd.org> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 17:21:52 -0000 On 21.08.2013 20:46, Sergey Kandaurov wrote: > number = strtoumax(buf, &endptr, 0); > > + if (number == UINTMAX_MAX && errno == ERANGE) { > + return (-1); > + } You need to reset errno before strtoumax() call (errno = 0), because any of previous functions may left it as ERANGE. -- http://ache.vniz.net/ bitcoin:1G6ugdNY6e5jx1GVnAU2ntj2NEfmjKG85r From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 17:23: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 ESMTP id 94E334BE; Wed, 21 Aug 2013 17:23:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) 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 740AD2B68; Wed, 21 Aug 2013 17:23: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 r7LHNPO2072369; Wed, 21 Aug 2013 17:23:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LHNO2n072366; Wed, 21 Aug 2013 17:23:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308211723.r7LHNO2n072366@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 21 Aug 2013 17:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254601 - in head/sys: fs/tmpfs kern 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 17:23:25 -0000 Author: kib Date: Wed Aug 21 17:23:24 2013 New Revision: 254601 URL: http://svnweb.freebsd.org/changeset/base/254601 Log: Extract the general-purpose code from tmpfs to perform uiomove from the page queue of some vm object. Discussed with: alc Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/kern/uipc_shm.c head/sys/sys/uio.h Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Aug 21 16:46:06 2013 (r254600) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Aug 21 17:23:24 2013 (r254601) @@ -439,225 +439,51 @@ tmpfs_setattr(struct vop_setattr_args *v } static int -tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx, - vm_offset_t offset, size_t tlen, struct uio *uio) -{ - vm_page_t m; - int error, rv; - - VM_OBJECT_WLOCK(tobj); - - /* - * Parallel reads of the page content from disk are prevented - * by exclusive busy. - * - * Although the tmpfs vnode lock is held here, it is - * nonetheless safe to sleep waiting for a free page. The - * pageout daemon does not need to acquire the tmpfs vnode - * lock to page out tobj's pages because tobj is a OBJT_SWAP - * type object. - */ - m = vm_page_grab(tobj, idx, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - if (m->valid != VM_PAGE_BITS_ALL) { - if (vm_pager_has_page(tobj, idx, NULL, NULL)) { - rv = vm_pager_get_pages(tobj, &m, 1, 0); - m = vm_page_lookup(tobj, idx); - if (m == NULL) { - printf( - "tmpfs: vm_obj %p idx %jd null lookup rv %d\n", - tobj, idx, rv); - VM_OBJECT_WUNLOCK(tobj); - return (EIO); - } - if (rv != VM_PAGER_OK) { - printf( - "tmpfs: vm_obj %p idx %jd valid %x pager error %d\n", - tobj, idx, m->valid, rv); - vm_page_lock(m); - vm_page_free(m); - vm_page_unlock(m); - VM_OBJECT_WUNLOCK(tobj); - return (EIO); - } - } else - vm_page_zero_invalid(m, TRUE); - } - vm_page_xunbusy(m); - vm_page_lock(m); - vm_page_hold(m); - vm_page_unlock(m); - VM_OBJECT_WUNLOCK(tobj); - error = uiomove_fromphys(&m, offset, tlen, uio); - vm_page_lock(m); - vm_page_unhold(m); - if (m->queue == PQ_NONE) { - vm_page_deactivate(m); - } else { - /* Requeue to maintain LRU ordering. */ - vm_page_requeue(m); - } - vm_page_unlock(m); - - return (error); -} - -static int tmpfs_read(struct vop_read_args *v) { - struct vnode *vp = v->a_vp; - struct uio *uio = v->a_uio; + struct vnode *vp; + struct uio *uio; struct tmpfs_node *node; - vm_object_t uobj; - size_t len; - int resid; - int error = 0; - vm_pindex_t idx; - vm_offset_t offset; - off_t addr; - size_t tlen; + vp = v->a_vp; + if (vp->v_type != VREG) + return (EISDIR); + uio = v->a_uio; + if (uio->uio_offset < 0) + return (EINVAL); node = VP_TO_TMPFS_NODE(vp); - - if (vp->v_type != VREG) { - error = EISDIR; - goto out; - } - - if (uio->uio_offset < 0) { - error = EINVAL; - goto out; - } - node->tn_status |= TMPFS_NODE_ACCESSED; - - uobj = node->tn_reg.tn_aobj; - while ((resid = uio->uio_resid) > 0) { - error = 0; - if (node->tn_size <= uio->uio_offset) - break; - len = MIN(node->tn_size - uio->uio_offset, resid); - if (len == 0) - break; - addr = uio->uio_offset; - idx = OFF_TO_IDX(addr); - offset = addr & PAGE_MASK; - tlen = MIN(PAGE_SIZE - offset, len); - error = tmpfs_nocacheread(uobj, idx, offset, tlen, uio); - if ((error != 0) || (resid == uio->uio_resid)) - break; - } - -out: - - return error; -} - -/* --------------------------------------------------------------------- */ - -static int -tmpfs_mappedwrite(vm_object_t tobj, size_t len, struct uio *uio) -{ - vm_pindex_t idx; - vm_page_t tpg; - vm_offset_t offset; - off_t addr; - size_t tlen; - int error, rv; - - error = 0; - - addr = uio->uio_offset; - idx = OFF_TO_IDX(addr); - offset = addr & PAGE_MASK; - tlen = MIN(PAGE_SIZE - offset, len); - - VM_OBJECT_WLOCK(tobj); - tpg = vm_page_grab(tobj, idx, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - if (tpg->valid != VM_PAGE_BITS_ALL) { - if (vm_pager_has_page(tobj, idx, NULL, NULL)) { - rv = vm_pager_get_pages(tobj, &tpg, 1, 0); - tpg = vm_page_lookup(tobj, idx); - if (tpg == NULL) { - printf( - "tmpfs: vm_obj %p idx %jd null lookup rv %d\n", - tobj, idx, rv); - VM_OBJECT_WUNLOCK(tobj); - return (EIO); - } - if (rv != VM_PAGER_OK) { - printf( - "tmpfs: vm_obj %p idx %jd valid %x pager error %d\n", - tobj, idx, tpg->valid, rv); - vm_page_lock(tpg); - vm_page_free(tpg); - vm_page_unlock(tpg); - VM_OBJECT_WUNLOCK(tobj); - return (EIO); - } - } else - vm_page_zero_invalid(tpg, TRUE); - } - vm_page_xunbusy(tpg); - vm_page_lock(tpg); - vm_page_hold(tpg); - vm_page_unlock(tpg); - VM_OBJECT_WUNLOCK(tobj); - error = uiomove_fromphys(&tpg, offset, tlen, uio); - VM_OBJECT_WLOCK(tobj); - if (error == 0) - vm_page_dirty(tpg); - vm_page_lock(tpg); - vm_page_unhold(tpg); - if (tpg->queue == PQ_NONE) { - vm_page_deactivate(tpg); - } else { - /* Requeue to maintain LRU ordering. */ - vm_page_requeue(tpg); - } - vm_page_unlock(tpg); - VM_OBJECT_WUNLOCK(tobj); - - return (error); + return (uiomove_object(node->tn_reg.tn_aobj, node->tn_size, uio)); } static int tmpfs_write(struct vop_write_args *v) { - struct vnode *vp = v->a_vp; - struct uio *uio = v->a_uio; - int ioflag = v->a_ioflag; - - boolean_t extended; - int error = 0; - off_t oldsize; + struct vnode *vp; + struct uio *uio; struct tmpfs_node *node; - vm_object_t uobj; - size_t len; - int resid; + off_t oldsize; + int error, ioflag; + boolean_t extended; + vp = v->a_vp; + uio = v->a_uio; + ioflag = v->a_ioflag; + error = 0; node = VP_TO_TMPFS_NODE(vp); oldsize = node->tn_size; - if (uio->uio_offset < 0 || vp->v_type != VREG) { - error = EINVAL; - goto out; - } - - if (uio->uio_resid == 0) { - error = 0; - goto out; - } - + if (uio->uio_offset < 0 || vp->v_type != VREG) + return (EINVAL); + if (uio->uio_resid == 0) + return (0); if (ioflag & IO_APPEND) uio->uio_offset = node->tn_size; - if (uio->uio_offset + uio->uio_resid > VFS_TO_TMPFS(vp->v_mount)->tm_maxfilesize) return (EFBIG); - if (vn_rlimit_fsize(vp, uio, uio->uio_td)) return (EFBIG); - extended = uio->uio_offset + uio->uio_resid > node->tn_size; if (extended) { error = tmpfs_reg_resize(vp, uio->uio_offset + uio->uio_resid, @@ -666,26 +492,13 @@ tmpfs_write(struct vop_write_args *v) goto out; } - uobj = node->tn_reg.tn_aobj; - while ((resid = uio->uio_resid) > 0) { - if (node->tn_size <= uio->uio_offset) - break; - len = MIN(node->tn_size - uio->uio_offset, resid); - if (len == 0) - break; - error = tmpfs_mappedwrite(uobj, len, uio); - if ((error != 0) || (resid == uio->uio_resid)) - break; - } - + error = uiomove_object(node->tn_reg.tn_aobj, node->tn_size, uio); node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | (extended ? TMPFS_NODE_CHANGED : 0); - if (node->tn_mode & (S_ISUID | S_ISGID)) { if (priv_check_cred(v->a_cred, PRIV_VFS_RETAINSUGID, 0)) node->tn_mode &= ~(S_ISUID | S_ISGID); } - if (error != 0) (void)tmpfs_reg_resize(vp, oldsize, TRUE); @@ -693,7 +506,7 @@ out: MPASS(IMPLIES(error == 0, uio->uio_resid == 0)); MPASS(IMPLIES(error != 0, oldsize == node->tn_size)); - return error; + return (error); } /* --------------------------------------------------------------------- */ Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Wed Aug 21 16:46:06 2013 (r254600) +++ head/sys/kern/uipc_shm.c Wed Aug 21 17:23:24 2013 (r254601) @@ -139,6 +139,100 @@ static struct fileops shm_ops = { FEATURE(posix_shm, "POSIX shared memory"); static int +uiomove_object_page(vm_object_t obj, size_t len, struct uio *uio) +{ + vm_page_t m; + vm_pindex_t idx; + size_t tlen; + int error, offset, rv; + + idx = OFF_TO_IDX(uio->uio_offset); + offset = uio->uio_offset & PAGE_MASK; + tlen = MIN(PAGE_SIZE - offset, len); + + VM_OBJECT_WLOCK(obj); + + /* + * Parallel reads of the page content from disk are prevented + * by exclusive busy. + * + * Although the tmpfs vnode lock is held here, it is + * nonetheless safe to sleep waiting for a free page. The + * pageout daemon does not need to acquire the tmpfs vnode + * lock to page out tobj's pages because tobj is a OBJT_SWAP + * type object. + */ + m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + if (m->valid != VM_PAGE_BITS_ALL) { + if (vm_pager_has_page(obj, idx, NULL, NULL)) { + rv = vm_pager_get_pages(obj, &m, 1, 0); + m = vm_page_lookup(obj, idx); + if (m == NULL) { + printf( + "uiomove_object: vm_obj %p idx %jd null lookup rv %d\n", + obj, idx, rv); + VM_OBJECT_WUNLOCK(obj); + return (EIO); + } + if (rv != VM_PAGER_OK) { + printf( + "uiomove_object: vm_obj %p idx %jd valid %x pager error %d\n", + obj, idx, m->valid, rv); + vm_page_lock(m); + vm_page_free(m); + vm_page_unlock(m); + VM_OBJECT_WUNLOCK(obj); + return (EIO); + } + } else + vm_page_zero_invalid(m, TRUE); + } + vm_page_xunbusy(m); + vm_page_lock(m); + vm_page_hold(m); + vm_page_unlock(m); + VM_OBJECT_WUNLOCK(obj); + error = uiomove_fromphys(&m, offset, tlen, uio); + if (uio->uio_rw == UIO_WRITE && error == 0) { + VM_OBJECT_WLOCK(obj); + vm_page_dirty(m); + VM_OBJECT_WUNLOCK(obj); + } + vm_page_lock(m); + vm_page_unhold(m); + if (m->queue == PQ_NONE) { + vm_page_deactivate(m); + } else { + /* Requeue to maintain LRU ordering. */ + vm_page_requeue(m); + } + vm_page_unlock(m); + + return (error); +} + +int +uiomove_object(vm_object_t obj, off_t obj_size, struct uio *uio) +{ + ssize_t resid; + size_t len; + int error; + + error = 0; + while ((resid = uio->uio_resid) > 0) { + if (obj_size <= uio->uio_offset) + break; + len = MIN(obj_size - uio->uio_offset, resid); + if (len == 0) + break; + error = uiomove_object_page(obj, len, uio); + if (error != 0 || resid == uio->uio_resid) + break; + } + return (error); +} + +static int shm_read(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td) { Modified: head/sys/sys/uio.h ============================================================================== --- head/sys/sys/uio.h Wed Aug 21 16:46:06 2013 (r254600) +++ head/sys/sys/uio.h Wed Aug 21 17:23:24 2013 (r254601) @@ -103,6 +103,7 @@ int uiomove_frombuf(void *buf, int bufle int uiomove_fromphys(struct vm_page *ma[], vm_offset_t offset, int n, struct uio *uio); int uiomove_nofault(void *cp, int n, struct uio *uio); +int uiomove_object(struct vm_object *obj, off_t obj_size, struct uio *uio); int uiomoveco(void *cp, int n, struct uio *uio, int disposable); #else /* !_KERNEL */ From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 17:36:03 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 ESMTP id 1776B925; Wed, 21 Aug 2013 17:36:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) 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 02A352C35; Wed, 21 Aug 2013 17:36:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7LHa2QT078862; Wed, 21 Aug 2013 17:36:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LHa2qD078858; Wed, 21 Aug 2013 17:36:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308211736.r7LHa2qD078858@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 21 Aug 2013 17:36:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254602 - in head/sys: fs/devfs kern 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 17:36:03 -0000 Author: kib Date: Wed Aug 21 17:36:01 2013 New Revision: 254602 URL: http://svnweb.freebsd.org/changeset/base/254602 Log: Make the seek a method of the struct fileops. Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/devfs/devfs_vnops.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c head/sys/sys/file.h Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Wed Aug 21 17:23:24 2013 (r254601) +++ head/sys/fs/devfs/devfs_vnops.c Wed Aug 21 17:36:01 2013 (r254602) @@ -1697,6 +1697,7 @@ static struct fileops devfs_ops_f = { .fo_chmod = vn_chmod, .fo_chown = vn_chown, .fo_sendfile = vn_sendfile, + .fo_seek = vn_seek, .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE }; Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Aug 21 17:23:24 2013 (r254601) +++ head/sys/kern/vfs_syscalls.c Wed Aug 21 17:36:01 2013 (r254602) @@ -1879,77 +1879,15 @@ sys_lseek(td, uap) int whence; } */ *uap; { - struct ucred *cred = td->td_ucred; struct file *fp; - struct vnode *vp; - struct vattr vattr; - off_t foffset, offset, size; - int error, noneg; + int error; AUDIT_ARG_FD(uap->fd); if ((error = fget(td, uap->fd, CAP_SEEK, &fp)) != 0) return (error); - if (!(fp->f_ops->fo_flags & DFLAG_SEEKABLE)) { - fdrop(fp, td); - return (ESPIPE); - } - vp = fp->f_vnode; - foffset = foffset_lock(fp, 0); - noneg = (vp->v_type != VCHR); - offset = uap->offset; - switch (uap->whence) { - case L_INCR: - if (noneg && - (foffset < 0 || - (offset > 0 && foffset > OFF_MAX - offset))) { - error = EOVERFLOW; - break; - } - offset += foffset; - break; - case L_XTND: - vn_lock(vp, LK_SHARED | LK_RETRY); - error = VOP_GETATTR(vp, &vattr, cred); - VOP_UNLOCK(vp, 0); - if (error) - break; - - /* - * If the file references a disk device, then fetch - * the media size and use that to determine the ending - * offset. - */ - if (vattr.va_size == 0 && vp->v_type == VCHR && - fo_ioctl(fp, DIOCGMEDIASIZE, &size, cred, td) == 0) - vattr.va_size = size; - if (noneg && - (vattr.va_size > OFF_MAX || - (offset > 0 && vattr.va_size > OFF_MAX - offset))) { - error = EOVERFLOW; - break; - } - offset += vattr.va_size; - break; - case L_SET: - break; - case SEEK_DATA: - error = fo_ioctl(fp, FIOSEEKDATA, &offset, cred, td); - break; - case SEEK_HOLE: - error = fo_ioctl(fp, FIOSEEKHOLE, &offset, cred, td); - break; - default: - error = EINVAL; - } - if (error == 0 && noneg && offset < 0) - error = EINVAL; - if (error != 0) - goto drop; - VFS_KNOTE_UNLOCKED(vp, 0); - *(off_t *)(td->td_retval) = offset; -drop: + error = (fp->f_ops->fo_flags & DFLAG_SEEKABLE) != 0 ? + fo_seek(fp, uap->offset, uap->whence, td) : ESPIPE; fdrop(fp, td); - foffset_unlock(fp, offset, error != 0 ? FOF_NOUPDATE : 0); return (error); } Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Wed Aug 21 17:23:24 2013 (r254601) +++ head/sys/kern/vfs_vnops.c Wed Aug 21 17:36:01 2013 (r254602) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -101,6 +102,7 @@ struct fileops vnops = { .fo_chmod = vn_chmod, .fo_chown = vn_chown, .fo_sendfile = vn_sendfile, + .fo_seek = vn_seek, .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE }; @@ -2010,3 +2012,72 @@ unlock: *off = noff; return (error); } + +int +vn_seek(struct file *fp, off_t offset, int whence, struct thread *td) +{ + struct ucred *cred; + struct vnode *vp; + struct vattr vattr; + off_t foffset, size; + int error, noneg; + + cred = td->td_ucred; + vp = fp->f_vnode; + foffset = foffset_lock(fp, 0); + noneg = (vp->v_type != VCHR); + error = 0; + switch (whence) { + case L_INCR: + if (noneg && + (foffset < 0 || + (offset > 0 && foffset > OFF_MAX - offset))) { + error = EOVERFLOW; + break; + } + offset += foffset; + break; + case L_XTND: + vn_lock(vp, LK_SHARED | LK_RETRY); + error = VOP_GETATTR(vp, &vattr, cred); + VOP_UNLOCK(vp, 0); + if (error) + break; + + /* + * If the file references a disk device, then fetch + * the media size and use that to determine the ending + * offset. + */ + if (vattr.va_size == 0 && vp->v_type == VCHR && + fo_ioctl(fp, DIOCGMEDIASIZE, &size, cred, td) == 0) + vattr.va_size = size; + if (noneg && + (vattr.va_size > OFF_MAX || + (offset > 0 && vattr.va_size > OFF_MAX - offset))) { + error = EOVERFLOW; + break; + } + offset += vattr.va_size; + break; + case L_SET: + break; + case SEEK_DATA: + error = fo_ioctl(fp, FIOSEEKDATA, &offset, cred, td); + break; + case SEEK_HOLE: + error = fo_ioctl(fp, FIOSEEKHOLE, &offset, cred, td); + break; + default: + error = EINVAL; + } + if (error == 0 && noneg && offset < 0) + error = EINVAL; + if (error != 0) + goto drop; + VFS_KNOTE_UNLOCKED(vp, 0); + *(off_t *)(td->td_retval) = offset; +drop: + foffset_unlock(fp, offset, error != 0 ? FOF_NOUPDATE : 0); + return (error); +} Modified: head/sys/sys/file.h ============================================================================== --- head/sys/sys/file.h Wed Aug 21 17:23:24 2013 (r254601) +++ head/sys/sys/file.h Wed Aug 21 17:36:01 2013 (r254602) @@ -108,6 +108,8 @@ typedef int fo_chown_t(struct file *fp, typedef int fo_sendfile_t(struct file *fp, int sockfd, struct uio *hdr_uio, struct uio *trl_uio, off_t offset, size_t nbytes, off_t *sent, int flags, int kflags, struct thread *td); +typedef int fo_seek_t(struct file *fp, off_t offset, int whence, + struct thread *td); typedef int fo_flags_t; struct fileops { @@ -122,6 +124,7 @@ struct fileops { fo_chmod_t *fo_chmod; fo_chown_t *fo_chown; fo_sendfile_t *fo_sendfile; + fo_seek_t *fo_seek; fo_flags_t fo_flags; /* DFLAG_* below */ }; @@ -242,6 +245,7 @@ fo_chown_t invfo_chown; fo_sendfile_t invfo_sendfile; fo_sendfile_t vn_sendfile; +fo_seek_t vn_seek; void finit(struct file *, u_int, short, void *, struct fileops *); int fgetvp(struct thread *td, int fd, cap_rights_t rights, struct vnode **vpp); @@ -370,6 +374,13 @@ fo_sendfile(struct file *fp, int sockfd, nbytes, sent, flags, kflags, td)); } +static __inline int +fo_seek(struct file *fp, off_t offset, int whence, struct thread *td) +{ + + return ((*fp->f_ops->fo_seek)(fp, offset, whence, td)); +} + #endif /* _KERNEL */ #endif /* !SYS_FILE_H */ From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 17:45: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 ESMTP id 4EAF6D5F; Wed, 21 Aug 2013 17:45:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) 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 3A87B2CD1; Wed, 21 Aug 2013 17:45:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7LHj2vC085550; Wed, 21 Aug 2013 17:45:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LHj0o5085520; Wed, 21 Aug 2013 17:45:00 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308211745.r7LHj0o5085520@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 21 Aug 2013 17:45:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254603 - in head/sys: kern security/mac security/mac_biba security/mac_mls security/mac_stub security/mac_test 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 17:45:02 -0000 Author: kib Date: Wed Aug 21 17:45:00 2013 New Revision: 254603 URL: http://svnweb.freebsd.org/changeset/base/254603 Log: Implement read(2)/write(2) and neccessary lseek(2) for posix shmfd. Add MAC framework entries for posix shm read and write. Do not allow implicit extension of the underlying memory segment past the limit set by ftruncate(2) by either of the syscalls. Read and write returns short i/o, lseek(2) fails with EINVAL when resulting offset does not fit into the limit. Discussed with: alc Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/uipc_shm.c head/sys/security/mac/mac_framework.h head/sys/security/mac/mac_policy.h head/sys/security/mac/mac_posix_shm.c head/sys/security/mac_biba/mac_biba.c head/sys/security/mac_mls/mac_mls.c head/sys/security/mac_stub/mac_stub.c head/sys/security/mac_test/mac_test.c head/sys/sys/mman.h Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Wed Aug 21 17:36:01 2013 (r254602) +++ head/sys/kern/uipc_shm.c Wed Aug 21 17:45:00 2013 (r254603) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -119,6 +120,7 @@ static fo_stat_t shm_stat; static fo_close_t shm_close; static fo_chmod_t shm_chmod; static fo_chown_t shm_chown; +static fo_seek_t shm_seek; /* File descriptor operations. */ static struct fileops shm_ops = { @@ -133,7 +135,8 @@ static struct fileops shm_ops = { .fo_chmod = shm_chmod, .fo_chown = shm_chown, .fo_sendfile = invfo_sendfile, - .fo_flags = DFLAG_PASSABLE + .fo_seek = shm_seek, + .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE }; FEATURE(posix_shm, "POSIX shared memory"); @@ -233,19 +236,96 @@ uiomove_object(vm_object_t obj, off_t ob } static int +shm_seek(struct file *fp, off_t offset, int whence, struct thread *td) +{ + struct shmfd *shmfd; + off_t foffset; + int error; + + shmfd = fp->f_data; + foffset = foffset_lock(fp, 0); + error = 0; + switch (whence) { + case L_INCR: + if (foffset < 0 || + (offset > 0 && foffset > OFF_MAX - offset)) { + error = EOVERFLOW; + break; + } + offset += foffset; + break; + case L_XTND: + if (offset > 0 && shmfd->shm_size > OFF_MAX - offset) { + error = EOVERFLOW; + break; + } + offset += shmfd->shm_size; + break; + case L_SET: + break; + default: + error = EINVAL; + } + if (error == 0) { + if (offset < 0 || offset > shmfd->shm_size) + error = EINVAL; + else + *(off_t *)(td->td_retval) = offset; + } + foffset_unlock(fp, offset, error != 0 ? FOF_NOUPDATE : 0); + return (error); +} + +static int shm_read(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td) { + struct shmfd *shmfd; + void *rl_cookie; + int error; - return (EOPNOTSUPP); + shmfd = fp->f_data; + foffset_lock_uio(fp, uio, flags); + rl_cookie = rangelock_rlock(&shmfd->shm_rl, uio->uio_offset, + uio->uio_offset + uio->uio_resid, &shmfd->shm_mtx); +#ifdef MAC + error = mac_posixshm_check_read(active_cred, fp->f_cred, shmfd); + if (error) + return (error); +#endif + error = uiomove_object(shmfd->shm_object, shmfd->shm_size, uio); + rangelock_unlock(&shmfd->shm_rl, rl_cookie, &shmfd->shm_mtx); + foffset_unlock_uio(fp, uio, flags); + return (error); } static int shm_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td) { + struct shmfd *shmfd; + void *rl_cookie; + int error; - return (EOPNOTSUPP); + shmfd = fp->f_data; +#ifdef MAC + error = mac_posixshm_check_write(active_cred, fp->f_cred, shmfd); + if (error) + return (error); +#endif + foffset_lock_uio(fp, uio, flags); + if ((flags & FOF_OFFSET) == 0) { + rl_cookie = rangelock_wlock(&shmfd->shm_rl, 0, OFF_MAX, + &shmfd->shm_mtx); + } else { + rl_cookie = rangelock_wlock(&shmfd->shm_rl, uio->uio_offset, + uio->uio_offset + uio->uio_resid, &shmfd->shm_mtx); + } + + error = uiomove_object(shmfd->shm_object, shmfd->shm_size, uio); + rangelock_unlock(&shmfd->shm_rl, rl_cookie, &shmfd->shm_mtx); + foffset_unlock_uio(fp, uio, flags); + return (error); } static int @@ -471,6 +551,8 @@ shm_alloc(struct ucred *ucred, mode_t mo shmfd->shm_atime = shmfd->shm_mtime = shmfd->shm_ctime = shmfd->shm_birthtime; refcount_init(&shmfd->shm_refs, 1); + mtx_init(&shmfd->shm_mtx, "shmrl", NULL, MTX_DEF); + rangelock_init(&shmfd->shm_rl); #ifdef MAC mac_posixshm_init(shmfd); mac_posixshm_create(ucred, shmfd); @@ -495,6 +577,8 @@ shm_drop(struct shmfd *shmfd) #ifdef MAC mac_posixshm_destroy(shmfd); #endif + rangelock_destroy(&shmfd->shm_rl); + mtx_destroy(&shmfd->shm_mtx); vm_object_deallocate(shmfd->shm_object); free(shmfd, M_SHMFD); } Modified: head/sys/security/mac/mac_framework.h ============================================================================== --- head/sys/security/mac/mac_framework.h Wed Aug 21 17:36:01 2013 (r254602) +++ head/sys/security/mac/mac_framework.h Wed Aug 21 17:45:00 2013 (r254603) @@ -243,6 +243,8 @@ int mac_posixshm_check_mmap(struct ucred int prot, int flags); int mac_posixshm_check_open(struct ucred *cred, struct shmfd *shmfd, accmode_t accmode); +int mac_posixshm_check_read(struct ucred *active_cred, + struct ucred *file_cred, struct shmfd *shmfd); int mac_posixshm_check_setmode(struct ucred *cred, struct shmfd *shmfd, mode_t mode); int mac_posixshm_check_setowner(struct ucred *cred, struct shmfd *shmfd, @@ -252,6 +254,8 @@ int mac_posixshm_check_stat(struct ucred int mac_posixshm_check_truncate(struct ucred *active_cred, struct ucred *file_cred, struct shmfd *shmfd); int mac_posixshm_check_unlink(struct ucred *cred, struct shmfd *shmfd); +int mac_posixshm_check_write(struct ucred *active_cred, + struct ucred *file_cred, struct shmfd *shmfd); void mac_posixshm_create(struct ucred *cred, struct shmfd *shmfd); void mac_posixshm_destroy(struct shmfd *); void mac_posixshm_init(struct shmfd *); Modified: head/sys/security/mac/mac_policy.h ============================================================================== --- head/sys/security/mac/mac_policy.h Wed Aug 21 17:36:01 2013 (r254602) +++ head/sys/security/mac/mac_policy.h Wed Aug 21 17:45:00 2013 (r254603) @@ -363,6 +363,9 @@ typedef int (*mpo_posixshm_check_mmap_t) typedef int (*mpo_posixshm_check_open_t)(struct ucred *cred, struct shmfd *shmfd, struct label *shmlabel, accmode_t accmode); +typedef int (*mpo_posixshm_check_read_t)(struct ucred *active_cred, + struct ucred *file_cred, struct shmfd *shmfd, + struct label *shmlabel); typedef int (*mpo_posixshm_check_setmode_t)(struct ucred *cred, struct shmfd *shmfd, struct label *shmlabel, mode_t mode); @@ -377,6 +380,9 @@ typedef int (*mpo_posixshm_check_truncat struct label *shmlabel); typedef int (*mpo_posixshm_check_unlink_t)(struct ucred *cred, struct shmfd *shmfd, struct label *shmlabel); +typedef int (*mpo_posixshm_check_write_t)(struct ucred *active_cred, + struct ucred *file_cred, struct shmfd *shmfd, + struct label *shmlabel); typedef void (*mpo_posixshm_create_t)(struct ucred *cred, struct shmfd *shmfd, struct label *shmlabel); typedef void (*mpo_posixshm_destroy_label_t)(struct label *label); @@ -818,11 +824,13 @@ struct mac_policy_ops { mpo_posixshm_check_create_t mpo_posixshm_check_create; mpo_posixshm_check_mmap_t mpo_posixshm_check_mmap; mpo_posixshm_check_open_t mpo_posixshm_check_open; + mpo_posixshm_check_read_t mpo_posixshm_check_read; mpo_posixshm_check_setmode_t mpo_posixshm_check_setmode; mpo_posixshm_check_setowner_t mpo_posixshm_check_setowner; mpo_posixshm_check_stat_t mpo_posixshm_check_stat; mpo_posixshm_check_truncate_t mpo_posixshm_check_truncate; mpo_posixshm_check_unlink_t mpo_posixshm_check_unlink; + mpo_posixshm_check_write_t mpo_posixshm_check_write; mpo_posixshm_create_t mpo_posixshm_create; mpo_posixshm_destroy_label_t mpo_posixshm_destroy_label; mpo_posixshm_init_label_t mpo_posixshm_init_label; Modified: head/sys/security/mac/mac_posix_shm.c ============================================================================== --- head/sys/security/mac/mac_posix_shm.c Wed Aug 21 17:36:01 2013 (r254602) +++ head/sys/security/mac/mac_posix_shm.c Wed Aug 21 17:45:00 2013 (r254603) @@ -228,3 +228,37 @@ mac_posixshm_check_setowner(struct ucred return (error); } + +MAC_CHECK_PROBE_DEFINE3(posixshm_check_read, "struct ucred *", + "struct ucred *", "struct shmfd *"); + +int +mac_posixshm_check_read(struct ucred *active_cred, struct ucred *file_cred, + struct shmfd *shmfd) +{ + int error; + + MAC_POLICY_CHECK_NOSLEEP(posixshm_check_read, active_cred, + file_cred, shmfd, shmfd->shm_label); + MAC_CHECK_PROBE3(posixshm_check_read, error, active_cred, + file_cred, shmfd); + + return (error); +} + +MAC_CHECK_PROBE_DEFINE3(posixshm_check_write, "struct ucred *", + "struct ucred *", "struct shmfd *"); + +int +mac_posixshm_check_write(struct ucred *active_cred, struct ucred *file_cred, + struct shmfd *shmfd) +{ + int error; + + MAC_POLICY_CHECK_NOSLEEP(posixshm_check_write, active_cred, + file_cred, shmfd, shmfd->shm_label); + MAC_CHECK_PROBE3(posixshm_check_write, error, active_cred, + file_cred, shmfd); + + return (error); +} Modified: head/sys/security/mac_biba/mac_biba.c ============================================================================== --- head/sys/security/mac_biba/mac_biba.c Wed Aug 21 17:36:01 2013 (r254602) +++ head/sys/security/mac_biba/mac_biba.c Wed Aug 21 17:45:00 2013 (r254603) @@ -1759,6 +1759,24 @@ biba_posixshm_check_open(struct ucred *c } static int +biba_posixshm_check_read(struct ucred *active_cred, struct ucred *file_cred, + struct shmfd *vp, struct label *shmlabel) +{ + struct mac_biba *subj, *obj; + + if (!biba_enabled || !revocation_enabled) + return (0); + + subj = SLOT(active_cred->cr_label); + obj = SLOT(shmlabel); + + if (!biba_dominate_effective(obj, subj)) + return (EACCES); + + return (0); +} + +static int biba_posixshm_check_setmode(struct ucred *cred, struct shmfd *shmfd, struct label *shmlabel, mode_t mode) { @@ -1848,6 +1866,24 @@ biba_posixshm_check_unlink(struct ucred return (0); } +static int +biba_posixshm_check_write(struct ucred *active_cred, struct ucred *file_cred, + struct shmfd *vp, struct label *shmlabel) +{ + struct mac_biba *subj, *obj; + + if (!biba_enabled || !revocation_enabled) + return (0); + + subj = SLOT(active_cred->cr_label); + obj = SLOT(shmlabel); + + if (!biba_dominate_effective(obj, subj)) + return (EACCES); + + return (0); +} + static void biba_posixshm_create(struct ucred *cred, struct shmfd *shmfd, struct label *shmlabel) @@ -3657,11 +3693,13 @@ static struct mac_policy_ops mac_biba_op .mpo_posixshm_check_mmap = biba_posixshm_check_mmap, .mpo_posixshm_check_open = biba_posixshm_check_open, + .mpo_posixshm_check_read = biba_posixshm_check_read, .mpo_posixshm_check_setmode = biba_posixshm_check_setmode, .mpo_posixshm_check_setowner = biba_posixshm_check_setowner, .mpo_posixshm_check_stat = biba_posixshm_check_stat, .mpo_posixshm_check_truncate = biba_posixshm_check_truncate, .mpo_posixshm_check_unlink = biba_posixshm_check_unlink, + .mpo_posixshm_check_write = biba_posixshm_check_write, .mpo_posixshm_create = biba_posixshm_create, .mpo_posixshm_destroy_label = biba_destroy_label, .mpo_posixshm_init_label = biba_init_label, Modified: head/sys/security/mac_mls/mac_mls.c ============================================================================== --- head/sys/security/mac_mls/mac_mls.c Wed Aug 21 17:36:01 2013 (r254602) +++ head/sys/security/mac_mls/mac_mls.c Wed Aug 21 17:45:00 2013 (r254603) @@ -1651,6 +1651,24 @@ mls_posixshm_check_open(struct ucred *cr } static int +mls_posixshm_check_read(struct ucred *active_cred, struct ucred *file_cred, + struct shmfd *shm, struct label *shmlabel) +{ + struct mac_mls *subj, *obj; + + if (!mls_enabled || !revocation_enabled) + return (0); + + subj = SLOT(active_cred->cr_label); + obj = SLOT(shmlabel); + + if (!mls_dominate_effective(subj, obj)) + return (EACCES); + + return (0); +} + +static int mls_posixshm_check_setmode(struct ucred *cred, struct shmfd *shmfd, struct label *shmlabel, mode_t mode) { @@ -1740,6 +1758,24 @@ mls_posixshm_check_unlink(struct ucred * return (0); } +static int +mls_posixshm_check_write(struct ucred *active_cred, struct ucred *file_cred, + struct shmfd *shm, struct label *shmlabel) +{ + struct mac_mls *subj, *obj; + + if (!mls_enabled || !revocation_enabled) + return (0); + + subj = SLOT(active_cred->cr_label); + obj = SLOT(shmlabel); + + if (!mls_dominate_effective(subj, obj)) + return (EACCES); + + return (0); +} + static void mls_posixshm_create(struct ucred *cred, struct shmfd *shmfd, struct label *shmlabel) @@ -3280,11 +3316,13 @@ static struct mac_policy_ops mls_ops = .mpo_posixshm_check_mmap = mls_posixshm_check_mmap, .mpo_posixshm_check_open = mls_posixshm_check_open, + .mpo_posixshm_check_read = mls_posixshm_check_read, .mpo_posixshm_check_setmode = mls_posixshm_check_setmode, .mpo_posixshm_check_setowner = mls_posixshm_check_setowner, .mpo_posixshm_check_stat = mls_posixshm_check_stat, .mpo_posixshm_check_truncate = mls_posixshm_check_truncate, .mpo_posixshm_check_unlink = mls_posixshm_check_unlink, + .mpo_posixshm_check_write = mls_posixshm_check_write, .mpo_posixshm_create = mls_posixshm_create, .mpo_posixshm_destroy_label = mls_destroy_label, .mpo_posixshm_init_label = mls_init_label, Modified: head/sys/security/mac_stub/mac_stub.c ============================================================================== --- head/sys/security/mac_stub/mac_stub.c Wed Aug 21 17:36:01 2013 (r254602) +++ head/sys/security/mac_stub/mac_stub.c Wed Aug 21 17:45:00 2013 (r254603) @@ -757,6 +757,14 @@ stub_posixshm_check_open(struct ucred *c } static int +stub_posixshm_check_read(struct ucred *active_cred, struct ucred *file_cred, + struct shmfd *shm, struct label *shmlabel) +{ + + return (0); +} + +static int stub_posixshm_check_setmode(struct ucred *cred, struct shmfd *shmfd, struct label *shmlabel, mode_t mode) { @@ -796,6 +804,14 @@ stub_posixshm_check_unlink(struct ucred return (0); } +static int +stub_posixshm_check_write(struct ucred *active_cred, struct ucred *file_cred, + struct shmfd *shm, struct label *shmlabel) +{ + + return (0); +} + static void stub_posixshm_create(struct ucred *cred, struct shmfd *shmfd, struct label *shmlabel) @@ -1782,11 +1798,13 @@ static struct mac_policy_ops stub_ops = .mpo_posixshm_check_create = stub_posixshm_check_create, .mpo_posixshm_check_mmap = stub_posixshm_check_mmap, .mpo_posixshm_check_open = stub_posixshm_check_open, + .mpo_posixshm_check_read = stub_posixshm_check_read, .mpo_posixshm_check_setmode = stub_posixshm_check_setmode, .mpo_posixshm_check_setowner = stub_posixshm_check_setowner, .mpo_posixshm_check_stat = stub_posixshm_check_stat, .mpo_posixshm_check_truncate = stub_posixshm_check_truncate, .mpo_posixshm_check_unlink = stub_posixshm_check_unlink, + .mpo_posixshm_check_write = stub_posixshm_check_write, .mpo_posixshm_create = stub_posixshm_create, .mpo_posixshm_destroy_label = stub_destroy_label, .mpo_posixshm_init_label = stub_init_label, Modified: head/sys/security/mac_test/mac_test.c ============================================================================== --- head/sys/security/mac_test/mac_test.c Wed Aug 21 17:36:01 2013 (r254602) +++ head/sys/security/mac_test/mac_test.c Wed Aug 21 17:45:00 2013 (r254603) @@ -1423,6 +1423,21 @@ test_posixshm_check_open(struct ucred *c return (0); } +COUNTER_DECL(posixshm_check_read); +static int +test_posixshm_check_read(struct ucred *active_cred, + struct ucred *file_cred, struct shmfd *shm, struct label *shmlabel) +{ + + LABEL_CHECK(active_cred->cr_label, MAGIC_CRED); + if (file_cred != NULL) + LABEL_CHECK(file_cred->cr_label, MAGIC_CRED); + LABEL_CHECK(shmlabel, MAGIC_POSIX_SHM); + COUNTER_INC(posixshm_check_read); + + return (0); +} + COUNTER_DECL(posixshm_check_setmode); static int test_posixshm_check_setmode(struct ucred *cred, struct shmfd *shmfd, @@ -1485,6 +1500,21 @@ test_posixshm_check_unlink(struct ucred return (0); } +COUNTER_DECL(posixshm_check_write); +static int +test_posixshm_check_write(struct ucred *active_cred, + struct ucred *file_cred, struct shmfd *shm, struct label *shmlabel) +{ + + LABEL_CHECK(active_cred->cr_label, MAGIC_CRED); + if (file_cred != NULL) + LABEL_CHECK(file_cred->cr_label, MAGIC_CRED); + LABEL_CHECK(shmlabel, MAGIC_POSIX_SHM); + COUNTER_INC(posixshm_check_write); + + return (0); +} + COUNTER_DECL(posixshm_create); static void test_posixshm_create(struct ucred *cred, struct shmfd *shmfd, @@ -3114,11 +3144,13 @@ static struct mac_policy_ops test_ops = .mpo_posixshm_check_create = test_posixshm_check_create, .mpo_posixshm_check_mmap = test_posixshm_check_mmap, .mpo_posixshm_check_open = test_posixshm_check_open, + .mpo_posixshm_check_read = test_posixshm_check_read, .mpo_posixshm_check_setmode = test_posixshm_check_setmode, .mpo_posixshm_check_setowner = test_posixshm_check_setowner, .mpo_posixshm_check_stat = test_posixshm_check_stat, .mpo_posixshm_check_truncate = test_posixshm_check_truncate, .mpo_posixshm_check_unlink = test_posixshm_check_unlink, + .mpo_posixshm_check_write = test_posixshm_check_write, .mpo_posixshm_create = test_posixshm_create, .mpo_posixshm_destroy_label = test_posixshm_destroy_label, .mpo_posixshm_init_label = test_posixshm_init_label, Modified: head/sys/sys/mman.h ============================================================================== --- head/sys/sys/mman.h Wed Aug 21 17:36:01 2013 (r254602) +++ head/sys/sys/mman.h Wed Aug 21 17:45:00 2013 (r254603) @@ -190,6 +190,10 @@ typedef __size_t size_t; #endif #if defined(_KERNEL) || defined(_WANT_FILE) +#include +#include +#include +#include #include struct file; @@ -214,6 +218,9 @@ struct shmfd { struct label *shm_label; /* MAC label */ const char *shm_path; + + struct rangelock shm_rl; + struct mtx shm_mtx; }; #endif From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 17:47:12 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 ESMTP id F34FEEE0; Wed, 21 Aug 2013 17:47:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) 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 E0EF42CED; Wed, 21 Aug 2013 17:47: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 r7LHlBUU086305; Wed, 21 Aug 2013 17:47:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LHlBeq086304; Wed, 21 Aug 2013 17:47:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308211747.r7LHlBeq086304@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 21 Aug 2013 17:47:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254604 - head/tools/test/posixshm 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 17:47:12 -0000 Author: kib Date: Wed Aug 21 17:47:11 2013 New Revision: 254604 URL: http://svnweb.freebsd.org/changeset/base/254604 Log: Add simple test for the read/write/lseek on posix shm filedescriptor. Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/tools/test/posixshm/shm_test.c Modified: head/tools/test/posixshm/shm_test.c ============================================================================== --- head/tools/test/posixshm/shm_test.c Wed Aug 21 17:45:00 2013 (r254603) +++ head/tools/test/posixshm/shm_test.c Wed Aug 21 17:47:11 2013 (r254604) @@ -21,7 +21,7 @@ * Signal handler which does nothing. */ static void -ignoreit(int sig) +ignoreit(int sig __unused) { ; } @@ -29,13 +29,13 @@ ignoreit(int sig) int main(int argc, char **argv) { - char buf[1024], *cp; - int desc, rv; + char buf[1024], *cp, c; + int error, desc, rv; long scval; sigset_t ss; struct sigaction sa; void *region; - size_t psize; + size_t i, psize; #ifndef _POSIX_SHARED_MEMORY_OBJECTS printf("_POSIX_SHARED_MEMORY_OBJECTS is undefined\n"); @@ -118,14 +118,29 @@ main(int argc, char **argv) sigemptyset(&ss); sigsuspend(&ss); - for (cp = region; cp < (char *)region + psize; cp++) + for (cp = region; cp < (char *)region + psize; cp++) { if (*cp != '\151') _exit(1); + } + if (lseek(desc, 0, SEEK_SET) == -1) + _exit(1); + for (i = 0; i < psize; i++) { + error = read(desc, &c, 1); + if (c != '\151') + _exit(1); + } _exit(0); } else { int status; - memset(region, '\151', psize); + memset(region, '\151', psize - 2); + error = pwrite(desc, region, 2, psize - 2); + if (error != 2) { + if (error >= 0) + errx(1, "short write %d", error); + else + err(1, "shmfd write"); + } kill(rv, SIGUSR1); waitpid(rv, &status, 0); From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 18:12: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 ESMTP id 88C6C9B0; Wed, 21 Aug 2013 18:12:05 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 5C5E12ECE; Wed, 21 Aug 2013 18:12: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 r7LIC5sF000903; Wed, 21 Aug 2013 18:12:05 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LIC4xv000900; Wed, 21 Aug 2013 18:12:04 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308211812.r7LIC4xv000900@svn.freebsd.org> From: Andre Oppermann Date: Wed, 21 Aug 2013 18:12:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254605 - in head/sys: kern 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 18:12:05 -0000 Author: andre Date: Wed Aug 21 18:12:04 2013 New Revision: 254605 URL: http://svnweb.freebsd.org/changeset/base/254605 Log: Revert r254520 and resurrect the M_NOFREE mbuf flag and functionality. Requested by: np, grehan Modified: head/sys/kern/kern_mbuf.c head/sys/kern/uipc_mbuf.c head/sys/sys/mbuf.h Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Wed Aug 21 17:47:11 2013 (r254604) +++ head/sys/kern/kern_mbuf.c Wed Aug 21 18:12:04 2013 (r254605) @@ -474,6 +474,7 @@ mb_dtor_mbuf(void *mem, int size, void * if ((flags & MB_NOTAGS) == 0 && (m->m_flags & M_PKTHDR) != 0) m_tag_delete_chain(m, NULL); KASSERT((m->m_flags & M_EXT) == 0, ("%s: M_EXT set", __func__)); + KASSERT((m->m_flags & M_NOFREE) == 0, ("%s: M_NOFREE set", __func__)); #ifdef INVARIANTS trash_dtor(mem, size, arg); #endif Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Wed Aug 21 17:47:11 2013 (r254604) +++ head/sys/kern/uipc_mbuf.c Wed Aug 21 18:12:04 2013 (r254605) @@ -278,10 +278,16 @@ m_extadd(struct mbuf *mb, caddr_t buf, u void mb_free_ext(struct mbuf *m) { + int skipmbuf; KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", __func__)); KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", __func__)); + /* + * check if the header is embedded in the cluster + */ + skipmbuf = (m->m_flags & M_NOFREE); + /* Free attached storage if this mbuf is the only reference to it. */ if (*(m->m_ext.ref_cnt) == 1 || atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) { @@ -322,6 +328,8 @@ mb_free_ext(struct mbuf *m) ("%s: unknown ext_type", __func__)); } } + if (skipmbuf) + return; /* * Free this mbuf back to the mbuf zone with all m_ext @@ -386,7 +394,7 @@ m_demote(struct mbuf *m0, int all) m_freem(m->m_nextpkt); m->m_nextpkt = NULL; } - m->m_flags = m->m_flags & (M_EXT|M_RDONLY); + m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_NOFREE); } } Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Wed Aug 21 17:47:11 2013 (r254604) +++ head/sys/sys/mbuf.h Wed Aug 21 18:12:04 2013 (r254605) @@ -191,6 +191,7 @@ struct mbuf { #define M_PROMISC 0x00000040 /* packet was not for us */ #define M_VLANTAG 0x00000080 /* ether_vtag is valid */ #define M_FLOWID 0x00000100 /* deprecated: flowid is valid */ +#define M_NOFREE 0x00000200 /* do not free mbuf, embedded in cluster */ #define M_PROTO1 0x00001000 /* protocol-specific */ #define M_PROTO2 0x00002000 /* protocol-specific */ @@ -526,7 +527,7 @@ m_free(struct mbuf *m) if (m->m_flags & M_EXT) mb_free_ext(m); - else + else if ((m->m_flags & M_NOFREE) == 0) uma_zfree(zone_mbuf, m); return (n); } From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 18:18:44 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 ESMTP id DCF47D74 for ; Wed, 21 Aug 2013 18:18:44 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 058B02F39 for ; Wed, 21 Aug 2013 18:18:43 +0000 (UTC) Received: (qmail 73503 invoked from network); 21 Aug 2013 19:01:46 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 19:01:46 -0000 Message-ID: <5215047C.8080107@freebsd.org> Date: Wed, 21 Aug 2013 20:18:36 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Navdeep Parhar Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> <5214D7E8.1080106@freebsd.org> <5214ED19.40907@FreeBSD.org> In-Reply-To: <5214ED19.40907@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 18:18:44 -0000 On 21.08.2013 18:38, Navdeep Parhar wrote: > On 08/21/13 08:08, Andre Oppermann wrote: >> On 20.08.2013 00:38, Peter Grehan wrote: > >> >>> If there's an alternative to M_NOFREE, I'd be more than happy to use >>> that. >> >> Set up your own (*ext_free) function and omit freeing of the mbuf >> itself. Make >> sure to properly track your mbufs to avoid leaking them. >> > > How is this an alternate to M_NOFREE? Your suggestion indicates that > you may have removed M_NOFREE thinking it did something other than what > it actually did. And this suggestion doesn't even work -- note the > uma_zfree(zone_mbuf, m) at the end of mb_free_ext that would run after > any custom ext_free. > > To recap: M_NOFREE was the way to tell the mbuf subsystem that the mbuf > does not come from zone_mbuf. Nothing more and nothing less. The mbuf > was in other ways like any other mbuf and could have a pkthdr (or not), > internal storage (or not), external cluster (or not), etc. etc. Mea culpa. You're totally right. I have mixed up my mental model with another working tree I carry along for quite some time. In it (*ext_free) completely replaces mb_free_ext() making it very easy to keep the mbuf. We should move that way hopefully sooner than later, simplifying a couple of things including externally managed refcounts. Sorry for the chaos and not getting it. M_NOFREE is back with r254605. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 18:22:53 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 ESMTP id 9EA2A166; Wed, 21 Aug 2013 18:22:53 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 5FB2F2FB3; Wed, 21 Aug 2013 18:22:53 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id BBC1E12266; Thu, 22 Aug 2013 04:22:51 +1000 (EST) Received: from Peter-Grehans-MacBook-Pro-2.local ([64.245.0.210]) by dommail.onthenet.com.au (MOS 4.2.4-GA) with ESMTP id BOC76732 (AUTH peterg@ptree32.com.au); Thu, 22 Aug 2013 04:22:50 +1000 Message-ID: <52150578.6040906@freebsd.org> Date: Wed, 21 Aug 2013 11:22:48 -0700 From: Peter Grehan User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r254605 - in head/sys: kern sys References: <201308211812.r7LIC4xv000900@svn.freebsd.org> In-Reply-To: <201308211812.r7LIC4xv000900@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 18:22:53 -0000 > Log: > Revert r254520 and resurrect the M_NOFREE mbuf flag and functionality. > > Requested by: np, grehan Thanks Andre. later, Peter. From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 18:23: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 ESMTP id 53A3C2A7; Wed, 21 Aug 2013 18:23:35 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pd0-x22c.google.com (mail-pd0-x22c.google.com [IPv6:2607:f8b0:400e:c02::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 168242FBD; Wed, 21 Aug 2013 18:23:35 +0000 (UTC) Received: by mail-pd0-f172.google.com with SMTP id z10so765119pdj.3 for ; Wed, 21 Aug 2013 11:23:34 -0700 (PDT) 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=gd2Oz77EjH0D+tP2saus0g2LAd2FWuMApBPfye8MYaI=; b=pjyUbYujOwsGZXez6LvwRBUjp0YjTtVjvjn5y9xSheZi8WbiXLUMtfMMrizlHoVXNT ehePYcL7jIgW8yL9v3H4jLcjc2gF/yQH78BRsM3aHivXX3zrEvYis1MuM1MF/ZIfPppd 8eTvlIpaL2ZSmpKxc1mq03qqvsj5UsFgQONqRaglI2BiV8kOubf5u8tMUmRq/Y0BcOJ9 5n5NPUvJ3Fze0btNahR5iZZ0xRbv7mLVgXI12c3SWyWebE6/j7SvWOBE4dS2+mIigGzZ iRPDxvagG+C/NFE30SVOAi8CcCu7dbrz2e/xtZmQ1bm4SIGLXPXiHx/x32Z0taMEG+Ti uFXA== X-Received: by 10.68.186.193 with SMTP id fm1mr1052826pbc.163.1377109414700; Wed, 21 Aug 2013 11:23:34 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id bg3sm9742404pbb.44.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 11:23:33 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <521505A3.4020103@FreeBSD.org> Date: Wed, 21 Aug 2013 11:23:31 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130819 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> <5214D7E8.1080106@freebsd.org> <5214ED19.40907@FreeBSD.org> <5215047C.8080107@freebsd.org> In-Reply-To: <5215047C.8080107@freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 18:23:35 -0000 On 08/21/13 11:18, Andre Oppermann wrote: > On 21.08.2013 18:38, Navdeep Parhar wrote: >> On 08/21/13 08:08, Andre Oppermann wrote: >>> On 20.08.2013 00:38, Peter Grehan wrote: >> >>> >>>> If there's an alternative to M_NOFREE, I'd be more than happy to use >>>> that. >>> >>> Set up your own (*ext_free) function and omit freeing of the mbuf >>> itself. Make >>> sure to properly track your mbufs to avoid leaking them. >>> >> >> How is this an alternate to M_NOFREE? Your suggestion indicates that >> you may have removed M_NOFREE thinking it did something other than what >> it actually did. And this suggestion doesn't even work -- note the >> uma_zfree(zone_mbuf, m) at the end of mb_free_ext that would run after >> any custom ext_free. >> >> To recap: M_NOFREE was the way to tell the mbuf subsystem that the mbuf >> does not come from zone_mbuf. Nothing more and nothing less. The mbuf >> was in other ways like any other mbuf and could have a pkthdr (or not), >> internal storage (or not), external cluster (or not), etc. etc. > > Mea culpa. You're totally right. I have mixed up my mental model with > another working tree I carry along for quite some time. In it (*ext_free) > completely replaces mb_free_ext() making it very easy to keep the mbuf. > We should move that way hopefully sooner than later, simplifying a couple > of things including externally managed refcounts. > > Sorry for the chaos and not getting it. > > M_NOFREE is back with r254605. > I saw that, thanks! I believe we need an extra patch to get M_NOFREE correct. I've had it forever in some of my internal repos but never committed it upstream (just plain forgot). Since this stuff is fresh in your mind, can you review this: diff -r cd78031b7885 sys/sys/mbuf.h --- a/sys/sys/mbuf.h Fri Aug 16 13:35:26 2013 -0700 +++ b/sys/sys/mbuf.h Wed Aug 21 10:55:57 2013 -0700 @@ -535,6 +535,8 @@ m_free(struct mbuf *m) { struct mbuf *n = m->m_next; + if ((m->m_flags & (M_PKTHDR|M_NOFREE)) == (M_PKTHDR|M_NOFREE)) + m_tag_delete_chain(m, NULL); if (m->m_flags & M_EXT) mb_free_ext(m); else if ((m->m_flags & M_NOFREE) == 0) It prevents leaks of tags from M_NOFREE+pkthdr mbufs. Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 19:03:16 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 ESMTP id 15078DEF; Wed, 21 Aug 2013 19:03:16 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-la0-x234.google.com (mail-la0-x234.google.com [IPv6:2a00:1450:4010:c03::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F14512289; Wed, 21 Aug 2013 19:03:14 +0000 (UTC) Received: by mail-la0-f52.google.com with SMTP id ev20so656022lab.25 for ; Wed, 21 Aug 2013 12:03:13 -0700 (PDT) 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=RseY/6z+mFIyqCOt2Z5rKNCi+pYkdRkPy++rVrz8d94=; b=hvL3knPzvRGXpk/YL+I2u56OnC41K0Zy0QEeMEo/QjW2j7qbgTx637LqT7yOi0K5hP IvjRpUoKaL1z6U97RuaOetkC2sJZ+xKbbNGX+5FhkRBQnNP0PHbkCc/k4H8H3WhvwVQI WV/8XYV82F78JKkY3BbcpWEYiDWdLaw9PG92eEMXeA8Tehb44Xy/TY3bEXzMAelSM77R sqg0T3Y8EtesPpN7HRXNTEu4ow6dtV8mHjbvR/Pp/vgyWDncpmxKUzh/4eRK2PQnk2Y7 +IG+CCTPKIvxdl3jRaqb9cibQq4kLMxFqWSwiuHRedCDGWu0u0C2TYVG+jtkOdlaA699 Lh3g== X-Received: by 10.152.115.176 with SMTP id jp16mr7167829lab.17.1377111792981; Wed, 21 Aug 2013 12:03:12 -0700 (PDT) Received: from omg ([77.87.117.72]) by mx.google.com with ESMTPSA id qa1sm3677525lbb.1.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 21 Aug 2013 12:03:12 -0700 (PDT) Sender: Sergey Kandaurov Date: Wed, 21 Aug 2013 23:03:10 +0400 From: Sergey Kandaurov To: Andrey Chernov Subject: Re: svn commit: r254600 - head/lib/libutil Message-ID: <20130821190309.GB52908@omg> References: <201308211646.r7LGk6eV051215@svn.freebsd.org> <5214F72B.7070006@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JwB53PgKC5A7+0Ej" Content-Disposition: inline In-Reply-To: <5214F72B.7070006@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 19:03:16 -0000 --JwB53PgKC5A7+0Ej Content-Type: multipart/mixed; boundary="KN5l+BnMqAQyZLvT" Content-Disposition: inline --KN5l+BnMqAQyZLvT Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 21, 2013 at 09:21:47PM +0400, Andrey Chernov wrote: > On 21.08.2013 20:46, Sergey Kandaurov wrote: > > number =3D strtoumax(buf, &endptr, 0); > > =20 > > + if (number =3D=3D UINTMAX_MAX && errno =3D=3D ERANGE) { > > + return (-1); > > + } >=20 > You need to reset errno before strtoumax() call (errno =3D 0), because any > of previous functions may left it as ERANGE. >=20 Thanks for pointing out. Does the patch look good? Index: expand_number.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- expand_number.c (revision 254600) +++ expand_number.c (working copy) @@ -53,6 +53,8 @@ unsigned shift; char *endptr; =20 + errno =3D 0; + number =3D strtoumax(buf, &endptr, 0); =20 if (number =3D=3D UINTMAX_MAX && errno =3D=3D ERANGE) { --KN5l+BnMqAQyZLvT Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="expand_number.diff" Content-Transfer-Encoding: quoted-printable Index: expand_number.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- expand_number.c (revision 254600) +++ expand_number.c (working copy) @@ -53,6 +53,8 @@ unsigned shift; char *endptr; =20 + errno =3D 0; + number =3D strtoumax(buf, &endptr, 0); =20 if (number =3D=3D UINTMAX_MAX && errno =3D=3D ERANGE) { --KN5l+BnMqAQyZLvT-- --JwB53PgKC5A7+0Ej Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBAgAGBQJSFQ7tAAoJED9Ol7oQYHQZzHIIAKD7AtePf4E8EH1Km53AnZMt XPW5WxbmZleWNnLOWs+8+fd9if5zCDaa2//UlwTEO61KpeGJXIW9iGbPNAv79rWt 4zBfM1Q5lbZqaXEwNf+0+pENMTu6D5nhnPb5pEbdXm3nxT4K+ug93xy+dP11a/7A MiCXWerPz1ic3cqaDxjdoQiWfToTf8lQlhy64lEJ5D6W1oJ4r3pUdg7cYP0mUTG9 4WQIbvbP7rv8DAH4j72fIoHjrYFtYYYIsFAMucwbGEiiqsX8y8C27KWeAAw4XrPW 0V1GerfANCN4kcyHQtNa9WQd2cFqJ7LADHO5hfPbqD5YGaIu1pv9H+Uerdf8ia8= =F5Vq -----END PGP SIGNATURE----- --JwB53PgKC5A7+0Ej-- From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 19:22:28 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 ESMTP id 8195F75E for ; Wed, 21 Aug 2013 19:22:28 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0ADF92426 for ; Wed, 21 Aug 2013 19:22:25 +0000 (UTC) Received: (qmail 73931 invoked from network); 21 Aug 2013 20:05:26 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 20:05:26 -0000 Message-ID: <52151368.40803@freebsd.org> Date: Wed, 21 Aug 2013 21:22:16 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Navdeep Parhar Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> <5214D7E8.1080106@freebsd.org> <5214ED19.40907@FreeBSD.org> <5215047C.8080107@freebsd.org> <521505A3.4020103@FreeBSD.org> In-Reply-To: <521505A3.4020103@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 19:22:28 -0000 On 21.08.2013 20:23, Navdeep Parhar wrote: > I believe we need an extra patch to get M_NOFREE correct. I've had it > forever in some of my internal repos but never committed it upstream > (just plain forgot). Since this stuff is fresh in your mind, can you > review this: > > diff -r cd78031b7885 sys/sys/mbuf.h > --- a/sys/sys/mbuf.h Fri Aug 16 13:35:26 2013 -0700 > +++ b/sys/sys/mbuf.h Wed Aug 21 10:55:57 2013 -0700 > @@ -535,6 +535,8 @@ m_free(struct mbuf *m) > { > struct mbuf *n = m->m_next; > > + if ((m->m_flags & (M_PKTHDR|M_NOFREE)) == (M_PKTHDR|M_NOFREE)) > + m_tag_delete_chain(m, NULL); > if (m->m_flags & M_EXT) > mb_free_ext(m); > else if ((m->m_flags & M_NOFREE) == 0) > > It prevents leaks of tags from M_NOFREE+pkthdr mbufs. Good point. Looks correct. But then I wonder if it is really a smart thing to allow single mbufs (w/o M_EXT) to be M_NOFREE at the same time. They easily get lost. If it doesn't have an external buffer attached there is no way to know when and if it was freed. If M_NOFREE is only allowed together with M_EXT then the tag chain delete should happen in mb_ext_free() next to 'skipmbuf' instead. Index: kern/uipc_mbuf.c =================================================================== --- kern/uipc_mbuf.c (revision 254605) +++ kern/uipc_mbuf.c (working copy) @@ -283,11 +283,6 @@ KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", __func__)); KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", __func__)); - /* - * check if the header is embedded in the cluster - */ - skipmbuf = (m->m_flags & M_NOFREE); - /* Free attached storage if this mbuf is the only reference to it. */ if (*(m->m_ext.ref_cnt) == 1 || atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) { @@ -328,8 +323,14 @@ ("%s: unknown ext_type", __func__)); } } - if (skipmbuf) + + /* + * Do not free if the mbuf is embedded in the cluster. + */ + if (m->m_flags & M_NOFREE) { + m_tag_delete_chain(m, NULL); return; + } /* * Free this mbuf back to the mbuf zone with all m_ext -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 19:40: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 ESMTP id DB9B9CF1; Wed, 21 Aug 2013 19:40:14 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pa0-x233.google.com (mail-pa0-x233.google.com [IPv6:2607:f8b0:400e:c03::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9FD972546; Wed, 21 Aug 2013 19:40:14 +0000 (UTC) Received: by mail-pa0-f51.google.com with SMTP id lf1so492040pab.38 for ; Wed, 21 Aug 2013 12:40:14 -0700 (PDT) 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=CjVw3cgCdr2fp3VTtzD1ZZB8eq348a8IS+VEQyTKIQY=; b=ZQWPUarIQbAJiTJe1uM8IyONtNsZgxCvJxVduoiBVSpg45ahbMk2qJkvY51MvybYa0 XyopTXak8pamtbqFk52xJ3vmgb7ia2Sf5t7o6swGClblpdMHLWQ/nQv9+ed6Rqmof+lw ZES0axLdXZtfjU7vaK5/Lgzvds/UhTEx31qqSo40fNMo4caTAtL/teiapnXppeBLrGH7 6dc4UeP/MsT3fQTaZjX5hqOc2oZSsDmGqCF9P/SPoZRZswy2033neCBKF+CI+UIE0Hmm UCc/uiItHx/N+3UhuN4sAL0Kx6Eh+XrNQMA5SGPHCNGNrZJIVER1RteThb/2LowKIiXW aG/g== X-Received: by 10.66.230.233 with SMTP id tb9mr11282537pac.38.1377114014184; Wed, 21 Aug 2013 12:40:14 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id s6sm11850237pan.12.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 12:40:13 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <52151799.3020809@FreeBSD.org> Date: Wed, 21 Aug 2013 12:40:09 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130819 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> <5214D7E8.1080106@freebsd.org> <5214ED19.40907@FreeBSD.org> <5215047C.8080107@freebsd.org> <521505A3.4020103@FreeBSD.org> <52151368.40803@freebsd.org> In-Reply-To: <52151368.40803@freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 19:40:15 -0000 On 08/21/13 12:22, Andre Oppermann wrote: > On 21.08.2013 20:23, Navdeep Parhar wrote: >> I believe we need an extra patch to get M_NOFREE correct. I've had it >> forever in some of my internal repos but never committed it upstream >> (just plain forgot). Since this stuff is fresh in your mind, can you >> review this: >> >> diff -r cd78031b7885 sys/sys/mbuf.h >> --- a/sys/sys/mbuf.h Fri Aug 16 13:35:26 2013 -0700 >> +++ b/sys/sys/mbuf.h Wed Aug 21 10:55:57 2013 -0700 >> @@ -535,6 +535,8 @@ m_free(struct mbuf *m) >> { >> struct mbuf *n = m->m_next; >> >> + if ((m->m_flags & (M_PKTHDR|M_NOFREE)) == (M_PKTHDR|M_NOFREE)) >> + m_tag_delete_chain(m, NULL); >> if (m->m_flags & M_EXT) >> mb_free_ext(m); >> else if ((m->m_flags & M_NOFREE) == 0) >> >> It prevents leaks of tags from M_NOFREE+pkthdr mbufs. > > Good point. Looks correct. > > But then I wonder if it is really a smart thing to allow single > mbufs (w/o M_EXT) to be M_NOFREE at the same time. They easily > get lost. If it doesn't have an external buffer attached there > is no way to know when and if it was freed. > > If M_NOFREE is only allowed together with M_EXT then the tag chain > delete should happen in mb_ext_free() next to 'skipmbuf' instead. > > Index: kern/uipc_mbuf.c > =================================================================== > --- kern/uipc_mbuf.c (revision 254605) > +++ kern/uipc_mbuf.c (working copy) > @@ -283,11 +283,6 @@ > KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", > __func__)); > KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", > __func__)); > > - /* > - * check if the header is embedded in the cluster > - */ > - skipmbuf = (m->m_flags & M_NOFREE); > - > /* Free attached storage if this mbuf is the only reference to > it. */ > if (*(m->m_ext.ref_cnt) == 1 || > atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) { > @@ -328,8 +323,14 @@ > ("%s: unknown ext_type", __func__)); > } > } > - if (skipmbuf) > + > + /* > + * Do not free if the mbuf is embedded in the cluster. > + */ > + if (m->m_flags & M_NOFREE) { > + m_tag_delete_chain(m, NULL); > return; > + } The problem with this is that the mbuf may already be gone if it was embedded in the cluster that was just freed by the ext free. That's why skipmbuf is used to cache the M_NOFREE bit. From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 19:40:44 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 ESMTP id 5D8AADB9; Wed, 21 Aug 2013 19:40:44 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) 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 3B57F257A; Wed, 21 Aug 2013 19:40:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7LJei0s048487; Wed, 21 Aug 2013 19:40:44 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LJehIe048484; Wed, 21 Aug 2013 19:40:43 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201308211940.r7LJehIe048484@svn.freebsd.org> From: "Justin T. Gibbs" Date: Wed, 21 Aug 2013 19:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254608 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 19:40:44 -0000 Author: gibbs Date: Wed Aug 21 19:40:43 2013 New Revision: 254608 URL: http://svnweb.freebsd.org/changeset/base/254608 Log: Add kstat entries for ZFS compression statistics. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c: Add module lifetime functions to allocate and teardown state data. Report: - Compression attempts. - Buffers found to be empty. - Compression calls that are skipped because the data length is already less than or equal to the minimum block length. - Compression attempts that fail to yield a 12.5% compression ratio. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c: Add calls to the zio_compress.c module's init and fini functions. Sponosred by: Spectra Logic Corporation MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Aug 21 19:30:07 2013 (r254607) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Wed Aug 21 19:40:43 2013 (r254608) @@ -1832,6 +1832,7 @@ dmu_init(void) dnode_init(); dbuf_init(); zfetch_init(); + zio_compress_init(); l2arc_init(); arc_init(); } @@ -1842,6 +1843,7 @@ dmu_fini(void) arc_fini(); /* arc depends on l2arc, so arc must go first */ l2arc_fini(); zfetch_fini(); + zio_compress_fini(); dbuf_fini(); dnode_fini(); dmu_objset_fini(); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Wed Aug 21 19:30:07 2013 (r254607) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Wed Aug 21 19:40:43 2013 (r254608) @@ -83,6 +83,12 @@ extern size_t zio_compress_data(enum zio extern int zio_decompress_data(enum zio_compress c, void *src, void *dst, size_t s_len, size_t d_len); +/* + * Module lifetime management. + */ +extern void zio_compress_init(void); +extern void zio_compress_fini(void); + #ifdef __cplusplus } #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Wed Aug 21 19:30:07 2013 (r254607) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Wed Aug 21 19:40:43 2013 (r254608) @@ -33,10 +33,32 @@ #include #include +#include #include #include #include +typedef struct zcomp_stats { + kstat_named_t zcompstat_attempts; + kstat_named_t zcompstat_empty; + kstat_named_t zcompstat_skipped_minblocksize; + kstat_named_t zcompstat_skipped_insufficient_gain; +} zcomp_stats_t; + +static zcomp_stats_t zcomp_stats = { + { "attempts", KSTAT_DATA_UINT64 }, + { "empty", KSTAT_DATA_UINT64 }, + { "skipped_minblocksize", KSTAT_DATA_UINT64 }, + { "skipped_insufficient_gain", KSTAT_DATA_UINT64 } +}; + +#define ZCOMPSTAT_INCR(stat, val) \ + atomic_add_64(&zcomp_stats.stat.value.ui64, (val)); + +#define ZCOMPSTAT_BUMP(stat) ZCOMPSTAT_INCR(stat, 1); + +kstat_t *zcomp_ksp; + /* * Compression vectors. */ @@ -87,6 +109,8 @@ zio_compress_data(enum zio_compress c, v ASSERT((uint_t)c < ZIO_COMPRESS_FUNCTIONS); ASSERT((uint_t)c == ZIO_COMPRESS_EMPTY || ci->ci_compress != NULL); + ZCOMPSTAT_BUMP(zcompstat_attempts); + /* * If the data is all zeroes, we don't even need to allocate * a block for it. We indicate this by returning zero size. @@ -96,21 +120,27 @@ zio_compress_data(enum zio_compress c, v if (*word != 0) break; - if (word == word_end) - return (0); + if (word == word_end) { + ZCOMPSTAT_BUMP(zcompstat_empty); + return (0); + } if (c == ZIO_COMPRESS_EMPTY) return (s_len); /* Compress at least 12.5% */ d_len = P2ALIGN(s_len - (s_len >> 3), minblocksize); - if (d_len == 0) + if (d_len == 0) { + ZCOMPSTAT_BUMP(zcompstat_skipped_minblocksize); return (s_len); + } c_len = ci->ci_compress(src, dst, s_len, d_len, ci->ci_level); - if (c_len > d_len) + if (c_len > d_len) { + ZCOMPSTAT_BUMP(zcompstat_skipped_insufficient_gain); return (s_len); + } /* * Cool. We compressed at least as much as we were hoping to. @@ -139,3 +169,26 @@ zio_decompress_data(enum zio_compress c, return (ci->ci_decompress(src, dst, s_len, d_len, ci->ci_level)); } + +void +zio_compress_init(void) +{ + + zcomp_ksp = kstat_create("zfs", 0, "zcompstats", "misc", + KSTAT_TYPE_NAMED, sizeof (zcomp_stats) / sizeof (kstat_named_t), + KSTAT_FLAG_VIRTUAL); + + if (zcomp_ksp != NULL) { + zcomp_ksp->ks_data = &zcomp_stats; + kstat_install(zcomp_ksp); + } +} + +void +zio_compress_fini(void) +{ + if (zcomp_ksp != NULL) { + kstat_delete(zcomp_ksp); + zcomp_ksp = NULL; + } +} From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 19:41:42 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 ESMTP id 7DF59F58 for ; Wed, 21 Aug 2013 19:41:42 +0000 (UTC) (envelope-from scott4long@yahoo.com) Received: from nm23-vm5.bullet.mail.ne1.yahoo.com (nm23-vm5.bullet.mail.ne1.yahoo.com [98.138.91.245]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3C054258F for ; Wed, 21 Aug 2013 19:41:42 +0000 (UTC) Received: from [98.138.226.179] by nm23.bullet.mail.ne1.yahoo.com with NNFMP; 21 Aug 2013 19:41:34 -0000 Received: from [98.138.84.39] by tm14.bullet.mail.ne1.yahoo.com with NNFMP; 21 Aug 2013 19:41:34 -0000 Received: from [127.0.0.1] by smtp107.mail.ne1.yahoo.com with NNFMP; 21 Aug 2013 19:41:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1377114093; bh=IC+U8ZNZGDdDDlgdE4rtcRWDAd0N/W+ZfDEhv0z9zoQ=; 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=SyWmql0X9IQH9O6YdKYcYx0bptzUs3jFunIo6AgLhTbEtPsmjXn70jahmFETRLQyQ/ZcC0a5sa/LjDbENpjSSYJ6WjZWgzYl9cdjahPh2kynFRtyQ4M4/rejhGV2nWhwZ24tgNMepGtfIMf61VNn6xMDrY/33aGbrTH+GKx9TEI= X-Yahoo-Newman-Id: 978900.93516.bm@smtp107.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: XCKIae4VM1nAQfclg6rerxlHGn94L8CmNs2haylBjpdrdDI g0fjJJc_o3nSQRIKXZ.lzpsE_RFtrgsDPiLtVkOoMh2J5yVd41Hgg0yXWuaN 4gKwZuMrRCQJdvSiWK29sokRpg9GACPeZQKF_tzC07LDMP3q4pRaWjCcs9sS nqd1swOK2hSEgBVkds6G2cq.s2Flv3LwUyO17.7atq.tme7x.dEqdYsf7Mxk FdEx69brbpEK.q0KOePZY6ajG8jUow0X_XY9._LjtjGilU3fcZIqqHMtZlqW upyotTConB9wyjUUuxV.LNna07X7YDN1lDiY3xS8HZA06gNwkjxjwl4SUtGK scR1GQHOnhnIzRNTRsxIb8j7MRPIpNOlk2E_zBkvHKVTnQsBCv9JvNL5FmE5 EuxJ4JfYZ5LFmcVyDR8Kh1jSjdRW8eBag0tAyDalNyfpxOJe8nPP2C1mOUsn HWRQSX8vLuDLP7zNdnDMGEIcHKI8hKx_CPBg_lUhtfB3wKE0KNoHnVyU5ist Ao7ZiBkqeNjRSv6KHxIwv8iO_3HQ3OHxJuiiMXJoJC5B53Cs5XvVU0OWKqDK ECw-- X-Yahoo-SMTP: clhABp.swBB7fs.LwIJpv3jkWgo2NU8- X-Rocket-Received: from [10.2.176.206] (scott4long@69.53.237.66 with ) by smtp107.mail.ne1.yahoo.com with SMTP; 21 Aug 2013 12:41:33 -0700 PDT Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: svn commit: r254520 - in head/sys: kern sys From: Scott Long In-Reply-To: <5214D5E0.9040002@freebsd.org> Date: Wed, 21 Aug 2013 13:41:32 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212870A.50105@freebsd.org> <521291F1.8060500@FreeBSD.org> <5214D5E0.9040002@freebsd.org> To: Andre Oppermann X-Mailer: Apple Mail (2.1508) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 19:41:42 -0000 On Aug 21, 2013, at 8:59 AM, Andre Oppermann wrote: > On 19.08.2013 23:45, Navdeep Parhar wrote: >> On 08/19/13 13:58, Andre Oppermann wrote: >>> On 19.08.2013 19:33, Navdeep Parhar wrote: >>>> On 08/19/13 04:16, Andre Oppermann wrote: >>>>> Author: andre >>>>> Date: Mon Aug 19 11:16:53 2013 >>>>> New Revision: 254520 >>>>> URL: http://svnweb.freebsd.org/changeset/base/254520 >>>>>=20 >>>>> Log: >>>>> Remove the unused M_NOFREE mbuf flag. It didn't have any = in-tree >>>>> users >>>>> for a very long time, if ever. >>>>>=20 >>>>> Should such a functionality ever be needed again the = appropriate and >>>>> much better way to do it is through a custom EXT_SOMETHING >>>>> external mbuf >>>>> type together with a dedicated *ext_free function. >>>>>=20 >>>>> Discussed with: trociny, glebius >>>>>=20 >>>>> Modified: >>>>> head/sys/kern/kern_mbuf.c >>>>> head/sys/kern/uipc_mbuf.c >>>>> head/sys/sys/mbuf.h >>>>>=20 >>>>=20 >>>> Hello Andre, >>>>=20 >>>> Is this just garbage collection or is there some other reason for = this? >>>=20 >>> This is garbage collection and removal of not quite right, rotten, >>> functionality. >>>=20 >>>> I recently tried some experiments to reduce the number of mbuf and >>>> cluster allocations in a 40G NIC driver. M_NOFREE and EXT_EXTREF = proved >>>> very useful and the code changes to the kernel were minimal. See >>>> user/np/cxl_tuning. The experiment was quite successful and I was >>>> planning to bring in most of those changes to HEAD. I was hoping = to get >>>> some runtime mileage on the approach in general before tweaking the >>>> ctors/dtors for jumpbo, jumbo9, jumbo16 to allow for an mbuf+refcnt >>>> within the cluster. But now M_NOFREE has vanished without a = warning... >>>=20 >>> I'm looking through your experimental code and that is some really = good >>> numbers you're achieving there! >>>=20 >>> However a couple things don't feel quite right, hackish even, and = not >>> fit for HEAD. This is a bit the same situation we had with some of = the >>> first 1GigE cards quite a number of years back (mostly ti(4)). = There >>> we ended up with a couple of just good enough hacks to make it fast. >>> Most of the remains I've collected today. >>=20 >> If M_NOFREE and EXT_EXTREF are properly supported in the tree (and = I'm >> arguing that they were, before r254520) then the changes are = perfectly >> legitimate. The only hackish part was that I was getting the cluster >> from the jumbop zone while bypassing its normal refcnt mechanism. = This >> I did so as to use the same zone as m_uiotombuf to keep it "hot" for = all >> consumers (driver + network stack). >=20 > If you insist I'll revert the commit removing M_NOFREE. EXT_EXTREF = isn't > touched yet, but should get better support. >=20 > The hackish part for me is that the driver again manages its own = memory > pool. Windows works that way, NetBSD is moving towards it while = FreeBSD > has and remains at a central network memory pool. The latter (our = current) > way of doing it seems more efficient overall especially on heavily = loaded > networked machines. There may be significant queues building (think = app > blocked having many sockets buffer fill up) up delaying the freeing = and > returning of network memory resources. Together with fragmentation = this > can lead to bad very outcomes. Router applications with many = interfaces > also greatly benefit from central memory pools. >=20 > So I'm really not sure that we should move back in the driver owned = pool > direction with lots of code duplication and copy-pasting (see NetBSD). > Also it is kinda weird to have a kernel based pool for data going down > the stack and another one in each driver for those going up. >=20 > Actually I'm of the opinion that we should stay with the central = memory > pool and fix so that it works just as well for those cases a driver = pool > currently performs better. The central memory pool approach is too slow, unfortunately. There's a reason that other OS's are moving to them. At Netflix we are currently working on some approaches to private memory pools in order to achieve better efficiency, and we're closely watching and anticipating = Navdeep's work. Scott From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 19:59:39 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 ESMTP id 16EB055D; Wed, 21 Aug 2013 19:59:39 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pd0-x231.google.com (mail-pd0-x231.google.com [IPv6:2607:f8b0:400e:c02::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CD8C5268A; Wed, 21 Aug 2013 19:59:38 +0000 (UTC) Received: by mail-pd0-f177.google.com with SMTP id y10so866196pdj.36 for ; Wed, 21 Aug 2013 12:59:37 -0700 (PDT) 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=dUhDtbQj8rYwY6jJnCBEZtJP0sKeIE2zsjljRkj081M=; b=heXS7HxUyTF+l0aeW2FvrXHCfG/cImhEwc+54cldFT1JaEV352FZMrTQoayqnrpzTt A7JbMQTAD4+ihLyvb2TjA2VGx65qwcA8Cg5VCpWmRZq/eWKbiEzbRIYlo+G4qL0pxwXC 2kwpvjOdlu3GHx2WXRdX78QCnwnpKUUCIfrYxXzfi5EoMnrjpweADZyuuTD97suUUxce NiwcgbdXvYuKE4ZkeguGpEnAs+65zW6X4y1Bybu8qUA67hlvXza6Ms2g4tHTci5OjEp4 JuC9cfhStMNjgcz49nkTKXFUJABdbfYAUNdTZzhOrojEqm42wNjH0Efh1NeCIhFfxRIJ +GgA== X-Received: by 10.68.252.194 with SMTP id zu2mr9356621pbc.58.1377115177723; Wed, 21 Aug 2013 12:59:37 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id ys4sm10131543pbb.9.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 12:59:36 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <52151C26.10004@FreeBSD.org> Date: Wed, 21 Aug 2013 12:59:34 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130819 Thunderbird/17.0.8 MIME-Version: 1.0 To: Scott Long Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212870A.50105@freebsd.org> <521291F1.8060500@FreeBSD.org> <5214D5E0.9040002@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 19:59:39 -0000 On 08/21/13 12:41, Scott Long wrote: > > On Aug 21, 2013, at 8:59 AM, Andre Oppermann wrote: > >> On 19.08.2013 23:45, Navdeep Parhar wrote: >>> On 08/19/13 13:58, Andre Oppermann wrote: >>>> On 19.08.2013 19:33, Navdeep Parhar wrote: >>>>> On 08/19/13 04:16, Andre Oppermann wrote: >>>>>> Author: andre >>>>>> Date: Mon Aug 19 11:16:53 2013 >>>>>> New Revision: 254520 >>>>>> URL: http://svnweb.freebsd.org/changeset/base/254520 >>>>>> >>>>>> Log: >>>>>> Remove the unused M_NOFREE mbuf flag. It didn't have any in-tree >>>>>> users >>>>>> for a very long time, if ever. >>>>>> >>>>>> Should such a functionality ever be needed again the appropriate and >>>>>> much better way to do it is through a custom EXT_SOMETHING >>>>>> external mbuf >>>>>> type together with a dedicated *ext_free function. >>>>>> >>>>>> Discussed with: trociny, glebius >>>>>> >>>>>> Modified: >>>>>> head/sys/kern/kern_mbuf.c >>>>>> head/sys/kern/uipc_mbuf.c >>>>>> head/sys/sys/mbuf.h >>>>>> >>>>> >>>>> Hello Andre, >>>>> >>>>> Is this just garbage collection or is there some other reason for this? >>>> >>>> This is garbage collection and removal of not quite right, rotten, >>>> functionality. >>>> >>>>> I recently tried some experiments to reduce the number of mbuf and >>>>> cluster allocations in a 40G NIC driver. M_NOFREE and EXT_EXTREF proved >>>>> very useful and the code changes to the kernel were minimal. See >>>>> user/np/cxl_tuning. The experiment was quite successful and I was >>>>> planning to bring in most of those changes to HEAD. I was hoping to get >>>>> some runtime mileage on the approach in general before tweaking the >>>>> ctors/dtors for jumpbo, jumbo9, jumbo16 to allow for an mbuf+refcnt >>>>> within the cluster. But now M_NOFREE has vanished without a warning... >>>> >>>> I'm looking through your experimental code and that is some really good >>>> numbers you're achieving there! >>>> >>>> However a couple things don't feel quite right, hackish even, and not >>>> fit for HEAD. This is a bit the same situation we had with some of the >>>> first 1GigE cards quite a number of years back (mostly ti(4)). There >>>> we ended up with a couple of just good enough hacks to make it fast. >>>> Most of the remains I've collected today. >>> >>> If M_NOFREE and EXT_EXTREF are properly supported in the tree (and I'm >>> arguing that they were, before r254520) then the changes are perfectly >>> legitimate. The only hackish part was that I was getting the cluster >>> from the jumbop zone while bypassing its normal refcnt mechanism. This >>> I did so as to use the same zone as m_uiotombuf to keep it "hot" for all >>> consumers (driver + network stack). >> >> If you insist I'll revert the commit removing M_NOFREE. EXT_EXTREF isn't >> touched yet, but should get better support. >> >> The hackish part for me is that the driver again manages its own memory >> pool. Windows works that way, NetBSD is moving towards it while FreeBSD >> has and remains at a central network memory pool. The latter (our current) >> way of doing it seems more efficient overall especially on heavily loaded >> networked machines. There may be significant queues building (think app >> blocked having many sockets buffer fill up) up delaying the freeing and >> returning of network memory resources. Together with fragmentation this >> can lead to bad very outcomes. Router applications with many interfaces >> also greatly benefit from central memory pools. >> >> So I'm really not sure that we should move back in the driver owned pool >> direction with lots of code duplication and copy-pasting (see NetBSD). >> Also it is kinda weird to have a kernel based pool for data going down >> the stack and another one in each driver for those going up. >> >> Actually I'm of the opinion that we should stay with the central memory >> pool and fix so that it works just as well for those cases a driver pool >> currently performs better. > > The central memory pool approach is too slow, unfortunately. There's a > reason that other OS's are moving to them. At Netflix we are > currently working on some approaches to private memory pools in order to > achieve better efficiency, and we're closely watching and anticipating Navdeep's > work. I should point out that I went to great lengths to use the jumbop zone in my experiments, and not create my own pool of memory for the rx buffers. The hope was to share cache warmth (sounds very cosy :-) with the likes of m_uiotombuf (which uses jumbop too) etc. So I'm actually in the camp that prefers central pools. I'm just trying out ways to reduce the trips we have to make to the pool(s) involved. Laying down mbufs within clusters, and packing multiple frames per cluster clearly helps. Careful cluster recycling within the NIC seems to work too. Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 20:27: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 ESMTP id 42BE5C1C; Wed, 21 Aug 2013 20:27:31 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0D0BB2870; Wed, 21 Aug 2013 20:27:30 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id E6792358C60; Wed, 21 Aug 2013 22:27:25 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id CD97C28494; Wed, 21 Aug 2013 22:27:25 +0200 (CEST) Date: Wed, 21 Aug 2013 22:27:25 +0200 From: Jilles Tjoelker To: Sergey Kandaurov Subject: Re: svn commit: r254600 - head/lib/libutil Message-ID: <20130821202725.GA4991@stack.nl> References: <201308211646.r7LGk6eV051215@svn.freebsd.org> <5214F72B.7070006@freebsd.org> <20130821190309.GB52908@omg> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130821190309.GB52908@omg> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 20:27:31 -0000 On Wed, Aug 21, 2013 at 11:03:10PM +0400, Sergey Kandaurov wrote: > On Wed, Aug 21, 2013 at 09:21:47PM +0400, Andrey Chernov wrote: > > On 21.08.2013 20:46, Sergey Kandaurov wrote: > > > number = strtoumax(buf, &endptr, 0); > > > > > > + if (number == UINTMAX_MAX && errno == ERANGE) { > > > + return (-1); > > > + } > > You need to reset errno before strtoumax() call (errno = 0), because any > > of previous functions may left it as ERANGE. > Thanks for pointing out. > Does the patch look good? > Index: expand_number.c > =================================================================== > --- expand_number.c (revision 254600) > +++ expand_number.c (working copy) > @@ -53,6 +53,8 @@ > unsigned shift; > char *endptr; > > + errno = 0; > + > number = strtoumax(buf, &endptr, 0); > > if (number == UINTMAX_MAX && errno == ERANGE) { > This may cause the function to set errno=0 if it is successful, which is not allowed for standard library functions from C and POSIX. There may be a problem not only if expand_number() is standardized but also if it is used in the implementation of a standard library function. The best solution is to save and restore errno around this (if [ERANGE] is detected, that is a valid errno value to keep). In an application it is acceptable to set errno=0 without further ado. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 20:39: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 ESMTP id 40CF8190 for ; Wed, 21 Aug 2013 20:39:41 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2E03A2956 for ; Wed, 21 Aug 2013 20:39:39 +0000 (UTC) Received: (qmail 74257 invoked from network); 21 Aug 2013 21:22:41 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 21:22:41 -0000 Message-ID: <52152584.50309@freebsd.org> Date: Wed, 21 Aug 2013 22:39:32 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Navdeep Parhar Subject: Re: svn commit: r254520 - in head/sys: kern sys References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212870A.50105@freebsd.org> <521291F1.8060500@FreeBSD.org> <5214D5E0.9040002@freebsd.org> <52151C26.10004@FreeBSD.org> In-Reply-To: <52151C26.10004@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, Scott Long X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 20:39:41 -0000 On 21.08.2013 21:59, Navdeep Parhar wrote: > On 08/21/13 12:41, Scott Long wrote: >> >> On Aug 21, 2013, at 8:59 AM, Andre Oppermann wrote: >> >>> On 19.08.2013 23:45, Navdeep Parhar wrote: >>>> On 08/19/13 13:58, Andre Oppermann wrote: >>>>> On 19.08.2013 19:33, Navdeep Parhar wrote: >>>>>> On 08/19/13 04:16, Andre Oppermann wrote: >>>>>>> Author: andre >>>>>>> Date: Mon Aug 19 11:16:53 2013 >>>>>>> New Revision: 254520 >>>>>>> URL: http://svnweb.freebsd.org/changeset/base/254520 >>>>>>> >>>>>>> Log: >>>>>>> Remove the unused M_NOFREE mbuf flag. It didn't have any in-tree >>>>>>> users >>>>>>> for a very long time, if ever. >>>>>>> >>>>>>> Should such a functionality ever be needed again the appropriate and >>>>>>> much better way to do it is through a custom EXT_SOMETHING >>>>>>> external mbuf >>>>>>> type together with a dedicated *ext_free function. >>>>>>> >>>>>>> Discussed with: trociny, glebius >>>>>>> >>>>>>> Modified: >>>>>>> head/sys/kern/kern_mbuf.c >>>>>>> head/sys/kern/uipc_mbuf.c >>>>>>> head/sys/sys/mbuf.h >>>>>>> >>>>>> >>>>>> Hello Andre, >>>>>> >>>>>> Is this just garbage collection or is there some other reason for this? >>>>> >>>>> This is garbage collection and removal of not quite right, rotten, >>>>> functionality. >>>>> >>>>>> I recently tried some experiments to reduce the number of mbuf and >>>>>> cluster allocations in a 40G NIC driver. M_NOFREE and EXT_EXTREF proved >>>>>> very useful and the code changes to the kernel were minimal. See >>>>>> user/np/cxl_tuning. The experiment was quite successful and I was >>>>>> planning to bring in most of those changes to HEAD. I was hoping to get >>>>>> some runtime mileage on the approach in general before tweaking the >>>>>> ctors/dtors for jumpbo, jumbo9, jumbo16 to allow for an mbuf+refcnt >>>>>> within the cluster. But now M_NOFREE has vanished without a warning... >>>>> >>>>> I'm looking through your experimental code and that is some really good >>>>> numbers you're achieving there! >>>>> >>>>> However a couple things don't feel quite right, hackish even, and not >>>>> fit for HEAD. This is a bit the same situation we had with some of the >>>>> first 1GigE cards quite a number of years back (mostly ti(4)). There >>>>> we ended up with a couple of just good enough hacks to make it fast. >>>>> Most of the remains I've collected today. >>>> >>>> If M_NOFREE and EXT_EXTREF are properly supported in the tree (and I'm >>>> arguing that they were, before r254520) then the changes are perfectly >>>> legitimate. The only hackish part was that I was getting the cluster >>>> from the jumbop zone while bypassing its normal refcnt mechanism. This >>>> I did so as to use the same zone as m_uiotombuf to keep it "hot" for all >>>> consumers (driver + network stack). >>> >>> If you insist I'll revert the commit removing M_NOFREE. EXT_EXTREF isn't >>> touched yet, but should get better support. >>> >>> The hackish part for me is that the driver again manages its own memory >>> pool. Windows works that way, NetBSD is moving towards it while FreeBSD >>> has and remains at a central network memory pool. The latter (our current) >>> way of doing it seems more efficient overall especially on heavily loaded >>> networked machines. There may be significant queues building (think app >>> blocked having many sockets buffer fill up) up delaying the freeing and >>> returning of network memory resources. Together with fragmentation this >>> can lead to bad very outcomes. Router applications with many interfaces >>> also greatly benefit from central memory pools. >>> >>> So I'm really not sure that we should move back in the driver owned pool >>> direction with lots of code duplication and copy-pasting (see NetBSD). >>> Also it is kinda weird to have a kernel based pool for data going down >>> the stack and another one in each driver for those going up. >>> >>> Actually I'm of the opinion that we should stay with the central memory >>> pool and fix so that it works just as well for those cases a driver pool >>> currently performs better. >> >> The central memory pool approach is too slow, unfortunately. There's a >> reason that other OS's are moving to them. At Netflix we are >> currently working on some approaches to private memory pools in order to >> achieve better efficiency, and we're closely watching and anticipating Navdeep's >> work. > > I should point out that I went to great lengths to use the jumbop zone > in my experiments, and not create my own pool of memory for the rx > buffers. The hope was to share cache warmth (sounds very cosy :-) with > the likes of m_uiotombuf (which uses jumbop too) etc. So I'm actually > in the camp that prefers central pools. I'm just trying out ways to > reduce the trips we have to make to the pool(s) involved. Laying down > mbufs within clusters, and packing multiple frames per cluster clearly > helps. Careful cluster recycling within the NIC seems to work too. What you describe does make a lot of sense. Jumbop is the optimal size for the VM. We should really look at and pushing forward to have a nicer M_NOFREE+M_EXTREF API for 10 and new HEAD going forward. As always it seems to depend on the use case and what is being measured too. Is it single stream performance? Concurrent streams? Both ways or only one way, in or out? Each makes very different use of many parts of the stack and driver leading to different bottlenecks. The Netflix case is a bit special obviously by being heavily send oriented on a great many concurrent connections. Here re-use of mbufs moving down the stack seems limited to non-existent because the clusters stay in the socket send buffer until acknowledged which is many milliseconds later. Only re-use of the mbuf header would be possible. Additionally with the use of sendfile there are no mbuf clusters to be captured anyway. On the way up the Netflix usage seems to be almost ACK only, that is small packets. If the NIC is capable of splatting a number of them into the same jumbop cluster back to back together without wasting a full cluster for each that looks to be quite a win as well. Then one only has to attach the mbuf headers to it and send it up the stack. There used to be some Syskonnect/Marvell GigE chips that were able to take different sized mbufs on their RX rings. One could be configured to splat the packet right into the small data portion of a header mbuf. Larger packets would into normal 2K clusters. Such an approach, if the NIC is capable of doing that, probably would be beneficial as well doing away with all M_EXT handling for small (ack) packets. However for the Netflix case I believe two things may provide additional immediate gains: a) moving the routing and arp tables to rmlocks with de-pointering them at the same time (see my other recent email to net@); b) analyzing and tuning the interaction between LRO, tcp ack compression, and tcp abc to reduce the chance of small TSO chains from getting emitted. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 20:43:51 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 ESMTP id 21AF537B; Wed, 21 Aug 2013 20:43:51 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 0AD4629AA; Wed, 21 Aug 2013 20:43: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 r7LKho2t082709; Wed, 21 Aug 2013 20:43:50 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LKholk082707; Wed, 21 Aug 2013 20:43:50 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308212043.r7LKholk082707@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 21 Aug 2013 20:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254610 - in head/sys: amd64/include i386/include 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 20:43:51 -0000 Author: jkim Date: Wed Aug 21 20:43:50 2013 New Revision: 254610 URL: http://svnweb.freebsd.org/changeset/base/254610 Log: Use consistent style. No functional change. Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Wed Aug 21 20:38:19 2013 (r254609) +++ head/sys/amd64/include/atomic.h Wed Aug 21 20:43:50 2013 (r254610) @@ -183,9 +183,9 @@ atomic_fetchadd_int(volatile u_int *p, u __asm __volatile( " " MPLOCKED " " - " xaddl %0, %1 ; " + " xaddl %0,%1 ; " "# atomic_fetchadd_int" - : "+r" (v), /* 0 (result) */ + : "+r" (v), /* 0 */ "=m" (*p) /* 1 */ : "m" (*p) /* 2 */ : "cc"); @@ -202,9 +202,9 @@ atomic_fetchadd_long(volatile u_long *p, __asm __volatile( " " MPLOCKED " " - " xaddq %0, %1 ; " + " xaddq %0,%1 ; " "# atomic_fetchadd_long" - : "+r" (v), /* 0 (result) */ + : "+r" (v), /* 0 */ "=m" (*p) /* 1 */ : "m" (*p) /* 2 */ : "cc"); @@ -307,7 +307,7 @@ ATOMIC_STORE(long); #ifdef __GNUCLIKE_ASM static __inline u_int -atomic_readandclear_int(volatile u_int *addr) +atomic_readandclear_int(volatile u_int *p) { u_int res; @@ -316,14 +316,14 @@ atomic_readandclear_int(volatile u_int * " xchgl %1,%0 ; " "# atomic_readandclear_int" : "+r" (res), /* 0 */ - "=m" (*addr) /* 1 */ - : "m" (*addr)); + "=m" (*p) /* 1 */ + : "m" (*p)); return (res); } static __inline u_long -atomic_readandclear_long(volatile u_long *addr) +atomic_readandclear_long(volatile u_long *p) { u_long res; @@ -332,16 +332,16 @@ atomic_readandclear_long(volatile u_long " xchgq %1,%0 ; " "# atomic_readandclear_long" : "+r" (res), /* 0 */ - "=m" (*addr) /* 1 */ - : "m" (*addr)); + "=m" (*p) /* 1 */ + : "m" (*p)); return (res); } #else /* !__GNUCLIKE_ASM */ -u_int atomic_readandclear_int(volatile u_int *addr); -u_long atomic_readandclear_long(volatile u_long *addr); +u_int atomic_readandclear_int(volatile u_int *p); +u_long atomic_readandclear_long(volatile u_long *p); #endif /* __GNUCLIKE_ASM */ Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Wed Aug 21 20:38:19 2013 (r254609) +++ head/sys/i386/include/atomic.h Wed Aug 21 20:43:50 2013 (r254610) @@ -272,9 +272,9 @@ atomic_fetchadd_int(volatile u_int *p, u __asm __volatile( " " MPLOCKED " " - " xaddl %0, %1 ; " + " xaddl %0,%1 ; " "# atomic_fetchadd_int" - : "+r" (v), /* 0 (result) */ + : "+r" (v), /* 0 */ "=m" (*p) /* 1 */ : "m" (*p) /* 2 */ : "cc"); @@ -397,7 +397,7 @@ atomic_fetchadd_long(volatile u_long *p, #ifdef __GNUCLIKE_ASM static __inline u_int -atomic_readandclear_int(volatile u_int *addr) +atomic_readandclear_int(volatile u_int *p) { u_int res; @@ -406,14 +406,14 @@ atomic_readandclear_int(volatile u_int * " xchgl %1,%0 ; " "# atomic_readandclear_int" : "+r" (res), /* 0 */ - "=m" (*addr) /* 1 */ - : "m" (*addr)); + "=m" (*p) /* 1 */ + : "m" (*p)); return (res); } static __inline u_long -atomic_readandclear_long(volatile u_long *addr) +atomic_readandclear_long(volatile u_long *p) { u_long res; @@ -422,16 +422,16 @@ atomic_readandclear_long(volatile u_long " xchgl %1,%0 ; " "# atomic_readandclear_long" : "+r" (res), /* 0 */ - "=m" (*addr) /* 1 */ - : "m" (*addr)); + "=m" (*p) /* 1 */ + : "m" (*p)); return (res); } #else /* !__GNUCLIKE_ASM */ -u_int atomic_readandclear_int(volatile u_int *addr); -u_long atomic_readandclear_long(volatile u_long *addr); +u_int atomic_readandclear_int(volatile u_int *p); +u_long atomic_readandclear_long(volatile u_long *p); #endif /* __GNUCLIKE_ASM */ From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 20:44:16 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 ESMTP id F09CC4B7 for ; Wed, 21 Aug 2013 20:44:15 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 19AB329B4 for ; Wed, 21 Aug 2013 20:44:14 +0000 (UTC) Received: (qmail 74287 invoked from network); 21 Aug 2013 21:27:16 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 21:27:16 -0000 Message-ID: <52152697.9070500@freebsd.org> Date: Wed, 21 Aug 2013 22:44:07 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Navdeep Parhar Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> <5214D7E8.1080106@freebsd.org> <5214ED19.40907@FreeBSD.org> <5215047C.8080107@freebsd.org> <521505A3.4020103@FreeBSD.org> <52151368.40803@freebsd.org> <52151799.3020809@FreeBSD.org> In-Reply-To: <52151799.3020809@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 20:44:16 -0000 On 21.08.2013 21:40, Navdeep Parhar wrote: > On 08/21/13 12:22, Andre Oppermann wrote: >> On 21.08.2013 20:23, Navdeep Parhar wrote: >>> I believe we need an extra patch to get M_NOFREE correct. I've had it >>> forever in some of my internal repos but never committed it upstream >>> (just plain forgot). Since this stuff is fresh in your mind, can you >>> review this: >>> >>> diff -r cd78031b7885 sys/sys/mbuf.h >>> --- a/sys/sys/mbuf.h Fri Aug 16 13:35:26 2013 -0700 >>> +++ b/sys/sys/mbuf.h Wed Aug 21 10:55:57 2013 -0700 >>> @@ -535,6 +535,8 @@ m_free(struct mbuf *m) >>> { >>> struct mbuf *n = m->m_next; >>> >>> + if ((m->m_flags & (M_PKTHDR|M_NOFREE)) == (M_PKTHDR|M_NOFREE)) >>> + m_tag_delete_chain(m, NULL); >>> if (m->m_flags & M_EXT) >>> mb_free_ext(m); >>> else if ((m->m_flags & M_NOFREE) == 0) >>> >>> It prevents leaks of tags from M_NOFREE+pkthdr mbufs. >> >> Good point. Looks correct. >> >> But then I wonder if it is really a smart thing to allow single >> mbufs (w/o M_EXT) to be M_NOFREE at the same time. They easily >> get lost. If it doesn't have an external buffer attached there >> is no way to know when and if it was freed. >> >> If M_NOFREE is only allowed together with M_EXT then the tag chain >> delete should happen in mb_ext_free() next to 'skipmbuf' instead. >> >> Index: kern/uipc_mbuf.c >> =================================================================== >> --- kern/uipc_mbuf.c (revision 254605) >> +++ kern/uipc_mbuf.c (working copy) >> @@ -283,11 +283,6 @@ >> KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", >> __func__)); >> KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", >> __func__)); >> >> - /* >> - * check if the header is embedded in the cluster >> - */ >> - skipmbuf = (m->m_flags & M_NOFREE); >> - >> /* Free attached storage if this mbuf is the only reference to >> it. */ >> if (*(m->m_ext.ref_cnt) == 1 || >> atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) { >> @@ -328,8 +323,14 @@ >> ("%s: unknown ext_type", __func__)); >> } >> } >> - if (skipmbuf) >> + >> + /* >> + * Do not free if the mbuf is embedded in the cluster. >> + */ >> + if (m->m_flags & M_NOFREE) { >> + m_tag_delete_chain(m, NULL); >> return; >> + } > > The problem with this is that the mbuf may already be gone if it was > embedded in the cluster that was just freed by the ext free. That's why > skipmbuf is used to cache the M_NOFREE bit. Next try: ;) Index: kern/uipc_mbuf.c =================================================================== --- kern/uipc_mbuf.c (revision 254605) +++ kern/uipc_mbuf.c (working copy) @@ -284,9 +284,12 @@ KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", __func__)); /* - * check if the header is embedded in the cluster + * Do not free if the mbuf is embedded in the cluster + * but make sure to get rid of any tag chains first. */ skipmbuf = (m->m_flags & M_NOFREE); + if (skipmbuf && (m->m_flags & M_PKTHDR)) + m_tag_delete_chain(m, NULL); /* Free attached storage if this mbuf is the only reference to it. */ if (*(m->m_ext.ref_cnt) == 1 || -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 20:49: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 ESMTP id 4E01A5E1; Wed, 21 Aug 2013 20:49:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 3AE8F29FA; Wed, 21 Aug 2013 20:49: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 r7LKnlNQ084631; Wed, 21 Aug 2013 20:49:47 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LKnkNF084614; Wed, 21 Aug 2013 20:49:46 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308212049.r7LKnkNF084614@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 21 Aug 2013 20:49:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254611 - in head/sys: amd64/include i386/include 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 20:49:47 -0000 Author: jkim Date: Wed Aug 21 20:49:46 2013 New Revision: 254611 URL: http://svnweb.freebsd.org/changeset/base/254611 Log: Remove bogus labels. No functional change. Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Wed Aug 21 20:43:50 2013 (r254610) +++ head/sys/amd64/include/atomic.h Wed Aug 21 20:49:46 2013 (r254611) @@ -140,7 +140,6 @@ atomic_cmpset_int(volatile u_int *dst, u " " MPLOCKED " " " cmpxchgl %2,%1 ; " " sete %0 ; " - "1: " "# atomic_cmpset_int" : "=a" (res), /* 0 */ "=m" (*dst) /* 1 */ @@ -161,7 +160,6 @@ atomic_cmpset_long(volatile u_long *dst, " " MPLOCKED " " " cmpxchgq %2,%1 ; " " sete %0 ; " - "1: " "# atomic_cmpset_long" : "=a" (res), /* 0 */ "=m" (*dst) /* 1 */ Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Wed Aug 21 20:43:50 2013 (r254610) +++ head/sys/i386/include/atomic.h Wed Aug 21 20:49:46 2013 (r254611) @@ -248,7 +248,6 @@ atomic_cmpset_int(volatile u_int *dst, u " " MPLOCKED " " " cmpxchgl %2,%1 ; " " sete %0 ; " - "1: " "# atomic_cmpset_int" : "=a" (res), /* 0 */ "=m" (*dst) /* 1 */ From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 20:52: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 ESMTP id E3EE27E1; Wed, 21 Aug 2013 20:52:33 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pb0-x22e.google.com (mail-pb0-x22e.google.com [IPv6:2607:f8b0:400e:c01::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A89792A3D; Wed, 21 Aug 2013 20:52:33 +0000 (UTC) Received: by mail-pb0-f46.google.com with SMTP id rq2so882970pbb.33 for ; Wed, 21 Aug 2013 13:52:33 -0700 (PDT) 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=XTlUvU3ihoRAs7k5IskscWvEb0vFHAY+tOiovy2aEk0=; b=Z6c1bUNg0UZUFYo2yiPdzFwMW5iwc4L39eilGk70UcRDI7f81dpZvKbBJesq5n6iD3 2LNaJi9Os9mCTrSmWSOxMAwHtYLPL++ORUGzcDOczFH4qZ3s5DtT692ZszmKOB6zASrH tYiA2NjUJpNCDvfUXT00qyoDHHoHXp0LM8GrHU3cP6buuACNv3prNa4qk8FoEiWeWuOp iGFTEXRPo8Fz2ttM9TyhK3quImDafiKD+u1500So0e6w3vQTzXftJYm6AXIGlo9SeSYO 9Q9RGWYsv8dOyy4pu4hUmtT0vc3/cCgvwPFEfMEOszxU+g1W776Lup/R/fo/MkwoaWZg A8/g== X-Received: by 10.68.164.1 with SMTP id ym1mr9719597pbb.33.1377118353320; Wed, 21 Aug 2013 13:52:33 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id xs1sm12102307pac.7.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 13:52:32 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <5215288E.6070708@FreeBSD.org> Date: Wed, 21 Aug 2013 13:52:30 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130819 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> <5214D7E8.1080106@freebsd.org> <5214ED19.40907@FreeBSD.org> <5215047C.8080107@freebsd.org> <521505A3.4020103@FreeBSD.org> <52151368.40803@freebsd.org> <52151799.3020809@FreeBSD.org> <52152697.9070500@freebsd.org> In-Reply-To: <52152697.9070500@freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 20:52:34 -0000 On 08/21/13 13:44, Andre Oppermann wrote: > On 21.08.2013 21:40, Navdeep Parhar wrote: >> On 08/21/13 12:22, Andre Oppermann wrote: >>> On 21.08.2013 20:23, Navdeep Parhar wrote: >>>> I believe we need an extra patch to get M_NOFREE correct. I've had it >>>> forever in some of my internal repos but never committed it upstream >>>> (just plain forgot). Since this stuff is fresh in your mind, can you >>>> review this: >>>> >>>> diff -r cd78031b7885 sys/sys/mbuf.h >>>> --- a/sys/sys/mbuf.h Fri Aug 16 13:35:26 2013 -0700 >>>> +++ b/sys/sys/mbuf.h Wed Aug 21 10:55:57 2013 -0700 >>>> @@ -535,6 +535,8 @@ m_free(struct mbuf *m) >>>> { >>>> struct mbuf *n = m->m_next; >>>> >>>> + if ((m->m_flags & (M_PKTHDR|M_NOFREE)) == (M_PKTHDR|M_NOFREE)) >>>> + m_tag_delete_chain(m, NULL); >>>> if (m->m_flags & M_EXT) >>>> mb_free_ext(m); >>>> else if ((m->m_flags & M_NOFREE) == 0) >>>> >>>> It prevents leaks of tags from M_NOFREE+pkthdr mbufs. >>> >>> Good point. Looks correct. >>> >>> But then I wonder if it is really a smart thing to allow single >>> mbufs (w/o M_EXT) to be M_NOFREE at the same time. They easily >>> get lost. If it doesn't have an external buffer attached there >>> is no way to know when and if it was freed. >>> >>> If M_NOFREE is only allowed together with M_EXT then the tag chain >>> delete should happen in mb_ext_free() next to 'skipmbuf' instead. >>> >>> Index: kern/uipc_mbuf.c >>> =================================================================== >>> --- kern/uipc_mbuf.c (revision 254605) >>> +++ kern/uipc_mbuf.c (working copy) >>> @@ -283,11 +283,6 @@ >>> KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", >>> __func__)); >>> KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", >>> __func__)); >>> >>> - /* >>> - * check if the header is embedded in the cluster >>> - */ >>> - skipmbuf = (m->m_flags & M_NOFREE); >>> - >>> /* Free attached storage if this mbuf is the only reference to >>> it. */ >>> if (*(m->m_ext.ref_cnt) == 1 || >>> atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) { >>> @@ -328,8 +323,14 @@ >>> ("%s: unknown ext_type", __func__)); >>> } >>> } >>> - if (skipmbuf) >>> + >>> + /* >>> + * Do not free if the mbuf is embedded in the cluster. >>> + */ >>> + if (m->m_flags & M_NOFREE) { >>> + m_tag_delete_chain(m, NULL); >>> return; >>> + } >> >> The problem with this is that the mbuf may already be gone if it was >> embedded in the cluster that was just freed by the ext free. That's why >> skipmbuf is used to cache the M_NOFREE bit. > > Next try: ;) It is most flexible to let M_NOFREE work without any assumptions attached (must be M_EXT, etc.) So I still prefer my patch to this. If you don't have any strong preferences may I commit that one instead? Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 20:59: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 ESMTP id 2FE0BA17 for ; Wed, 21 Aug 2013 20:59:25 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 45D1D2A99 for ; Wed, 21 Aug 2013 20:59:23 +0000 (UTC) Received: (qmail 74377 invoked from network); 21 Aug 2013 21:42:25 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 21 Aug 2013 21:42:25 -0000 Message-ID: <52152A24.8030109@freebsd.org> Date: Wed, 21 Aug 2013 22:59:16 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Navdeep Parhar Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> <5214D7E8.1080106@freebsd.org> <5214ED19.40907@FreeBSD.org> <5215047C.8080107@freebsd.org> <521505A3.4020103@FreeBSD.org> <52151368.40803@freebsd.org> <52151799.3020809@FreeBSD.org> <52152697.9070500@freebsd.org> <5215288E.6070708@FreeBSD.org> In-Reply-To: <5215288E.6070708@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 20:59:25 -0000 On 21.08.2013 22:52, Navdeep Parhar wrote: > On 08/21/13 13:44, Andre Oppermann wrote: >> On 21.08.2013 21:40, Navdeep Parhar wrote: >>> On 08/21/13 12:22, Andre Oppermann wrote: >>>> On 21.08.2013 20:23, Navdeep Parhar wrote: >>>>> I believe we need an extra patch to get M_NOFREE correct. I've had it >>>>> forever in some of my internal repos but never committed it upstream >>>>> (just plain forgot). Since this stuff is fresh in your mind, can you >>>>> review this: >>>>> >>>>> diff -r cd78031b7885 sys/sys/mbuf.h >>>>> --- a/sys/sys/mbuf.h Fri Aug 16 13:35:26 2013 -0700 >>>>> +++ b/sys/sys/mbuf.h Wed Aug 21 10:55:57 2013 -0700 >>>>> @@ -535,6 +535,8 @@ m_free(struct mbuf *m) >>>>> { >>>>> struct mbuf *n = m->m_next; >>>>> >>>>> + if ((m->m_flags & (M_PKTHDR|M_NOFREE)) == (M_PKTHDR|M_NOFREE)) >>>>> + m_tag_delete_chain(m, NULL); >>>>> if (m->m_flags & M_EXT) >>>>> mb_free_ext(m); >>>>> else if ((m->m_flags & M_NOFREE) == 0) >>>>> >>>>> It prevents leaks of tags from M_NOFREE+pkthdr mbufs. >>>> >>>> Good point. Looks correct. >>>> >>>> But then I wonder if it is really a smart thing to allow single >>>> mbufs (w/o M_EXT) to be M_NOFREE at the same time. They easily >>>> get lost. If it doesn't have an external buffer attached there >>>> is no way to know when and if it was freed. >>>> >>>> If M_NOFREE is only allowed together with M_EXT then the tag chain >>>> delete should happen in mb_ext_free() next to 'skipmbuf' instead. >>>> >>>> Index: kern/uipc_mbuf.c >>>> =================================================================== >>>> --- kern/uipc_mbuf.c (revision 254605) >>>> +++ kern/uipc_mbuf.c (working copy) >>>> @@ -283,11 +283,6 @@ >>>> KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", >>>> __func__)); >>>> KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", >>>> __func__)); >>>> >>>> - /* >>>> - * check if the header is embedded in the cluster >>>> - */ >>>> - skipmbuf = (m->m_flags & M_NOFREE); >>>> - >>>> /* Free attached storage if this mbuf is the only reference to >>>> it. */ >>>> if (*(m->m_ext.ref_cnt) == 1 || >>>> atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) { >>>> @@ -328,8 +323,14 @@ >>>> ("%s: unknown ext_type", __func__)); >>>> } >>>> } >>>> - if (skipmbuf) >>>> + >>>> + /* >>>> + * Do not free if the mbuf is embedded in the cluster. >>>> + */ >>>> + if (m->m_flags & M_NOFREE) { >>>> + m_tag_delete_chain(m, NULL); >>>> return; >>>> + } >>> >>> The problem with this is that the mbuf may already be gone if it was >>> embedded in the cluster that was just freed by the ext free. That's why >>> skipmbuf is used to cache the M_NOFREE bit. >> >> Next try: ;) > > It is most flexible to let M_NOFREE work without any assumptions > attached (must be M_EXT, etc.) So I still prefer my patch to this. If > you don't have any strong preferences may I commit that one instead? I don't mind having your patch. Though I don't see how it possibly can't leak mbufs if they are not M_EXT. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 21:14:17 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 ESMTP id 4FCA1CE1; Wed, 21 Aug 2013 21:14:17 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 3C7B92B7A; Wed, 21 Aug 2013 21:14: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 r7LLEHAl099476; Wed, 21 Aug 2013 21:14:17 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LLEGrW099474; Wed, 21 Aug 2013 21:14:16 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308212114.r7LLEGrW099474@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 21 Aug 2013 21:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254612 - in head/sys: amd64/include i386/include 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 21:14:17 -0000 Author: jkim Date: Wed Aug 21 21:14:16 2013 New Revision: 254612 URL: http://svnweb.freebsd.org/changeset/base/254612 Log: Use '+' modifier for a memory operand that is both an input and an output. It was actually done in r86301 but reverted in r150182 because GCC 3.x was not able to handle it for a memory operand. Apparently, this problem was fixed in GCC 4.1+ and several contrib sources already rely on this feature. Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Wed Aug 21 20:49:46 2013 (r254611) +++ head/sys/amd64/include/atomic.h Wed Aug 21 21:14:16 2013 (r254612) @@ -108,8 +108,8 @@ static __inline void \ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ __asm __volatile(MPLOCKED OP \ - : "=m" (*p) \ - : CONS (V), "m" (*p) \ + : "+m" (*p) \ + : CONS (V) \ : "cc"); \ } \ \ @@ -117,8 +117,8 @@ static __inline void \ atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ __asm __volatile(MPLOCKED OP \ - : "=m" (*p) \ - : CONS (V), "m" (*p) \ + : "+m" (*p) \ + : CONS (V) \ : "memory", "cc"); \ } \ struct __hack @@ -142,10 +142,9 @@ atomic_cmpset_int(volatile u_int *dst, u " sete %0 ; " "# atomic_cmpset_int" : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ + "+m" (*dst) /* 1 */ : "r" (src), /* 2 */ - "a" (expect), /* 3 */ - "m" (*dst) /* 4 */ + "a" (expect) /* 3 */ : "memory", "cc"); return (res); @@ -162,10 +161,9 @@ atomic_cmpset_long(volatile u_long *dst, " sete %0 ; " "# atomic_cmpset_long" : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ + "+m" (*dst) /* 1 */ : "r" (src), /* 2 */ - "a" (expect), /* 3 */ - "m" (*dst) /* 4 */ + "a" (expect) /* 3 */ : "memory", "cc"); return (res); @@ -184,9 +182,8 @@ atomic_fetchadd_int(volatile u_int *p, u " xaddl %0,%1 ; " "# atomic_fetchadd_int" : "+r" (v), /* 0 */ - "=m" (*p) /* 1 */ - : "m" (*p) /* 2 */ - : "cc"); + "+m" (*p) /* 1 */ + : : "cc"); return (v); } @@ -203,9 +200,8 @@ atomic_fetchadd_long(volatile u_long *p, " xaddq %0,%1 ; " "# atomic_fetchadd_long" : "+r" (v), /* 0 */ - "=m" (*p) /* 1 */ - : "m" (*p) /* 2 */ - : "cc"); + "+m" (*p) /* 1 */ + : : "cc"); return (v); } @@ -253,9 +249,8 @@ atomic_load_acq_##TYPE(volatile u_##TYPE \ __asm __volatile(MPLOCKED LOP \ : "=a" (res), /* 0 */ \ - "=m" (*p) /* 1 */ \ - : "m" (*p) /* 2 */ \ - : "memory", "cc"); \ + "+m" (*p) /* 1 */ \ + : : "memory", "cc"); \ \ return (res); \ } \ @@ -314,8 +309,7 @@ atomic_readandclear_int(volatile u_int * " xchgl %1,%0 ; " "# atomic_readandclear_int" : "+r" (res), /* 0 */ - "=m" (*p) /* 1 */ - : "m" (*p)); + "+m" (*p)); /* 1 */ return (res); } @@ -330,8 +324,7 @@ atomic_readandclear_long(volatile u_long " xchgq %1,%0 ; " "# atomic_readandclear_long" : "+r" (res), /* 0 */ - "=m" (*p) /* 1 */ - : "m" (*p)); + "+m" (*p)); /* 1 */ return (res); } Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Wed Aug 21 20:49:46 2013 (r254611) +++ head/sys/i386/include/atomic.h Wed Aug 21 21:14:16 2013 (r254612) @@ -106,8 +106,8 @@ static __inline void \ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ __asm __volatile(MPLOCKED OP \ - : "=m" (*p) \ - : CONS (V), "m" (*p) \ + : "+m" (*p) \ + : CONS (V) \ : "cc"); \ } \ \ @@ -115,8 +115,8 @@ static __inline void \ atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ __asm __volatile(MPLOCKED OP \ - : "=m" (*p) \ - : CONS (V), "m" (*p) \ + : "+m" (*p) \ + : CONS (V) \ : "memory", "cc"); \ } \ struct __hack @@ -174,11 +174,10 @@ atomic_load_acq_64_i586(volatile uint64_ " movl %%ebx,%%eax ; " " movl %%ecx,%%edx ; " " " MPLOCKED " " - " cmpxchg8b %2" + " cmpxchg8b %1" : "=&A" (res), /* 0 */ - "=m" (*p) /* 1 */ - : "m" (*p) /* 2 */ - : "memory", "cc"); + "+m" (*p) /* 1 */ + : : "memory", "cc"); return (res); } @@ -192,12 +191,11 @@ atomic_store_rel_64_i586(volatile uint64 " movl %%edx,%%ecx ; " "1: " " " MPLOCKED " " - " cmpxchg8b %2 ; " + " cmpxchg8b %0 ; " " jne 1b" - : "=m" (*p), /* 0 */ + : "+m" (*p), /* 0 */ "+A" (v) /* 1 */ - : "m" (*p) /* 2 */ - : "ebx", "ecx", "memory", "cc"); + : : "ebx", "ecx", "memory", "cc"); } #endif /* _KERNEL && !WANT_FUNCTIONS */ @@ -220,7 +218,7 @@ atomic_cmpset_int(volatile u_int *dst, u __asm __volatile( " pushfl ; " " cli ; " - " cmpl %3,%4 ; " + " cmpl %3,%1 ; " " jne 1f ; " " movl %2,%1 ; " "1: " @@ -228,10 +226,9 @@ atomic_cmpset_int(volatile u_int *dst, u " popfl ; " "# atomic_cmpset_int" : "=q" (res), /* 0 */ - "=m" (*dst) /* 1 */ + "+m" (*dst) /* 1 */ : "r" (src), /* 2 */ - "r" (expect), /* 3 */ - "m" (*dst) /* 4 */ + "r" (expect) /* 3 */ : "memory"); return (res); @@ -250,10 +247,9 @@ atomic_cmpset_int(volatile u_int *dst, u " sete %0 ; " "# atomic_cmpset_int" : "=a" (res), /* 0 */ - "=m" (*dst) /* 1 */ + "+m" (*dst) /* 1 */ : "r" (src), /* 2 */ - "a" (expect), /* 3 */ - "m" (*dst) /* 4 */ + "a" (expect) /* 3 */ : "memory", "cc"); return (res); @@ -274,9 +270,8 @@ atomic_fetchadd_int(volatile u_int *p, u " xaddl %0,%1 ; " "# atomic_fetchadd_int" : "+r" (v), /* 0 */ - "=m" (*p) /* 1 */ - : "m" (*p) /* 2 */ - : "cc"); + "+m" (*p) /* 1 */ + : : "cc"); return (v); } @@ -324,9 +319,8 @@ atomic_load_acq_##TYPE(volatile u_##TYPE \ __asm __volatile(MPLOCKED LOP \ : "=a" (res), /* 0 */ \ - "=m" (*p) /* 1 */ \ - : "m" (*p) /* 2 */ \ - : "memory", "cc"); \ + "+m" (*p) /* 1 */ \ + : : "memory", "cc"); \ \ return (res); \ } \ @@ -405,8 +399,7 @@ atomic_readandclear_int(volatile u_int * " xchgl %1,%0 ; " "# atomic_readandclear_int" : "+r" (res), /* 0 */ - "=m" (*p) /* 1 */ - : "m" (*p)); + "+m" (*p)); /* 1 */ return (res); } @@ -421,8 +414,7 @@ atomic_readandclear_long(volatile u_long " xchgl %1,%0 ; " "# atomic_readandclear_long" : "+r" (res), /* 0 */ - "=m" (*p) /* 1 */ - : "m" (*p)); + "+m" (*p)); /* 1 */ return (res); } From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 21:14: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 ESMTP id C9B13E7C; Wed, 21 Aug 2013 21:14:56 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pa0-x22b.google.com (mail-pa0-x22b.google.com [IPv6:2607:f8b0:400e:c03::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8E5722B87; Wed, 21 Aug 2013 21:14:56 +0000 (UTC) Received: by mail-pa0-f43.google.com with SMTP id hz10so1253456pad.30 for ; Wed, 21 Aug 2013 14:14:56 -0700 (PDT) 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=DWm3Wh0YqbnMctRflqfwf5v/AnalrbJfsfITAs15KEw=; b=w8Zq1Fo/yspy0TXZoMlCC5gedchSSqwHgWa78w+Vec6eVOKnP1Bmxi2EDl+CkF4fPD +0QsOqSm0VrZa0JesqC9/EtHgtATuoMS6AnpESe5+WsOXtMz7nSimHRxTavv1qLn1WuX nIpK6uZ/D18LCa+P/PRwSuKh4LRULBLevZpYxK1YyvaZwcuUdFo0SGd7w6W9Y/wHo058 9B11iEnvNtNbaZOa/kbCpAMIpqJssamCOC76hjhTW/wxaqloNEkr2+TC9rfngKtczNPu NWmxf3yAmNkrDsT4wBUBqEfRn55CDY2NhlvwIsJ3D2xnHz2m2psz7dE3F4G3NYRGyJuI t8Bg== X-Received: by 10.66.254.194 with SMTP id ak2mr1700441pad.167.1377119695573; Wed, 21 Aug 2013 14:14:55 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id oj6sm12169445pab.9.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 14:14:54 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <52152D96.5000308@FreeBSD.org> Date: Wed, 21 Aug 2013 14:13:58 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130819 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: M_NOFREE removal (was Re: svn commit: r254520 - in head/sys: kern sys) References: <201308191116.r7JBGsc6065793@svn.freebsd.org> <521256CE.6070706@FreeBSD.org> <5212587A.2080202@freebsd.org> <52128937.1010407@freebsd.org> <52129E55.30803@freebsd.org> <5214D7E8.1080106@freebsd.org> <5214ED19.40907@FreeBSD.org> <5215047C.8080107@freebsd.org> <521505A3.4020103@FreeBSD.org> <52151368.40803@freebsd.org> <52151799.3020809@FreeBSD.org> <52152697.9070500@freebsd.org> <5215288E.6070708@FreeBSD.org> <52152A24.8030109@freebsd.org> In-Reply-To: <52152A24.8030109@freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, freebsd-net@freebsd.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 21:14:56 -0000 On 08/21/13 13:59, Andre Oppermann wrote: > On 21.08.2013 22:52, Navdeep Parhar wrote: >> It is most flexible to let M_NOFREE work without any assumptions >> attached (must be M_EXT, etc.) So I still prefer my patch to this. If >> you don't have any strong preferences may I commit that one instead? > > I don't mind having your patch. Though I don't see how it possibly > can't leak > mbufs if they are not M_EXT. > Interfaces that are guaranteed to consume and free an mbuf (instead of potentially queueing it somewhere) can be handed M_NOFREE mbufs with inline data, and the caller knows that it is always safe to free the underlying storage after the call. Clearly, caution is required. But let's not completely prohibit use cases like these. Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 21:24: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 ESMTP id 9A3AB5E5; Wed, 21 Aug 2013 21:24:21 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-la0-x22b.google.com (mail-la0-x22b.google.com [IPv6:2a00:1450:4010:c03::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 682F82C4C; Wed, 21 Aug 2013 21:24:20 +0000 (UTC) Received: by mail-la0-f43.google.com with SMTP id ep20so798622lab.30 for ; Wed, 21 Aug 2013 14:24:16 -0700 (PDT) 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=RTF0p2ExA/cub0jEgItXHm1xgns4n1lwfgVw3HtrnG4=; b=W/UUYyLeDmk+chBj8y0BJIiPVS648BgCwB2OWty+oQfzukPa1I5vqKNslUa0rr/PaS awdYkPeFm5YwgvT9Digs2hbMW5SoF0IO74ny0JldSgw2IYp3YBKDmsApXAJSnRLMCuGk RKCrSZKxhdacaGSlEa5j5gdMAz0Ed1GdgQVp3m1yrlRSlckOP58szlYIfLCvESnZOwX0 4HMA+3VfKA+96vmQoTy13DLYGGgRK2UUu3stiV4cYXvsXO1MHKgjvj1Nsm5jE24tOK1O TORL4rLmo4eRf1WcuesUwHFTTr/DLCrgSfFrda406RXVRKxBqtrCl8yvrkaML2upz2bM bZUQ== X-Received: by 10.112.77.134 with SMTP id s6mr2877451lbw.38.1377120256689; Wed, 21 Aug 2013 14:24:16 -0700 (PDT) Received: from omg ([77.87.117.72]) by mx.google.com with ESMTPSA id o1sm3587273lah.8.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 21 Aug 2013 14:24:16 -0700 (PDT) Sender: Sergey Kandaurov Date: Thu, 22 Aug 2013 01:24:13 +0400 From: Sergey Kandaurov To: Jilles Tjoelker Subject: Re: svn commit: r254600 - head/lib/libutil Message-ID: <20130821212413.GC52908@omg> References: <201308211646.r7LGk6eV051215@svn.freebsd.org> <5214F72B.7070006@freebsd.org> <20130821190309.GB52908@omg> <20130821202725.GA4991@stack.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8TaQrIeukR7mmbKf" Content-Disposition: inline In-Reply-To: <20130821202725.GA4991@stack.nl> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 21:24:21 -0000 --8TaQrIeukR7mmbKf Content-Type: multipart/mixed; boundary="Yb+qhiCg54lqZFXW" Content-Disposition: inline --Yb+qhiCg54lqZFXW Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 21, 2013 at 10:27:25PM +0200, Jilles Tjoelker wrote: > On Wed, Aug 21, 2013 at 11:03:10PM +0400, Sergey Kandaurov wrote: > > On Wed, Aug 21, 2013 at 09:21:47PM +0400, Andrey Chernov wrote: > > > On 21.08.2013 20:46, Sergey Kandaurov wrote: > > > > number =3D strtoumax(buf, &endptr, 0); > > > > =20 > > > > + if (number =3D=3D UINTMAX_MAX && errno =3D=3D ERANGE) { > > > > + return (-1); > > > > + } >=20 > > > You need to reset errno before strtoumax() call (errno =3D 0), becaus= e any > > > of previous functions may left it as ERANGE. >=20 > > Thanks for pointing out. > > Does the patch look good? >=20 > > Index: expand_number.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- expand_number.c (revision 254600) > > +++ expand_number.c (working copy) > > @@ -53,6 +53,8 @@ > > unsigned shift; > > char *endptr; > > =20 > > + errno =3D 0; > > + > > number =3D strtoumax(buf, &endptr, 0); > > =20 > > if (number =3D=3D UINTMAX_MAX && errno =3D=3D ERANGE) { > >=20 >=20 > This may cause the function to set errno=3D0 if it is successful, which is > not allowed for standard library functions from C and POSIX. There may > be a problem not only if expand_number() is standardized but also if it > is used in the implementation of a standard library function. The best > solution is to save and restore errno around this (if [ERANGE] is > detected, that is a valid errno value to keep). >=20 > In an application it is acceptable to set errno=3D0 without further ado. >=20 What about this change? It changes errno only if it was modified from zero in strtoumax(). Unconditionally restoring errno after strtoumax() unless ERANGE is probably not good as strtoumax() might set different errno (e.g. EINVAL) and we might want to keep it as well. Please correct me, if I'm wrong. Index: lib/libutil/expand_number.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libutil/expand_number.c (revision 254600) +++ lib/libutil/expand_number.c (working copy) @@ -50,15 +50,22 @@ expand_number(const char *buf, uint64_t *num) { uint64_t number; + int saved_errno; unsigned shift; char *endptr; =20 + saved_errno =3D errno; + errno =3D 0; + number =3D strtoumax(buf, &endptr, 0); =20 if (number =3D=3D UINTMAX_MAX && errno =3D=3D ERANGE) { return (-1); } =20 + if (errno =3D=3D 0) + errno =3D saved_errno; + if (endptr =3D=3D buf) { /* No valid digits. */ errno =3D EINVAL; --Yb+qhiCg54lqZFXW Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="expand_number.2.diff" Content-Transfer-Encoding: quoted-printable Index: lib/libutil/expand_number.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- lib/libutil/expand_number.c (revision 254600) +++ lib/libutil/expand_number.c (working copy) @@ -50,15 +50,22 @@ expand_number(const char *buf, uint64_t *num) { uint64_t number; + int saved_errno; unsigned shift; char *endptr; =20 + saved_errno =3D errno; + errno =3D 0; + number =3D strtoumax(buf, &endptr, 0); =20 if (number =3D=3D UINTMAX_MAX && errno =3D=3D ERANGE) { return (-1); } =20 + if (errno =3D=3D 0) + errno =3D saved_errno; + if (endptr =3D=3D buf) { /* No valid digits. */ errno =3D EINVAL; --Yb+qhiCg54lqZFXW-- --8TaQrIeukR7mmbKf Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBAgAGBQJSFS/9AAoJED9Ol7oQYHQZ0pkIAIYQRN1biQO+lAAir+EFeF0m RmU8Q7LE9G+5AAoAkUN+xJW53blML7aBi7RLlpEHvPrPszPWPaR3KJ/TxUGiX1f4 wrRdPsHdqA0od8yI46EN3LixLjxwxIHlWW/FK2DW6Dp2tZuaYjsal6t8R+9OSlvX HL834c2Yz5U2652AnFsm3sNNIVcFHCPCrue1ygZITE4boCTI0SJaFdRVic2PrxYI z4tEbhavm77ecxomS82hO6wR2OUVAMXaSsKdVtkpdlmHJllssDMADlKBCFRQPJDG vwHIxWeSNoxlNxt5QCWvn9eVx4SSMYT8wOi5XzmrzeXIUKpB6Wx3tHbuULXEnYo= =uKp9 -----END PGP SIGNATURE----- --8TaQrIeukR7mmbKf-- From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 21:30: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 ESMTP id 6017D9DE; Wed, 21 Aug 2013 21:30:07 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 33E762D07; Wed, 21 Aug 2013 21:30: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 r7LLU7IL008360; Wed, 21 Aug 2013 21:30:07 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LLU6X8008358; Wed, 21 Aug 2013 21:30:06 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308212130.r7LLU6X8008358@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 21 Aug 2013 21:30:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254614 - in head/sys: amd64/include i386/include 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 21:30:07 -0000 Author: jkim Date: Wed Aug 21 21:30:06 2013 New Revision: 254614 URL: http://svnweb.freebsd.org/changeset/base/254614 Log: - Remove the "a" constraint from main output operand for atomic_cmpset(). - Use "+" modifier for the "expect" because it is also an output (unused). Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Wed Aug 21 21:20:16 2013 (r254613) +++ head/sys/amd64/include/atomic.h Wed Aug 21 21:30:06 2013 (r254614) @@ -138,13 +138,13 @@ atomic_cmpset_int(volatile u_int *dst, u __asm __volatile( " " MPLOCKED " " - " cmpxchgl %2,%1 ; " + " cmpxchgl %3,%1 ; " " sete %0 ; " "# atomic_cmpset_int" - : "=a" (res), /* 0 */ - "+m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (expect) /* 3 */ + : "=q" (res), /* 0 */ + "+m" (*dst), /* 1 */ + "+a" (expect) /* 2 */ + : "r" (src) /* 3 */ : "memory", "cc"); return (res); @@ -157,13 +157,13 @@ atomic_cmpset_long(volatile u_long *dst, __asm __volatile( " " MPLOCKED " " - " cmpxchgq %2,%1 ; " + " cmpxchgq %3,%1 ; " " sete %0 ; " "# atomic_cmpset_long" - : "=a" (res), /* 0 */ - "+m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (expect) /* 3 */ + : "=q" (res), /* 0 */ + "+m" (*dst), /* 1 */ + "+a" (expect) /* 2 */ + : "r" (src) /* 3 */ : "memory", "cc"); return (res); Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Wed Aug 21 21:20:16 2013 (r254613) +++ head/sys/i386/include/atomic.h Wed Aug 21 21:30:06 2013 (r254614) @@ -243,13 +243,13 @@ atomic_cmpset_int(volatile u_int *dst, u __asm __volatile( " " MPLOCKED " " - " cmpxchgl %2,%1 ; " + " cmpxchgl %3,%1 ; " " sete %0 ; " "# atomic_cmpset_int" - : "=a" (res), /* 0 */ - "+m" (*dst) /* 1 */ - : "r" (src), /* 2 */ - "a" (expect) /* 3 */ + : "=q" (res), /* 0 */ + "+m" (*dst), /* 1 */ + "+a" (expect) /* 2 */ + : "r" (src) /* 3 */ : "memory", "cc"); return (res); From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 21:30:57 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 ESMTP id 56A7AB45; Wed, 21 Aug 2013 21:30:57 +0000 (UTC) (envelope-from ken@FreeBSD.org) 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 2A55F2D3C; Wed, 21 Aug 2013 21:30:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7LLUvpW008992; Wed, 21 Aug 2013 21:30:57 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LLUvO5008991; Wed, 21 Aug 2013 21:30:57 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201308212130.r7LLUvO5008991@svn.freebsd.org> From: "Kenneth D. Merry" Date: Wed, 21 Aug 2013 21:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254615 - head/sys/dev/mps 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 21:30:57 -0000 Author: ken Date: Wed Aug 21 21:30:56 2013 New Revision: 254615 URL: http://svnweb.freebsd.org/changeset/base/254615 Log: Fix mps(4) driver breakage that came in in change 253550 that manifested itself in out of chain frame conditions. When the driver ran out of chain frames, the request in question would get completed early, and go through mpssas_scsiio_complete(). In mpssas_scsiio_complete(), the negation of the CAM status values (CAM_STATUS_MASK | CAM_SIM_QUEUED) was ORed in instead of being ANDed in. This resulted in a bogus CAM CCB status value. This didn't show up in the non-error case, because the status was reset to something valid (e.g. CAM_REQ_CMP) later on in the function. But in the error case, such as when the driver ran out of chain frames, the CAM_REQUEUE_REQ status was ORed in to the bogus status value. This led to the CAM transport layer repeatedly releasing the SIM queue, because it though that the CAM_RELEASE_SIMQ flag had been set. The symptom was messages like this on the console when INVARIANTS were enabled: xpt_release_simq: requested 1 > present 0 xpt_release_simq: requested 1 > present 0 xpt_release_simq: requested 1 > present 0 mps_sas.c: In mpssas_scsiio_complete(), use &= to take status bits out. |= adds them in. In the error case in mpssas_scsiio_complete(), set the status to CAM_REQUEUE_REQ, don't OR it in. MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Wed Aug 21 21:30:06 2013 (r254614) +++ head/sys/dev/mps/mps_sas.c Wed Aug 21 21:30:56 2013 (r254615) @@ -2103,7 +2103,7 @@ mpssas_scsiio_complete(struct mps_softc cm->cm_targ->completed++; cm->cm_targ->outstanding--; TAILQ_REMOVE(&cm->cm_targ->commands, cm, cm_link); - ccb->ccb_h.status |= ~(CAM_STATUS_MASK | CAM_SIM_QUEUED); + ccb->ccb_h.status &= ~(CAM_STATUS_MASK | CAM_SIM_QUEUED); if (cm->cm_state == MPS_CM_STATE_TIMEDOUT) { TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery); @@ -2145,7 +2145,7 @@ mpssas_scsiio_complete(struct mps_softc * because there can be no reply when we haven't actually * gone out to the hardware. */ - ccb->ccb_h.status |= CAM_REQUEUE_REQ; + ccb->ccb_h.status = CAM_REQUEUE_REQ; /* * Currently the only error included in the mask is From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 21:37:58 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 ESMTP id EE618F6D; Wed, 21 Aug 2013 21:37:57 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 99D102E4E; Wed, 21 Aug 2013 21:37:57 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 85697358C60; Wed, 21 Aug 2013 23:37:55 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 6C01028494; Wed, 21 Aug 2013 23:37:55 +0200 (CEST) Date: Wed, 21 Aug 2013 23:37:55 +0200 From: Jilles Tjoelker To: Sergey Kandaurov Subject: Re: svn commit: r254600 - head/lib/libutil Message-ID: <20130821213755.GA8052@stack.nl> References: <201308211646.r7LGk6eV051215@svn.freebsd.org> <5214F72B.7070006@freebsd.org> <20130821190309.GB52908@omg> <20130821202725.GA4991@stack.nl> <20130821212413.GC52908@omg> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130821212413.GC52908@omg> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 21:37:58 -0000 On Thu, Aug 22, 2013 at 01:24:13AM +0400, Sergey Kandaurov wrote: > On Wed, Aug 21, 2013 at 10:27:25PM +0200, Jilles Tjoelker wrote: > > On Wed, Aug 21, 2013 at 11:03:10PM +0400, Sergey Kandaurov wrote: > > > On Wed, Aug 21, 2013 at 09:21:47PM +0400, Andrey Chernov wrote: > > > > On 21.08.2013 20:46, Sergey Kandaurov wrote: > > > > > number = strtoumax(buf, &endptr, 0); > > > > > > > > > > + if (number == UINTMAX_MAX && errno == ERANGE) { > > > > > + return (-1); > > > > > + } > > > > You need to reset errno before strtoumax() call (errno = 0), because any > > > > of previous functions may left it as ERANGE. > > > Thanks for pointing out. > > > Does the patch look good? > > > Index: expand_number.c > > > =================================================================== > > > --- expand_number.c (revision 254600) > > > +++ expand_number.c (working copy) > > > @@ -53,6 +53,8 @@ > > > unsigned shift; > > > char *endptr; > > > > > > + errno = 0; > > > + > > > number = strtoumax(buf, &endptr, 0); > > > > > > if (number == UINTMAX_MAX && errno == ERANGE) { > > This may cause the function to set errno=0 if it is successful, which is > > not allowed for standard library functions from C and POSIX. There may > > be a problem not only if expand_number() is standardized but also if it > > is used in the implementation of a standard library function. The best > > solution is to save and restore errno around this (if [ERANGE] is > > detected, that is a valid errno value to keep). > > In an application it is acceptable to set errno=0 without further ado. > What about this change? > It changes errno only if it was modified from zero in strtoumax(). > Unconditionally restoring errno after strtoumax() unless ERANGE is > probably not good as strtoumax() might set different errno (e.g. EINVAL) > and we might want to keep it as well. Please correct me, if I'm wrong. > Index: lib/libutil/expand_number.c > =================================================================== > --- lib/libutil/expand_number.c (revision 254600) > +++ lib/libutil/expand_number.c (working copy) > @@ -50,15 +50,22 @@ > expand_number(const char *buf, uint64_t *num) > { > uint64_t number; > + int saved_errno; > unsigned shift; > char *endptr; > > + saved_errno = errno; > + errno = 0; > + > number = strtoumax(buf, &endptr, 0); > > if (number == UINTMAX_MAX && errno == ERANGE) { > return (-1); > } > > + if (errno == 0) > + errno = saved_errno; > + > if (endptr == buf) { > /* No valid digits. */ > errno = EINVAL; > This looks good to me. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 21:47:56 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 ESMTP id C1E28415; Wed, 21 Aug 2013 21:47:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) 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 AF2252EE8; Wed, 21 Aug 2013 21:47: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 r7LLluVA016808; Wed, 21 Aug 2013 21:47:56 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LLlu6V016807; Wed, 21 Aug 2013 21:47:56 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201308212147.r7LLlu6V016807@svn.freebsd.org> From: Adrian Chadd Date: Wed, 21 Aug 2013 21:47:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254616 - head/sys/dev/hwpmc 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 21:47:56 -0000 Author: adrian Date: Wed Aug 21 21:47:56 2013 New Revision: 254616 URL: http://svnweb.freebsd.org/changeset/base/254616 Log: Change the name of this particular event to reflect the name used in Linux and Intel examples. Sourced: * https://github.com/andikleen/pmu-tools/blob/master/snb-client.csv * http://software.intel.com/en-us/comment/1747932#comment-1747932 Note: * It's not currently in the Intel SDM; I need to chase down what's going on. Tested: * Sandy Bridge Modified: head/sys/dev/hwpmc/pmc_events.h Modified: head/sys/dev/hwpmc/pmc_events.h ============================================================================== --- head/sys/dev/hwpmc/pmc_events.h Wed Aug 21 21:30:56 2013 (r254615) +++ head/sys/dev/hwpmc/pmc_events.h Wed Aug 21 21:47:56 2013 (r254616) @@ -3304,7 +3304,7 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE IAP_EVENT_D2H_04H) \ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE", \ IAP_EVENT_D2H_08H) \ -__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS", \ +__PMC_EV_ALIAS("MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS", \ IAP_EVENT_D4H_02H) \ __PMC_EV_ALIAS("L2_TRANS.DEMAND_DATA_RD", IAP_EVENT_F0H_01H) \ __PMC_EV_ALIAS("L2_TRANS.RFO", IAP_EVENT_F0H_02H) \ @@ -3538,7 +3538,7 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE IAP_EVENT_D2H_08H) \ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.ALL", \ IAP_EVENT_D2H_0FH) \ -__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS", \ +__PMC_EV_ALIAS("MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS", \ IAP_EVENT_D4H_02H) \ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM", \ IAP_EVENT_D3H_01H) \ From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 21:52: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 ESMTP id C9D4B5BA; Wed, 21 Aug 2013 21:52:10 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vb0-x232.google.com (mail-vb0-x232.google.com [IPv6:2607:f8b0:400c:c02::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 53AB42F35; Wed, 21 Aug 2013 21:52:10 +0000 (UTC) Received: by mail-vb0-f50.google.com with SMTP id x14so739190vbb.9 for ; Wed, 21 Aug 2013 14:52:09 -0700 (PDT) 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=dcnqNaKeEPYGwyjF5XT7efDFPNIvB5Pv1ixVawUekS0=; b=scpDyKMVhdA1YOE+L7e2YJ1yUhTdKwwvdyk2shRfpEO/XbOwC1iaSMCGDUOOuDrwT/ B/DDUz8mSqS64fL/DXTrTC2rddg9WkFb+Sx1od/59mEpukj9rqxhJ61Yi3y/+4c9PoQt eZz0m0SxHtvuzLbyQOx36yDOWem2mg+yOpeDhp89A5oBfCkmV3JFjkcjHcfuoqpwk4iC 7Pl4y+Wx8Hm1E1LO3VAv4DLhut0GfYMysssrRyDm4gOUkVT7Cpfj0CjavueTOPz6V0Qo DHfwUKiIpQyuDQO6h/BrAoVGM7v9CFJnACfNMqFg2KI/Cf1OgPpm9YMXqp7/BQtMJmxN ZMdA== MIME-Version: 1.0 X-Received: by 10.220.76.10 with SMTP id a10mr197679vck.31.1377121929359; Wed, 21 Aug 2013 14:52:09 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.220.65.132 with HTTP; Wed, 21 Aug 2013 14:52:09 -0700 (PDT) In-Reply-To: <201308212147.r7LLlu6V016807@svn.freebsd.org> References: <201308212147.r7LLlu6V016807@svn.freebsd.org> Date: Wed, 21 Aug 2013 14:52:09 -0700 X-Google-Sender-Auth: yTv-ciPlOz_hgPKRudAAgApihvs Message-ID: Subject: Re: svn commit: r254616 - head/sys/dev/hwpmc From: Davide Italiano To: Adrian Chadd 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 21:52:11 -0000 On Wed, Aug 21, 2013 at 2:47 PM, Adrian Chadd wrote: > Author: adrian > Date: Wed Aug 21 21:47:56 2013 > New Revision: 254616 > URL: http://svnweb.freebsd.org/changeset/base/254616 > > Log: > Change the name of this particular event to reflect the name used in > Linux and Intel examples. > > Sourced: > > * https://github.com/andikleen/pmu-tools/blob/master/snb-client.csv > * http://software.intel.com/en-us/comment/1747932#comment-1747932 > > Note: > > * It's not currently in the Intel SDM; I need to chase down what's > going on. > > Tested: > > * Sandy Bridge > > Modified: > head/sys/dev/hwpmc/pmc_events.h > > Modified: head/sys/dev/hwpmc/pmc_events.h > ============================================================================== > --- head/sys/dev/hwpmc/pmc_events.h Wed Aug 21 21:30:56 2013 (r254615) > +++ head/sys/dev/hwpmc/pmc_events.h Wed Aug 21 21:47:56 2013 (r254616) > @@ -3304,7 +3304,7 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE > IAP_EVENT_D2H_04H) \ > __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE", \ > IAP_EVENT_D2H_08H) \ > -__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS", \ > +__PMC_EV_ALIAS("MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS", \ > IAP_EVENT_D4H_02H) \ > __PMC_EV_ALIAS("L2_TRANS.DEMAND_DATA_RD", IAP_EVENT_F0H_01H) \ > __PMC_EV_ALIAS("L2_TRANS.RFO", IAP_EVENT_F0H_02H) \ > @@ -3538,7 +3538,7 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE > IAP_EVENT_D2H_08H) \ > __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.ALL", \ > IAP_EVENT_D2H_0FH) \ > -__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS", \ > +__PMC_EV_ALIAS("MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS", \ > IAP_EVENT_D4H_02H) \ > __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM", \ > IAP_EVENT_D3H_01H) \ Can you update the manpage as well? -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 21:59: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 ESMTP id C4F52879; Wed, 21 Aug 2013 21:59:12 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-ve0-x231.google.com (mail-ve0-x231.google.com [IPv6:2607:f8b0:400c:c01::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8CB2F81; Wed, 21 Aug 2013 21:59:12 +0000 (UTC) Received: by mail-ve0-f177.google.com with SMTP id cz11so871643veb.36 for ; Wed, 21 Aug 2013 14:59:11 -0700 (PDT) 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=qchRlJvo5j6oi0Cyagj5nqRB/tlNCtaQQ6mCkB+lDLY=; b=RYFPxO8M70hEEIAQLDxEbxEVfTMpfk5f17yJY9usI/xKkNda6EvvVci6/e7tjbni7h otFgvcvi84ZpdrrV1XB019koS67AqXNK2SSXR3vQLrxSChIJFYvUdtbYAVAEAX+I1wwr g8Wp10L1LikUmp4rrGjyxkIK5FSRFGzD5GSqZOcUZYTdWAPsJJTHEI+qwIVo2cQ+7n5a ObA4+TJ6cpUgCKxp70ykohFM3/YGBCNOxphC/1lWX+ZAEXitubtDQ7QGqzSr7tfz7b70 0D48gLo4PTrjtTmQSosTMHvQTgCrjEmgamzXAhjYPyiFKa2ycT4abvI8W7/8SZq9qytS KvBQ== MIME-Version: 1.0 X-Received: by 10.220.145.75 with SMTP id c11mr2220501vcv.30.1377122351400; Wed, 21 Aug 2013 14:59:11 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.220.65.132 with HTTP; Wed, 21 Aug 2013 14:59:11 -0700 (PDT) In-Reply-To: References: <201308212147.r7LLlu6V016807@svn.freebsd.org> Date: Wed, 21 Aug 2013 14:59:11 -0700 X-Google-Sender-Auth: q5P3Fr4eeoEQUgfr4KyjYWlh5o8 Message-ID: Subject: Re: svn commit: r254616 - head/sys/dev/hwpmc From: Davide Italiano To: Adrian Chadd 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 21:59:13 -0000 On Wed, Aug 21, 2013 at 2:52 PM, Davide Italiano wrote: > On Wed, Aug 21, 2013 at 2:47 PM, Adrian Chadd wrote: >> Author: adrian >> Date: Wed Aug 21 21:47:56 2013 >> New Revision: 254616 >> URL: http://svnweb.freebsd.org/changeset/base/254616 >> >> Log: >> Change the name of this particular event to reflect the name used in >> Linux and Intel examples. >> >> Sourced: >> >> * https://github.com/andikleen/pmu-tools/blob/master/snb-client.csv >> * http://software.intel.com/en-us/comment/1747932#comment-1747932 >> >> Note: >> >> * It's not currently in the Intel SDM; I need to chase down what's >> going on. >> >> Tested: >> >> * Sandy Bridge >> >> Modified: >> head/sys/dev/hwpmc/pmc_events.h >> >> Modified: head/sys/dev/hwpmc/pmc_events.h >> ============================================================================== >> --- head/sys/dev/hwpmc/pmc_events.h Wed Aug 21 21:30:56 2013 (r254615) >> +++ head/sys/dev/hwpmc/pmc_events.h Wed Aug 21 21:47:56 2013 (r254616) >> @@ -3304,7 +3304,7 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE >> IAP_EVENT_D2H_04H) \ >> __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE", \ >> IAP_EVENT_D2H_08H) \ >> -__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS", \ >> +__PMC_EV_ALIAS("MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS", \ >> IAP_EVENT_D4H_02H) \ >> __PMC_EV_ALIAS("L2_TRANS.DEMAND_DATA_RD", IAP_EVENT_F0H_01H) \ >> __PMC_EV_ALIAS("L2_TRANS.RFO", IAP_EVENT_F0H_02H) \ >> @@ -3538,7 +3538,7 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE >> IAP_EVENT_D2H_08H) \ >> __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.ALL", \ >> IAP_EVENT_D2H_0FH) \ >> -__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS", \ >> +__PMC_EV_ALIAS("MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS", \ >> IAP_EVENT_D4H_02H) \ >> __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM", \ >> IAP_EVENT_D3H_01H) \ > > Can you update the manpage as well? > > -- > Davide > > "There are no solved problems; there are only problems that are more > or less solved" -- Henri Poincare Also for r254476, as already requested by Hiren, because everyone looks at the manpage to understand what metrice the event measures before running pmcstat, so having manpages update when new events are added is almost necessary. Thanks, -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 22:02:42 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 ESMTP id 3CF689DA; Wed, 21 Aug 2013 22:02:42 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com [IPv6:2a00:1450:400c:c05::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3D95F2FC0; Wed, 21 Aug 2013 22:02:41 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id hi8so1024829wib.9 for ; Wed, 21 Aug 2013 15:02:39 -0700 (PDT) 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=M+cbVNOB1/ZFmrquzueSBVeE20/rMYY1HouxmkdEMeQ=; b=yFSDS+HDsXi7K5mjAB/Vtc4Reg62uyKNJRx0HkCY7qDEV6ndXdRoIt9H2aSwvxdoAA E2MGvnqyn8+cW1sy0a5yIQsnqvc3z2P2ACy4fwnAi9hmBc9exjt4MMyHxZHGAikGJV1J WR4oj9NIQEMzSojuJ9YhuZnhLvoHtFWbi+84Y+VJVugjYLwTfCMvRDTuKR5O5W0tdIAY oJ3+vM/RyGDmkjvdbDuUrIpvoivMige5o09Yw4cxRAgL+K3A4geWgtMKtrXHMOAOcFI7 DXcPzKkmQkhEFE8wsTEDIwTZmUg3Td0BKcecpJC46mFj/l97W6RgtusJtY2kNdv7ayDa wt4g== MIME-Version: 1.0 X-Received: by 10.180.211.206 with SMTP id ne14mr7148439wic.30.1377122559348; Wed, 21 Aug 2013 15:02:39 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.217.116.136 with HTTP; Wed, 21 Aug 2013 15:02:39 -0700 (PDT) In-Reply-To: References: <201308212147.r7LLlu6V016807@svn.freebsd.org> Date: Wed, 21 Aug 2013 15:02:39 -0700 X-Google-Sender-Auth: gbnu2QAkSFN4dkZ0pezUrIHJTIQ Message-ID: Subject: Re: svn commit: r254616 - head/sys/dev/hwpmc From: Adrian Chadd To: Davide Italiano Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 22:02:42 -0000 i'll talk with you/hiren/{MANPAGE_PEOPLE} once my current run of "figuring out what the hell" is done. That way the updates can be done in one big hit. Thanks -adrian On 21 August 2013 14:59, Davide Italiano wrote: > On Wed, Aug 21, 2013 at 2:52 PM, Davide Italiano > wrote: > > On Wed, Aug 21, 2013 at 2:47 PM, Adrian Chadd > wrote: > >> Author: adrian > >> Date: Wed Aug 21 21:47:56 2013 > >> New Revision: 254616 > >> URL: http://svnweb.freebsd.org/changeset/base/254616 > >> > >> Log: > >> Change the name of this particular event to reflect the name used in > >> Linux and Intel examples. > >> > >> Sourced: > >> > >> * https://github.com/andikleen/pmu-tools/blob/master/snb-client.csv > >> * http://software.intel.com/en-us/comment/1747932#comment-1747932 > >> > >> Note: > >> > >> * It's not currently in the Intel SDM; I need to chase down what's > >> going on. > >> > >> Tested: > >> > >> * Sandy Bridge > >> > >> Modified: > >> head/sys/dev/hwpmc/pmc_events.h > >> > >> Modified: head/sys/dev/hwpmc/pmc_events.h > >> > ============================================================================== > >> --- head/sys/dev/hwpmc/pmc_events.h Wed Aug 21 21:30:56 2013 > (r254615) > >> +++ head/sys/dev/hwpmc/pmc_events.h Wed Aug 21 21:47:56 2013 > (r254616) > >> @@ -3304,7 +3304,7 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE > >> IAP_EVENT_D2H_04H) > \ > >> __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE", > \ > >> IAP_EVENT_D2H_08H) > \ > >> -__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS", > \ > >> +__PMC_EV_ALIAS("MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS", > \ > >> IAP_EVENT_D4H_02H) > \ > >> __PMC_EV_ALIAS("L2_TRANS.DEMAND_DATA_RD", IAP_EVENT_F0H_01H) > \ > >> __PMC_EV_ALIAS("L2_TRANS.RFO", IAP_EVENT_F0H_02H) > \ > >> @@ -3538,7 +3538,7 @@ __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RE > >> IAP_EVENT_D2H_08H) > \ > >> __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.ALL", > \ > >> IAP_EVENT_D2H_0FH) > \ > >> -__PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_HIT_RETIRED.LLC_MISS", > \ > >> +__PMC_EV_ALIAS("MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS", \ > >> IAP_EVENT_D4H_02H) > \ > >> __PMC_EV_ALIAS("MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM", > \ > >> IAP_EVENT_D3H_01H) > \ > > > > Can you update the manpage as well? > > > > -- > > Davide > > > > "There are no solved problems; there are only problems that are more > > or less solved" -- Henri Poincare > > Also for r254476, as already requested by Hiren, because everyone > looks at the manpage to understand what metrice the event measures > before running pmcstat, so having manpages update when new events are > added is almost necessary. > > Thanks, > > -- > Davide > > "There are no solved problems; there are only problems that are more > or less solved" -- Henri Poincare > From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 22:03:07 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 ESMTP id B09A0B26; Wed, 21 Aug 2013 22:03:07 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 8EC1F2FC6; Wed, 21 Aug 2013 22:03: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 r7LM37Z5025903; Wed, 21 Aug 2013 22:03:07 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LM37kd025900; Wed, 21 Aug 2013 22:03:07 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308212203.r7LM37kd025900@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 21 Aug 2013 22:03:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254617 - in head: share/man/man9 sys/amd64/include sys/i386/include 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 22:03:07 -0000 Author: jkim Date: Wed Aug 21 22:03:06 2013 New Revision: 254617 URL: http://svnweb.freebsd.org/changeset/base/254617 Log: Implement atomic_swap() and atomic_testandset(). Reviewed by: arch, bde, jilles, kib Modified: head/share/man/man9/atomic.9 head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/share/man/man9/atomic.9 ============================================================================== --- head/share/man/man9/atomic.9 Wed Aug 21 21:47:56 2013 (r254616) +++ head/share/man/man9/atomic.9 Wed Aug 21 22:03:06 2013 (r254617) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2005 +.Dd August 20, 2013 .Dt ATOMIC 9 .Os .Sh NAME @@ -62,6 +62,10 @@ .Fn atomic_subtract_[acq_|rel_] "volatile *p" " v" .Ft void .Fn atomic_store_rel_ "volatile *p" " v" +.Ft +.Fn atomic_swap_ "volatile *p" " v" +.Ft int +.Fn atomic_testandset_ "volatile *p" "u_int v" .Sh DESCRIPTION Each of the atomic operations is guaranteed to be atomic in the presence of interrupts. @@ -184,9 +188,9 @@ This section describes the semantics of .Bd -literal -compact if (*dst == old) { *dst = new; - return 1; + return (1); } else - return 0; + return (0); .Ed .El .Pp @@ -203,7 +207,7 @@ and .Bd -literal -compact tmp = *p; *p += v; -return tmp; +return (tmp); .Ed .El .Pp @@ -216,9 +220,9 @@ and .Dq Li 32 and do not have any variants with memory barriers at this time. .Bl -hang -.It Fn atomic_load addr +.It Fn atomic_load p .Bd -literal -compact -return (*addr) +return (*p); .Ed .El .Pp @@ -226,11 +230,11 @@ The .Fn atomic_load functions are only provided with acquire memory barriers. .Bl -hang -.It Fn atomic_readandclear addr +.It Fn atomic_readandclear p .Bd -literal -compact -temp = *addr; -*addr = 0; -return (temp); +tmp = *p; +*p = 0; +return (tmp); .Ed .El .Pp @@ -243,8 +247,7 @@ functions are not implemented for the ty .Dq Li 8 , and .Dq Li 16 -and do -not have any variants with memory barriers at this time. +and do not have any variants with memory barriers at this time. .Bl -hang .It Fn atomic_set p v .Bd -literal -compact @@ -264,6 +267,44 @@ The .Fn atomic_store functions are only provided with release memory barriers. .Pp +.Bl -hang +.It Fn atomic_swap p v +.Bd -literal -compact +tmp = *p; +*p = v; +return (tmp); +.Ed +.El +.Pp +The +.Fn atomic_swap +functions are not implemented for the types +.Dq Li char , +.Dq Li short , +.Dq Li ptr , +.Dq Li 8 , +and +.Dq Li 16 +and do not have any variants with memory barriers at this time. +.Bl -hang +.It Fn atomic_testandset p v +.Bd -literal -compact +bit = 1 << (v % (sizeof(*p) * NBBY)); +tmp = (*p & bit) != 0; +*p |= bit; +return (tmp); +.Ed +.El +.Pp +The +.Fn atomic_testandset +functions are only implemented for the types +.Dq Li int , +.Dq Li long +and +.Dq Li 32 +and do not have any variants with memory barriers at this time. +.Pp The type .Dq Li 64 is currently not implemented for any of the atomic operations on the @@ -275,15 +316,17 @@ architectures. .Sh RETURN VALUES The .Fn atomic_cmpset -function -returns the result of the compare operation. +function returns the result of the compare operation. The .Fn atomic_fetchadd , .Fn atomic_load , +.Fn atomic_readandclear , and -.Fn atomic_readandclear -functions -return the value at the specified address. +.Fn atomic_swap +functions return the value at the specified address. +The +.Fn atomic_testandset +function returns the result of the test operation. .Sh EXAMPLES This example uses the .Fn atomic_cmpset_acq_ptr @@ -354,3 +397,9 @@ The .Fn atomic_fetchadd operations were added in .Fx 6.0 . +The +.Fn atomic_swap +and +.Fn atomic_testandset +operations were added in +.Fx 10.0 . Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Wed Aug 21 21:47:56 2013 (r254616) +++ head/sys/amd64/include/atomic.h Wed Aug 21 22:03:06 2013 (r254617) @@ -54,12 +54,14 @@ * atomic_clear_int(P, V) (*(u_int *)(P) &= ~(V)) * atomic_add_int(P, V) (*(u_int *)(P) += (V)) * atomic_subtract_int(P, V) (*(u_int *)(P) -= (V)) + * atomic_swap_int(P, V) (return (*(u_int *)(P)); *(u_int *)(P) = (V);) * atomic_readandclear_int(P) (return (*(u_int *)(P)); *(u_int *)(P) = 0;) * * atomic_set_long(P, V) (*(u_long *)(P) |= (V)) * atomic_clear_long(P, V) (*(u_long *)(P) &= ~(V)) * atomic_add_long(P, V) (*(u_long *)(P) += (V)) * atomic_subtract_long(P, V) (*(u_long *)(P) -= (V)) + * atomic_swap_long(P, V) (return (*(u_long *)(P)); *(u_long *)(P) = (V);) * atomic_readandclear_long(P) (return (*(u_long *)(P)); *(u_long *)(P) = 0;) */ @@ -80,6 +82,8 @@ int atomic_cmpset_int(volatile u_int *ds int atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); u_long atomic_fetchadd_long(volatile u_long *p, u_long v); +int atomic_testandset_int(volatile u_int *p, u_int v); +int atomic_testandset_long(volatile u_long *p, u_int v); #define ATOMIC_LOAD(TYPE, LOP) \ u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p) @@ -205,6 +209,40 @@ atomic_fetchadd_long(volatile u_long *p, return (v); } +static __inline int +atomic_testandset_int(volatile u_int *p, u_int v) +{ + u_char res; + + __asm __volatile( + " " MPLOCKED " " + " btsl %2,%1 ; " + " setc %0 ; " + "# atomic_testandset_int" + : "=q" (res), /* 0 */ + "+m" (*p) /* 1 */ + : "Ir" (v & 0x1f) /* 2 */ + : "cc"); + return (res); +} + +static __inline int +atomic_testandset_long(volatile u_long *p, u_int v) +{ + u_char res; + + __asm __volatile( + " " MPLOCKED " " + " btsq %2,%1 ; " + " setc %0 ; " + "# atomic_testandset_long" + : "=q" (res), /* 0 */ + "+m" (*p) /* 1 */ + : "Jr" ((u_long)(v & 0x3f)) /* 2 */ + : "cc"); + return (res); +} + /* * We assume that a = b will do atomic loads and stores. Due to the * IA32 memory model, a simple store guarantees release semantics. @@ -296,43 +334,39 @@ ATOMIC_STORE(long); #ifndef WANT_FUNCTIONS -/* Read the current value and store a zero in the destination. */ +/* Read the current value and store a new value in the destination. */ #ifdef __GNUCLIKE_ASM static __inline u_int -atomic_readandclear_int(volatile u_int *p) +atomic_swap_int(volatile u_int *p, u_int v) { - u_int res; - res = 0; __asm __volatile( " xchgl %1,%0 ; " - "# atomic_readandclear_int" - : "+r" (res), /* 0 */ + "# atomic_swap_int" + : "+r" (v), /* 0 */ "+m" (*p)); /* 1 */ - return (res); + return (v); } static __inline u_long -atomic_readandclear_long(volatile u_long *p) +atomic_swap_long(volatile u_long *p, u_long v) { - u_long res; - res = 0; __asm __volatile( " xchgq %1,%0 ; " - "# atomic_readandclear_long" - : "+r" (res), /* 0 */ + "# atomic_swap_long" + : "+r" (v), /* 0 */ "+m" (*p)); /* 1 */ - return (res); + return (v); } #else /* !__GNUCLIKE_ASM */ -u_int atomic_readandclear_int(volatile u_int *p); -u_long atomic_readandclear_long(volatile u_long *p); +u_int atomic_swap_int(volatile u_int *p, u_int v); +u_long atomic_swap_long(volatile u_long *p, u_long v); #endif /* __GNUCLIKE_ASM */ @@ -376,6 +410,9 @@ u_long atomic_readandclear_long(volatile #define atomic_cmpset_acq_long atomic_cmpset_long #define atomic_cmpset_rel_long atomic_cmpset_long +#define atomic_readandclear_int(p) atomic_swap_int(p, 0) +#define atomic_readandclear_long(p) atomic_swap_long(p, 0) + /* Operations on 8-bit bytes. */ #define atomic_set_8 atomic_set_char #define atomic_set_acq_8 atomic_set_acq_char @@ -426,8 +463,10 @@ u_long atomic_readandclear_long(volatile #define atomic_cmpset_32 atomic_cmpset_int #define atomic_cmpset_acq_32 atomic_cmpset_acq_int #define atomic_cmpset_rel_32 atomic_cmpset_rel_int +#define atomic_swap_32 atomic_swap_int #define atomic_readandclear_32 atomic_readandclear_int #define atomic_fetchadd_32 atomic_fetchadd_int +#define atomic_testandset_32 atomic_testandset_int /* Operations on 64-bit quad words. */ #define atomic_set_64 atomic_set_long @@ -447,7 +486,9 @@ u_long atomic_readandclear_long(volatile #define atomic_cmpset_64 atomic_cmpset_long #define atomic_cmpset_acq_64 atomic_cmpset_acq_long #define atomic_cmpset_rel_64 atomic_cmpset_rel_long +#define atomic_swap_64 atomic_swap_long #define atomic_readandclear_64 atomic_readandclear_long +#define atomic_testandset_64 atomic_testandset_long /* Operations on pointers. */ #define atomic_set_ptr atomic_set_long @@ -467,6 +508,7 @@ u_long atomic_readandclear_long(volatile #define atomic_cmpset_ptr atomic_cmpset_long #define atomic_cmpset_acq_ptr atomic_cmpset_acq_long #define atomic_cmpset_rel_ptr atomic_cmpset_rel_long +#define atomic_swap_ptr atomic_swap_long #define atomic_readandclear_ptr atomic_readandclear_long #endif /* !WANT_FUNCTIONS */ Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Wed Aug 21 21:47:56 2013 (r254616) +++ head/sys/i386/include/atomic.h Wed Aug 21 22:03:06 2013 (r254617) @@ -54,12 +54,14 @@ * atomic_clear_int(P, V) (*(u_int *)(P) &= ~(V)) * atomic_add_int(P, V) (*(u_int *)(P) += (V)) * atomic_subtract_int(P, V) (*(u_int *)(P) -= (V)) + * atomic_swap_int(P, V) (return (*(u_int *)(P)); *(u_int *)(P) = (V);) * atomic_readandclear_int(P) (return (*(u_int *)(P)); *(u_int *)(P) = 0;) * * atomic_set_long(P, V) (*(u_long *)(P) |= (V)) * atomic_clear_long(P, V) (*(u_long *)(P) &= ~(V)) * atomic_add_long(P, V) (*(u_long *)(P) += (V)) * atomic_subtract_long(P, V) (*(u_long *)(P) -= (V)) + * atomic_swap_long(P, V) (return (*(u_long *)(P)); *(u_long *)(P) = (V);) * atomic_readandclear_long(P) (return (*(u_long *)(P)); *(u_long *)(P) = 0;) */ @@ -78,6 +80,7 @@ void atomic_##NAME##_barr_##TYPE(volatil int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); +int atomic_testandset_int(volatile u_int *p, u_int v); #define ATOMIC_LOAD(TYPE, LOP) \ u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p) @@ -275,6 +278,23 @@ atomic_fetchadd_int(volatile u_int *p, u return (v); } +static __inline int +atomic_testandset_int(volatile u_int *p, u_int v) +{ + u_char res; + + __asm __volatile( + " " MPLOCKED " " + " btsl %2,%1 ; " + " setc %0 ; " + "# atomic_testandset_int" + : "=q" (res), /* 0 */ + "+m" (*p) /* 1 */ + : "Ir" (v & 0x1f) /* 2 */ + : "cc"); + return (res); +} + /* * We assume that a = b will do atomic loads and stores. Due to the * IA32 memory model, a simple store guarantees release semantics. @@ -386,43 +406,40 @@ atomic_fetchadd_long(volatile u_long *p, return (atomic_fetchadd_int((volatile u_int *)p, (u_int)v)); } -/* Read the current value and store a zero in the destination. */ +static __inline int +atomic_testandset_long(volatile u_long *p, u_int v) +{ + + return (atomic_testandset_int((volatile u_int *)p, v)); +} + +/* Read the current value and store a new value in the destination. */ #ifdef __GNUCLIKE_ASM static __inline u_int -atomic_readandclear_int(volatile u_int *p) +atomic_swap_int(volatile u_int *p, u_int v) { - u_int res; - res = 0; __asm __volatile( " xchgl %1,%0 ; " - "# atomic_readandclear_int" - : "+r" (res), /* 0 */ + "# atomic_swap_int" + : "+r" (v), /* 0 */ "+m" (*p)); /* 1 */ - return (res); + return (v); } static __inline u_long -atomic_readandclear_long(volatile u_long *p) +atomic_swap_long(volatile u_long *p, u_long v) { - u_long res; - res = 0; - __asm __volatile( - " xchgl %1,%0 ; " - "# atomic_readandclear_long" - : "+r" (res), /* 0 */ - "+m" (*p)); /* 1 */ - - return (res); + return (atomic_swap_int((volatile u_int *)p, (u_int)v)); } #else /* !__GNUCLIKE_ASM */ -u_int atomic_readandclear_int(volatile u_int *p); -u_long atomic_readandclear_long(volatile u_long *p); +u_int atomic_swap_int(volatile u_int *p, u_int v); +u_long atomic_swap_long(volatile u_long *p, u_long v); #endif /* __GNUCLIKE_ASM */ @@ -466,6 +483,9 @@ u_long atomic_readandclear_long(volatile #define atomic_cmpset_acq_long atomic_cmpset_long #define atomic_cmpset_rel_long atomic_cmpset_long +#define atomic_readandclear_int(p) atomic_swap_int(p, 0) +#define atomic_readandclear_long(p) atomic_swap_long(p, 0) + /* Operations on 8-bit bytes. */ #define atomic_set_8 atomic_set_char #define atomic_set_acq_8 atomic_set_acq_char @@ -516,8 +536,10 @@ u_long atomic_readandclear_long(volatile #define atomic_cmpset_32 atomic_cmpset_int #define atomic_cmpset_acq_32 atomic_cmpset_acq_int #define atomic_cmpset_rel_32 atomic_cmpset_rel_int +#define atomic_swap_32 atomic_swap_int #define atomic_readandclear_32 atomic_readandclear_int #define atomic_fetchadd_32 atomic_fetchadd_int +#define atomic_testandset_32 atomic_testandset_int /* Operations on pointers. */ #define atomic_set_ptr(p, v) \ @@ -556,6 +578,8 @@ u_long atomic_readandclear_long(volatile #define atomic_cmpset_rel_ptr(dst, old, new) \ atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old), \ (u_int)(new)) +#define atomic_swap_ptr(p, v) \ + atomic_swap_int((volatile u_int *)(p), (u_int)(v)) #define atomic_readandclear_ptr(p) \ atomic_readandclear_int((volatile u_int *)(p)) From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 22:05:59 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 ESMTP id 7398DD40; Wed, 21 Aug 2013 22:05:59 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 4590B2FF3; Wed, 21 Aug 2013 22:05:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7LM5xof026923; Wed, 21 Aug 2013 22:05:59 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LM5wXj026921; Wed, 21 Aug 2013 22:05:58 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308212205.r7LM5wXj026921@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 21 Aug 2013 22:05:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254618 - in head/sys: amd64/include i386/include 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 22:05:59 -0000 Author: jkim Date: Wed Aug 21 22:05:58 2013 New Revision: 254618 URL: http://svnweb.freebsd.org/changeset/base/254618 Log: Remove empty lines before return statements for style consistency. Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Wed Aug 21 22:03:06 2013 (r254617) +++ head/sys/amd64/include/atomic.h Wed Aug 21 22:05:58 2013 (r254618) @@ -150,7 +150,6 @@ atomic_cmpset_int(volatile u_int *dst, u "+a" (expect) /* 2 */ : "r" (src) /* 3 */ : "memory", "cc"); - return (res); } @@ -169,7 +168,6 @@ atomic_cmpset_long(volatile u_long *dst, "+a" (expect) /* 2 */ : "r" (src) /* 3 */ : "memory", "cc"); - return (res); } @@ -289,7 +287,6 @@ atomic_load_acq_##TYPE(volatile u_##TYPE : "=a" (res), /* 0 */ \ "+m" (*p) /* 1 */ \ : : "memory", "cc"); \ - \ return (res); \ } \ struct __hack @@ -346,7 +343,6 @@ atomic_swap_int(volatile u_int *p, u_int "# atomic_swap_int" : "+r" (v), /* 0 */ "+m" (*p)); /* 1 */ - return (v); } @@ -359,7 +355,6 @@ atomic_swap_long(volatile u_long *p, u_l "# atomic_swap_long" : "+r" (v), /* 0 */ "+m" (*p)); /* 1 */ - return (v); } Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Wed Aug 21 22:03:06 2013 (r254617) +++ head/sys/i386/include/atomic.h Wed Aug 21 22:05:58 2013 (r254618) @@ -145,7 +145,6 @@ atomic_load_acq_64_i386(volatile uint64_ : "m" (*low), /* 1 */ "m" (*high) /* 2 */ : "memory"); - return (res); } @@ -181,7 +180,6 @@ atomic_load_acq_64_i586(volatile uint64_ : "=&A" (res), /* 0 */ "+m" (*p) /* 1 */ : : "memory", "cc"); - return (res); } @@ -233,7 +231,6 @@ atomic_cmpset_int(volatile u_int *dst, u : "r" (src), /* 2 */ "r" (expect) /* 3 */ : "memory"); - return (res); } @@ -254,7 +251,6 @@ atomic_cmpset_int(volatile u_int *dst, u "+a" (expect) /* 2 */ : "r" (src) /* 3 */ : "memory", "cc"); - return (res); } @@ -341,7 +337,6 @@ atomic_load_acq_##TYPE(volatile u_##TYPE : "=a" (res), /* 0 */ \ "+m" (*p) /* 1 */ \ : : "memory", "cc"); \ - \ return (res); \ } \ struct __hack @@ -425,7 +420,6 @@ atomic_swap_int(volatile u_int *p, u_int "# atomic_swap_int" : "+r" (v), /* 0 */ "+m" (*p)); /* 1 */ - return (v); } From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 22:27:43 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 ESMTP id 062CA2F1; Wed, 21 Aug 2013 22:27:43 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 E59DE2142; Wed, 21 Aug 2013 22:27:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7LMRgTp038180; Wed, 21 Aug 2013 22:27:42 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LMRg1A038178; Wed, 21 Aug 2013 22:27:42 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308212227.r7LMRg1A038178@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 21 Aug 2013 22:27:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254619 - in head/sys/i386: i386 include 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 22:27:43 -0000 Author: jkim Date: Wed Aug 21 22:27:42 2013 New Revision: 254619 URL: http://svnweb.freebsd.org/changeset/base/254619 Log: Reimplement atomic_load_acq_64() and atomic_store_rel_64() for i386. These functions are now real functions rather than function pointers. Supposedly, it is faster for modern processors. Suggested by: bde Modified: head/sys/i386/i386/machdep.c head/sys/i386/include/atomic.h Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Wed Aug 21 22:05:58 2013 (r254618) +++ head/sys/i386/i386/machdep.c Wed Aug 21 22:27:42 2013 (r254619) @@ -1548,21 +1548,6 @@ idle_sysctl(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, idle_sysctl, "A", "currently selected idle function"); -uint64_t (*atomic_load_acq_64)(volatile uint64_t *) = - atomic_load_acq_64_i386; -void (*atomic_store_rel_64)(volatile uint64_t *, uint64_t) = - atomic_store_rel_64_i386; - -static void -cpu_probe_cmpxchg8b(void) -{ - - if ((cpu_feature & CPUID_CX8) != 0) { - atomic_load_acq_64 = atomic_load_acq_64_i586; - atomic_store_rel_64 = atomic_store_rel_64_i586; - } -} - /* * Reset registers to default values on exec. */ @@ -2824,7 +2809,6 @@ init386(first) thread0.td_pcb->pcb_gsd = PCPU_GET(fsgs_gdt)[1]; cpu_probe_amdc1e(); - cpu_probe_cmpxchg8b(); } #else @@ -3115,7 +3099,6 @@ init386(first) thread0.td_frame = &proc0_tf; cpu_probe_amdc1e(); - cpu_probe_cmpxchg8b(); #ifdef FDT x86_init_fdt(); Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Wed Aug 21 22:05:58 2013 (r254618) +++ head/sys/i386/include/atomic.h Wed Aug 21 22:27:42 2013 (r254619) @@ -32,6 +32,11 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#ifdef _KERNEL +#include +#include +#endif + #define mb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc") #define wmb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc") #define rmb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc") @@ -87,6 +92,9 @@ u_##TYPE atomic_load_acq_##TYPE(volatile #define ATOMIC_STORE(TYPE) \ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +uint64_t atomic_load_acq_64(volatile uint64_t *); +void atomic_store_rel_64(volatile uint64_t *, uint64_t); + #else /* !KLD_MODULE && __GNUCLIKE_ASM */ /* @@ -124,83 +132,6 @@ atomic_##NAME##_barr_##TYPE(volatile u_# } \ struct __hack -#if defined(_KERNEL) && !defined(WANT_FUNCTIONS) - -/* I486 does not support SMP or CMPXCHG8B. */ -static __inline uint64_t -atomic_load_acq_64_i386(volatile uint64_t *p) -{ - volatile uint32_t *high, *low; - uint64_t res; - - low = (volatile uint32_t *)p; - high = (volatile uint32_t *)p + 1; - __asm __volatile( - " pushfl ; " - " cli ; " - " movl %1,%%eax ; " - " movl %2,%%edx ; " - " popfl" - : "=&A" (res) /* 0 */ - : "m" (*low), /* 1 */ - "m" (*high) /* 2 */ - : "memory"); - return (res); -} - -static __inline void -atomic_store_rel_64_i386(volatile uint64_t *p, uint64_t v) -{ - volatile uint32_t *high, *low; - - low = (volatile uint32_t *)p; - high = (volatile uint32_t *)p + 1; - __asm __volatile( - " pushfl ; " - " cli ; " - " movl %%eax,%0 ; " - " movl %%edx,%1 ; " - " popfl" - : "=m" (*low), /* 0 */ - "=m" (*high) /* 1 */ - : "A" (v) /* 2 */ - : "memory"); -} - -static __inline uint64_t -atomic_load_acq_64_i586(volatile uint64_t *p) -{ - uint64_t res; - - __asm __volatile( - " movl %%ebx,%%eax ; " - " movl %%ecx,%%edx ; " - " " MPLOCKED " " - " cmpxchg8b %1" - : "=&A" (res), /* 0 */ - "+m" (*p) /* 1 */ - : : "memory", "cc"); - return (res); -} - -static __inline void -atomic_store_rel_64_i586(volatile uint64_t *p, uint64_t v) -{ - - __asm __volatile( - " movl %%eax,%%ebx ; " - " movl %%edx,%%ecx ; " - "1: " - " " MPLOCKED " " - " cmpxchg8b %0 ; " - " jne 1b" - : "+m" (*p), /* 0 */ - "+A" (v) /* 1 */ - : : "ebx", "ecx", "memory", "cc"); -} - -#endif /* _KERNEL && !WANT_FUNCTIONS */ - /* * Atomic compare and set, used by the mutex functions * @@ -343,6 +274,108 @@ struct __hack #endif /* _KERNEL && !SMP */ +#ifdef _KERNEL + +#ifdef WANT_FUNCTIONS +uint64_t atomic_load_acq_64_i386(volatile uint64_t *); +uint64_t atomic_load_acq_64_i586(volatile uint64_t *); +void atomic_store_rel_64_i386(volatile uint64_t *, uint64_t); +void atomic_store_rel_64_i586(volatile uint64_t *, uint64_t); +#endif + +/* I486 does not support SMP or CMPXCHG8B. */ +static __inline uint64_t +atomic_load_acq_64_i386(volatile uint64_t *p) +{ + volatile uint32_t *q; + uint64_t res; + + q = (volatile uint32_t *)p; + __asm __volatile( + " pushfl ; " + " cli ; " + " movl %1,%%eax ; " + " movl %2,%%edx ; " + " popfl" + : "=&A" (res) /* 0 */ + : "m" (*q), /* 1 */ + "m" (*(q + 1)) /* 2 */ + : "memory"); + return (res); +} + +static __inline void +atomic_store_rel_64_i386(volatile uint64_t *p, uint64_t v) +{ + volatile uint32_t *q; + + q = (volatile uint32_t *)p; + __asm __volatile( + " pushfl ; " + " cli ; " + " movl %%eax,%0 ; " + " movl %%edx,%1 ; " + " popfl" + : "=m" (*q), /* 0 */ + "=m" (*(q + 1)) /* 1 */ + : "A" (v) /* 2 */ + : "memory"); +} + +static __inline uint64_t +atomic_load_acq_64_i586(volatile uint64_t *p) +{ + uint64_t res; + + __asm __volatile( + " movl %%ebx,%%eax ; " + " movl %%ecx,%%edx ; " + " " MPLOCKED " " + " cmpxchg8b %1" + : "=&A" (res), /* 0 */ + "+m" (*p) /* 1 */ + : : "memory", "cc"); + return (res); +} + +static __inline void +atomic_store_rel_64_i586(volatile uint64_t *p, uint64_t v) +{ + + __asm __volatile( + " movl %%eax,%%ebx ; " + " movl %%edx,%%ecx ; " + "1: " + " " MPLOCKED " " + " cmpxchg8b %0 ; " + " jne 1b" + : "+m" (*p), /* 0 */ + "+A" (v) /* 1 */ + : : "ebx", "ecx", "memory", "cc"); +} + +static __inline uint64_t +atomic_load_acq_64(volatile uint64_t *p) +{ + + if ((cpu_feature & CPUID_CX8) == 0) + return (atomic_load_acq_64_i386(p)); + else + return (atomic_load_acq_64_i586(p)); +} + +static __inline void +atomic_store_rel_64(volatile uint64_t *p, uint64_t v) +{ + + if ((cpu_feature & CPUID_CX8) == 0) + atomic_store_rel_64_i386(p, v); + else + atomic_store_rel_64_i586(p, v); +} + +#endif /* _KERNEL */ + #endif /* KLD_MODULE || !__GNUCLIKE_ASM */ ATOMIC_ASM(set, char, "orb %b1,%0", "iq", v); @@ -381,11 +414,6 @@ ATOMIC_STORE(long); #ifndef WANT_FUNCTIONS -#ifdef _KERNEL -extern uint64_t (*atomic_load_acq_64)(volatile uint64_t *); -extern void (*atomic_store_rel_64)(volatile uint64_t *, uint64_t); -#endif - static __inline int atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src) { From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 22:30: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 ESMTP id B6D767AA; Wed, 21 Aug 2013 22:30:11 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 A42A12318; Wed, 21 Aug 2013 22:30: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 r7LMUBi7039084; Wed, 21 Aug 2013 22:30:11 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LMUBxc039083; Wed, 21 Aug 2013 22:30:11 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308212230.r7LMUBxc039083@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 21 Aug 2013 22:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254620 - head/sys/i386/include 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 22:30:11 -0000 Author: jkim Date: Wed Aug 21 22:30:11 2013 New Revision: 254620 URL: http://svnweb.freebsd.org/changeset/base/254620 Log: Implement atomic_cmpset_64() and atomic_swap_64() for i386. Modified: head/sys/i386/include/atomic.h Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Wed Aug 21 22:27:42 2013 (r254619) +++ head/sys/i386/include/atomic.h Wed Aug 21 22:30:11 2013 (r254620) @@ -92,8 +92,10 @@ u_##TYPE atomic_load_acq_##TYPE(volatile #define ATOMIC_STORE(TYPE) \ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v) +int atomic_cmpset_64(volatile uint64_t *, uint64_t, uint64_t); uint64_t atomic_load_acq_64(volatile uint64_t *); void atomic_store_rel_64(volatile uint64_t *, uint64_t); +uint64_t atomic_swap_64(volatile uint64_t *, uint64_t); #else /* !KLD_MODULE && __GNUCLIKE_ASM */ @@ -277,13 +279,46 @@ struct __hack #ifdef _KERNEL #ifdef WANT_FUNCTIONS +int atomic_cmpset_64_i386(volatile uint64_t *, uint64_t, uint64_t); +int atomic_cmpset_64_i586(volatile uint64_t *, uint64_t, uint64_t); uint64_t atomic_load_acq_64_i386(volatile uint64_t *); uint64_t atomic_load_acq_64_i586(volatile uint64_t *); void atomic_store_rel_64_i386(volatile uint64_t *, uint64_t); void atomic_store_rel_64_i586(volatile uint64_t *, uint64_t); +uint64_t atomic_swap_64_i386(volatile uint64_t *, uint64_t); +uint64_t atomic_swap_64_i586(volatile uint64_t *, uint64_t); #endif /* I486 does not support SMP or CMPXCHG8B. */ +static __inline int +atomic_cmpset_64_i386(volatile uint64_t *dst, uint64_t expect, uint64_t src) +{ + volatile uint32_t *p; + u_char res; + + p = (volatile uint32_t *)dst; + __asm __volatile( + " pushfl ; " + " cli ; " + " xorl %1,%%eax ; " + " xorl %2,%%edx ; " + " orl %%edx,%%eax ; " + " jne 1f ; " + " movl %4,%1 ; " + " movl %5,%2 ; " + "1: " + " sete %3 ; " + " popfl" + : "+A" (expect), /* 0 */ + "+m" (*p), /* 1 */ + "+m" (*(p + 1)), /* 2 */ + "=q" (res) /* 3 */ + : "r" ((uint32_t)src), /* 4 */ + "r" ((uint32_t)(src >> 32)) /* 5 */ + : "memory", "cc"); + return (res); +} + static __inline uint64_t atomic_load_acq_64_i386(volatile uint64_t *p) { @@ -323,6 +358,47 @@ atomic_store_rel_64_i386(volatile uint64 } static __inline uint64_t +atomic_swap_64_i386(volatile uint64_t *p, uint64_t v) +{ + volatile uint32_t *q; + uint64_t res; + + q = (volatile uint32_t *)p; + __asm __volatile( + " pushfl ; " + " cli ; " + " movl %1,%%eax ; " + " movl %2,%%edx ; " + " movl %4,%2 ; " + " movl %3,%1 ; " + " popfl" + : "=&A" (res), /* 0 */ + "+m" (*q), /* 1 */ + "+m" (*(q + 1)) /* 2 */ + : "r" ((uint32_t)v), /* 3 */ + "r" ((uint32_t)(v >> 32))); /* 4 */ + return (res); +} + +static __inline int +atomic_cmpset_64_i586(volatile uint64_t *dst, uint64_t expect, uint64_t src) +{ + u_char res; + + __asm __volatile( + " " MPLOCKED " " + " cmpxchg8b %1 ; " + " sete %0" + : "=q" (res), /* 0 */ + "+m" (*dst), /* 1 */ + "+A" (expect) /* 2 */ + : "b" ((uint32_t)src), /* 3 */ + "c" ((uint32_t)(src >> 32)) /* 4 */ + : "memory", "cc"); + return (res); +} + +static __inline uint64_t atomic_load_acq_64_i586(volatile uint64_t *p) { uint64_t res; @@ -355,6 +431,33 @@ atomic_store_rel_64_i586(volatile uint64 } static __inline uint64_t +atomic_swap_64_i586(volatile uint64_t *p, uint64_t v) +{ + + __asm __volatile( + " movl %%eax,%%ebx ; " + " movl %%edx,%%ecx ; " + "1: " + " " MPLOCKED " " + " cmpxchg8b %0 ; " + " jne 1b" + : "+m" (*p), /* 0 */ + "+A" (v) /* 1 */ + : : "ebx", "ecx", "memory", "cc"); + return (v); +} + +static __inline int +atomic_cmpset_64(volatile uint64_t *dst, uint64_t expect, uint64_t src) +{ + + if ((cpu_feature & CPUID_CX8) == 0) + return (atomic_cmpset_64_i386(dst, expect, src)); + else + return (atomic_cmpset_64_i586(dst, expect, src)); +} + +static __inline uint64_t atomic_load_acq_64(volatile uint64_t *p) { @@ -374,6 +477,16 @@ atomic_store_rel_64(volatile uint64_t *p atomic_store_rel_64_i586(p, v); } +static __inline uint64_t +atomic_swap_64(volatile uint64_t *p, uint64_t v) +{ + + if ((cpu_feature & CPUID_CX8) == 0) + return (atomic_swap_64_i386(p, v)); + else + return (atomic_swap_64_i586(p, v)); +} + #endif /* _KERNEL */ #endif /* KLD_MODULE || !__GNUCLIKE_ASM */ From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 22:37: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 ESMTP id 83A8097F; Wed, 21 Aug 2013 22:37:16 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) 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 70AAB237A; Wed, 21 Aug 2013 22:37: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 r7LMbGvo043083; Wed, 21 Aug 2013 22:37:16 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LMbG8W043082; Wed, 21 Aug 2013 22:37:16 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201308212237.r7LMbG8W043082@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 21 Aug 2013 22:37:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254621 - head/lib/libutil 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 22:37:16 -0000 Author: pluknet Date: Wed Aug 21 22:37:15 2013 New Revision: 254621 URL: http://svnweb.freebsd.org/changeset/base/254621 Log: Reset errno before strtoumax() call to properly detect ERANGE. Restore saved errno if strtoumax() call is successful. Reported by: ache Reviewed by: jilles MFC after: 1 week Modified: head/lib/libutil/expand_number.c Modified: head/lib/libutil/expand_number.c ============================================================================== --- head/lib/libutil/expand_number.c Wed Aug 21 22:30:11 2013 (r254620) +++ head/lib/libutil/expand_number.c Wed Aug 21 22:37:15 2013 (r254621) @@ -50,15 +50,22 @@ int expand_number(const char *buf, uint64_t *num) { uint64_t number; + int saved_errno; unsigned shift; char *endptr; + saved_errno = errno; + errno = 0; + number = strtoumax(buf, &endptr, 0); if (number == UINTMAX_MAX && errno == ERANGE) { return (-1); } + if (errno == 0) + errno = saved_errno; + if (endptr == buf) { /* No valid digits. */ errno = EINVAL; From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 22:39: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 ESMTP id 996E5BA1; Wed, 21 Aug 2013 22:39:20 +0000 (UTC) (envelope-from jeff@FreeBSD.org) 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 6C0E2239C; Wed, 21 Aug 2013 22:39:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7LMdKqo043769; Wed, 21 Aug 2013 22:39:20 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LMdK96043768; Wed, 21 Aug 2013 22:39:20 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201308212239.r7LMdK96043768@svn.freebsd.org> From: Jeff Roberson Date: Wed, 21 Aug 2013 22:39:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254622 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 22:39:20 -0000 Author: jeff Date: Wed Aug 21 22:39:19 2013 New Revision: 254622 URL: http://svnweb.freebsd.org/changeset/base/254622 Log: - Eliminate the vm object lock from the active queue scan. It is not necessary since we do not free or cache the page from active anymore. Document the one possible race that is harmless. Sponsored by: EMC / Isilon Storage Division Discussed with: alc Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Wed Aug 21 22:37:15 2013 (r254621) +++ head/sys/vm/vm_pageout.c Wed Aug 21 22:39:19 2013 (r254622) @@ -1333,25 +1333,6 @@ relock_queues: m = next; continue; } - object = m->object; - if (!VM_OBJECT_TRYWLOCK(object) && - !vm_pageout_fallback_object_lock(m, &next)) { - VM_OBJECT_WUNLOCK(object); - vm_page_unlock(m); - m = next; - continue; - } - - /* - * Don't deactivate pages that are busy. - */ - if (vm_page_busied(m) || m->hold_count != 0) { - vm_page_unlock(m); - VM_OBJECT_WUNLOCK(object); - vm_page_requeue_locked(m); - m = next; - continue; - } /* * The count for pagedaemon pages is done after checking the @@ -1367,7 +1348,15 @@ relock_queues: vm_page_aflag_clear(m, PGA_REFERENCED); act_delta += 1; } - if (object->ref_count != 0) + /* + * Unlocked object ref count check. Two races are possible. + * 1) The ref was transitioning to zero and we saw non-zero, + * the pmap bits will be checked unnecessarily. + * 2) The ref was transitioning to one and we saw zero. + * The page lock prevents a new reference to this page so + * we need not check the reference bits. + */ + if (m->object->ref_count != 0) act_delta += pmap_ts_referenced(m); /* @@ -1387,9 +1376,6 @@ relock_queues: * queue depending on usage. */ if (act_delta == 0) { - KASSERT(object->ref_count != 0 || - !pmap_page_is_mapped(m), - ("vm_pageout_scan: page %p is mapped", m)); /* Dequeue to avoid later lock recursion. */ vm_page_dequeue_locked(m); vm_page_deactivate(m); @@ -1397,7 +1383,6 @@ relock_queues: } else vm_page_requeue_locked(m); vm_page_unlock(m); - VM_OBJECT_WUNLOCK(object); m = next; } vm_pagequeue_unlock(pq); From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 22:40:30 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 ESMTP id 5800ADB2; Wed, 21 Aug 2013 22:40:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 44C1823E1; Wed, 21 Aug 2013 22:40: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 r7LMeUvh044125; Wed, 21 Aug 2013 22:40:30 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LMeT19044122; Wed, 21 Aug 2013 22:40:29 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308212240.r7LMeT19044122@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 21 Aug 2013 22:40:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254623 - in head/sys: amd64/include i386/include 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 22:40:30 -0000 Author: jkim Date: Wed Aug 21 22:40:29 2013 New Revision: 254623 URL: http://svnweb.freebsd.org/changeset/base/254623 Log: Reimplement atomic operations on PDEs and PTEs in pmap.h. This change significantly reduces duplicate code and make it easier to read. Reviewed by: alc, bde Modified: head/sys/amd64/include/pmap.h head/sys/i386/include/pmap.h Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Wed Aug 21 22:39:19 2013 (r254622) +++ head/sys/amd64/include/pmap.h Wed Aug 21 22:40:29 2013 (r254623) @@ -206,41 +206,14 @@ extern u_int64_t KPML4phys; /* physical pt_entry_t *vtopte(vm_offset_t); #define vtophys(va) pmap_kextract(((vm_offset_t) (va))) -static __inline pt_entry_t -pte_load(pt_entry_t *ptep) -{ - pt_entry_t r; - - r = *ptep; - return (r); -} - -static __inline pt_entry_t -pte_load_store(pt_entry_t *ptep, pt_entry_t pte) -{ - pt_entry_t r; - - __asm __volatile( - "xchgq %0,%1" - : "=m" (*ptep), - "=r" (r) - : "1" (pte), - "m" (*ptep)); - return (r); -} - -#define pte_load_clear(pte) atomic_readandclear_long(pte) - -static __inline void -pte_store(pt_entry_t *ptep, pt_entry_t pte) -{ +#define pte_load_store(ptep, pte) atomic_swap_long(ptep, pte) +#define pte_load_clear(ptep) atomic_swap_long(ptep, 0) +#define pte_store(ptep, pte) do { \ + *(u_long *)(ptep) = (u_long)(pte); \ +} while (0) +#define pte_clear(ptep) pte_store(ptep, 0) - *ptep = pte; -} - -#define pte_clear(ptep) pte_store((ptep), (pt_entry_t)0ULL) - -#define pde_store(pdep, pde) pte_store((pdep), (pde)) +#define pde_store(pdep, pde) pte_store(pdep, pde) extern pt_entry_t pg_nx; Modified: head/sys/i386/include/pmap.h ============================================================================== --- head/sys/i386/include/pmap.h Wed Aug 21 22:39:19 2013 (r254622) +++ head/sys/i386/include/pmap.h Wed Aug 21 22:40:29 2013 (r254623) @@ -326,98 +326,27 @@ pmap_kextract(vm_offset_t va) #if defined(PAE) && !defined(XEN) -#define pde_cmpset(pdep, old, new) \ - atomic_cmpset_64((pdep), (old), (new)) - -static __inline pt_entry_t -pte_load(pt_entry_t *ptep) -{ - pt_entry_t r; - - __asm __volatile( - "lock; cmpxchg8b %1" - : "=A" (r) - : "m" (*ptep), "a" (0), "d" (0), "b" (0), "c" (0)); - return (r); -} - -static __inline pt_entry_t -pte_load_store(pt_entry_t *ptep, pt_entry_t v) -{ - pt_entry_t r; - - r = *ptep; - __asm __volatile( - "1:\n" - "\tlock; cmpxchg8b %1\n" - "\tjnz 1b" - : "+A" (r) - : "m" (*ptep), "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32))); - return (r); -} - -/* XXXRU move to atomic.h? */ -static __inline int -atomic_cmpset_64(volatile uint64_t *dst, uint64_t exp, uint64_t src) -{ - int64_t res = exp; - - __asm __volatile ( - " lock ; " - " cmpxchg8b %2 ; " - " setz %%al ; " - " movzbl %%al,%0 ; " - "# atomic_cmpset_64" - : "+A" (res), /* 0 (result) */ - "=m" (*dst) /* 1 */ - : "m" (*dst), /* 2 */ - "b" ((uint32_t)src), - "c" ((uint32_t)(src >> 32))); - - return (res); -} - -#define pte_load_clear(ptep) pte_load_store((ptep), (pt_entry_t)0ULL) - -#define pte_store(ptep, pte) pte_load_store((ptep), (pt_entry_t)pte) +#define pde_cmpset(pdep, old, new) atomic_cmpset_64_i586(pdep, old, new) +#define pte_load_store(ptep, pte) atomic_swap_64_i586(ptep, pte) +#define pte_load_clear(ptep) atomic_swap_64_i586(ptep, 0) +#define pte_store(ptep, pte) atomic_store_rel_64_i586(ptep, pte) extern pt_entry_t pg_nx; -#elif !defined(PAE) && !defined (XEN) - -#define pde_cmpset(pdep, old, new) \ - atomic_cmpset_int((pdep), (old), (new)) - -static __inline pt_entry_t -pte_load(pt_entry_t *ptep) -{ - pt_entry_t r; - - r = *ptep; - return (r); -} - -static __inline pt_entry_t -pte_load_store(pt_entry_t *ptep, pt_entry_t pte) -{ - __asm volatile("xchgl %0, %1" : "+m" (*ptep), "+r" (pte)); - return (pte); -} - -#define pte_load_clear(pte) atomic_readandclear_int(pte) - -static __inline void -pte_store(pt_entry_t *ptep, pt_entry_t pte) -{ +#elif !defined(PAE) && !defined(XEN) - *ptep = pte; -} +#define pde_cmpset(pdep, old, new) atomic_cmpset_int(pdep, old, new) +#define pte_load_store(ptep, pte) atomic_swap_int(ptep, pte) +#define pte_load_clear(ptep) atomic_swap_int(ptep, 0) +#define pte_store(ptep, pte) do { \ + *(u_int *)(ptep) = (u_int)(pte); \ +} while (0) #endif /* PAE */ -#define pte_clear(ptep) pte_store((ptep), (pt_entry_t)0ULL) +#define pte_clear(ptep) pte_store(ptep, 0) -#define pde_store(pdep, pde) pte_store((pdep), (pde)) +#define pde_store(pdep, pde) pte_store(pdep, pde) #endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 22:43: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 ESMTP id 9B8D3F31; Wed, 21 Aug 2013 22:43:31 +0000 (UTC) (envelope-from obrien@FreeBSD.org) 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 7833823FF; Wed, 21 Aug 2013 22:43: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 r7LMhV3f046913; Wed, 21 Aug 2013 22:43:31 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LMhUx8046903; Wed, 21 Aug 2013 22:43:30 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201308212243.r7LMhUx8046903@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 21 Aug 2013 22:43:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254624 - in head: . sys/amd64/conf sys/conf sys/i386/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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 22:43:31 -0000 Author: obrien Date: Wed Aug 21 22:43:29 2013 New Revision: 254624 URL: http://svnweb.freebsd.org/changeset/base/254624 Log: The PADLOCK_RNG and RDRAND_RNG kernel options are now devices. Thus "device padlock_rng" and "device rdrand_rng" should be used instead of "options PADLOCK_RNG" & "options RDRAND_RNG". Requested by: so@ (des) Submitted by: obrien, arthurmesh@gmail.com Obtained from: Juniper Networks Modified: head/UPDATING head/sys/amd64/conf/GENERIC head/sys/amd64/conf/NOTES head/sys/conf/options.amd64 head/sys/conf/options.i386 head/sys/i386/conf/GENERIC head/sys/i386/conf/NOTES Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Aug 21 22:40:29 2013 (r254623) +++ head/UPDATING Wed Aug 21 22:43:29 2013 (r254624) @@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20130821: + The PADLOCK_RNG and RDRAND_RNG kernel options are now devices. + Thus "device padlock_rng" and "device rdrand_rng" should be + used instead of "options PADLOCK_RNG" & "options RDRAND_RNG". + 20130813: WITH_ICONV has been split into two feature sets. WITH_ICONV now enables just the iconv* functionality and is now on by default. @@ -340,9 +345,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 20120913: The random(4) support for the VIA hardware random number generator (`PADLOCK') is no longer enabled unconditionally. - Add the PADLOCK_RNG option in the custom kernel config if + Add the padlock_rng device in the custom kernel config if needed. The GENERIC kernels on i386 and amd64 do include the - option, so the change only affects the custom kernel + device, so the change only affects the custom kernel configurations. 20120908: Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Wed Aug 21 22:40:29 2013 (r254623) +++ head/sys/amd64/conf/GENERIC Wed Aug 21 22:43:29 2013 (r254624) @@ -293,8 +293,8 @@ device wpi # Intel 3945ABG wireless NI # Pseudo devices. device loop # Network loopback device random # Entropy device -options PADLOCK_RNG # VIA Padlock RNG -options RDRAND_RNG # Intel Bull Mountain RNG +device padlock_rng # VIA Padlock RNG +device rdrand_rng # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Wed Aug 21 22:40:29 2013 (r254623) +++ head/sys/amd64/conf/NOTES Wed Aug 21 22:43:29 2013 (r254624) @@ -496,6 +496,8 @@ device vpd device asmc #device si device tpm +device padlock_rng # VIA Padlock RNG +device rdrand_rng # Intel Bull Mountain RNG # # Laptop/Notebook options: Modified: head/sys/conf/options.amd64 ============================================================================== --- head/sys/conf/options.amd64 Wed Aug 21 22:40:29 2013 (r254623) +++ head/sys/conf/options.amd64 Wed Aug 21 22:43:29 2013 (r254624) @@ -68,7 +68,3 @@ XENHVM opt_global.h # options for the Intel C600 SAS driver (isci) ISCI_LOGGING opt_isci.h - -# hw random number generators for random(4) -PADLOCK_RNG opt_cpu.h -RDRAND_RNG opt_cpu.h Modified: head/sys/conf/options.i386 ============================================================================== --- head/sys/conf/options.i386 Wed Aug 21 22:40:29 2013 (r254623) +++ head/sys/conf/options.i386 Wed Aug 21 22:43:29 2013 (r254624) @@ -123,7 +123,3 @@ XENHVM opt_global.h # options for the Intel C600 SAS driver (isci) ISCI_LOGGING opt_isci.h - -# hw random number generators for random(4) -PADLOCK_RNG opt_cpu.h -RDRAND_RNG opt_cpu.h Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Wed Aug 21 22:40:29 2013 (r254623) +++ head/sys/i386/conf/GENERIC Wed Aug 21 22:43:29 2013 (r254624) @@ -307,8 +307,8 @@ device wpi # Intel 3945ABG wireless NI # Pseudo devices. device loop # Network loopback device random # Entropy device -options PADLOCK_RNG # VIA Padlock RNG -options RDRAND_RNG # Intel Bull Mountain RNG +device padlock_rng # VIA Padlock RNG +device rdrand_rng # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Wed Aug 21 22:40:29 2013 (r254623) +++ head/sys/i386/conf/NOTES Wed Aug 21 22:43:29 2013 (r254624) @@ -850,6 +850,8 @@ hint.spic.0.port="0x10a0" device asmc #device si device tpm +device padlock_rng # VIA Padlock RNG +device rdrand_rng # Intel Bull Mountain RNG # # Laptop/Notebook options: From owner-svn-src-head@FreeBSD.ORG Wed Aug 21 23:04: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 ESMTP id 6C8636C4; Wed, 21 Aug 2013 23:04:51 +0000 (UTC) (envelope-from ken@FreeBSD.org) 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 567352513; Wed, 21 Aug 2013 23:04: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 r7LN4pa1058464; Wed, 21 Aug 2013 23:04:51 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7LN4mr6058450; Wed, 21 Aug 2013 23:04:48 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201308212304.r7LN4mr6058450@svn.freebsd.org> From: "Kenneth D. Merry" Date: Wed, 21 Aug 2013 23:04:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254627 - in head: bin/chflags bin/ls lib/libc/gen lib/libc/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/msdosfs sys/fs/smbfs sys/sys 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 23:04:51 -0000 Author: ken Date: Wed Aug 21 23:04:48 2013 New Revision: 254627 URL: http://svnweb.freebsd.org/changeset/base/254627 Log: Expand the use of stat(2) flags to allow storing some Windows/DOS and CIFS file attributes as BSD stat(2) flags. This work is intended to be compatible with ZFS, the Solaris CIFS server's interaction with ZFS, somewhat compatible with MacOS X, and of course compatible with Windows. The Windows attributes that are implemented were chosen based on the attributes that ZFS already supports. The summary of the flags is as follows: UF_SYSTEM: Command line name: "system" or "usystem" ZFS name: XAT_SYSTEM, ZFS_SYSTEM Windows: FILE_ATTRIBUTE_SYSTEM This flag means that the file is used by the operating system. FreeBSD does not enforce any special handling when this flag is set. UF_SPARSE: Command line name: "sparse" or "usparse" ZFS name: XAT_SPARSE, ZFS_SPARSE Windows: FILE_ATTRIBUTE_SPARSE_FILE This flag means that the file is sparse. Although ZFS may modify this in some situations, there is not generally any special handling for this flag. UF_OFFLINE: Command line name: "offline" or "uoffline" ZFS name: XAT_OFFLINE, ZFS_OFFLINE Windows: FILE_ATTRIBUTE_OFFLINE This flag means that the file has been moved to offline storage. FreeBSD does not have any special handling for this flag. UF_REPARSE: Command line name: "reparse" or "ureparse" ZFS name: XAT_REPARSE, ZFS_REPARSE Windows: FILE_ATTRIBUTE_REPARSE_POINT This flag means that the file is a Windows reparse point. ZFS has special handling code for reparse points, but we don't currently have the other supporting infrastructure for them. UF_HIDDEN: Command line name: "hidden" or "uhidden" ZFS name: XAT_HIDDEN, ZFS_HIDDEN Windows: FILE_ATTRIBUTE_HIDDEN This flag means that the file may be excluded from a directory listing if the application honors it. FreeBSD has no special handling for this flag. The name and bit definition for UF_HIDDEN are identical to the definition in MacOS X. UF_READONLY: Command line name: "urdonly", "rdonly", "readonly" ZFS name: XAT_READONLY, ZFS_READONLY Windows: FILE_ATTRIBUTE_READONLY This flag means that the file may not written or appended, but its attributes may be changed. ZFS currently enforces this flag, but Illumos developers have discussed disabling enforcement. The behavior of this flag is different than MacOS X. MacOS X uses UF_IMMUTABLE to represent the DOS readonly permission, but that flag has a stronger meaning than the semantics of DOS readonly permissions. UF_ARCHIVE: Command line name: "uarch", "uarchive" ZFS_NAME: XAT_ARCHIVE, ZFS_ARCHIVE Windows name: FILE_ATTRIBUTE_ARCHIVE The UF_ARCHIVED flag means that the file has changed and needs to be archived. The meaning is same as the Windows FILE_ATTRIBUTE_ARCHIVE attribute, and the ZFS XAT_ARCHIVE and ZFS_ARCHIVE attribute. msdosfs and ZFS have special handling for this flag. i.e. they will set it when the file changes. sys/param.h: Bump __FreeBSD_version to 1000047 for the addition of new stat(2) flags. chflags.1: Document the new command line flag names (e.g. "system", "hidden") available to the user. ls.1: Reference chflags(1) for a list of file flags and their meanings. strtofflags.c: Implement the mapping between the new command line flag names and new stat(2) flags. chflags.2: Document all of the new stat(2) flags, and explain the intended behavior in a little more detail. Explain how they map to Windows file attributes. Different filesystems behave differently with respect to flags, so warn the application developer to take care when using them. zfs_vnops.c: Add support for getting and setting the UF_ARCHIVE, UF_READONLY, UF_SYSTEM, UF_HIDDEN, UF_REPARSE, UF_OFFLINE, and UF_SPARSE flags. All of these flags are implemented using attributes that ZFS already supports, so the on-disk format has not changed. ZFS currently doesn't allow setting the UF_REPARSE flag, and we don't really have the other infrastructure to support reparse points. msdosfs_denode.c, msdosfs_vnops.c: Add support for getting and setting UF_HIDDEN, UF_SYSTEM and UF_READONLY in MSDOSFS. It supported SF_ARCHIVED, but this has been changed to be UF_ARCHIVE, which has the same semantics as the DOS archive attribute instead of inverse semantics like SF_ARCHIVED. After discussion with Bruce Evans, change several things in the msdosfs behavior: Use UF_READONLY to indicate whether a file is writeable instead of file permissions, but don't actually enforce it. Refuse to change attributes on the root directory, because it is special in FAT filesystems, but allow most other attribute changes on directories. Don't set the archive attribute on a directory when its modification time is updated. Windows and DOS don't set the archive attribute in that scenario, so we are now bug-for-bug compatible. smbfs_node.c, smbfs_vnops.c: Add support for UF_HIDDEN, UF_SYSTEM, UF_READONLY and UF_ARCHIVE in SMBFS. This is similar to changes that Apple has made in their version of SMBFS (as of smb-583.8, posted on opensource.apple.com), but not quite the same. We map SMB_FA_READONLY to UF_READONLY, because UF_READONLY is intended to match the semantics of the DOS readonly flag. The MacOS X code maps both UF_IMMUTABLE and SF_IMMUTABLE to SMB_FA_READONLY, but the immutable flags have stronger meaning than the DOS readonly bit. stat.h: Add definitions for UF_SYSTEM, UF_SPARSE, UF_OFFLINE, UF_REPARSE, UF_ARCHIVE, UF_READONLY and UF_HIDDEN. The definition of UF_HIDDEN is the same as the MacOS X definition. Add commented-out definitions of UF_COMPRESSED and UF_TRACKED. They are defined in MacOS X (as of 10.8.2), but we do not implement them (yet). ufs_vnops.c: Add support for getting and setting UF_ARCHIVE, UF_HIDDEN, UF_OFFLINE, UF_READONLY, UF_REPARSE, UF_SPARSE, and UF_SYSTEM in UFS. Alphabetize the flags that are supported. These new flags are only stored, UFS does not take any action if the flag is set. Sponsored by: Spectra Logic Reviewed by: bde (earlier version) Modified: head/bin/chflags/chflags.1 head/bin/ls/ls.1 head/lib/libc/gen/strtofflags.c head/lib/libc/sys/chflags.2 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/fs/msdosfs/msdosfs_denode.c head/sys/fs/msdosfs/msdosfs_vnops.c head/sys/fs/smbfs/smbfs_node.c head/sys/fs/smbfs/smbfs_vnops.c head/sys/sys/param.h head/sys/sys/stat.h head/sys/ufs/ufs/ufs_vnops.c Modified: head/bin/chflags/chflags.1 ============================================================================== --- head/bin/chflags/chflags.1 Wed Aug 21 22:57:29 2013 (r254626) +++ head/bin/chflags/chflags.1 Wed Aug 21 23:04:48 2013 (r254627) @@ -32,7 +32,7 @@ .\" @(#)chflags.1 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd March 3, 2006 +.Dd April 8, 2013 .Dt CHFLAGS 1 .Os .Sh NAME @@ -101,20 +101,36 @@ The following keywords are currently def .Bl -tag -offset indent -width ".Cm opaque" .It Cm arch , archived set the archived flag (super-user only) -.It Cm opaque -set the opaque flag (owner or super-user only) .It Cm nodump set the nodump flag (owner or super-user only) +.It Cm opaque +set the opaque flag (owner or super-user only) .It Cm sappnd , sappend set the system append-only flag (super-user only) .It Cm schg , schange , simmutable set the system immutable flag (super-user only) +.It Cm snapshot +set the snapshot flag (filesystems do not allow changing this flag) .It Cm sunlnk , sunlink set the system undeletable flag (super-user only) .It Cm uappnd , uappend set the user append-only flag (owner or super-user only) +.It Cm uarch , uarchive +set the archive flag (owner or super-user only) .It Cm uchg , uchange , uimmutable set the user immutable flag (owner or super-user only) +.It Cm uhidden , hidden +set the hidden file attribute (owner or super-user only) +.It Cm uoffline , offline +set the offline file attribute (owner or super-user only) +.It Cm urdonly , rdonly , readonly +set the DOS, Windows and CIFS readonly flag (owner or super-user only) +.It Cm usparse , sparse +set the sparse file attribute (owner or super-user only) +.It Cm usystem , system +set the DOS, Windows and CIFS system flag (owner or super-user only) +.It Cm ureparse , reparse +set the Windows reparse point file attribute (owner or super-user only) .It Cm uunlnk , uunlink set the user undeletable flag (owner or super-user only) .El Modified: head/bin/ls/ls.1 ============================================================================== --- head/bin/ls/ls.1 Wed Aug 21 22:57:29 2013 (r254626) +++ head/bin/ls/ls.1 Wed Aug 21 23:04:48 2013 (r254627) @@ -232,6 +232,9 @@ output. Include the file flags in a long .Pq Fl l output. +See +.Xr chflags 1 +for a list of file flags and their meanings. .It Fl p Write a slash .Pq Ql / Modified: head/lib/libc/gen/strtofflags.c ============================================================================== --- head/lib/libc/gen/strtofflags.c Wed Aug 21 22:57:29 2013 (r254626) +++ head/lib/libc/gen/strtofflags.c Wed Aug 21 23:04:48 2013 (r254627) @@ -62,13 +62,29 @@ static struct { #endif { "nouappnd", 0, UF_APPEND }, { "nouappend", 0, UF_APPEND }, + { "nouarch", 0, UF_ARCHIVE }, + { "nouarchive", 0, UF_ARCHIVE }, + { "nohidden", 0, UF_HIDDEN }, + { "nouhidden", 0, UF_HIDDEN }, { "nouchg", 0, UF_IMMUTABLE }, { "nouchange", 0, UF_IMMUTABLE }, { "nouimmutable", 0, UF_IMMUTABLE }, { "nodump", 1, UF_NODUMP }, - { "noopaque", 0, UF_OPAQUE }, { "nouunlnk", 0, UF_NOUNLINK }, - { "nouunlink", 0, UF_NOUNLINK } + { "nouunlink", 0, UF_NOUNLINK }, + { "nooffline", 0, UF_OFFLINE }, + { "nouoffline", 0, UF_OFFLINE }, + { "noopaque", 0, UF_OPAQUE }, + { "nordonly", 0, UF_READONLY }, + { "nourdonly", 0, UF_READONLY }, + { "noreadonly", 0, UF_READONLY }, + { "noureadonly", 0, UF_READONLY }, + { "noreparse", 0, UF_REPARSE }, + { "noureparse", 0, UF_REPARSE }, + { "nosparse", 0, UF_SPARSE }, + { "nousparse", 0, UF_SPARSE }, + { "nosystem", 0, UF_SYSTEM }, + { "nousystem", 0, UF_SYSTEM } }; #define nmappings (sizeof(mapping) / sizeof(mapping[0])) Modified: head/lib/libc/sys/chflags.2 ============================================================================== --- head/lib/libc/sys/chflags.2 Wed Aug 21 22:57:29 2013 (r254626) +++ head/lib/libc/sys/chflags.2 Wed Aug 21 23:04:48 2013 (r254627) @@ -112,26 +112,61 @@ The flags specified are formed by the following values .Pp .Bl -tag -width ".Dv SF_IMMUTABLE" -compact -offset indent -.It Dv UF_NODUMP -Do not dump the file. -.It Dv UF_IMMUTABLE -The file may not be changed. -.It Dv UF_APPEND +.It Dv SF_APPEND The file may only be appended to. -.It Dv UF_NOUNLINK -The file may not be renamed or deleted. -.It Dv UF_OPAQUE -The directory is opaque when viewed through a union stack. .It Dv SF_ARCHIVED -The file may be archived. +The file has been archived. +This flag means the opposite of the DOS, Windows and CIFS +FILE_ATTRIBUTE_ARCHIVE attribute. +This flag has been deprecated, and may be removed in a future release. .It Dv SF_IMMUTABLE The file may not be changed. -.It Dv SF_APPEND -The file may only be appended to. .It Dv SF_NOUNLINK The file may not be renamed or deleted. .It Dv SF_SNAPSHOT The file is a snapshot file. +.It Dv UF_APPEND +The file may only be appended to. +.It Dv UF_ARCHIVE +The file needs to be archived. +This flag has the same meaning as the DOS, Windows and CIFS +FILE_ATTRIBUTE_ARCHIVE attribute. +Filesystems in FreeBSD may or may not have special handling for this flag. +For instance, ZFS tracks changes to files and will set this bit when a +file is updated. +UFS only stores the flag, and relies on the application to change it when +needed. +.It Dv UF_HIDDEN +The file may be hidden from directory listings at the application's +discretion. +The file has the DOS, Windows and CIFS FILE_ATTRIBUTE_HIDDEN attribute. +.It Dv UF_IMMUTABLE +The file may not be changed. +.It Dv UF_NODUMP +Do not dump the file. +.It Dv UF_NOUNLINK +The file may not be renamed or deleted. +.It Dv UF_OFFLINE +The file is offline, or has the Windows and CIFS FILE_ATTRIBUTE_OFFLINE +attribute. +Filesystems in FreeBSD store and display this flag, but do not provide any +special handling when it is set. +.It Dv UF_OPAQUE +The directory is opaque when viewed through a union stack. +.It Dv UF_READONLY +The file is read only, and may not be written or appended. +Filesystems may use this flag to maintain compatibility with the DOS, Windows +and CIFS FILE_ATTRIBUTE_READONLY attribute. +.It Dv UF_REPARSE +The file contains a Windows reparse point and has the Windows and CIFS +FILE_ATTRIBUTE_REPARSE_POINT attribute. +.It Dv UF_SPARSE +The file has the Windows FILE_ATTRIBUTE_SPARSE_FILE attribute. +This may also be used by a filesystem to indicate a sparse file. +.It Dv UF_SYSTEM +The file has the DOS, Windows and CIFS FILE_ATTRIBUTE_SYSTEM attribute. +Filesystems in FreeBSD may store and display this flag, but do not provide +any special handling when it is set. .El .Pp If one of @@ -162,6 +197,13 @@ the system is in single-user mode. .Xr init 8 for details.) .Pp +The implementation of all flags is filesystem-dependent. +See the description of the +.Dv UF_ARCHIVE +flag above for one example of the differences in behavior. +Care should be exercised when writing applications to account for +support or lack of support of these flags in various filesystems. +.Pp The .Dv SF_SNAPSHOT flag is maintained by the system and cannot be toggled. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Aug 21 22:57:29 2013 (r254626) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Aug 21 23:04:48 2013 (r254627) @@ -6071,6 +6071,14 @@ zfs_freebsd_getattr(ap) XVA_SET_REQ(&xvap, XAT_APPENDONLY); XVA_SET_REQ(&xvap, XAT_NOUNLINK); XVA_SET_REQ(&xvap, XAT_NODUMP); + XVA_SET_REQ(&xvap, XAT_READONLY); + XVA_SET_REQ(&xvap, XAT_ARCHIVE); + XVA_SET_REQ(&xvap, XAT_SYSTEM); + XVA_SET_REQ(&xvap, XAT_HIDDEN); + XVA_SET_REQ(&xvap, XAT_REPARSE); + XVA_SET_REQ(&xvap, XAT_OFFLINE); + XVA_SET_REQ(&xvap, XAT_SPARSE); + error = zfs_getattr(ap->a_vp, (vattr_t *)&xvap, 0, ap->a_cred, NULL); if (error != 0) return (error); @@ -6086,8 +6094,23 @@ zfs_freebsd_getattr(ap) xvap.xva_xoptattrs.xoa_appendonly); FLAG_CHECK(SF_NOUNLINK, XAT_NOUNLINK, xvap.xva_xoptattrs.xoa_nounlink); + FLAG_CHECK(UF_ARCHIVE, XAT_ARCHIVE, + xvap.xva_xoptattrs.xoa_archive); FLAG_CHECK(UF_NODUMP, XAT_NODUMP, xvap.xva_xoptattrs.xoa_nodump); + FLAG_CHECK(UF_READONLY, XAT_READONLY, + xvap.xva_xoptattrs.xoa_readonly); + FLAG_CHECK(UF_SYSTEM, XAT_SYSTEM, + xvap.xva_xoptattrs.xoa_system); + FLAG_CHECK(UF_HIDDEN, XAT_HIDDEN, + xvap.xva_xoptattrs.xoa_hidden); + FLAG_CHECK(UF_REPARSE, XAT_REPARSE, + xvap.xva_xoptattrs.xoa_reparse); + FLAG_CHECK(UF_OFFLINE, XAT_OFFLINE, + xvap.xva_xoptattrs.xoa_offline); + FLAG_CHECK(UF_SPARSE, XAT_SPARSE, + xvap.xva_xoptattrs.xoa_sparse); + #undef FLAG_CHECK *vap = xvap.xva_vattr; vap->va_flags = fflags; @@ -6125,7 +6148,16 @@ zfs_freebsd_setattr(ap) return (EOPNOTSUPP); fflags = vap->va_flags; - if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_NODUMP)) != 0) + /* + * XXX KDM + * We need to figure out whether it makes sense to allow + * UF_REPARSE through, since we don't really have other + * facilities to handle reparse points and zfs_setattr() + * doesn't currently allow setting that attribute anyway. + */ + if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_ARCHIVE| + UF_NODUMP|UF_SYSTEM|UF_HIDDEN|UF_READONLY|UF_REPARSE| + UF_OFFLINE|UF_SPARSE)) != 0) return (EOPNOTSUPP); /* * Unprivileged processes are not permitted to unset system @@ -6177,8 +6209,22 @@ zfs_freebsd_setattr(ap) xvap.xva_xoptattrs.xoa_appendonly); FLAG_CHANGE(SF_NOUNLINK, ZFS_NOUNLINK, XAT_NOUNLINK, xvap.xva_xoptattrs.xoa_nounlink); + FLAG_CHANGE(UF_ARCHIVE, ZFS_ARCHIVE, XAT_ARCHIVE, + xvap.xva_xoptattrs.xoa_archive); FLAG_CHANGE(UF_NODUMP, ZFS_NODUMP, XAT_NODUMP, xvap.xva_xoptattrs.xoa_nodump); + FLAG_CHANGE(UF_READONLY, ZFS_READONLY, XAT_READONLY, + xvap.xva_xoptattrs.xoa_readonly); + FLAG_CHANGE(UF_SYSTEM, ZFS_SYSTEM, XAT_SYSTEM, + xvap.xva_xoptattrs.xoa_system); + FLAG_CHANGE(UF_HIDDEN, ZFS_HIDDEN, XAT_HIDDEN, + xvap.xva_xoptattrs.xoa_hidden); + FLAG_CHANGE(UF_REPARSE, ZFS_REPARSE, XAT_REPARSE, + xvap.xva_xoptattrs.xoa_hidden); + FLAG_CHANGE(UF_OFFLINE, ZFS_OFFLINE, XAT_OFFLINE, + xvap.xva_xoptattrs.xoa_offline); + FLAG_CHANGE(UF_SPARSE, ZFS_SPARSE, XAT_SPARSE, + xvap.xva_xoptattrs.xoa_sparse); #undef FLAG_CHANGE } return (zfs_setattr(vp, (vattr_t *)&xvap, 0, cred, NULL)); Modified: head/sys/fs/msdosfs/msdosfs_denode.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_denode.c Wed Aug 21 22:57:29 2013 (r254626) +++ head/sys/fs/msdosfs/msdosfs_denode.c Wed Aug 21 23:04:48 2013 (r254627) @@ -304,8 +304,8 @@ deupdat(dep, waitfor) if ((dep->de_flag & DE_MODIFIED) == 0 && waitfor == 0) return (0); dep->de_flag &= ~DE_MODIFIED; - if (dep->de_Attributes & ATTR_DIRECTORY) - return (0); + if (DETOV(dep)->v_vflag & VV_ROOT) + return (EINVAL); if (dep->de_refcnt <= 0) return (0); error = readde(dep, &bp, &dirp); Modified: head/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vnops.c Wed Aug 21 22:57:29 2013 (r254626) +++ head/sys/fs/msdosfs/msdosfs_vnops.c Wed Aug 21 23:04:48 2013 (r254627) @@ -172,8 +172,7 @@ msdosfs_create(ap) if (error) goto bad; - ndirent.de_Attributes = (ap->a_vap->va_mode & VWRITE) ? - ATTR_ARCHIVE : ATTR_ARCHIVE | ATTR_READONLY; + ndirent.de_Attributes = ATTR_ARCHIVE; ndirent.de_LowerCase = 0; ndirent.de_StartCluster = 0; ndirent.de_FileSize = 0; @@ -256,8 +255,7 @@ msdosfs_access(ap) mode_t file_mode; accmode_t accmode = ap->a_accmode; - file_mode = (S_IXUSR|S_IXGRP|S_IXOTH) | (S_IRUSR|S_IRGRP|S_IROTH) | - ((dep->de_Attributes & ATTR_READONLY) ? 0 : (S_IWUSR|S_IWGRP|S_IWOTH)); + file_mode = S_IRWXU|S_IRWXG|S_IRWXO; file_mode &= (vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask); /* @@ -266,8 +264,8 @@ msdosfs_access(ap) */ if (accmode & VWRITE) { switch (vp->v_type) { - case VDIR: case VREG: + case VDIR: if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); break; @@ -322,10 +320,7 @@ msdosfs_getattr(ap) else vap->va_fileid = (long)fileid; - if ((dep->de_Attributes & ATTR_READONLY) == 0) - mode = S_IRWXU|S_IRWXG|S_IRWXO; - else - mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; + mode = S_IRWXU|S_IRWXG|S_IRWXO; vap->va_mode = mode & (ap->a_vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask); vap->va_uid = pmp->pm_uid; @@ -345,8 +340,14 @@ msdosfs_getattr(ap) vap->va_birthtime.tv_nsec = 0; } vap->va_flags = 0; - if ((dep->de_Attributes & ATTR_ARCHIVE) == 0) - vap->va_flags |= SF_ARCHIVED; + if (dep->de_Attributes & ATTR_ARCHIVE) + vap->va_flags |= UF_ARCHIVE; + if (dep->de_Attributes & ATTR_HIDDEN) + vap->va_flags |= UF_HIDDEN; + if (dep->de_Attributes & ATTR_READONLY) + vap->va_flags |= UF_READONLY; + if (dep->de_Attributes & ATTR_SYSTEM) + vap->va_flags |= UF_SYSTEM; vap->va_gen = 0; vap->va_blocksize = pmp->pm_bpcluster; vap->va_bytes = @@ -395,6 +396,18 @@ msdosfs_setattr(ap) #endif return (EINVAL); } + + /* + * We don't allow setting attributes on the root directory. + * The special case for the root directory is because before + * FAT32, the root directory didn't have an entry for itself + * (and was otherwise special). With FAT32, the root + * directory is not so special, but still doesn't have an + * entry for itself. + */ + if (vp->v_vflag & VV_ROOT) + return (EINVAL); + if (vap->va_flags != VNOVAL) { if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); @@ -408,24 +421,29 @@ msdosfs_setattr(ap) * attributes. We ignored the access time and the * read and execute bits. We were strict for the other * attributes. - * - * Here we are strict, stricter than ufs in not allowing - * users to attempt to set SF_SETTABLE bits or anyone to - * set unsupported bits. However, we ignore attempts to - * set ATTR_ARCHIVE for directories `cp -pr' from a more - * sensible filesystem attempts it a lot. */ - if (vap->va_flags & SF_SETTABLE) { - error = priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0); - if (error) - return (error); - } - if (vap->va_flags & ~SF_ARCHIVED) + if (vap->va_flags & ~(UF_ARCHIVE | UF_HIDDEN | UF_READONLY | + UF_SYSTEM)) return EOPNOTSUPP; - if (vap->va_flags & SF_ARCHIVED) - dep->de_Attributes &= ~ATTR_ARCHIVE; - else if (!(dep->de_Attributes & ATTR_DIRECTORY)) + if (vap->va_flags & UF_ARCHIVE) dep->de_Attributes |= ATTR_ARCHIVE; + else + dep->de_Attributes &= ~ATTR_ARCHIVE; + if (vap->va_flags & UF_HIDDEN) + dep->de_Attributes |= ATTR_HIDDEN; + else + dep->de_Attributes &= ~ATTR_HIDDEN; + /* We don't allow changing the readonly bit on directories. */ + if (vp->v_type != VDIR) { + if (vap->va_flags & UF_READONLY) + dep->de_Attributes |= ATTR_READONLY; + else + dep->de_Attributes &= ~ATTR_READONLY; + } + if (vap->va_flags & UF_SYSTEM) + dep->de_Attributes |= ATTR_SYSTEM; + else + dep->de_Attributes &= ~ATTR_SYSTEM; dep->de_flag |= DE_MODIFIED; } @@ -489,21 +507,24 @@ msdosfs_setattr(ap) error = VOP_ACCESS(vp, VWRITE, cred, td); } else error = VOP_ACCESS(vp, VADMIN, cred, td); - if (vp->v_type != VDIR) { - if ((pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0 && - vap->va_atime.tv_sec != VNOVAL) { - dep->de_flag &= ~DE_ACCESS; - timespec2fattime(&vap->va_atime, 0, - &dep->de_ADate, NULL, NULL); - } - if (vap->va_mtime.tv_sec != VNOVAL) { - dep->de_flag &= ~DE_UPDATE; - timespec2fattime(&vap->va_mtime, 0, - &dep->de_MDate, &dep->de_MTime, NULL); - } - dep->de_Attributes |= ATTR_ARCHIVE; - dep->de_flag |= DE_MODIFIED; + if ((pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0 && + vap->va_atime.tv_sec != VNOVAL) { + dep->de_flag &= ~DE_ACCESS; + timespec2fattime(&vap->va_atime, 0, + &dep->de_ADate, NULL, NULL); + } + if (vap->va_mtime.tv_sec != VNOVAL) { + dep->de_flag &= ~DE_UPDATE; + timespec2fattime(&vap->va_mtime, 0, + &dep->de_MDate, &dep->de_MTime, NULL); } + /* + * We don't set the archive bit when modifying the time of + * a directory to emulate the Windows/DOS behavior. + */ + if (vp->v_type != VDIR) + dep->de_Attributes |= ATTR_ARCHIVE; + dep->de_flag |= DE_MODIFIED; } /* * DOS files only have the ability to have their writability Modified: head/sys/fs/smbfs/smbfs_node.c ============================================================================== --- head/sys/fs/smbfs/smbfs_node.c Wed Aug 21 22:57:29 2013 (r254626) +++ head/sys/fs/smbfs/smbfs_node.c Wed Aug 21 23:04:48 2013 (r254627) @@ -370,10 +370,13 @@ smbfs_attr_cachelookup(struct vnode *vp, if (diff > 2) /* XXX should be configurable */ return ENOENT; va->va_type = vp->v_type; /* vnode type (for create) */ + va->va_flags = 0; /* flags defined for file */ if (vp->v_type == VREG) { va->va_mode = smp->sm_file_mode; /* files access mode and type */ - if (np->n_dosattr & SMB_FA_RDONLY) + if (np->n_dosattr & SMB_FA_RDONLY) { va->va_mode &= ~(S_IWUSR|S_IWGRP|S_IWOTH); + va->va_flags |= UF_READONLY; + } } else if (vp->v_type == VDIR) { va->va_mode = smp->sm_dir_mode; /* files access mode and type */ } else @@ -390,7 +393,15 @@ smbfs_attr_cachelookup(struct vnode *vp, va->va_mtime = np->n_mtime; va->va_atime = va->va_ctime = va->va_mtime; /* time file changed */ va->va_gen = VNOVAL; /* generation number of file */ - va->va_flags = 0; /* flags defined for file */ + if (np->n_dosattr & SMB_FA_HIDDEN) + va->va_flags |= UF_HIDDEN; + if (np->n_dosattr & SMB_FA_SYSTEM) + va->va_flags |= UF_SYSTEM; + /* + * We don't set the archive bit for directories. + */ + if ((vp->v_type != VDIR) && (np->n_dosattr & SMB_FA_ARCHIVE)) + va->va_flags |= UF_ARCHIVE; va->va_rdev = NODEV; /* device the special file represents */ va->va_bytes = va->va_size; /* bytes of disk space held by file */ va->va_filerev = 0; /* file modification number */ Modified: head/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- head/sys/fs/smbfs/smbfs_vnops.c Wed Aug 21 22:57:29 2013 (r254626) +++ head/sys/fs/smbfs/smbfs_vnops.c Wed Aug 21 23:04:48 2013 (r254627) @@ -305,16 +305,30 @@ smbfs_setattr(ap) int old_n_dosattr; SMBVDEBUG("\n"); - if (vap->va_flags != VNOVAL) - return EOPNOTSUPP; isreadonly = (vp->v_mount->mnt_flag & MNT_RDONLY); /* * Disallow write attempts if the filesystem is mounted read-only. */ if ((vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL || - vap->va_mode != (mode_t)VNOVAL) && isreadonly) + vap->va_mode != (mode_t)VNOVAL || vap->va_flags != VNOVAL) && + isreadonly) return EROFS; + + /* + * We only support setting four flags. Don't allow setting others. + * + * We map UF_READONLY to SMB_FA_RDONLY, unlike the MacOS X version + * of this code, which maps both UF_IMMUTABLE AND SF_IMMUTABLE to + * SMB_FA_RDONLY. The immutable flags have different semantics + * than readonly, which is the reason for the difference. + */ + if (vap->va_flags != VNOVAL) { + if (vap->va_flags & ~(UF_HIDDEN|UF_SYSTEM|UF_ARCHIVE| + UF_READONLY)) + return EINVAL; + } + scred = smbfs_malloc_scred(); smb_makescred(scred, td, ap->a_cred); if (vap->va_size != VNOVAL) { @@ -353,12 +367,47 @@ smbfs_setattr(ap) goto out; } } - if (vap->va_mode != (mode_t)VNOVAL) { + if ((vap->va_flags != VNOVAL) || (vap->va_mode != (mode_t)VNOVAL)) { old_n_dosattr = np->n_dosattr; - if (vap->va_mode & S_IWUSR) - np->n_dosattr &= ~SMB_FA_RDONLY; - else - np->n_dosattr |= SMB_FA_RDONLY; + + if (vap->va_mode != (mode_t)VNOVAL) { + if (vap->va_mode & S_IWUSR) + np->n_dosattr &= ~SMB_FA_RDONLY; + else + np->n_dosattr |= SMB_FA_RDONLY; + } + + if (vap->va_flags != VNOVAL) { + if (vap->va_flags & UF_HIDDEN) + np->n_dosattr |= SMB_FA_HIDDEN; + else + np->n_dosattr &= ~SMB_FA_HIDDEN; + + if (vap->va_flags & UF_SYSTEM) + np->n_dosattr |= SMB_FA_SYSTEM; + else + np->n_dosattr &= ~SMB_FA_SYSTEM; + + if (vap->va_flags & UF_ARCHIVE) + np->n_dosattr |= SMB_FA_ARCHIVE; + else + np->n_dosattr &= ~SMB_FA_ARCHIVE; + + /* + * We only support setting the immutable / readonly + * bit for regular files. According to comments in + * the MacOS X version of this code, supporting the + * readonly bit on directories doesn't do the same + * thing in Windows as in Unix. + */ + if (vp->v_type == VREG) { + if (vap->va_flags & UF_READONLY) + np->n_dosattr |= SMB_FA_RDONLY; + else + np->n_dosattr &= ~SMB_FA_RDONLY; + } + } + if (np->n_dosattr != old_n_dosattr) { error = smbfs_smb_setpattr(np, np->n_dosattr, NULL, scred); if (error) Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Aug 21 22:57:29 2013 (r254626) +++ head/sys/sys/param.h Wed Aug 21 23:04:48 2013 (r254627) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000046 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000047 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/sys/sys/stat.h ============================================================================== --- head/sys/sys/stat.h Wed Aug 21 22:57:29 2013 (r254626) +++ head/sys/sys/stat.h Wed Aug 21 23:04:48 2013 (r254627) @@ -265,8 +265,26 @@ struct nstat { #define UF_NODUMP 0x00000001 /* do not dump file */ #define UF_IMMUTABLE 0x00000002 /* file may not be changed */ #define UF_APPEND 0x00000004 /* writes to file may only append */ -#define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */ -#define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */ +#define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */ +#define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */ +/* + * These two bits are defined in MacOS X. They are not currently used in + * FreeBSD. + */ +#if 0 +#define UF_COMPRESSED 0x00000020 /* file is compressed */ +#define UF_TRACKED 0x00000040 /* renames and deletes are tracked */ +#endif + +#define UF_SYSTEM 0x00000080 /* Windows system file bit */ +#define UF_SPARSE 0x00000100 /* sparse file */ +#define UF_OFFLINE 0x00000200 /* file is offline */ +#define UF_REPARSE 0x00000400 /* Windows reparse point file bit */ +#define UF_ARCHIVE 0x00000800 /* file needs to be archived */ +#define UF_READONLY 0x00001000 /* Windows readonly file bit */ +/* This is the same as the MacOS X definition of UF_HIDDEN. */ +#define UF_HIDDEN 0x00008000 /* file is hidden */ + /* * Super-user changeable flags. */ Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Wed Aug 21 22:57:29 2013 (r254626) +++ head/sys/ufs/ufs/ufs_vnops.c Wed Aug 21 23:04:48 2013 (r254627) @@ -528,9 +528,11 @@ ufs_setattr(ap) return (EINVAL); } if (vap->va_flags != VNOVAL) { - if ((vap->va_flags & ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND | - UF_OPAQUE | UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE | - SF_APPEND | SF_NOUNLINK | SF_SNAPSHOT)) != 0) + if ((vap->va_flags & ~(SF_APPEND | SF_ARCHIVED | SF_IMMUTABLE | + SF_NOUNLINK | SF_SNAPSHOT | UF_APPEND | UF_ARCHIVE | + UF_HIDDEN | UF_IMMUTABLE | UF_NODUMP | UF_NOUNLINK | + UF_OFFLINE | UF_OPAQUE | UF_READONLY | UF_REPARSE | + UF_SPARSE | UF_SYSTEM)) != 0) return (EOPNOTSUPP); if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 00:51:39 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 ESMTP id 3E22D327; Thu, 22 Aug 2013 00:51:39 +0000 (UTC) (envelope-from delphij@FreeBSD.org) 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 2A5D22A8F; Thu, 22 Aug 2013 00:51: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 r7M0pdrX012614; Thu, 22 Aug 2013 00:51:39 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7M0pc9W012612; Thu, 22 Aug 2013 00:51:38 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201308220051.r7M0pc9W012612@svn.freebsd.org> From: Xin LI Date: Thu, 22 Aug 2013 00:51:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254629 - head/sys/netinet head/sys/netinet6 stable/8/sys/netinet stable/8/sys/netinet6 stable/9/sys/netinet stable/9/sys/netinet6 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.14 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: Thu, 22 Aug 2013 00:51:39 -0000 Author: delphij Date: Thu Aug 22 00:51:37 2013 New Revision: 254629 URL: http://svnweb.freebsd.org/changeset/base/254629 Log: Fix an integer overflow in computing the size of a temporary buffer can result in a buffer which is too small for the requested operation. Security: CVE-2013-3077 Security: FreeBSD-SA-13:09.ip_multicast Modified: head/sys/netinet/in_mcast.c head/sys/netinet6/in6_mcast.c Changes in other areas also in this revision: Modified: stable/8/sys/netinet/in_mcast.c stable/8/sys/netinet6/in6_mcast.c stable/9/sys/netinet/in_mcast.c stable/9/sys/netinet6/in6_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Wed Aug 21 23:22:36 2013 (r254628) +++ head/sys/netinet/in_mcast.c Thu Aug 22 00:51:37 2013 (r254629) @@ -1648,6 +1648,8 @@ inp_get_source_filters(struct inpcb *inp * has asked for, but we always tell userland how big the * buffer really needs to be. */ + if (msfr.msfr_nsrcs > in_mcast_maxsocksrc) + msfr.msfr_nsrcs = in_mcast_maxsocksrc; tss = NULL; if (msfr.msfr_srcs != NULL && msfr.msfr_nsrcs > 0) { tss = malloc(sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs, Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Wed Aug 21 23:22:36 2013 (r254628) +++ head/sys/netinet6/in6_mcast.c Thu Aug 22 00:51:37 2013 (r254629) @@ -1625,6 +1625,8 @@ in6p_get_source_filters(struct inpcb *in * has asked for, but we always tell userland how big the * buffer really needs to be. */ + if (msfr.msfr_nsrcs > in6_mcast_maxsocksrc) + msfr.msfr_nsrcs = in6_mcast_maxsocksrc; tss = NULL; if (msfr.msfr_srcs != NULL && msfr.msfr_nsrcs > 0) { tss = malloc(sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs, From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 02:54:21 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 ESMTP id 7F1DF807; Thu, 22 Aug 2013 02:54:21 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) 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 6CD822781; Thu, 22 Aug 2013 02:54:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7M2sL17079996; Thu, 22 Aug 2013 02:54:21 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7M2sLLs079994; Thu, 22 Aug 2013 02:54:21 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201308220254.r7M2sLLs079994@svn.freebsd.org> From: Justin Hibbits Date: Thu, 22 Aug 2013 02:54:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254634 - head/sys/cddl/dev/dtrace/powerpc 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.14 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: Thu, 22 Aug 2013 02:54:21 -0000 Author: jhibbits Date: Thu Aug 22 02:54:20 2013 New Revision: 254634 URL: http://svnweb.freebsd.org/changeset/base/254634 Log: Make dtrace_copy() actually work on PowerPC. Although unused currently, it may be used in the future by dtrace. Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Thu Aug 22 01:54:52 2013 (r254633) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Thu Aug 22 02:54:20 2013 (r254634) @@ -125,13 +125,13 @@ void dtrace_copy(uintptr_t src, uintptr_t dest, size_t size) */ ASENTRY_NOPROF(dtrace_copy) - addme %r7,%r3 - addme %r8,%r4 + subi %r7,%r3,1 + subi %r8,%r4,1 + mtctr %r5 1: lbzu %r3,1(%r7) stbu %r3,1(%r8) - addme %r5,%r5 - beq 2f + bdnz 1b 2: blr END(dtrace_copy) From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 04:47: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 ESMTP id CE25A9DC; Thu, 22 Aug 2013 04:47:07 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 4C1BC2C84; Thu, 22 Aug 2013 04:47:06 +0000 (UTC) Received: from lstewart.caia.swin.edu.au (lstewart.caia.swin.edu.au [136.186.229.95]) by lauren.room52.net (Postfix) with ESMTPSA id F0B4F7E81E; Thu, 22 Aug 2013 14:46:57 +1000 (EST) Message-ID: <521597C1.6070805@freebsd.org> Date: Thu, 22 Aug 2013 14:46:57 +1000 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130817 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r254524 - head/sys/sys References: <201308191356.r7JDuELE075073@svn.freebsd.org> <521257E2.4020502@FreeBSD.org> <5213AAA1.6020700@freebsd.org> <5214DD31.6010205@freebsd.org> <5214E86F.1060102@freebsd.org> In-Reply-To: <5214E86F.1060102@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Cc: Davide Italiano , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Navdeep Parhar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Thu, 22 Aug 2013 04:47:08 -0000 On 08/22/13 02:18, Andre Oppermann wrote: > On 21.08.2013 17:59, Davide Italiano wrote: >> On Wed, Aug 21, 2013 at 5:30 PM, Andre Oppermann >> wrote: >>> On 20.08.2013 20:13, Davide Italiano wrote: >>>> >>>> On Tue, Aug 20, 2013 at 7:42 PM, Andre Oppermann >>>> wrote: >>>>> >>>>> On 19.08.2013 19:37, Navdeep Parhar wrote: >>>>>> >>>>>> Why reuse the freed up bits so soon (at least one of which >>>>>> I think was prematurely GC'ed -- see my other email on >>>>>> M_NOFREE). There was room beyond M_HASHTYPEBITS, no? >>>>> >>>>> >>>>> This is HEAD where kernel and modules have to be (re)compiled >>>>> together at any point in time. On stable this reuse would >>>>> not have been possible. >>>>> >>>>> In a subsequent commit I compacted and ordered the flags. >>>>> There's a couple of free ones remaining. >>>>> >>>>> I have some additional mbuf changes coming up to be posted >>>>> for possible objections later today. The close HEAD freeze >>>>> deadline has got me rushed a bit to allow 10.x backporting of >>>>> the checksum/offload overhaul. >>>>> >>>>> -- Andre >>>>> >>>> >>>> In my opinion the possibility we have about breaking KPI/KBI >>>> should not be abused, even if it's allowed in HEAD. In other >>>> words,people should go for preserving it when (as in this >>>> case) it's easy and without additional costs. Your point about >>>> "this is HEAD, it can be broken at any time" makes relatively >>>> little sense to me. Note that in the worst case such KPI/KBI >>>> breakages are annoying for $VENDORS who maintain out-of-tree >>>> code, which need to rebuild/change their code, or, if they get >>>> pissed off, drop FreeBSD support. In your case, it's just a >>>> matter of "code cleaness" about few lines, which, IMHO and >>>> always IMHO, doesn't justify the breakage. >>> >>> >>> Preserving the API but having to recompile is always fair game in >>> HEAD. In fact it happens all the time and the only supported way >>> to track HEAD is to recompile kernel and modules together. >>> >>> For removing (crufty) functionality I agree that it shouldn't be >>> done just for the sake of it and also shouldn't be done often. >>> Sometimes it is necessary in the name of progress. Having to >>> support old, crufty or broken ways of doing something is a waste >>> of developer time too. >>> >>> It's always a judgement call. In this case there is a perfectly >>> valid alternative way of doing that also is less dangerous to >>> leak mbufs. >>> >>> -- Andre >>> >> >> I don't see in any way how flags reordering might be in any way >> connected to mbufs leaks, alas. There's a similar recent('ish) >> discussion and it was decided to not compact/reorder flags. See >> r253662/r253775 for references. So, I'm not sure what's the >> de-facto policy, but still, as a community FreeBSD should decide >> one strategy and be stuck with that. It's a matter of being >> consistent, which, IMHO, is something that should not be >> undervaluated. > > I fail to see what problem you have with the flag reordering. > Recompile and done. That's why we work with #defines instead of > magic 0x1234 values. On a general note, Navdeep's and Davide's objections are fair and in line with defacto policy and established practice. Breaking the KBI because we allow ourselves to on head doesn't mean we should, especially when there is an alternative approach that preserves it, achieves the same outcome and would be an equivalent amount of effort. As noted by Navdeep, there are 4 bits beyond M_HASHTYPEBITS which could have been used. We want to allow as much time to elapse as possible between deprecating a bit's use/meaning and reusing it for something new. As an aside, embedding the date a bit became "free" in the comment next to the bit would be useful to ensure eventual bit reuse reclaims the oldest free bit(s) first. > If someone outside the tree was using the spare bits for their own > private purposes, yes, they would quickly have to check and possibly > adjust them. That's trivial however and should be expected when > tracking an OpenSource operating system. To be expected, sure, but we should only inflict the pain when it is truly necessary. Determining necessity should be straight forward in this instance: Are there other changes on the immediate horizon for 10.0 that require new bits? If yes, how many bits? If the answer is no, the recently deprecated bits should be reinstated as they were and M_PROTOFLAGS[9-12] should be moved to after M_HASHTYPEBITS. If yes, moving M_PROTOFLAGS[9-12] to after M_HASHTYPEBITS is probably a waste of time/effort (depending on how many bits are needed) as the new functionality will have to recycle some of the free bits anyway. In addition to this, the reordering done in r254527 is also a POLA and KBI issue for no gain. The flags easily fit on a single screen of text so it's not like they couldn't all be seen together easily. Changing bit definitions in such an important subsystem for purely cosmetic gain is a bad idea and I would argue in favour of reverting the reordering done in r254527 (which should have been committed as a separate commit anyway - lumping everything in one commit was unfortunate). The fact these patches don't have a "Reviewed by" line is of concern. "Discussed with" != "Reviewed by". I appreciate some of us (myself included) got a bit caught off guard by the proposed 10.0 timeline, but rushing changes, especially to critical infrastructure, without review is not a good idea. Cheers, Lawrence From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 05:07:50 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 ESMTP id ACAC8E2B; Thu, 22 Aug 2013 05:07:50 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) 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 992A22D37; Thu, 22 Aug 2013 05:07: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 r7M57ohh046350; Thu, 22 Aug 2013 05:07:50 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7M57oRa046349; Thu, 22 Aug 2013 05:07:50 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201308220507.r7M57oRa046349@svn.freebsd.org> From: Justin Hibbits Date: Thu, 22 Aug 2013 05:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254639 - head/sys/powerpc/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.14 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: Thu, 22 Aug 2013 05:07:50 -0000 Author: jhibbits Date: Thu Aug 22 05:07:50 2013 New Revision: 254639 URL: http://svnweb.freebsd.org/changeset/base/254639 Log: Enable DTrace hooks in ppc64. Modified: head/sys/powerpc/conf/GENERIC64 Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Thu Aug 22 05:03:41 2013 (r254638) +++ head/sys/powerpc/conf/GENERIC64 Thu Aug 22 05:07:50 2013 (r254639) @@ -24,6 +24,7 @@ ident GENERIC machine powerpc powerpc64 makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +makeoptions WITH_CTF=1 # Platform support options POWERMAC #NewWorld Apple PowerMacs @@ -67,6 +68,8 @@ options _KPOSIX_PRIORITY_SCHEDULING #Po options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options MAC # TrustedBSD MAC Framework +options KDTRACE_HOOKS # Kernel DTrace hooks +options DDB_CTF # Kernel ELF linker loads CTF data options INCLUDE_CONFIG_FILE # Include this file in kernel # Debugging support. Always need this: From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 05:53: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 ESMTP id 5D0CC9FC; Thu, 22 Aug 2013 05:53:48 +0000 (UTC) (envelope-from adrian@FreeBSD.org) 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 263E72F69; Thu, 22 Aug 2013 05:53: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 r7M5rm3E069419; Thu, 22 Aug 2013 05:53:48 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7M5rlbG069416; Thu, 22 Aug 2013 05:53:47 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201308220553.r7M5rlbG069416@svn.freebsd.org> From: Adrian Chadd Date: Thu, 22 Aug 2013 05:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254640 - head/sys/net80211 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.14 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: Thu, 22 Aug 2013 05:53:48 -0000 Author: adrian Date: Thu Aug 22 05:53:47 2013 New Revision: 254640 URL: http://svnweb.freebsd.org/changeset/base/254640 Log: Add in some backwards compatability hacks to make -HEAD net80211 compile on -9. Modified: head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_input.c Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Thu Aug 22 05:07:50 2013 (r254639) +++ head/sys/net80211/ieee80211_freebsd.h Thu Aug 22 05:53:47 2013 (r254640) @@ -234,9 +234,22 @@ struct mbuf *ieee80211_getmgtframe(uint8 #define M_FF M_PROTO6 /* fast frame */ #define M_TXCB M_PROTO7 /* do tx complete callback */ #define M_AMPDU_MPDU M_PROTO8 /* ok for A-MPDU aggregation */ + +/* + * FreeBSD-HEAD from 1000046 retired M_*FRAG* flags and turned them + * into header flags instead. So, we use the new protocol-specific + * flags. + * + * Earlier FreeBSD versions overload M_FRAG, M_FIRSTFRAG and M_LASTFRAG. + * + * XXX TODO: rename these fields so there are no namespace clashes! + */ +#if __FreeBSD_version >= 1000046 #define M_FRAG M_PROTO9 /* frame fragmentation */ #define M_FIRSTFRAG M_PROTO10 /* first frame fragment */ #define M_LASTFRAG M_PROTO11 /* last frame fragment */ +#endif + #define M_80211_TX \ (M_ENCAP|M_EAPOL|M_PWR_SAV|M_MORE_DATA|M_FF|M_TXCB| \ M_AMPDU_MPDU|M_FRAG|M_FIRSTFRAG|M_LASTFRAG) @@ -249,10 +262,18 @@ struct mbuf *ieee80211_getmgtframe(uint8 #endif #define M_80211_RX (M_AMPDU|M_WEP|M_AMPDU_MPDU) +#if __FreeBSD_version >= 1000046 #define IEEE80211_MBUF_TX_FLAG_BITS \ M_FLAG_BITS \ "\15M_ENCAP\17M_EAPOL\20M_PWR_SAV\21M_MORE_DATA\22M_FF\23M_TXCB" \ "\24M_AMPDU_MPDU\25M_FRAG\26M_FIRSTFRAG\27M_LASTFRAG" +#else +/* There aren't any flag bits available for versions before this */ +/* XXX TODO: implement M_FLAG_BITS for this! */ +#define IEEE80211_MBUF_TX_FLAG_BITS \ + "\15M_ENCAP\17M_EAPOL\20M_PWR_SAV\21M_MORE_DATA\22M_FF\23M_TXCB" \ + "\24M_AMPDU_MPDU" +#endif #define IEEE80211_MBUF_RX_FLAG_BITS \ M_FLAG_BITS \ Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Thu Aug 22 05:07:50 2013 (r254639) +++ head/sys/net80211/ieee80211_hostap.c Thu Aug 22 05:53:47 2013 (r254640) @@ -355,8 +355,12 @@ hostap_deliver_data(struct ieee80211vap struct ifnet *ifp = vap->iv_ifp; /* clear driver/net80211 flags before passing up */ +#if __FreeBSD_version >= 1000046 m->m_flags &= ~(M_MCAST | M_BCAST); m_clrprotoflags(m); +#else + m->m_flags &= ~(M_80211_RX | M_MCAST | M_BCAST); +#endif KASSERT(vap->iv_opmode == IEEE80211_M_HOSTAP, ("gack, opmode %d", vap->iv_opmode)); Modified: head/sys/net80211/ieee80211_input.c ============================================================================== --- head/sys/net80211/ieee80211_input.c Thu Aug 22 05:07:50 2013 (r254639) +++ head/sys/net80211/ieee80211_input.c Thu Aug 22 05:53:47 2013 (r254640) @@ -251,7 +251,9 @@ ieee80211_deliver_data(struct ieee80211v /* clear driver/net80211 flags before passing up */ m->m_flags &= ~(M_MCAST | M_BCAST); +#if __FreeBSD_version >= 1000046 m_clrprotoflags(m); +#endif /* NB: see hostap_deliver_data, this path doesn't handle hostap */ KASSERT(vap->iv_opmode != IEEE80211_M_HOSTAP, ("gack, hostap")); From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 07:39:57 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 ESMTP id EF62FD97; Thu, 22 Aug 2013 07:39:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) 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 CE2732571; Thu, 22 Aug 2013 07:39:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7M7dvxF021883; Thu, 22 Aug 2013 07:39:57 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7M7dsHX021841; Thu, 22 Aug 2013 07:39:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308220739.r7M7dsHX021841@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 22 Aug 2013 07:39:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254649 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/agp dev/drm2/i915 dev/drm2/ttm dev/md kern sparc64/sparc64 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.14 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: Thu, 22 Aug 2013 07:39:58 -0000 Author: kib Date: Thu Aug 22 07:39:53 2013 New Revision: 254649 URL: http://svnweb.freebsd.org/changeset/base/254649 Log: Remove the deprecated VM_ALLOC_RETRY flag for the vm_page_grab(9). The flag was mandatory since r209792, where vm_page_grab(9) was changed to only support the alloc retry semantic. Suggested and reviewed by: alc Sponsored by: The FreeBSD Foundation Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/dev/agp/agp.c head/sys/dev/agp/agp_i810.c head/sys/dev/drm2/i915/i915_gem.c head/sys/dev/drm2/ttm/ttm_tt.c head/sys/dev/md/md.c head/sys/kern/kern_exec.c head/sys/kern/kern_sharedpage.c head/sys/kern/uipc_shm.c head/sys/kern/uipc_syscalls.c head/sys/kern/vfs_bio.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/swap_pager.c head/sys/vm/vm_glue.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Aug 22 07:39:53 2013 (r254649) @@ -539,7 +539,7 @@ mappedread_sf(vnode_t *vp, int nbytes, u int bytes = MIN(PAGESIZE, len); pp = vm_page_grab(obj, OFF_TO_IDX(start), VM_ALLOC_SBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_IGN_SBUSY); + VM_ALLOC_NORMAL | VM_ALLOC_IGN_SBUSY); if (pp->valid == 0) { zfs_vmobject_wunlock(obj); va = zfs_map_page(pp, &sf); Modified: head/sys/dev/agp/agp.c ============================================================================== --- head/sys/dev/agp/agp.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/dev/agp/agp.c Thu Aug 22 07:39:53 2013 (r254649) @@ -555,7 +555,7 @@ agp_generic_bind_memory(device_t dev, st * the pages will be allocated and zeroed. */ m = vm_page_grab(mem->am_obj, OFF_TO_IDX(i), - VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY); + VM_ALLOC_WIRED | VM_ALLOC_ZERO); AGP_DPF("found page pa=%#jx\n", (uintmax_t)VM_PAGE_TO_PHYS(m)); } VM_OBJECT_WUNLOCK(mem->am_obj); Modified: head/sys/dev/agp/agp_i810.c ============================================================================== --- head/sys/dev/agp/agp_i810.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/dev/agp/agp_i810.c Thu Aug 22 07:39:53 2013 (r254649) @@ -1970,7 +1970,7 @@ agp_i810_alloc_memory(device_t dev, int */ VM_OBJECT_WLOCK(mem->am_obj); m = vm_page_grab(mem->am_obj, 0, VM_ALLOC_NOBUSY | - VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY); + VM_ALLOC_WIRED | VM_ALLOC_ZERO); VM_OBJECT_WUNLOCK(mem->am_obj); mem->am_physical = VM_PAGE_TO_PHYS(m); } else { Modified: head/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- head/sys/dev/drm2/i915/i915_gem.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/dev/drm2/i915/i915_gem.c Thu Aug 22 07:39:53 2013 (r254649) @@ -2099,9 +2099,7 @@ i915_gem_object_bind_to_gtt(struct drm_i obj->gtt_space = NULL; /* * i915_gem_object_get_pages_gtt() cannot return - * ENOMEM, since we use vm_page_grab(VM_ALLOC_RETRY) - * (which does not support operation without a flag - * anyway). + * ENOMEM, since we use vm_page_grab(). */ return (ret); } @@ -2516,7 +2514,7 @@ i915_gem_wire_page(vm_object_t object, v int rv; VM_OBJECT_ASSERT_WLOCKED(object); - m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL); if (m->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(object, pindex, NULL, NULL)) { rv = vm_pager_get_pages(object, &m, 1, 0); Modified: head/sys/dev/drm2/ttm/ttm_tt.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_tt.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/dev/drm2/ttm/ttm_tt.c Thu Aug 22 07:39:53 2013 (r254649) @@ -288,7 +288,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm) VM_OBJECT_WLOCK(obj); vm_object_pip_add(obj, 1); for (i = 0; i < ttm->num_pages; ++i) { - from_page = vm_page_grab(obj, i, VM_ALLOC_RETRY); + from_page = vm_page_grab(obj, i, VM_ALLOC_NORMAL); if (from_page->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(obj, i, NULL, NULL)) { rv = vm_pager_get_pages(obj, &from_page, 1, 0); @@ -351,7 +351,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, v from_page = ttm->pages[i]; if (unlikely(from_page == NULL)) continue; - to_page = vm_page_grab(obj, i, VM_ALLOC_RETRY); + to_page = vm_page_grab(obj, i, VM_ALLOC_NORMAL); pmap_copy_page(from_page, to_page); vm_page_dirty(to_page); to_page->valid = VM_PAGE_BITS_ALL; Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/dev/md/md.c Thu Aug 22 07:39:53 2013 (r254649) @@ -826,8 +826,7 @@ mdstart_swap(struct md_s *sc, struct bio vm_object_pip_add(sc->object, 1); for (i = bp->bio_offset / PAGE_SIZE; i <= lastp; i++) { len = ((i == lastp) ? lastend : PAGE_SIZE) - offs; - m = vm_page_grab(sc->object, i, VM_ALLOC_NORMAL | - VM_ALLOC_RETRY); + m = vm_page_grab(sc->object, i, VM_ALLOC_NORMAL); if (bp->bio_cmd == BIO_READ) { if (m->valid == VM_PAGE_BITS_ALL) rv = VM_PAGER_OK; Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/kern/kern_exec.c Thu Aug 22 07:39:53 2013 (r254649) @@ -934,7 +934,7 @@ exec_map_first_page(imgp) object->pg_color = 0; } #endif - ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL); if (ma[0]->valid != VM_PAGE_BITS_ALL) { initial_pagein = VM_INITIAL_PAGEIN; if (initial_pagein > object->size) Modified: head/sys/kern/kern_sharedpage.c ============================================================================== --- head/sys/kern/kern_sharedpage.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/kern/kern_sharedpage.c Thu Aug 22 07:39:53 2013 (r254649) @@ -108,8 +108,7 @@ shared_page_init(void *dummy __unused) shared_page_obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, VM_PROT_DEFAULT, 0, NULL); VM_OBJECT_WLOCK(shared_page_obj); - m = vm_page_grab(shared_page_obj, 0, VM_ALLOC_RETRY | VM_ALLOC_NOBUSY | - VM_ALLOC_ZERO); + m = vm_page_grab(shared_page_obj, 0, VM_ALLOC_NOBUSY | VM_ALLOC_ZERO); m->valid = VM_PAGE_BITS_ALL; VM_OBJECT_WUNLOCK(shared_page_obj); addr = kva_alloc(PAGE_SIZE); Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/kern/uipc_shm.c Thu Aug 22 07:39:53 2013 (r254649) @@ -165,7 +165,7 @@ uiomove_object_page(vm_object_t obj, siz * lock to page out tobj's pages because tobj is a OBJT_SWAP * type object. */ - m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL); if (m->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(obj, idx, NULL, NULL)) { rv = vm_pager_get_pages(obj, &m, 1, 0); Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/kern/uipc_syscalls.c Thu Aug 22 07:39:53 2013 (r254649) @@ -2230,7 +2230,7 @@ retry_space: pindex = OFF_TO_IDX(off); VM_OBJECT_WLOCK(obj); pg = vm_page_grab(obj, pindex, VM_ALLOC_NOBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_RETRY); + VM_ALLOC_NORMAL | VM_ALLOC_WIRED); /* * Check if page is valid for what we need, Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/kern/vfs_bio.c Thu Aug 22 07:39:53 2013 (r254649) @@ -3490,7 +3490,7 @@ allocbuf(struct buf *bp, int size) m = vm_page_grab(obj, OFF_TO_IDX(bp->b_offset) + bp->b_npages, VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED | - VM_ALLOC_RETRY | VM_ALLOC_IGN_SBUSY | + VM_ALLOC_IGN_SBUSY | VM_ALLOC_COUNT(desiredpages - bp->b_npages)); if (m->valid == 0) bp->b_flags &= ~B_CACHE; Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/sparc64/sparc64/pmap.c Thu Aug 22 07:39:53 2013 (r254649) @@ -1230,7 +1230,7 @@ pmap_pinit(pmap_t pm) VM_OBJECT_WLOCK(pm->pm_tsb_obj); for (i = 0; i < TSB_PAGES; i++) { m = vm_page_grab(pm->pm_tsb_obj, i, VM_ALLOC_NOBUSY | - VM_ALLOC_RETRY | VM_ALLOC_WIRED | VM_ALLOC_ZERO); + VM_ALLOC_WIRED | VM_ALLOC_ZERO); m->valid = VM_PAGE_BITS_ALL; m->md.pmap = pm; ma[i] = m; Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/vm/swap_pager.c Thu Aug 22 07:39:53 2013 (r254649) @@ -1711,7 +1711,7 @@ swp_pager_force_pagein(vm_object_t objec vm_page_t m; vm_object_pip_add(object, 1); - m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL); if (m->valid == VM_PAGE_BITS_ALL) { vm_object_pip_subtract(object, 1); vm_page_dirty(m); Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/vm/vm_glue.c Thu Aug 22 07:39:53 2013 (r254649) @@ -233,7 +233,7 @@ vm_imgact_hold_page(vm_object_t object, VM_OBJECT_WLOCK(object); pindex = OFF_TO_IDX(offset); - m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL); if (m->valid != VM_PAGE_BITS_ALL) { ma[0] = m; rv = vm_pager_get_pages(object, ma, 1, 0); @@ -395,7 +395,7 @@ vm_thread_new(struct thread *td, int pag * Get a kernel stack page. */ m = vm_page_grab(ksobj, i, VM_ALLOC_NOBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_WIRED); + VM_ALLOC_NORMAL | VM_ALLOC_WIRED); ma[i] = m; m->valid = VM_PAGE_BITS_ALL; } @@ -527,7 +527,7 @@ vm_thread_swapin(struct thread *td) ksobj = td->td_kstack_obj; VM_OBJECT_WLOCK(ksobj); for (i = 0; i < pages; i++) - ma[i] = vm_page_grab(ksobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY | + ma[i] = vm_page_grab(ksobj, i, VM_ALLOC_NORMAL | VM_ALLOC_WIRED); for (i = 0; i < pages; i++) { if (ma[i]->valid != VM_PAGE_BITS_ALL) { Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/vm/vm_object.c Thu Aug 22 07:39:53 2013 (r254649) @@ -2034,8 +2034,7 @@ vm_object_populate(vm_object_t object, v VM_OBJECT_ASSERT_WLOCKED(object); for (pindex = start; pindex < end; pindex++) { - m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | - VM_ALLOC_RETRY); + m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL); if (m->valid != VM_PAGE_BITS_ALL) { ma[0] = m; rv = vm_pager_get_pages(object, ma, 1, 0); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/vm/vm_page.c Thu Aug 22 07:39:53 2013 (r254649) @@ -2685,9 +2685,6 @@ vm_page_advise(vm_page_t m, int advice) * to be in the object. If the page doesn't exist, first allocate it * and then conditionally zero it. * - * The caller must always specify the VM_ALLOC_RETRY flag. This is intended - * to facilitate its eventual removal. - * * This routine may sleep. * * The object must be locked on entry. The lock will, however, be released @@ -2700,8 +2697,6 @@ vm_page_grab(vm_object_t object, vm_pind int sleep; VM_OBJECT_ASSERT_WLOCKED(object); - KASSERT((allocflags & VM_ALLOC_RETRY) != 0, - ("vm_page_grab: VM_ALLOC_RETRY is required")); KASSERT((allocflags & VM_ALLOC_SBUSY) == 0 || (allocflags & VM_ALLOC_IGN_SBUSY) != 0, ("vm_page_grab: VM_ALLOC_SBUSY/VM_ALLOC_IGN_SBUSY mismatch")); @@ -2735,8 +2730,7 @@ retrylookup: return (m); } } - m = vm_page_alloc(object, pindex, allocflags & ~(VM_ALLOC_RETRY | - VM_ALLOC_IGN_SBUSY)); + m = vm_page_alloc(object, pindex, allocflags & ~VM_ALLOC_IGN_SBUSY); if (m == NULL) { VM_OBJECT_WUNLOCK(object); VM_WAIT; Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Thu Aug 22 07:10:18 2013 (r254648) +++ head/sys/vm/vm_page.h Thu Aug 22 07:39:53 2013 (r254649) @@ -389,7 +389,6 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa) /* page allocation flags: */ #define VM_ALLOC_WIRED 0x0020 /* non pageable */ #define VM_ALLOC_ZERO 0x0040 /* Try to obtain a zeroed page */ -#define VM_ALLOC_RETRY 0x0080 /* Mandatory with vm_page_grab() */ #define VM_ALLOC_NOOBJ 0x0100 /* No associated object */ #define VM_ALLOC_NOBUSY 0x0200 /* Do not busy the page */ #define VM_ALLOC_IFCACHED 0x0400 /* Fail if the page is not cached */ From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 07:43: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 ESMTP id 15C11D4; Thu, 22 Aug 2013 07:43:37 +0000 (UTC) (envelope-from des@FreeBSD.org) 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 036B625B9; Thu, 22 Aug 2013 07:43: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 r7M7haot024935; Thu, 22 Aug 2013 07:43:36 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7M7haKx024934; Thu, 22 Aug 2013 07:43:36 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201308220743.r7M7haKx024934@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Thu, 22 Aug 2013 07:43:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254650 - head/lib/libfetch 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.14 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: Thu, 22 Aug 2013 07:43:37 -0000 Author: des Date: Thu Aug 22 07:43:36 2013 New Revision: 254650 URL: http://svnweb.freebsd.org/changeset/base/254650 Log: Even though it doesn't really make sense in the context of a CONNECT request, RFC 2616 14.23 mandates the presence of the Host: header in all HTTP 1.1 requests. PR: kern/181445 Submitted by: Kimo MFC after: 3 days Modified: head/lib/libfetch/http.c Modified: head/lib/libfetch/http.c ============================================================================== --- head/lib/libfetch/http.c Thu Aug 22 07:39:53 2013 (r254649) +++ head/lib/libfetch/http.c Thu Aug 22 07:43:36 2013 (r254650) @@ -1400,6 +1400,8 @@ http_connect(struct url *URL, struct url if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 && purl) { http_cmd(conn, "CONNECT %s:%d HTTP/1.1", URL->host, URL->port); + http_cmd(conn, "Host: %s:%d", + URL->host, URL->port); http_cmd(conn, ""); if (http_get_reply(conn) != HTTP_OK) { fetch_close(conn); From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 08:15:04 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 ESMTP id 6FDD89FB; Thu, 22 Aug 2013 08:15:04 +0000 (UTC) (envelope-from erwin@FreeBSD.org) 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 59EC027BB; Thu, 22 Aug 2013 08:15:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7M8F4o6040878; Thu, 22 Aug 2013 08:15:04 GMT (envelope-from erwin@svn.freebsd.org) Received: (from erwin@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7M8F4SN040876; Thu, 22 Aug 2013 08:15:04 GMT (envelope-from erwin@svn.freebsd.org) Message-Id: <201308220815.r7M8F4SN040876@svn.freebsd.org> From: Erwin Lansing Date: Thu, 22 Aug 2013 08:15:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254651 - in head: contrib/bind9 contrib/bind9/bin contrib/bind9/bin/check contrib/bind9/bin/confgen contrib/bind9/bin/dig contrib/bind9/bin/dig/include/dig contrib/bind9/bin/dnssec con... 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.14 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: Thu, 22 Aug 2013 08:15:04 -0000 Author: erwin Date: Thu Aug 22 08:15:03 2013 New Revision: 254651 URL: http://svnweb.freebsd.org/changeset/base/254651 Log: Update Bind to 9.9.3-P2 Notable new features: * Elliptic Curve Digital Signature Algorithm keys and signatures in DNSSEC are now supported per RFC 6605. [RT #21918] * Introduces a new tool "dnssec-verify" that validates a signed zone, checking for the correctness of signatures and NSEC/NSEC3 chains. [RT #23673] * BIND now recognizes the TLSA resource record type, created to support IETF DANE (DNS-based Authentication of Named Entities) [RT #28989] * The new "inline-signing" option, in combination with the "auto-dnssec" option that was introduced in BIND 9.7, allows named to sign zones completely transparently. Approved by: delphij (mentor) MFC after: 3 days Sponsored by: DK Hostmaster A/S Added: head/contrib/bind9/bin/dnssec/dnssec-verify.8 - copied unchanged from r254322, vendor/bind9/dist/bin/dnssec/dnssec-verify.8 head/contrib/bind9/bin/dnssec/dnssec-verify.c - copied unchanged from r254322, vendor/bind9/dist/bin/dnssec/dnssec-verify.c head/contrib/bind9/bin/dnssec/dnssec-verify.docbook - copied unchanged from r254322, vendor/bind9/dist/bin/dnssec/dnssec-verify.docbook head/contrib/bind9/bin/dnssec/dnssec-verify.html - copied unchanged from r254322, vendor/bind9/dist/bin/dnssec/dnssec-verify.html head/contrib/bind9/bin/named/bind9.ver3.xsl - copied unchanged from r254322, vendor/bind9/dist/bin/named/bind9.ver3.xsl head/contrib/bind9/bin/named/bind9.ver3.xsl.h - copied unchanged from r254322, vendor/bind9/dist/bin/named/bind9.ver3.xsl.h head/contrib/bind9/doc/arm/man.dnssec-verify.html - copied unchanged from r254322, vendor/bind9/dist/doc/arm/man.dnssec-verify.html head/contrib/bind9/lib/dns/clientinfo.c - copied unchanged from r254322, vendor/bind9/dist/lib/dns/clientinfo.c head/contrib/bind9/lib/dns/include/dns/clientinfo.h - copied unchanged from r254322, vendor/bind9/dist/lib/dns/include/dns/clientinfo.h head/contrib/bind9/lib/dns/include/dns/update.h - copied unchanged from r254322, vendor/bind9/dist/lib/dns/include/dns/update.h head/contrib/bind9/lib/dns/rdata/generic/naptr_35.c - copied unchanged from r254322, vendor/bind9/dist/lib/dns/rdata/generic/naptr_35.c head/contrib/bind9/lib/dns/rdata/generic/naptr_35.h - copied unchanged from r254322, vendor/bind9/dist/lib/dns/rdata/generic/naptr_35.h head/contrib/bind9/lib/dns/update.c - copied unchanged from r254322, vendor/bind9/dist/lib/dns/update.c head/contrib/bind9/lib/isc/include/isc/pool.h - copied unchanged from r254322, vendor/bind9/dist/lib/isc/include/isc/pool.h head/contrib/bind9/lib/isc/include/isc/queue.h - copied unchanged from r254322, vendor/bind9/dist/lib/isc/include/isc/queue.h head/contrib/bind9/lib/isc/pool.c - copied unchanged from r254322, vendor/bind9/dist/lib/isc/pool.c head/usr.sbin/dnssec-verify/ head/usr.sbin/dnssec-verify/Makefile (contents, props changed) Deleted: head/contrib/bind9/lib/dns/rdata/in_1/naptr_35.c head/contrib/bind9/lib/dns/rdata/in_1/naptr_35.h Modified: head/contrib/bind9/CHANGES head/contrib/bind9/COPYRIGHT head/contrib/bind9/HISTORY head/contrib/bind9/Makefile.in head/contrib/bind9/README head/contrib/bind9/bin/Makefile.in head/contrib/bind9/bin/check/check-tool.c head/contrib/bind9/bin/check/check-tool.h head/contrib/bind9/bin/check/named-checkconf.c head/contrib/bind9/bin/check/named-checkzone.8 head/contrib/bind9/bin/check/named-checkzone.c head/contrib/bind9/bin/check/named-checkzone.docbook head/contrib/bind9/bin/check/named-checkzone.html head/contrib/bind9/bin/confgen/ddns-confgen.c head/contrib/bind9/bin/confgen/rndc-confgen.c head/contrib/bind9/bin/dig/Makefile.in head/contrib/bind9/bin/dig/dig.1 head/contrib/bind9/bin/dig/dig.c head/contrib/bind9/bin/dig/dig.docbook head/contrib/bind9/bin/dig/dig.html head/contrib/bind9/bin/dig/dighost.c head/contrib/bind9/bin/dig/host.c head/contrib/bind9/bin/dig/include/dig/dig.h head/contrib/bind9/bin/dig/nslookup.c head/contrib/bind9/bin/dnssec/Makefile.in head/contrib/bind9/bin/dnssec/dnssec-dsfromkey.8 head/contrib/bind9/bin/dnssec/dnssec-dsfromkey.c head/contrib/bind9/bin/dnssec/dnssec-dsfromkey.docbook head/contrib/bind9/bin/dnssec/dnssec-dsfromkey.html head/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.8 head/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.c head/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.docbook head/contrib/bind9/bin/dnssec/dnssec-keyfromlabel.html head/contrib/bind9/bin/dnssec/dnssec-keygen.8 head/contrib/bind9/bin/dnssec/dnssec-keygen.c head/contrib/bind9/bin/dnssec/dnssec-keygen.docbook head/contrib/bind9/bin/dnssec/dnssec-keygen.html head/contrib/bind9/bin/dnssec/dnssec-revoke.c head/contrib/bind9/bin/dnssec/dnssec-revoke.docbook head/contrib/bind9/bin/dnssec/dnssec-settime.8 head/contrib/bind9/bin/dnssec/dnssec-settime.c head/contrib/bind9/bin/dnssec/dnssec-settime.docbook head/contrib/bind9/bin/dnssec/dnssec-settime.html head/contrib/bind9/bin/dnssec/dnssec-signzone.8 head/contrib/bind9/bin/dnssec/dnssec-signzone.c head/contrib/bind9/bin/dnssec/dnssec-signzone.docbook head/contrib/bind9/bin/dnssec/dnssec-signzone.html head/contrib/bind9/bin/dnssec/dnssectool.c head/contrib/bind9/bin/dnssec/dnssectool.h head/contrib/bind9/bin/named/Makefile.in head/contrib/bind9/bin/named/builtin.c head/contrib/bind9/bin/named/client.c head/contrib/bind9/bin/named/config.c head/contrib/bind9/bin/named/control.c head/contrib/bind9/bin/named/controlconf.c head/contrib/bind9/bin/named/include/dlz/dlz_dlopen_driver.h head/contrib/bind9/bin/named/include/named/client.h head/contrib/bind9/bin/named/include/named/control.h head/contrib/bind9/bin/named/include/named/globals.h head/contrib/bind9/bin/named/include/named/interfacemgr.h head/contrib/bind9/bin/named/include/named/server.h head/contrib/bind9/bin/named/include/named/zoneconf.h head/contrib/bind9/bin/named/interfacemgr.c head/contrib/bind9/bin/named/logconf.c head/contrib/bind9/bin/named/main.c head/contrib/bind9/bin/named/named.8 head/contrib/bind9/bin/named/named.conf.5 head/contrib/bind9/bin/named/named.conf.docbook head/contrib/bind9/bin/named/named.conf.html head/contrib/bind9/bin/named/named.docbook head/contrib/bind9/bin/named/named.html head/contrib/bind9/bin/named/query.c head/contrib/bind9/bin/named/server.c head/contrib/bind9/bin/named/statschannel.c head/contrib/bind9/bin/named/unix/Makefile.in head/contrib/bind9/bin/named/unix/dlz_dlopen_driver.c head/contrib/bind9/bin/named/unix/os.c head/contrib/bind9/bin/named/update.c head/contrib/bind9/bin/named/xfrout.c head/contrib/bind9/bin/named/zoneconf.c head/contrib/bind9/bin/nsupdate/Makefile.in head/contrib/bind9/bin/nsupdate/nsupdate.1 head/contrib/bind9/bin/nsupdate/nsupdate.c head/contrib/bind9/bin/nsupdate/nsupdate.docbook head/contrib/bind9/bin/nsupdate/nsupdate.html head/contrib/bind9/bin/rndc/rndc.c head/contrib/bind9/bin/tools/genrandom.8 head/contrib/bind9/bin/tools/genrandom.docbook head/contrib/bind9/bin/tools/genrandom.html head/contrib/bind9/bin/tools/nsec3hash.c head/contrib/bind9/config.h.in head/contrib/bind9/config.threads.in head/contrib/bind9/configure.in head/contrib/bind9/doc/arm/Bv9ARM-book.xml head/contrib/bind9/doc/arm/Bv9ARM.ch01.html head/contrib/bind9/doc/arm/Bv9ARM.ch03.html head/contrib/bind9/doc/arm/Bv9ARM.ch04.html head/contrib/bind9/doc/arm/Bv9ARM.ch05.html head/contrib/bind9/doc/arm/Bv9ARM.ch06.html head/contrib/bind9/doc/arm/Bv9ARM.ch07.html head/contrib/bind9/doc/arm/Bv9ARM.ch08.html head/contrib/bind9/doc/arm/Bv9ARM.ch09.html head/contrib/bind9/doc/arm/Bv9ARM.ch10.html head/contrib/bind9/doc/arm/Bv9ARM.html head/contrib/bind9/doc/arm/Bv9ARM.pdf head/contrib/bind9/doc/arm/dnssec.xml head/contrib/bind9/doc/arm/man.arpaname.html head/contrib/bind9/doc/arm/man.ddns-confgen.html head/contrib/bind9/doc/arm/man.dig.html head/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html head/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html head/contrib/bind9/doc/arm/man.dnssec-keygen.html head/contrib/bind9/doc/arm/man.dnssec-revoke.html head/contrib/bind9/doc/arm/man.dnssec-settime.html head/contrib/bind9/doc/arm/man.dnssec-signzone.html head/contrib/bind9/doc/arm/man.genrandom.html head/contrib/bind9/doc/arm/man.host.html head/contrib/bind9/doc/arm/man.isc-hmac-fixup.html head/contrib/bind9/doc/arm/man.named-checkconf.html head/contrib/bind9/doc/arm/man.named-checkzone.html head/contrib/bind9/doc/arm/man.named-journalprint.html head/contrib/bind9/doc/arm/man.named.html head/contrib/bind9/doc/arm/man.nsec3hash.html head/contrib/bind9/doc/arm/man.nsupdate.html head/contrib/bind9/doc/arm/man.rndc-confgen.html head/contrib/bind9/doc/arm/man.rndc.conf.html head/contrib/bind9/doc/arm/man.rndc.html head/contrib/bind9/doc/arm/pkcs11.xml head/contrib/bind9/doc/misc/options head/contrib/bind9/lib/bind9/api head/contrib/bind9/lib/bind9/check.c head/contrib/bind9/lib/dns/Makefile.in head/contrib/bind9/lib/dns/acache.c head/contrib/bind9/lib/dns/acl.c head/contrib/bind9/lib/dns/adb.c head/contrib/bind9/lib/dns/api head/contrib/bind9/lib/dns/byaddr.c head/contrib/bind9/lib/dns/cache.c head/contrib/bind9/lib/dns/callbacks.c head/contrib/bind9/lib/dns/client.c head/contrib/bind9/lib/dns/db.c head/contrib/bind9/lib/dns/dbtable.c head/contrib/bind9/lib/dns/diff.c head/contrib/bind9/lib/dns/dispatch.c head/contrib/bind9/lib/dns/dns64.c head/contrib/bind9/lib/dns/dnssec.c head/contrib/bind9/lib/dns/dst_api.c head/contrib/bind9/lib/dns/dst_internal.h head/contrib/bind9/lib/dns/dst_openssl.h head/contrib/bind9/lib/dns/dst_parse.c head/contrib/bind9/lib/dns/ecdb.c head/contrib/bind9/lib/dns/gssapi_link.c head/contrib/bind9/lib/dns/gssapictx.c head/contrib/bind9/lib/dns/hmac_link.c head/contrib/bind9/lib/dns/include/dns/Makefile.in head/contrib/bind9/lib/dns/include/dns/acache.h head/contrib/bind9/lib/dns/include/dns/acl.h head/contrib/bind9/lib/dns/include/dns/adb.h head/contrib/bind9/lib/dns/include/dns/cache.h head/contrib/bind9/lib/dns/include/dns/callbacks.h head/contrib/bind9/lib/dns/include/dns/db.h head/contrib/bind9/lib/dns/include/dns/dispatch.h head/contrib/bind9/lib/dns/include/dns/dlz_dlopen.h head/contrib/bind9/lib/dns/include/dns/dnssec.h head/contrib/bind9/lib/dns/include/dns/events.h head/contrib/bind9/lib/dns/include/dns/journal.h head/contrib/bind9/lib/dns/include/dns/log.h head/contrib/bind9/lib/dns/include/dns/master.h head/contrib/bind9/lib/dns/include/dns/masterdump.h head/contrib/bind9/lib/dns/include/dns/nsec.h head/contrib/bind9/lib/dns/include/dns/nsec3.h head/contrib/bind9/lib/dns/include/dns/private.h head/contrib/bind9/lib/dns/include/dns/rdata.h head/contrib/bind9/lib/dns/include/dns/rdataset.h head/contrib/bind9/lib/dns/include/dns/resolver.h head/contrib/bind9/lib/dns/include/dns/result.h head/contrib/bind9/lib/dns/include/dns/rpz.h head/contrib/bind9/lib/dns/include/dns/rriterator.h head/contrib/bind9/lib/dns/include/dns/sdb.h head/contrib/bind9/lib/dns/include/dns/sdlz.h head/contrib/bind9/lib/dns/include/dns/time.h head/contrib/bind9/lib/dns/include/dns/types.h head/contrib/bind9/lib/dns/include/dns/view.h head/contrib/bind9/lib/dns/include/dns/zone.h head/contrib/bind9/lib/dns/include/dns/zt.h head/contrib/bind9/lib/dns/include/dst/dst.h head/contrib/bind9/lib/dns/iptable.c head/contrib/bind9/lib/dns/journal.c head/contrib/bind9/lib/dns/key.c head/contrib/bind9/lib/dns/keytable.c head/contrib/bind9/lib/dns/log.c head/contrib/bind9/lib/dns/lookup.c head/contrib/bind9/lib/dns/master.c head/contrib/bind9/lib/dns/masterdump.c head/contrib/bind9/lib/dns/message.c head/contrib/bind9/lib/dns/nsec.c head/contrib/bind9/lib/dns/nsec3.c head/contrib/bind9/lib/dns/openssldh_link.c head/contrib/bind9/lib/dns/openssldsa_link.c head/contrib/bind9/lib/dns/opensslecdsa_link.c head/contrib/bind9/lib/dns/opensslgost_link.c head/contrib/bind9/lib/dns/opensslrsa_link.c head/contrib/bind9/lib/dns/private.c head/contrib/bind9/lib/dns/rbt.c head/contrib/bind9/lib/dns/rbtdb.c head/contrib/bind9/lib/dns/rdata.c head/contrib/bind9/lib/dns/rdata/any_255/tsig_250.c head/contrib/bind9/lib/dns/rdata/generic/cert_37.c head/contrib/bind9/lib/dns/rdata/generic/dlv_32769.c head/contrib/bind9/lib/dns/rdata/generic/dnskey_48.c head/contrib/bind9/lib/dns/rdata/generic/ds_43.c head/contrib/bind9/lib/dns/rdata/generic/ipseckey_45.c head/contrib/bind9/lib/dns/rdata/generic/key_25.c head/contrib/bind9/lib/dns/rdata/generic/keydata_65533.c head/contrib/bind9/lib/dns/rdata/generic/nsec3_50.c head/contrib/bind9/lib/dns/rdata/generic/nsec3_50.h head/contrib/bind9/lib/dns/rdata/generic/opt_41.c head/contrib/bind9/lib/dns/rdata/generic/rrsig_46.c head/contrib/bind9/lib/dns/rdata/generic/sig_24.c head/contrib/bind9/lib/dns/rdata/generic/soa_6.c head/contrib/bind9/lib/dns/rdata/generic/sshfp_44.c head/contrib/bind9/lib/dns/rdata/generic/tkey_249.c head/contrib/bind9/lib/dns/rdata/generic/uri_256.c head/contrib/bind9/lib/dns/rdata/generic/uri_256.h head/contrib/bind9/lib/dns/rdata/in_1/dhcid_49.c head/contrib/bind9/lib/dns/resolver.c head/contrib/bind9/lib/dns/sdb.c head/contrib/bind9/lib/dns/sdlz.c head/contrib/bind9/lib/dns/validator.c head/contrib/bind9/lib/dns/view.c head/contrib/bind9/lib/dns/xfrin.c head/contrib/bind9/lib/dns/zone.c head/contrib/bind9/lib/dns/zt.c head/contrib/bind9/lib/irs/api head/contrib/bind9/lib/isc/Makefile.in head/contrib/bind9/lib/isc/api head/contrib/bind9/lib/isc/include/isc/heap.h head/contrib/bind9/lib/isc/include/isc/list.h head/contrib/bind9/lib/isc/include/isc/mem.h head/contrib/bind9/lib/isc/include/isc/namespace.h head/contrib/bind9/lib/isc/include/isc/radix.h head/contrib/bind9/lib/isc/include/isc/socket.h head/contrib/bind9/lib/isc/include/isc/task.h head/contrib/bind9/lib/isc/include/isc/taskpool.h head/contrib/bind9/lib/isc/log.c head/contrib/bind9/lib/isc/radix.c head/contrib/bind9/lib/isc/socket_api.c head/contrib/bind9/lib/isc/task.c head/contrib/bind9/lib/isc/task_api.c head/contrib/bind9/lib/isc/task_p.h head/contrib/bind9/lib/isc/taskpool.c head/contrib/bind9/lib/isc/unix/socket.c head/contrib/bind9/lib/isccc/api head/contrib/bind9/lib/isccfg/api head/contrib/bind9/lib/isccfg/namedconf.c head/contrib/bind9/lib/lwres/api head/contrib/bind9/lib/lwres/man/lwres_config.3 head/contrib/bind9/lib/lwres/man/lwres_config.docbook head/contrib/bind9/lib/lwres/man/lwres_config.html head/contrib/bind9/lib/lwres/man/lwres_context.3 head/contrib/bind9/lib/lwres/man/lwres_context.docbook head/contrib/bind9/lib/lwres/man/lwres_context.html head/contrib/bind9/lib/lwres/man/lwres_gabn.3 head/contrib/bind9/lib/lwres/man/lwres_gabn.docbook head/contrib/bind9/lib/lwres/man/lwres_gabn.html head/contrib/bind9/lib/lwres/man/lwres_gai_strerror.3 head/contrib/bind9/lib/lwres/man/lwres_gai_strerror.docbook head/contrib/bind9/lib/lwres/man/lwres_gai_strerror.html head/contrib/bind9/lib/lwres/man/lwres_getaddrinfo.3 head/contrib/bind9/lib/lwres/man/lwres_getaddrinfo.docbook head/contrib/bind9/lib/lwres/man/lwres_getaddrinfo.html head/contrib/bind9/lib/lwres/man/lwres_gethostent.3 head/contrib/bind9/lib/lwres/man/lwres_gethostent.docbook head/contrib/bind9/lib/lwres/man/lwres_gethostent.html head/contrib/bind9/lib/lwres/man/lwres_getipnode.3 head/contrib/bind9/lib/lwres/man/lwres_getipnode.docbook head/contrib/bind9/lib/lwres/man/lwres_getipnode.html head/contrib/bind9/lib/lwres/man/lwres_getnameinfo.3 head/contrib/bind9/lib/lwres/man/lwres_getnameinfo.docbook head/contrib/bind9/lib/lwres/man/lwres_getnameinfo.html head/contrib/bind9/lib/lwres/man/lwres_getrrsetbyname.3 head/contrib/bind9/lib/lwres/man/lwres_getrrsetbyname.docbook head/contrib/bind9/lib/lwres/man/lwres_getrrsetbyname.html head/contrib/bind9/lib/lwres/man/lwres_gnba.3 head/contrib/bind9/lib/lwres/man/lwres_gnba.docbook head/contrib/bind9/lib/lwres/man/lwres_gnba.html head/contrib/bind9/lib/lwres/man/lwres_hstrerror.3 head/contrib/bind9/lib/lwres/man/lwres_hstrerror.docbook head/contrib/bind9/lib/lwres/man/lwres_hstrerror.html head/contrib/bind9/lib/lwres/man/lwres_inetntop.3 head/contrib/bind9/lib/lwres/man/lwres_inetntop.docbook head/contrib/bind9/lib/lwres/man/lwres_inetntop.html head/contrib/bind9/lib/lwres/man/lwres_noop.3 head/contrib/bind9/lib/lwres/man/lwres_noop.docbook head/contrib/bind9/lib/lwres/man/lwres_noop.html head/contrib/bind9/lib/lwres/man/lwres_packet.3 head/contrib/bind9/lib/lwres/man/lwres_packet.docbook head/contrib/bind9/lib/lwres/man/lwres_packet.html head/contrib/bind9/lib/lwres/man/lwres_resutil.3 head/contrib/bind9/lib/lwres/man/lwres_resutil.docbook head/contrib/bind9/lib/lwres/man/lwres_resutil.html head/contrib/bind9/lib/lwres/print_p.h head/contrib/bind9/lib/lwres/strtoul.c head/contrib/bind9/lib/lwres/unix/Makefile.in head/contrib/bind9/lib/lwres/unix/include/Makefile.in head/contrib/bind9/lib/lwres/unix/include/lwres/Makefile.in head/contrib/bind9/lib/lwres/unix/include/lwres/net.h head/contrib/bind9/lib/lwres/version.c head/contrib/bind9/make/Makefile.in head/contrib/bind9/make/includes.in head/contrib/bind9/make/rules.in head/contrib/bind9/mkinstalldirs head/contrib/bind9/version head/lib/bind/config.h head/lib/bind/dns/Makefile head/lib/bind/dns/code.h head/lib/bind/dns/dns/rdatastruct.h head/lib/bind/isc/Makefile head/share/doc/bind9/Makefile head/usr.bin/nslookup/Makefile head/usr.bin/nsupdate/Makefile head/usr.sbin/Makefile Directory Properties: head/contrib/bind9/ (props changed) Modified: head/contrib/bind9/CHANGES ============================================================================== --- head/contrib/bind9/CHANGES Thu Aug 22 07:43:36 2013 (r254650) +++ head/contrib/bind9/CHANGES Thu Aug 22 08:15:03 2013 (r254651) @@ -1,15 +1,15 @@ - --- 9.8.5-P2 released --- + --- 9.9.3-P2 released --- 3621. [security] Incorrect bounds checking on private type 'keydata' can lead to a remotely triggerable REQUIRE failure (CVE-2013-4854). [RT #34238] - --- 9.8.5-P1 released --- + --- 9.9.3-P1 released --- 3584. [security] Caching data from an incompletely signed zone could trigger an assertion failure in resolver.c [RT #33690] - --- 9.8.5 released --- + --- 9.9.3 released --- 3568. [cleanup] Add a product description line to the version file, to be reported by named -v/-V. [RT #33366] @@ -21,7 +21,7 @@ 3561. [bug] dig: issue a warning if an EDNS query returns FORMERR or NOTIMP. Adjust usage message. [RT #33363] - --- 9.8.5rc1 released --- + --- 9.9.3rc2 released --- 3560. [bug] isc-config.sh did not honor includedir and libdir when set via configure. [RT #33345] @@ -31,6 +31,8 @@ 3558. [bug] IXFR of a DLZ stored zone was broken. [RT #33331] +3557. [bug] Reloading redirect zones was broken. [RT #33292] + 3556. [maint] Added AAAA for D.ROOT-SERVERS.NET. 3555. [bug] Address theoretical race conditions in acache.c @@ -51,9 +53,7 @@ 3547. [bug] Some malformed unknown rdata records were not properly detected and rejected. [RT #33129] -3056. [func] Added support for URI resource record. [RT #23386] - - --- 9.8.5rc1 released --- + --- 9.9.3rc1 released --- 3546. [func] Add EUI48 and EUI64 types. [RT #33082] @@ -64,8 +64,6 @@ 3543. [bug] Update socket structure before attaching to socket manager after accept. [RT #33084] -3542. [bug] masterformat system test was broken. [RT #33086] - 3541. [bug] Parts of libdns were not properly initialized when built in libexport mode. [RT #33028] @@ -94,6 +92,17 @@ 3530. [contrib] Better RTT tracking in queryperf. [RT #30128] +3528. [func] New "dnssec-coverage" command scans the timing + metadata for a set of DNSSEC keys and reports if a + lapse in signing coverage has been scheduled + inadvertently. (Note: This tool depends on python; + it will not be built or installed on systems that + do not have a python interpreter.) [RT #28098] + +3527. [compat] Add a URI to allow applications to explicitly + request a particular XML schema from the statistics + channel, returning 404 if not supported. [RT #32481] + 3526. [cleanup] Set up dependencies for unit tests correctly during build. [RT #32803] @@ -102,7 +111,7 @@ 3520. [bug] 'mctx' was not being referenced counted in some places where it should have been. [RT #32794] - --- 9.8.5b2 released --- + --- 9.9.3b2 released --- 3517. [bug] Reorder destruction to avoid shutdown race. [RT #32777] @@ -114,6 +123,8 @@ to 1024 bits for hmac-sha384 and hmac-sha512. [RT #32753] +3511. [doc] Improve documentation of redirect zones. [RT #32756] + 3509. [cleanup] Added a product line to version file to allow for easy naming of different products (BIND vs BIND ESV, for example). [RT #32755] @@ -121,8 +132,24 @@ 3508. [contrib] queryperf was incorrectly rejecting the -T option. [RT #32338] +3507. [bug] Statistics channel XSL (when built with + --enable-newstats) had a glitch when attempting + to chart query data before any queries had been + received. [RT #32620] + +3505. [bug] When setting "max-cache-size" and "max-acache-size", + larger values than 4 gigabytes could not be set + explicitly, though larger sizes were available + when setting cache size to 0. This has been + corrected; the full range is now available. + [RT #32358] + 3503. [doc] Clarify size_spec syntax. [RT #32449] +3501. [func] zone-statistics now takes three options: full, + terse, and none. "yes" and "no" are retained as + synonyms for full and terse, respectively. [RT #29165] + 3500. [security] Support NAPTR regular expression validation on all platforms without using libregex, which can be vulnerable to memory exhaustion attack @@ -141,6 +168,15 @@ NSIP and NSDNAME checking. --enable-rpz-nsip and --enable-rpz-nsdname are now the default. [RT #32251] +3493. [contrib] Added BDBHPT dynamically-lodable DLZ module, + contributed by Mark Goldfinch. [RT #32549] + +3492. [bug] Fixed a regression in zone loading performance + due to lock contention. [RT #30399] + +3491. [bug] Slave zones using inline-signing must specify a + file name. [RT #31946] + 3489. [bug] --enable-developer now turns on ISC_LIST_CHECKINIT. When cloning a rdataset do not copy the link contents. [RT #32651] @@ -156,8 +192,14 @@ 3485. [cleanup] Only compile openssl_gostlink.c if we support GOST. +3483. [bug] Corrected XSL code in use with --enable-newstats. + [RT #32587] + 3481. [cleanup] Removed use of const const in atf. +3480. [bug] Silence logging noise when setting up zone + statistics. [RT #32525] + 3479. [bug] Address potential memory leaks in gssapi support code. [RT #32405] @@ -167,10 +209,18 @@ 3474. [bug] nsupdate could assert when the local and remote address families didn't match. [RT #22897] +3473. [bug] dnssec-signzone/verify could incorrectly report + an error condition due to an empty node above an + opt-out delegation lacking an NSEC3. [RT #32072] + +3471. [bug] The number of UDP dispatches now defaults to + the number of CPUs even if -n has been set to + a higher value. [RT #30964] + 3470. [bug] Slave zones could fail to dump when successfully refreshing after an initial failure. [RT #31276] - --- 9.8.5b1 released --- + --- 9.9.3b1 released --- 3468. [security] RPZ rules to generate A records (but not AAAA records) could trigger an assertion failure when used in @@ -179,6 +229,9 @@ 3467. [bug] Added checks in dnssec-keygen and dnssec-settime to check for delete date < inactive date. [RT #31719] +3466. [contrib] Corrected the DNS_CLIENTINFOMETHODS_VERSION check + in DLZ example driver. [RT #32275] + 3465. [bug] Handle isolated reserved ports. [RT #31778] 3464. [maint] Updates to PKCS#11 openssl patches, supporting @@ -192,6 +245,8 @@ 3461. [bug] Negative responses could incorrectly have AD=1 set. [RT #32237] +3460. [bug] Only link against readline where needed. [RT #29810] + 3458. [bug] Return FORMERR when presented with a overly long domain named in a request. [RT #29682] @@ -203,6 +258,9 @@ 3454. [port] sparc64: improve atomic support. [RT #25182] +3453. [bug] 'rndc addzone' of a zone with 'inline-signing yes;' + failed. [RT #31960] + 3452. [bug] Accept duplicate singleton records. [RT #32329] 3451. [port] Increase per thread stack size from 64K to 1M. @@ -266,9 +324,19 @@ 3427. [bug] dig +trace incorrectly displayed name server addresses instead of names. [RT #31641] +3426. [bug] dnssec-checkds: Clearer output when records are not + found. [RT #31968] + 3425. [bug] "acacheentry" reference counting was broken resulting in use after free. [RT #31908] +3424. [func] dnssec-dsfromkey now emits the hash without spaces. + [RT #31951] + +3423. [bug] "rndc signing -nsec3param" didn't accept the full + range of possible values. Address portability issues. + [RT #31938] + 3422. [bug] Added a clear error message for when the SOA does not match the referral. [RT #31281] @@ -279,9 +347,22 @@ 3419. [bug] Memory leak on validation cancel. [RT #31869] +3417. [func] Optional new XML schema (version 3.0) for the + statistics channel adds query type statistics at the + zone level, and flattens the XML tree and uses + compressed format to optimize parsing. Includes new XSL + that permits charting via the Google Charts API on + browsers that support javascript in XSL. To enable, + build with "configure --enable-newstats". [RT #30023] + +3416. [bug] Named could die on shutdown if running with 128 UDP + dispatches per interface. [RT #31743] + 3415. [bug] named could die with a REQUIRE failure if a validation was canceled. [RT #31804] +3414. [bug] Address locking issues found by Coverity. [RT #31626] + 3412. [bug] Copy timeval structure from control message data. [RT #31548] @@ -295,6 +376,11 @@ (DNS-based Authentication of Named Entities). [RT #30513] +3408. [bug] Some DNSSEC-related options (update-check-ksk, + dnssec-loadkeys-interval, dnssec-dnskey-kskonly) + are now legal in slave zones as long as + inline-signing is in use. [RT #31078] + 3406. [bug] mem.c: Fix compilation errors when building with ISC_MEM_TRACKLINES or ISC_MEMPOOL_NAMES disabled. Also, ISC_MEM_DEBUG is no longer optional. [RT #31559] @@ -316,6 +402,13 @@ in the "srcid" file in the build tree and normally set to the most recent git hash. [RT #31494] +3399. [port] netbsd: rename 'bool' parameter to avoid namespace + clash. [RT #31515] + +3398. [bug] SOA parameters were not being updated with inline + signed zones if the zone was modified while the + server was offline. [RT #29272] + 3397. [bug] dig crashed when using +nssearch with +tcp. [RT #25298] 3396. [bug] OPT records were incorrectly removed from signed, @@ -348,11 +441,10 @@ 3386. [bug] Address locking violation when generating new NSEC / NSEC3 chains. [RT #31224] -3384. [bug] Improved logging of crypto errors. [RT #30963] +3385. [bug] named-checkconf didn't detect missing master lists + in also-notify clauses. [RT #30810] -3383. [security] A certain combination of records in the RBT could - cause named to hang while populating the additional - section of a response. [RT #31090] +3384. [bug] Improved logging of crypto errors. [RT #30963] 3382. [bug] SOA query from slave used use-v6-udp-ports range, if set, regardless of the address family in use. @@ -370,6 +462,9 @@ 3378. [bug] Handle missing 'managed-keys-directory' better. [RT #30625] +3377. [bug] Removed spurious newline from NSEC3 multiline + output. [RT #31044] + 3376. [bug] Lack of EDNS support was being recorded without a successful response. [RT #30811] @@ -386,19 +481,34 @@ add NS RRsets to the additional section or not. [RT #30479] - --- 9.8.4 released --- +3316. [tuning] Improved locking performance when recursing. + [RT #28836] + +3315. [tuning] Use multiple dispatch objects for sending upstream + queries; this can improve performance on busy + multiprocessor systems by reducing lock contention. + [RT #28605] + + --- 9.9.2 released --- + +3383. [security] A certain combination of records in the RBT could + cause named to hang while populating the additional + section of a response. [RT #31090] 3373. [bug] win32: open raw files in binary mode. [RT #30944] 3364. [security] Named could die on specially crafted record. [RT #30416] - --- 9.8.4rc1 released --- + --- 9.9.2rc1 released --- + +3370. [bug] Address use after free while shutting down. [RT #30241] 3369. [bug] nsupdate terminated unexpectedly in interactive mode if built with readline support. [RT #29550] -3368. [bug] and were not C++ safe. +3368. [bug] , and + were not C++ safe. 3367. [bug] dns_dnsseckey_create() result was not being checked. [RT #30685] @@ -417,6 +527,9 @@ could trigger an assertion failure on startup. [RT #27730] +3361. [bug] "rndc signing -nsec3param" didn't work correctly + when salt was set to '-' (no salt). [RT #30099] + 3360. [bug] 'host -w' could die. [RT #18723] 3359. [bug] An improperly-formed TSIG secret could cause a @@ -428,10 +541,12 @@ approaching their expiry, so they don't remain in caches after expiry. [RT #26429] - --- 9.8.4b1 released --- +3355. [port] Use more portable awk in verify system test. 3354. [func] Improve OpenSSL error logging. [RT #29932] + --- 9.9.2b1 released --- + 3353. [bug] Use a single task for task exclusive operations. [RT #29872] @@ -446,6 +561,8 @@ ISC_MEM_DEBUGCTX memory debugging flag is set. [RT #30240] +3349. [bug] Change #3345 was incomplete. [RT #30233] + 3348. [bug] Prevent RRSIG data from being cached if a negative record matching the covering type exists at a higher trust level. Such data already can't be retrieved from @@ -459,16 +576,42 @@ 3346. [security] Bad-cache data could be used before it was initialized, causing an assert. [RT #30025] +3345. [bug] Addressed race condition when removing the last item + or inserting the first item in an ISC_QUEUE. + [RT #29539] + +3344. [func] New "dnssec-checkds" command checks a zone to + determine which DS records should be published + in the parent zone, or which DLV records should be + published in a DLV zone, and queries the DNS to + ensure that it exists. (Note: This tool depends + on python; it will not be built or installed on + systems that do not have a python interpreter.) + [RT #28099] + 3342. [bug] Change #3314 broke saving of stub zones to disk resulting in excessive cpu usage in some cases. [RT #29952] +3341. [func] New "dnssec-verify" command checks a signed zone + to ensure correctness of signatures and of NSEC/NSEC3 + chains. [RT #23673] + +3339. [func] Allow the maximum supported rsa exponent size to be + specified: "max-rsa-exponent-size ;" [RT #29228] + +3338. [bug] Address race condition in units tests: asyncload_zone + and asyncload_zt. [RT #26100] + 3337. [bug] Change #3294 broke support for the multiple keys in controls. [RT #29694] 3335. [func] nslookup: return a nonzero exit code when unable to get an answer. [RT #29492] +3334. [bug] Hold a zone table reference while performing a + asynchronous load of a zone. [RT #28326] + 3333. [bug] Setting resolver-query-timeout too low can cause named to not recover if it loses connectivity. [RT #29623] @@ -504,7 +647,7 @@ 3317. [func] Add ECDSA support (RFC 6605). [RT #21918] - --- 9.8.3 released --- + --- 9.9.1 released --- 3318. [tuning] Reduce the amount of work performed while holding a bucket lock when finished with a fetch context. @@ -536,6 +679,8 @@ 3304. [bug] Use hmctx, not mctx when freeing rbtdb->heaps. [RT #28571] +3303. [bug] named could die when reloading. [RT #28606] + 3302. [bug] dns_dnssec_findmatchingkeys could fail to find keys if the zone name contained character that required special mappings. [RT #28600] @@ -549,22 +694,15 @@ 3299. [bug] Make SDB handle errors from database drivers better. [RT #28534] -3232. [bug] Zero zone->curmaster before return in - dns_zone_setmasterswithkeys(). [RT #26732] - -3183. [bug] Added RTLD_GLOBAL flag to dlopen call. [RT #26301] - -3197. [bug] Don't try to log the filename and line number when - the config parser can't open a file. [RT #22263] - - --- 9.8.2 released --- - 3298. [bug] Named could dereference a NULL pointer in zmgr_start_xfrin_ifquota if the zone was being removed. [RT #28419] 3297. [bug] Named could die on a malformed master file. [RT #28467] +3296. [bug] Named could die with a INSIST failure in + client.c:exit_check. [RT #28346] + 3295. [bug] Adjust isc_time_secondsastimet range check to be more portable. [RT # 26542] @@ -576,6 +714,16 @@ 3290. [bug] was not being installed. [RT #28169] +3273. [bug] AAAA responses could be returned in the additional + section even when filter-aaaa-on-v4 was in use. + [RT #27292] + + --- 9.9.0 released --- + + --- 9.9.0rc4 released --- + +3289. [bug] 'rndc retransfer' failed for inline zones. [RT #28036] + 3288. [bug] dlz_destroy() function wasn't correctly registered by the DLZ dlopen driver. [RT #28056] @@ -584,7 +732,7 @@ 3286. [bug] Managed key maintenance timer could fail to start after 'rndc reconfig'. [RT #26786] - --- 9.8.2rc2 released --- + --- 9.9.0rc3 released --- 3285. [bug] val-frdataset was incorrectly disassociated in proveunsecure after calling startfinddlvsep. @@ -607,24 +755,34 @@ 3280. [bug] Potential double free of a rdataset on out of memory with DNS64. [RT #27762] +3279. [bug] Hold a internal reference to the zone while performing + a asynchronous load. Address potential memory leak + if the asynchronous is cancelled. [RT #27750] + 3278. [bug] Make sure automatic key maintenance is started when "auto-dnssec maintain" is turned on during "rndc reconfig". [RT #26805] +3277. [bug] win32: isc_socket_dup is not implemented. [RT #27696] + 3276. [bug] win32: ns_os_openfile failed to return NULL on safe_open failure. [RT #27696] -3274. [bug] Log when a zone is not reusable. Only set loadtime - on successful loads. [RT #27650] - -3273. [bug] AAAA responses could be returned in the additional - section even when filter-aaaa-on-v4 was in use. - [RT #27292] +3275. [bug] Corrected rndc -h output; the 'rndc sync -clean' + option had been misspelled as '-clear'. (To avoid + future confusion, both options now work.) [RT #27173] 3271. [port] darwin: mksymtbl is not always stable, loop several times before giving up. mksymtbl was using non portable perl to covert 64 bit hex strings. [RT #27653] + --- 9.9.0rc2 released --- + +3270. [bug] "rndc reload" didn't reuse existing zones correctly + when inline-signing was in use. [RT #27650] + +3269. [port] darwin 11 and later now built threaded by default. + 3268. [bug] Convert RRSIG expiry times to 64 timestamps to work out the earliest expiry time. [RT #23311] @@ -636,14 +794,26 @@ DNSKEY RRset was not being properly computed. [RT #26543] +3265. [bug] Corrected a problem with lock ordering in the + inline-signing code. [RT #27557] + +3264. [bug] Automatic regeneration of signatures in an + inline-signing zone could stall when the server + was restarted. [RT #27344] + +3263. [bug] "rndc sync" did not affect the unsigned side of an + inline-signing zone. [RT #27337] + 3262. [bug] Signed responses were handled incorrectly by RPZ. [RT #27316] - --- 9.8.2rc1 released --- +3261. [func] RRset ordering now defaults to random. [RT #27174] 3260. [bug] "rrset-order cyclic" could appear not to rotate for some query patterns. [RT #27170/27185] + --- 9.9.0rc1 released --- + 3259. [bug] named-compilezone: Suppress "dump zone to " message when writing to stdout. [RT #27109] @@ -655,12 +825,21 @@ 3256. [bug] Disable empty zones for lwresd -C. [RT #27139] +3255. [func] No longer require that a empty zones be explicitly + enabled or that a empty zone is disabled for + RFC 1918 empty zones to be configured. [RT #27139] + 3254. [bug] Set isc_socket_ipv6only() on the IPv6 control channels. [RT #22249] 3253. [bug] Return DNS_R_SYNTAX when the input to a text field is too long. [RT #26956] +3252. [bug] When master zones using inline-signing were + updated while the server was offline, the source + zone could fall out of sync with the signed + copy. They can now resynchronize. [RT #26676] + 3251. [bug] Enforce a upper bound (65535 bytes) on the amount of memory dns_sdlz_putrr() can allocate per record to prevent run away memory consumption on ISC_R_NOSPACE. @@ -680,8 +859,34 @@ 3247. [bug] 'raw' format zones failed to preserve load order breaking 'fixed' sort order. [RT #27087] -3243. [port] netbsd,bsdi: the thread defaults were not being - properly set. +3246. [bug] Named failed to start with a empty also-notify list. + [RT #27087] + +3245. [bug] Don't report a error unchanged serials unless there + were other changes when thawing a zone with + ixfr-fromdifferences. [RT #26845] + +3244. [func] Added readline support to nslookup and nsupdate. + Also simplified nsupdate syntax to make "update" + and "prereq" optional. [RT #24659] + +3243. [port] freebsd,netbsd,bsdi: the thread defaults were not + being properly set. + +3242. [func] Extended the header of raw-format master files to + include the serial number of the zone from which + they were generated, if different (as in the case + of inline-signing zones). This is to be used in + inline-signing zones, to track changes between the + unsigned and signed versions of the zone, which may + have different serial numbers. + + (Note: raw zonefiles generated by this version of + BIND are no longer compatible with prior versions. + To generate a backward-compatible raw zonefile + using dnssec-signzone or named-compilezone, specify + output format "raw=0" instead of simply "raw".) + [RT #26587] 3241. [bug] Address race conditions in the resolver code. [RT #26889] @@ -696,10 +901,21 @@ 3237. [bug] dig -6 didn't work with +trace. [RT #26906] - --- 9.8.2b1 released --- +3236. [bug] Backed out changes #3182 and #3202, related to + EDNS(0) fallback behavior. [RT #26416] + +3235. [func] dns_db_diffx, a extended dns_db_diff which returns + the generated diff and optionally writes it to a + journal. [RT #26386] 3234. [bug] 'make depend' produced invalid makefiles. [RT #26830] +3233. [bug] 'rndc freeze/thaw' didn't work for inline zones. + [RT #26632] + +3232. [bug] Zero zone->curmaster before return in + dns_zone_setmasterswithkeys(). [RT #26732] + 3231. [bug] named could fail to send a incompressible zone. [RT #26796] @@ -717,14 +933,29 @@ 3226. [bug] Address minor resource leakages. [RT #26624] +3225. [bug] Silence spurious "setsockopt(517, IPV6_V6ONLY) failed" + messages. [RT #26507] + +3224. [bug] 'rndc signing' argument parsing was broken. [RT #26684] + +3223. [bug] 'task_test privilege_drop' generated false positives. + [RT #26766] + +3222. [cleanup] Replace dns_journal_{get,set}_bitws with + dns_journal_{get,set}_sourceserial. [RT #26634] + 3221. [bug] Fixed a potential core dump on shutdown due to referencing fetch context after it's been freed. [RT #26720] + --- 9.9.0b2 released --- + 3220. [bug] Change #3186 was incomplete; dns_db_rpz_findips() could fail to set the database version correctly, causing an assertion failure. [RT #26180] +3219. [bug] Disable NOEDNS caching following a timeout. + 3218. [security] Cache lookup could return RRSIG data associated with nonexistent records, leading to an assertion failure. [RT #26590] @@ -733,12 +964,24 @@ 3216. [bug] resolver.c:validated() was not thread-safe. [RT #26478] +3215. [bug] 'rndc recursing' could cause a core dump. [RT #26495] + +3214. [func] Add 'named -U' option to set the number of UDP + listener threads per interface. [RT #26485] + 3213. [doc] Clarify ixfr-from-differences behavior. [RT #25188] 3212. [bug] rbtdb.c: failed to remove a node from the deadnodes list prior to adding a reference to it leading a possible assertion failure. [RT #23219] +3211. [func] dnssec-signzone: "-f -" prints to stdout; "-O full" + option prints in single-line-per-record format. + [RT #20287] + +3210. [bug] Canceling the oldest query due to recursive-client + overload could trigger an assertion failure. [RT #26463] + 3209. [func] Add "dnssec-lookaside 'no'". [RT #24858] 3208. [bug] 'dig -y' handle unknown tsig algorithm better. @@ -748,6 +991,11 @@ 3206. [cleanup] Add ISC information to log at start time. [RT #25484] +3205. [func] Upgrade dig's defaults to better reflect modern + nameserver behavior. Enable "dig +adflag" and + "dig +edns=0" by default. Enable "+dnssec" when + running "dig +trace". [RT #23497] + 3204. [bug] When a master server that has been marked as unreachable sends a NOTIFY, mark it reachable again. [RT #25960] @@ -755,12 +1003,24 @@ 3203. [bug] Increase log level to 'info' for validation failures from expired or not-yet-valid RRSIGs. [RT #21796] +3202. [bug] NOEDNS caching on timeout was too aggressive. + [RT #26416] + +3201. [func] 'rndc querylog' can now be given an on/off parameter + instead of only being used as a toggle. [RT #18351] + 3200. [doc] Some rndc functions were undocumented or were missing from 'rndc -h' output. [RT #25555] +3199. [func] When logging client information, include the name + being queried. [RT #25944] + 3198. [doc] Clarified that dnssec-settime can alter keyfile permissions. [RT #24866] +3197. [bug] Don't try to log the filename and line number when + the config parser can't open a file. [RT #22263] + 3196. [bug] nsupdate: return nonzero exit code when target zone doesn't exist. [RT #25783] @@ -789,10 +1049,50 @@ 3187. [port] win32: support for Visual Studio 2008. [RT #26356] + --- 9.9.0b1 released --- + 3186. [bug] Version/db mis-match in rpz code. [RT #26180] +3185. [func] New 'rndc signing' option for auto-dnssec zones: + - 'rndc signing -list' displays the current + state of signing operations + - 'rndc signing -clear' clears the signing state + records for keys that have fully signed the zone + - 'rndc signing -nsec3param' sets the NSEC3 + parameters for the zone + The 'rndc keydone' syntax is removed. [RT #23729] + +3184. [bug] named had excessive cpu usage when a redirect zone was + configured. [RT #26013] + +3183. [bug] Added RTLD_GLOBAL flag to dlopen call. [RT #26301] + +3182. [bug] Auth servers behind firewalls which block packets + greater than 512 bytes may cause other servers to + perform poorly. Now, adb retains edns information + and caches noedns servers. [RT #23392/24964] + +3181. [func] Inline-signing is now supported for master zones. + [RT #26224] + +3180. [func] Local copies of slave zones are now saved in raw + format by default, to improve startup performance. + 'masterfile-format text;' can be used to override + the default, if desired. [RT #25867] + 3179. [port] kfreebsd: build issues. [RT #26273] +3178. [bug] A race condition introduced by change #3163 could + cause an assertion failure on shutdown. [RT #26271] + +3177. [func] 'rndc keydone', remove the indicator record that + named has finished signing the zone with the + corresponding key. [RT #26206] + +3176. [doc] Corrected example code and added a README to the + sample external DLZ module in contrib/dlz/example. + [RT #26215] + 3175. [bug] Fix how DNSSEC positive wildcard responses from a NSEC3 signed zone are validated. Stop sending a unnecessary NSEC3 record when generating such @@ -803,9 +1103,14 @@ 3173. [port] Correctly validate root DS responses. [RT #25726] +3172. [port] darwin 10.* and freebsd [89] are now built threaded by + default. + 3171. [bug] Exclusively lock the task when adding a zone using 'rndc addzone'. [RT #25600] + --- 9.9.0a3 released --- + 3170. [func] RPZ update: - fix precedence among competing rules - improve ARM text including documenting rule precedence @@ -820,10 +1125,28 @@ 3169. [func] Catch db/version mis-matches when calling dns_db_*(). [RT #26017] +3168. [bug] Nxdomain redirection could trigger an assert with + a ANY query. [RT #26017] + 3167. [bug] Negative answers from forwarders were not being correctly tagged making them appear to not be cached. [RT #25380] +3166. [bug] Upgrading a zone to support inline-signing failed. + [RT #26014] + +3165. [bug] dnssec-signzone could generate new signatures when + resigning, even when valid signatures were already + present. [RT #26025] + +3164. [func] Enable DLZ modules to retrieve client information, + so that responses can be changed depending on the + source address of the query. [RT #25768] + +3163. [bug] Use finer-grained locking in client.c to address + concurrency problems with large numbers of threads. + [RT #26044] + 3162. [test] start.pl: modified to allow for "named.args" in ns*/ subdirectory to override stock arguments to named. Largely from RT#26044, but no separate ticket. @@ -831,24 +1154,52 @@ 3161. [bug] zone.c:del_sigs failed to always reset rdata leading assertion failures. [RT #25880] +3160. [bug] When printing out a NSEC3 record in multiline form + the newline was not being printed causing type codes + to be run together. [RT #25873] + +3159. [bug] On some platforms, named could assert on startup + when running in a chrooted environment without + /proc. [RT #25863] + +3158. [bug] Recursive servers would prefer a particular UDP + socket instead of using all available sockets. + [RT #26038] + 3157. [tuning] Reduce the time spent in "rndc reconfig" by parsing the config file before pausing the server. [RT #21373] +3156. [placeholder] + + --- 9.9.0a2 released --- + 3155. [bug] Fixed a build failure when using contrib DLZ drivers (e.g., mysql, postgresql, etc). [RT #25710] 3154. [bug] Attempting to print an empty rdataset could trigger an assert. [RT #25452] +3153. [func] Extend request-ixfr to zone level and remove the + side effect of forcing an AXFR. [RT #25156] + 3152. [cleanup] Some versions of gcc and clang failed due to incorrect use of __builtin_expect. [RT #25183] 3151. [bug] Queries for type RRSIG or SIG could be handled incorrectly. [RT #21050] +3150. [func] Improved startup and reconfiguration time by + enabling zones to load in multiple threads. [RT #25333] + +3149. [placeholder] + 3148. [bug] Processing of normal queries could be stalled when forwarding a UPDATE message. [RT #24711] +3147. [func] Initial inline signing support. [RT #23657] + + --- 9.9.0a1 released --- + 3146. [test] Fixed gcc4.6.0 errors in ATF. [RT #25598] 3145. [test] Capture output of ATF unit tests in "./atf.out" if @@ -859,29 +1210,31 @@ 3143. [bug] Silence clang compiler warnings. [RT #25174] -3139. [test] Added tests from RFC 6234, RFC 2202, and RFC 1321 - for the hashing algorithms (md5, sha1 - sha512, and - their hmac counterparts). [RT #25067] - - --- 9.8.1 released --- - - --- 9.8.1rc1 released --- +3142. [bug] NAPTR is class agnostic. [RT #25429] 3141. [bug] Silence spurious "zone serial (0) unchanged" messages associated with empty zones. [RT #25079] +3140. [func] New command "rndc flushtree " clears the + specified name from the server cache along with + all names under it. [RT #19970] + +3139. [test] Added tests from RFC 6234, RFC 2202, and RFC 1321 + for the hashing algorithms (md5, sha1 - sha512, and + their hmac counterparts). [RT #25067] + 3138. [bug] Address memory leaks and out-of-order operations when shutting named down. [RT #25210] +3137. [func] Improve hardware scalability by allowing multiple + worker threads to process incoming UDP packets. + This can significantly increase query throughput + on some systems. [RT #22992] + 3136. [func] Add RFC 1918 reverse zones to the list of built-in empty zones switched on by the 'empty-zones-enable' option. [RT #24990] - Note: empty-zones-enable must be "yes;" or a empty - zone needs to be disabled in named.conf for RFC 1918 - zones to be activated. This requirement may be - removed in future releases. - 3135. [port] FreeBSD: workaround broken IPV6_USE_MIN_MTU processing. See http://www.freebsd.org/cgi/query-pr.cgi?pr=158307 [RT #24950] @@ -889,19 +1242,34 @@ 3134. [bug] Improve the accuracy of dnssec-signzone's signing statistics. [RT #16030] - --- 9.8.1b3 released --- - 3133. [bug] Change #3114 was incomplete. [RT #24577] +3132. [placeholder] + 3131. [tuning] Improve scalability by allocating one zone task per 100 zones at startup time, rather than using a fixed-size task table. [RT #24406] +3130. [func] Support alternate methods for managing a dynamic + zone's serial number. Two methods are currently + defined using serial-update-method, "increment" + (default) and "unixtime". [RT #23849] + 3129. [bug] Named could crash on 'rndc reconfig' when allow-new-zones was set to yes and named ACLs were used. [RT #22739] - --- 9.8.1b2 released --- +3128. [func] Inserting an NSEC3PARAM via dynamic update in an + auto-dnssec zone that has not been signed yet + will cause it to be signed with the specified NSEC3 + parameters when keys are activated. The + NSEC3PARAM record will not appear in the zone until + it is signed, but the parameters will be stored. + [RT #23684] + +3127. [bug] 'rndc thaw' will now remove a zone's journal file + if the zone serial number has been changed and + ixfr-from-differences is not in use. [RT #24687] 3126. [security] Using DNAME record to generate replacements caused RPZ to exit with a assertion failure. [RT #24766] @@ -941,6 +1309,12 @@ never-implemented 'auto-dnssec create' option. [RT #24533] +3116. [func] New 'dnssec-update-mode' option controls updates + of DNSSEC records in signed dynamic zones. Set to + 'no-resign' to disable automatic RRSIG regeneration + while retaining the ability to sign new or changed + data. [RT #24533] + 3115. [bug] Named could fail to return requested data when following a CNAME that points into the same zone. [RT #24455] @@ -951,8 +1325,6 @@ 3113. [doc] Document the relationship between serial-query-rate and NOTIFY messages. - --- 9.8.1b1 released --- - 3112. [doc] Add missing descriptions of the update policy name types "ms-self", "ms-subdomain", "krb5-self" and "krb5-subdomain", which allow machines to update @@ -965,9 +1337,23 @@ 3110. [bug] dnssec-signzone: Wrong error message could appear when attempting to sign with no KSK. [RT #24369] +3109. [func] The also-notify option now uses the same syntax + as a zone's masters clause. This means it is + now possible to specify a TSIG key to use when + sending notifies to a given server, or to include + an explicit named masters list in an also-notfiy + statement. [RT #23508] + +3108. [cleanup] dnssec-signzone: Clarified some error and + warning messages; removed #ifdef ALLOW_KSKLESS_ZONES + code (use -P instead). [RT #20852] + 3107. [bug] dnssec-signzone: Report the correct number of ZSKs when using -x. [RT #20852] +3106. [func] When logging client requests, include the name of + the TSIG key if any. [RT #23619] + 3105. [bug] GOST support can be suppressed by "configure --without-gost" [RT #24367] @@ -977,6 +1363,12 @@ instead of in the options statement could trigger an assertion failure in named-checkconf. [RT #24382] *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 10:01:30 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 ESMTP id 0FA42B7A for ; Thu, 22 Aug 2013 10:01:30 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-ea0-f176.google.com (mail-ea0-f176.google.com [209.85.215.176]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9BF602E77 for ; Thu, 22 Aug 2013 10:01:29 +0000 (UTC) Received: by mail-ea0-f176.google.com with SMTP id q16so793725ead.21 for ; Thu, 22 Aug 2013 03:01:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:openpgp:content-type :content-transfer-encoding; bh=jPd64LOJ2LCRbl5L+RL17xcvyMBAaQelZ55wHWlPygU=; b=f41KfSVdX24mXh580T2yw2O7twAE3OGUy3774ZK8SLvALEIDbvEX67P+Pb0lOb4ybX bqzzafqfZNwqvCffsbar4Y9HmfpA71N+tKgUOS8Q12rZhsBLz+C9JPB/GSXE39HLotSo VP7v+cv3vc3Nr9DEgSmBwpsqS73YAZO14O4SCkyH7/fcHdXOJXjFnVQOMzDLhAFEqvyl o01FclS8snKV3VV0tThMgImAXMA6CP8CAt6vItV+oARybnucWGSF9XuKIaUt94PCoY7t ieuLP2hDsGUm3wzDCvxAiEZ+2mlh8SpMBxEg47KA2fK5SPNNcr+S6gXbkSxi7WbiucW5 uarg== X-Gm-Message-State: ALoCoQkdcf9hQc1Owpupyeu+BDCQWH0tyWD7ZIIEKeLoseLqYDk2b9mazFhNxXTry00PFoy+3lwj X-Received: by 10.15.27.133 with SMTP id p5mr1868011eeu.65.1377165682149; Thu, 22 Aug 2013 03:01:22 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id b45sm16365250eef.4.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 Aug 2013 03:01:21 -0700 (PDT) Message-ID: <5215E16E.4080207@freebsd.org> Date: Thu, 22 Aug 2013 14:01:18 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Jilles Tjoelker Subject: Re: svn commit: r254600 - head/lib/libutil References: <201308211646.r7LGk6eV051215@svn.freebsd.org> <5214F72B.7070006@freebsd.org> <20130821190309.GB52908@omg> <20130821202725.GA4991@stack.nl> <20130821212413.GC52908@omg> <20130821213755.GA8052@stack.nl> In-Reply-To: <20130821213755.GA8052@stack.nl> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Sergey Kandaurov , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Thu, 22 Aug 2013 10:01:30 -0000 On 22.08.2013 1:37, Jilles Tjoelker wrote: >> if (number == UINTMAX_MAX && errno == ERANGE) { >> return (-1); >> } >> >> + if (errno == 0) >> + errno = saved_errno; >> + > This looks good to me. > Just being nitpicking) number == UINTMAX_MAX check is unneeded. -- http://ache.vniz.net/ bitcoin:1G6ugdNY6e5jx1GVnAU2ntj2NEfmjKG85r From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 10:07:04 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 ESMTP id 27582D6B for ; Thu, 22 Aug 2013 10:07:04 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-ee0-f41.google.com (mail-ee0-f41.google.com [74.125.83.41]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B3D502ED1 for ; Thu, 22 Aug 2013 10:07:03 +0000 (UTC) Received: by mail-ee0-f41.google.com with SMTP id d17so805605eek.0 for ; Thu, 22 Aug 2013 03:06:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:openpgp:content-type :content-transfer-encoding; bh=qCMOGWCpLQLRSJlWy2A2M8oXc6/uZoesOaLH+Otb4bY=; b=kWiBJwJh2+IneVCmbWHpP6d3LpXV+GqkeQ9H3DPRdUHtNZUihnaETCs+arYcOS8Ycm CNfnYwrPskHBDuaEdzg4vmR/YzeTMIWACvjdHwFskBxEwbm1HtkDUsqV0/Il8YAwRp4i 2ntj+DjOzxvp+YMEx5xjT5AqogFBKzUlBLtSjb5dY43LPkqvH2Trl5RhJECiVOVFYzE/ 6J1J6Vup3bu9zbtmZjFkbmuSf7DlUdfkJQDKKVh6vik7Pbo/msmyfq1sc/x4V70gojYP QPtBkYffqDkKcpApHDFLmq67X2f9WYRmwurz3uwxu+dwe7mS4/Ys6BdyNnqmNSwLS+ui rLpQ== X-Gm-Message-State: ALoCoQmDVCZIj6MpkUwdHkaf1VcicU3KA3FA0EmD73dsM+3lQFNEeY+GvutK7J653KULczfm2H3E X-Received: by 10.14.115.133 with SMTP id e5mr17642449eeh.27.1377166015729; Thu, 22 Aug 2013 03:06:55 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id b45sm16400984eef.4.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 Aug 2013 03:06:55 -0700 (PDT) Message-ID: <5215E2BC.3070904@freebsd.org> Date: Thu, 22 Aug 2013 14:06:52 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Jilles Tjoelker Subject: Re: svn commit: r254600 - head/lib/libutil References: <201308211646.r7LGk6eV051215@svn.freebsd.org> <5214F72B.7070006@freebsd.org> <20130821190309.GB52908@omg> <20130821202725.GA4991@stack.nl> <20130821212413.GC52908@omg> <20130821213755.GA8052@stack.nl> <5215E16E.4080207@freebsd.org> In-Reply-To: <5215E16E.4080207@freebsd.org> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Sergey Kandaurov , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Thu, 22 Aug 2013 10:07:04 -0000 On 22.08.2013 14:01, Andrey Chernov wrote: > On 22.08.2013 1:37, Jilles Tjoelker wrote: >>> if (number == UINTMAX_MAX && errno == ERANGE) { >>> return (-1); >>> } >>> >>> + if (errno == 0) >>> + errno = saved_errno; >>> + >> This looks good to me. >> > > Just being nitpicking) number == UINTMAX_MAX check is unneeded. > Sorry for misguiding, forget it. The check is needed, other functions inside strtoumax() (FIX_LOCALE, isspace) may set errno in theory. -- http://ache.vniz.net/ bitcoin:1G6ugdNY6e5jx1GVnAU2ntj2NEfmjKG85r From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 10:51: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 ESMTP id 2FF6F9C8; Thu, 22 Aug 2013 10:51:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id A58DB21C9; Thu, 22 Aug 2013 10:51:30 +0000 (UTC) Received: from c122-106-156-23.carlnfd1.nsw.optusnet.com.au (c122-106-156-23.carlnfd1.nsw.optusnet.com.au [122.106.156.23]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 0D4F44241AC; Thu, 22 Aug 2013 20:51:17 +1000 (EST) Date: Thu, 22 Aug 2013 20:51:15 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jilles Tjoelker Subject: Re: svn commit: r254600 - head/lib/libutil In-Reply-To: <20130821213755.GA8052@stack.nl> Message-ID: <20130822185756.Y1297@besplex.bde.org> References: <201308211646.r7LGk6eV051215@svn.freebsd.org> <5214F72B.7070006@freebsd.org> <20130821190309.GB52908@omg> <20130821202725.GA4991@stack.nl> <20130821212413.GC52908@omg> <20130821213755.GA8052@stack.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=bpB1Wiqi c=1 sm=1 tr=0 a=ebeQFi2P/qHVC0Yw9JDJ4g==:117 a=PO7r1zJSAAAA:8 a=aw4-S10CjX0A:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=H7VN2zDOXXgA:10 a=10tJtSuNjYdlZKnmVusA:9 a=nWxIxC1GMPgnsk2h:21 a=zFEI9HLo3Qmo5DcZ:21 a=CjuIK1q_8ugA:10 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Sergey Kandaurov , Andrey Chernov , src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Thu, 22 Aug 2013 10:51:31 -0000 On Wed, 21 Aug 2013, Jilles Tjoelker wrote: > On Thu, Aug 22, 2013 at 01:24:13AM +0400, Sergey Kandaurov wrote: >> On Wed, Aug 21, 2013 at 10:27:25PM +0200, Jilles Tjoelker wrote: >>> On Wed, Aug 21, 2013 at 11:03:10PM +0400, Sergey Kandaurov wrote: >>>> On Wed, Aug 21, 2013 at 09:21:47PM +0400, Andrey Chernov wrote: >>>>> On 21.08.2013 20:46, Sergey Kandaurov wrote: >>>>>> number = strtoumax(buf, &endptr, 0); >>>>>> >>>>>> + if (number == UINTMAX_MAX && errno == ERANGE) { >>>>>> + return (-1); >>>>>> + } > >>>>> You need to reset errno before strtoumax() call (errno = 0), because any >>>>> of previous functions may left it as ERANGE. This also has a bogus test for UINTMAX_MAX wheich prevents input of the number UINTMAX_MAX on systems where the limit for the function (UINT64_T_MAX) is the same as the limit for strtoumax(). This test is a wrong way of doing the errno thing. This also has a high density of style bugs: - excessive braces - extra blank line expand_number() remains a very badly designed and implemented function. Its design errors start with its name. It doesn't expand numbers. It converts strings to numbers. The strtoumax() family is missing this bug and others. Its design errors continue with it taking a uint64_t arg and not a uint64_t arg. Its implementation errors begin with broken range checking. The above is an incomplete fix for this. Unless uintmax_t is the same as uint64_t, there are still the following bugs: - the return value of strotumax() is assigned to a uint64_t. This may overflow. After overflow, the bogus (number == UINTMAX_MAX) check has no effect, since when overflow is possible 'number' cannot equal UINTMAX_MAX. - values that exceed the maximum supported (UINT64_MAX) are not detected. They are silently truncated to uint64_t. >>>> Thanks for pointing out. >>>> Does the patch look good? No. It adds many more style bugs... >>>> Index: expand_number.c >>>> =================================================================== >>>> --- expand_number.c (revision 254600) >>>> +++ expand_number.c (working copy) >>>> @@ -53,6 +53,8 @@ >>>> unsigned shift; >>>> char *endptr; >>>> >>>> + errno = 0; >>>> + Another extra blank line. It is worse than most, since it separates the initialization for calling stroumax() from the call. >>>> number = strtoumax(buf, &endptr, 0); >>>> This extra blank line separates the call from the error checking for the function. It was added in the commit that started this thread. The previous version had a bogus extra blank line to separate the result of the error checking from the call. >>>> if (number == UINTMAX_MAX && errno == ERANGE) { > >>> This may cause the function to set errno=0 if it is successful, which is >>> not allowed for standard library functions from C and POSIX. There may >>> be a problem not only if expand_number() is standardized but also if it >>> is used in the implementation of a standard library function. The best >>> solution is to save and restore errno around this (if [ERANGE] is >>> detected, that is a valid errno value to keep). This is painful, but seems to be necessary. >>> In an application it is acceptable to set errno=0 without further ado. > >> What about this change? >> It changes errno only if it was modified from zero in strtoumax(). >> Unconditionally restoring errno after strtoumax() unless ERANGE is >> probably not good as strtoumax() might set different errno (e.g. EINVAL) >> and we might want to keep it as well. Please correct me, if I'm wrong. > >> Index: lib/libutil/expand_number.c >> =================================================================== >> --- lib/libutil/expand_number.c (revision 254600) >> +++ lib/libutil/expand_number.c (working copy) >> @@ -50,15 +50,22 @@ >> expand_number(const char *buf, uint64_t *num) >> { >> uint64_t number; >> + int saved_errno; Style bugs: - declarations more unsorted than before. Previously, only endptr was unsorted. - the variable for this is normally names serrno. libutil mostly follows this convention -- it has several serrno's and no saved_errno's, but it does have some error's (error = errno; ...), mainly in pidfile.c. Only login_cap.c is notkkk careful about clobbering errno to 0. >> unsigned shift; >> char *endptr; >> >> + saved_errno = errno; >> + errno = 0; >> + >> number = strtoumax(buf, &endptr, 0); >> >> if (number == UINTMAX_MAX && errno == ERANGE) { >> return (-1); >> } Style bugs, as above. >> >> + if (errno == 0) >> + errno = saved_errno; >> + Yet another style bug. >> if (endptr == buf) { >> /* No valid digits. */ >> errno = EINVAL; >> Another style bug is the placement of the error checking. Normally the endptr check is done before the range check. > > This looks good to me. This looks not so good to me. Some of the other bugs in the old version: % /* % * Convert an expression of the following forms to a uint64_t. % * 1) A positive decimal number. % * 2) A positive decimal number followed by a 'b' or 'B' (mult by 1). % * 3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10). % * 4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20). % * 5) A positive decimal number followed by a 'g' or 'G' (mult by 1 << 30). % * 6) A positive decimal number followed by a 't' or 'T' (mult by 1 << 40). % * 7) A positive decimal number followed by a 'p' or 'P' (mult by 1 << 50). % * 8) A positive decimal number followed by a 'e' or 'E' (mult by 1 << 60). This garbage was copied from a similar comment in dd/args.c. The number is actually neither positive nor decimal, especially in dd where there is a variant of this function that returns negative numbers. Another design error in this function is that it can't return negative numbers. % */ % This bogus blank line detaches the comment from the code that it describes, resulting in the comment describing null code. % int % expand_number(const char *buf, uint64_t *num) % { % uint64_t number; % unsigned shift; % char *endptr; % % number = strtoumax(buf, &endptr, 0); This supports non-positive non-decimal numbers. The support for non-decimal numbers is more intentional (it is given by the base 0 in the call). Negative numbers are only supported by strtoumax() allowing a minus sign and returning a nonnegative number equal to 1 larger than UINTMAX_MAX less the number without the minus sign. % % if (endptr == buf) { % /* No valid digits. */ % errno = EINVAL; % return (-1); % } Most of the bugs except ones in the comment are missing in dd/args.c: % static uintmax_t % get_num(const char *val) % { % uintmax_t num, mult, prevnum; By using variables of the same type that strtoumax() returns, it avoids overflow bugs in the overflow checking... % char *expr; % % errno = 0; This was fixed 14 years ago in dd. Perhaps earlier in my version. For variations on the bugs, see the 4.4Lite version. It was missing this errno setting. Since this is an application, it can clobber errno like this. % num = strtouq(val, &expr, 0); This is still broken. It unnecessarily assumes that uquad_t = uintmax_t. 4.4BSD-Lite uses strtoul() here, and using strtouq() is a wrong fix. % if (errno != 0) /* Overflow or underflow. */ % err(1, "%s", oper); The error handling is simpler since this is not a library function. The comment about underflow is wrong. Underflow can't happen. What the comment means by underflow is "overflow, with a negative sign". 4.4BSD-Lite was missing this bug. But 4.4BSD-Lite had a wrong range check (num == ULONG_MAX, essentially the same as expand_number() now). % 4.4BSD-Lite was missing this bug (extra blank line). % if (expr == val) /* No valid digits. */ % errx(1, "%s: illegal numeric value", oper); - this code, with its more specific error message, was broken by a POSIX bug. It is now unreachable (EINVAL is returned if no number is found, and for some other cases like an invalid base which can't happen for the above call). It is not bad to break it becauses its message is of low quality in a different way than the strerror(errno) message from err(). There are no lawyers here. strerror(EINVAL) is just too generic. % [...] dd's function is very careful to avoid overflow in shifts and multiplications. expand_number() just allows things to overflow. Since the variables are unsigned, overflow just causes garbage results. Not good enough for a library function. dd's function also supports multipliers. The overflow avoidance is more complication for multiplication than for shifting. Multipliers would be useful in a library function too. expand_number() doesn't support them. Another of its design errors is that it does less than dd's functions, so it cannot be used to replace them. % } % % /* % * Convert an expression of the following forms to an off_t. This is the % * same as get_num(), but it uses signed numbers. % * % * The major problem here is that an off_t may not necessarily be a intmax_t. % */ % static off_t % get_off_t(const char *val) % { % intmax_t num, mult, prevnum; % char *expr; % % errno = 0; % num = strtoq(val, &expr, 0); % if (errno != 0) /* Overflow or underflow. */ % err(1, "%s", oper); % % if (expr == val) /* No valid digits. */ % errx(1, "%s: illegal numeric value", oper); % ... % } dd also has this misimplemented function. It is supposed to fix the problem that get_num() only returns unsigned values. But it is misimplemented by making a copy of get_num() and changing some unsigned types to signed types. The result is mostly worse than casting the result of get_num(). The careful overflow checking no longer works, since it is actually not so careful and does things like checking for overflow after overflow has already occurred. Overflow already occurring gives underfined behaviour with signed types. So the duplicated function differs from just casting the result of get_num() as follows: - it gives undefined behaviour on overflow - strtoq() clamps to QUAD_MAX_/MIN where strtouq() clamps to UQUAD_MAX/MIN(). This mainly amplifies the bugs seeking to large offsets. The kernel supports 64-bit unsigned offsets for some defice files and these are needed for /dev/kmem. But QUAD_MAX is smaller than the necessary offsets, so oseek and iseek in bytes are broken. You have to trick dd into working by using non-byte offsets. Some tricks (bogus casts/conversions in various places) are needed anyway since signed 64-bit off_t can't hold the necessary offsets. The function is still missing checks that quad_t is not too large for offsets. My fix for get_off_t() is to just make it (off_t)get_num() with a check that the result is actually representable as an off_t. This only depends on 2's complement magic. To start fixing expand_number(): /* Fix comment here. */ int expand_number(const char *buf, uint64_t *num) { char *endptr; uintmax_t num; uint64_t number; unsigned shift; int serrno; serrno = errno; errno = 0; num = strtoumax(buf, &endptr, 0); if (num > UINT64_MAX) errno = ERANGE; if (errno != 0) return (-1); errno = serrno; number = num; ... } This depends on the POSIX bug for detecting the no-digits case. Fortunately, the early error handling of this function is simple and compatible with that of strtoumax(), so we don't need to translate strtoumax()'s errors except for adjusting its range error. Similarly in dd: /* Fix comment here. */ static uintmax_t get_num(const char *val) { char *expr; uintmax_t num, mult, prevnum; errno = 0; num = strtoumax(val, &expr, 0); if (errno != 0) err(1, "%s", oper); ... } /* * Convert an expression of the above form to an off_t. This version does * not handle negative numbers perfectly. It assumes 2's complement and * maybe nonnegative multipliers. I hope perfect handling is not necessary * for dd. */ static off_t get_off_t(const char *val) { uintmax_t num; num = get_num(val); if (num != (u_quad_t)(off_t)num) errx(1, "%s: offset too large", oper); return ((off_t)num); } Bruce From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 12:47: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 ESMTP id 5489BD9D; Thu, 22 Aug 2013 12:47:25 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CBE6B2A73; Thu, 22 Aug 2013 12:47:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id r7MCgfrY010549; Thu, 22 Aug 2013 16:42:41 +0400 (MSK) (envelope-from marck@rinet.ru) Date: Thu, 22 Aug 2013 16:42:41 +0400 (MSK) From: Dmitry Morozovsky To: "Kenneth D. Merry" Subject: Re: svn commit: r254615 - head/sys/dev/mps In-Reply-To: <201308212130.r7LLUvO5008991@svn.freebsd.org> Message-ID: References: <201308212130.r7LLUvO5008991@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (woozle.rinet.ru [0.0.0.0]); Thu, 22 Aug 2013 16:42:41 +0400 (MSK) 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.14 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: Thu, 22 Aug 2013 12:47:25 -0000 Ken, On Wed, 21 Aug 2013, Kenneth D. Merry wrote: > Author: ken > Date: Wed Aug 21 21:30:56 2013 > New Revision: 254615 > URL: http://svnweb.freebsd.org/changeset/base/254615 > > Log: > Fix mps(4) driver breakage that came in in change 253550 that > manifested itself in out of chain frame conditions. > > When the driver ran out of chain frames, the request in question > would get completed early, and go through mpssas_scsiio_complete(). > > In mpssas_scsiio_complete(), the negation of the CAM status values > (CAM_STATUS_MASK | CAM_SIM_QUEUED) was ORed in instead of being > ANDed in. This resulted in a bogus CAM CCB status value. This > didn't show up in the non-error case, because the status was reset > to something valid (e.g. CAM_REQ_CMP) later on in the function. > > But in the error case, such as when the driver ran out of chain > frames, the CAM_REQUEUE_REQ status was ORed in to the bogus status > value. This led to the CAM transport layer repeatedly releasing > the SIM queue, because it though that the CAM_RELEASE_SIMQ flag had > been set. The symptom was messages like this on the console when > INVARIANTS were enabled: > > xpt_release_simq: requested 1 > present 0 > xpt_release_simq: requested 1 > present 0 > xpt_release_simq: requested 1 > present 0 what is real impact of the bug? > > mps_sas.c: In mpssas_scsiio_complete(), use &= to take status > bits out. |= adds them in. > > In the error case in mpssas_scsiio_complete(), set > the status to CAM_REQUEUE_REQ, don't OR it in. > > MFC after: 3 days This patch does not apply cleanly as r253550 had not been merged, and the first masking does not occur on contemporary stable/9. Comments? Thank you! > Sponsored by: Spectra Logic > > Modified: > head/sys/dev/mps/mps_sas.c > > Modified: head/sys/dev/mps/mps_sas.c > ============================================================================== > --- head/sys/dev/mps/mps_sas.c Wed Aug 21 21:30:06 2013 (r254614) > +++ head/sys/dev/mps/mps_sas.c Wed Aug 21 21:30:56 2013 (r254615) > @@ -2103,7 +2103,7 @@ mpssas_scsiio_complete(struct mps_softc > cm->cm_targ->completed++; > cm->cm_targ->outstanding--; > TAILQ_REMOVE(&cm->cm_targ->commands, cm, cm_link); > - ccb->ccb_h.status |= ~(CAM_STATUS_MASK | CAM_SIM_QUEUED); > + ccb->ccb_h.status &= ~(CAM_STATUS_MASK | CAM_SIM_QUEUED); > > if (cm->cm_state == MPS_CM_STATE_TIMEDOUT) { > TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery); > @@ -2145,7 +2145,7 @@ mpssas_scsiio_complete(struct mps_softc > * because there can be no reply when we haven't actually > * gone out to the hardware. > */ > - ccb->ccb_h.status |= CAM_REQUEUE_REQ; > + ccb->ccb_h.status = CAM_REQUEUE_REQ; > > /* > * Currently the only error included in the mask is > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 12:49: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 ESMTP id D5C80B9; Thu, 22 Aug 2013 12:49:28 +0000 (UTC) (envelope-from ae@FreeBSD.org) 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 C37BA2A92; Thu, 22 Aug 2013 12:49: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 r7MCnSRm077187; Thu, 22 Aug 2013 12:49:28 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MCnSZK077186; Thu, 22 Aug 2013 12:49:28 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201308221249.r7MCnSZK077186@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 22 Aug 2013 12:49:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254654 - head/share/mk 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.14 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: Thu, 22 Aug 2013 12:49:28 -0000 Author: ae Date: Thu Aug 22 12:49:28 2013 New Revision: 254654 URL: http://svnweb.freebsd.org/changeset/base/254654 Log: Really disconnect pkg_install from the build. Reported by: Mikhail Timofeyev Modified: head/share/mk/bsd.own.mk Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Thu Aug 22 09:33:07 2013 (r254653) +++ head/share/mk/bsd.own.mk Thu Aug 22 12:49:28 2013 (r254654) @@ -332,7 +332,6 @@ __DEFAULT_YES_OPTIONS = \ PC_SYSINSTALL \ PF \ PKGBOOTSTRAP \ - PKGTOOLS \ PMC \ PORTSNAP \ PPP \ @@ -385,6 +384,7 @@ __DEFAULT_NO_OPTIONS = \ NAND \ OFED \ OPENSSH_NONE_CIPHER \ + PKGTOOLS \ SHARED_TOOLCHAIN \ SVN \ USB_GADGET_EXAMPLES From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 14:02:38 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 ESMTP id 77A1DCD6; Thu, 22 Aug 2013 14:02:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) 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 561012F62; Thu, 22 Aug 2013 14:02: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 r7ME2c2u015780; Thu, 22 Aug 2013 14:02:38 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7ME2Zh7015706; Thu, 22 Aug 2013 14:02:35 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201308221402.r7ME2Zh7015706@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 22 Aug 2013 14:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254657 - in head: sbin/iscontrol sys/conf sys/dev/iscsi/initiator sys/dev/iscsi_initiator sys/modules sys/modules/iscsi/initiator sys/modules/iscsi_initiator 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.14 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: Thu, 22 Aug 2013 14:02:38 -0000 Author: trasz Date: Thu Aug 22 14:02:34 2013 New Revision: 254657 URL: http://svnweb.freebsd.org/changeset/base/254657 Log: Move the old iSCSI initiator source to a more appropriate place (sys/dev/iscsi_initiator/ instead of sys/dev/iscsi/initiator/), to make room for the new one. This is also more logical location (kernel module being named iscsi_initiator.ko, for example). There is no ongoing work on this I know of, so it shouldn't make life harder for anyone. There are no functional changes, apart from "svn mv" and adjusting paths. Added: head/sys/dev/iscsi_initiator/ - copied from r254596, head/sys/dev/iscsi/initiator/ head/sys/modules/iscsi_initiator/ - copied from r254596, head/sys/modules/iscsi/initiator/ Deleted: head/sys/dev/iscsi/initiator/ head/sys/modules/iscsi/initiator/ Modified: head/sbin/iscontrol/auth_subr.c head/sbin/iscontrol/config.c head/sbin/iscontrol/fsm.c head/sbin/iscontrol/iscontrol.c head/sbin/iscontrol/login.c head/sbin/iscontrol/misc.c head/sbin/iscontrol/pdu.c head/sys/conf/files head/sys/dev/iscsi_initiator/isc_cam.c head/sys/dev/iscsi_initiator/isc_sm.c head/sys/dev/iscsi_initiator/isc_soc.c head/sys/dev/iscsi_initiator/isc_subr.c head/sys/dev/iscsi_initiator/iscsi.c head/sys/dev/iscsi_initiator/iscsi_subr.c head/sys/modules/Makefile head/sys/modules/iscsi_initiator/Makefile Modified: head/sbin/iscontrol/auth_subr.c ============================================================================== --- head/sbin/iscontrol/auth_subr.c Thu Aug 22 13:24:40 2013 (r254656) +++ head/sbin/iscontrol/auth_subr.c Thu Aug 22 14:02:34 2013 (r254657) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "iscontrol.h" static int Modified: head/sbin/iscontrol/config.c ============================================================================== --- head/sbin/iscontrol/config.c Thu Aug 22 13:24:40 2013 (r254656) +++ head/sbin/iscontrol/config.c Thu Aug 22 14:02:34 2013 (r254657) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "iscontrol.h" /* Modified: head/sbin/iscontrol/fsm.c ============================================================================== --- head/sbin/iscontrol/fsm.c Thu Aug 22 13:24:40 2013 (r254656) +++ head/sbin/iscontrol/fsm.c Thu Aug 22 14:02:34 2013 (r254657) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "iscontrol.h" typedef enum { Modified: head/sbin/iscontrol/iscontrol.c ============================================================================== --- head/sbin/iscontrol/iscontrol.c Thu Aug 22 13:24:40 2013 (r254656) +++ head/sbin/iscontrol/iscontrol.c Thu Aug 22 14:02:34 2013 (r254657) @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "iscontrol.h" static char version[] = "2.3.1"; // keep in sync with iscsi_initiator Modified: head/sbin/iscontrol/login.c ============================================================================== --- head/sbin/iscontrol/login.c Thu Aug 22 13:24:40 2013 (r254656) +++ head/sbin/iscontrol/login.c Thu Aug 22 14:02:34 2013 (r254657) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "iscontrol.h" static char *status_class1[] = { Modified: head/sbin/iscontrol/misc.c ============================================================================== --- head/sbin/iscontrol/misc.c Thu Aug 22 13:24:40 2013 (r254656) +++ head/sbin/iscontrol/misc.c Thu Aug 22 14:02:34 2013 (r254657) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "iscontrol.h" static inline char Modified: head/sbin/iscontrol/pdu.c ============================================================================== --- head/sbin/iscontrol/pdu.c Thu Aug 22 13:24:40 2013 (r254656) +++ head/sbin/iscontrol/pdu.c Thu Aug 22 14:02:34 2013 (r254657) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "iscontrol.h" static void pukeText(char *it, pdu_t *pp); Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Aug 22 13:24:40 2013 (r254656) +++ head/sys/conf/files Thu Aug 22 14:02:34 2013 (r254657) @@ -1521,12 +1521,12 @@ ipw_monitor.fw optional ipwmonitorfw | compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "ipw_monitor.fw" -dev/iscsi/initiator/iscsi.c optional iscsi_initiator scbus -dev/iscsi/initiator/iscsi_subr.c optional iscsi_initiator scbus -dev/iscsi/initiator/isc_cam.c optional iscsi_initiator scbus -dev/iscsi/initiator/isc_soc.c optional iscsi_initiator scbus -dev/iscsi/initiator/isc_sm.c optional iscsi_initiator scbus -dev/iscsi/initiator/isc_subr.c optional iscsi_initiator scbus +dev/iscsi_initiator/iscsi.c optional iscsi_initiator scbus +dev/iscsi_initiator/iscsi_subr.c optional iscsi_initiator scbus +dev/iscsi_initiator/isc_cam.c optional iscsi_initiator scbus +dev/iscsi_initiator/isc_soc.c optional iscsi_initiator scbus +dev/iscsi_initiator/isc_sm.c optional iscsi_initiator scbus +dev/iscsi_initiator/isc_subr.c optional iscsi_initiator scbus dev/isf/isf.c optional isf dev/isf/isf_fdt.c optional isf fdt dev/isf/isf_nexus.c optional isf Modified: head/sys/dev/iscsi_initiator/isc_cam.c ============================================================================== --- head/sys/dev/iscsi/initiator/isc_cam.c Wed Aug 21 08:01:52 2013 (r254596) +++ head/sys/dev/iscsi_initiator/isc_cam.c Thu Aug 22 14:02:34 2013 (r254657) @@ -53,8 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include static void _inq(struct cam_sim *sim, union ccb *ccb) Modified: head/sys/dev/iscsi_initiator/isc_sm.c ============================================================================== --- head/sys/dev/iscsi/initiator/isc_sm.c Wed Aug 21 08:01:52 2013 (r254596) +++ head/sys/dev/iscsi_initiator/isc_sm.c Thu Aug 22 14:02:34 2013 (r254657) @@ -62,8 +62,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include static void _async(isc_session_t *sp, pduq_t *pq) Modified: head/sys/dev/iscsi_initiator/isc_soc.c ============================================================================== --- head/sys/dev/iscsi/initiator/isc_soc.c Wed Aug 21 08:01:52 2013 (r254596) +++ head/sys/dev/iscsi_initiator/isc_soc.c Thu Aug 22 14:02:34 2013 (r254657) @@ -56,8 +56,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include #ifndef NO_USE_MBUF #define USE_MBUF Modified: head/sys/dev/iscsi_initiator/isc_subr.c ============================================================================== --- head/sys/dev/iscsi/initiator/isc_subr.c Wed Aug 21 08:01:52 2013 (r254596) +++ head/sys/dev/iscsi_initiator/isc_subr.c Thu Aug 22 14:02:34 2013 (r254657) @@ -55,8 +55,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include static MALLOC_DEFINE(M_ISC, "iSC", "iSCSI driver options"); Modified: head/sys/dev/iscsi_initiator/iscsi.c ============================================================================== --- head/sys/dev/iscsi/initiator/iscsi.c Wed Aug 21 08:01:52 2013 (r254596) +++ head/sys/dev/iscsi_initiator/iscsi.c Thu Aug 22 14:02:34 2013 (r254657) @@ -58,8 +58,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include static char *iscsi_driver_version = "2.3.1"; static struct isc_softc *isc; Modified: head/sys/dev/iscsi_initiator/iscsi_subr.c ============================================================================== --- head/sys/dev/iscsi/initiator/iscsi_subr.c Wed Aug 21 08:01:52 2013 (r254596) +++ head/sys/dev/iscsi_initiator/iscsi_subr.c Thu Aug 22 14:02:34 2013 (r254657) @@ -53,8 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include /* | Interface to the SCSI layer Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Thu Aug 22 13:24:40 2013 (r254656) +++ head/sys/modules/Makefile Thu Aug 22 14:02:34 2013 (r254657) @@ -159,7 +159,7 @@ SUBDIR= \ ${_ipw} \ ${_ipwfw} \ ${_isci} \ - iscsi \ + iscsi_initiator \ isp \ ${_ispfw} \ ${_iwi} \ Modified: head/sys/modules/iscsi_initiator/Makefile ============================================================================== --- head/sys/modules/iscsi/initiator/Makefile Wed Aug 21 08:01:52 2013 (r254596) +++ head/sys/modules/iscsi_initiator/Makefile Thu Aug 22 14:02:34 2013 (r254657) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../../dev/iscsi/initiator +.PATH: ${.CURDIR}/../../dev/iscsi_initiator KMOD=iscsi_initiator SRCS= iscsi.h iscsivar.h From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 14:21: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 ESMTP id 25C9945E; Thu, 22 Aug 2013 14:21:09 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E88AE20F1; Thu, 22 Aug 2013 14:21:08 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id r7MEL7pR050671; Thu, 22 Aug 2013 08:21:07 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id r7MEL7qi050670; Thu, 22 Aug 2013 08:21:07 -0600 (MDT) (envelope-from ken) Date: Thu, 22 Aug 2013 08:21:07 -0600 From: "Kenneth D. Merry" To: Dmitry Morozovsky Subject: Re: svn commit: r254615 - head/sys/dev/mps Message-ID: <20130822142107.GA49996@nargothrond.kdm.org> References: <201308212130.r7LLUvO5008991@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i 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.14 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: Thu, 22 Aug 2013 14:21:09 -0000 On Thu, Aug 22, 2013 at 16:42:41 +0400, Dmitry Morozovsky wrote: > Ken, > > On Wed, 21 Aug 2013, Kenneth D. Merry wrote: > > > Author: ken > > Date: Wed Aug 21 21:30:56 2013 > > New Revision: 254615 > > URL: http://svnweb.freebsd.org/changeset/base/254615 > > > > Log: > > Fix mps(4) driver breakage that came in in change 253550 that > > manifested itself in out of chain frame conditions. > > > > When the driver ran out of chain frames, the request in question > > would get completed early, and go through mpssas_scsiio_complete(). > > > > In mpssas_scsiio_complete(), the negation of the CAM status values > > (CAM_STATUS_MASK | CAM_SIM_QUEUED) was ORed in instead of being > > ANDed in. This resulted in a bogus CAM CCB status value. This > > didn't show up in the non-error case, because the status was reset > > to something valid (e.g. CAM_REQ_CMP) later on in the function. > > > > But in the error case, such as when the driver ran out of chain > > frames, the CAM_REQUEUE_REQ status was ORed in to the bogus status > > value. This led to the CAM transport layer repeatedly releasing > > the SIM queue, because it though that the CAM_RELEASE_SIMQ flag had > > been set. The symptom was messages like this on the console when > > INVARIANTS were enabled: > > > > xpt_release_simq: requested 1 > present 0 > > xpt_release_simq: requested 1 > present 0 > > xpt_release_simq: requested 1 > present 0 > > what is real impact of the bug? Your system will essentially hang, certainly as far as anything connected to the controller in question. > > > > mps_sas.c: In mpssas_scsiio_complete(), use &= to take status > > bits out. |= adds them in. > > > > In the error case in mpssas_scsiio_complete(), set > > the status to CAM_REQUEUE_REQ, don't OR it in. > > > > MFC after: 3 days > > This patch does not apply cleanly as r253550 had not been merged, and the first > masking does not occur on contemporary stable/9. Comments? As far as I know, this is not a problem on the version of the driver in stable/9. But then again, I have not tested the out of chain frames code since early 2011 when I last fixed it. If you want to verify the behavior is correct in stable/9, do this: 1. enable INVARIANTS 2. In /boot/loader.conf: hw.mps.max_chains=32 3. Use up most of your memory. If you're using ZFS, just do a sequential write to a file so that the ARC starts filling up with cached data. Look at the free memory in top to see how much you've used. This will cause enough fragmentation to lead to more scatter/gather segments getting used in the driver. 4. Do something like this: ((i=0)); while [ $i -lt 60 ]; do dd if=/dev/da0 of=/dev/null bs=1m & ((i++)); done 5. Look for an out of chain frames message on the console. To see how far you are towards using the chain frames, run 'sysctl dev.mps'. You can see how many chain frames you have free, and how many requests have failed. This change just needs to be merged along with the other changes to avoid having the regression in stable. Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 14: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 ESMTP id 6198531F; Thu, 22 Aug 2013 14:58:07 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DD3162352; Thu, 22 Aug 2013 14:58:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id r7MEw0Xe014172; Thu, 22 Aug 2013 18:58:00 +0400 (MSK) (envelope-from marck@rinet.ru) Date: Thu, 22 Aug 2013 18:58:00 +0400 (MSK) From: Dmitry Morozovsky To: "Kenneth D. Merry" Subject: Re: svn commit: r254615 - head/sys/dev/mps In-Reply-To: <20130822142107.GA49996@nargothrond.kdm.org> Message-ID: References: <201308212130.r7LLUvO5008991@svn.freebsd.org> <20130822142107.GA49996@nargothrond.kdm.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (woozle.rinet.ru [0.0.0.0]); Thu, 22 Aug 2013 18:58:00 +0400 (MSK) 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.14 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: Thu, 22 Aug 2013 14:58:07 -0000 On Thu, 22 Aug 2013, Kenneth D. Merry wrote: > > > Fix mps(4) driver breakage that came in in change 253550 that > > > manifested itself in out of chain frame conditions. > > > > > > When the driver ran out of chain frames, the request in question > > > would get completed early, and go through mpssas_scsiio_complete(). > > what is real impact of the bug? > > Your system will essentially hang, certainly as far as anything connected > to the controller in question. [snip] > 5. Look for an out of chain frames message on the console. To see how far > you are towards using the chain frames, run 'sysctl dev.mps'. You can see > how many chain frames you have free, and how many requests have failed. > > This change just needs to be merged along with the other changes to avoid > having the regression in stable. Thank you very much for the explanation. We use a couple of servers with mps (and many spindles there), all on stable/9 from this summer, and you commit turns on an alarm light in my head ;) -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 15:56: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 ESMTP id 56E49A40; Thu, 22 Aug 2013 15:56:09 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-qe0-x234.google.com (mail-qe0-x234.google.com [IPv6:2607:f8b0:400d:c02::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CB3D02719; Thu, 22 Aug 2013 15:56:08 +0000 (UTC) Received: by mail-qe0-f52.google.com with SMTP id a11so1187211qen.25 for ; Thu, 22 Aug 2013 08:56:08 -0700 (PDT) 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=Wj4XidgCkP7imiqxkPkwqynP0sfqn+E23hVbzo1dJkI=; b=JIi0Vz0NYP6Aa6bD/z1KU8d3Ok9HW7TlNYG0YUogoDdWxzaLUoVUKNm1bh7pwZyOxo dfsiZc2rgFLh6AOquHfHT3CclgOp/jMiJPwkdeyWlXS12M9QjfIp45KNctehu6BTObig Xm9LIQ9LhD2ihq8KZaVz621+14P8BxeCF5zmiP+tv+LUEAx9XjVdep+XLYKI2Bkerz4m Lcd8opmOZ0aLVHOcbpm3mj9r3VUvtRS067aRqTj38bPa5QlPTK6EOm9c3GVO9GRYtBJF O42mLWNF7PQZDQw9tzFzf8WFCShvLZ7Q+2Um77SgES15ObUHHQFaCzYaSzJ5QRoCz09Y qNHA== MIME-Version: 1.0 X-Received: by 10.229.47.71 with SMTP id m7mr1698633qcf.25.1377186967869; Thu, 22 Aug 2013 08:56:07 -0700 (PDT) Sender: asomers@gmail.com Received: by 10.49.39.101 with HTTP; Thu, 22 Aug 2013 08:56:07 -0700 (PDT) In-Reply-To: <201308040636.r746aI5i038931@svn.freebsd.org> References: <201308040636.r746aI5i038931@svn.freebsd.org> Date: Thu, 22 Aug 2013 09:56:07 -0600 X-Google-Sender-Auth: ASc1PLWBeU55DnFyaihfDufSNJ0 Message-ID: Subject: Re: svn commit: r253924 - in head: etc etc/rc.d share/man/man5 From: Alan Somers To: Hiroki Sato Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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.14 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: Thu, 22 Aug 2013 15:56:09 -0000 With this revision, I am unable to down an ipv4 interface using "/etc/rc.d/netif stop em1". When I try, ipv4_down cannot find the address to delete, because "$_inet" begins with a tab character and the therefore it matches the "*)" rule in the case statement. Presumably "$_inet" doesn't always begin with a tab, so this patch will match with or without the tab. Does it look good to you? --- /usr/home/alans/freebsd/head/etc/network.subr 2013-08-20 19:33:30.6712 28832 +0000 +++ /etc/network.subr 2013-08-22 15:49:53.000000000 +0000 @@ -661,16 +668,16 @@ for _inet in $inetList ; do # get rid of extraneous line case $_inet in - "") break ;; - inet\ *) ;; - *) continue ;; + "") break ;; + \ inet\ *|inet\ *) ;; + *) continue ;; esac [ -z "$_inet" ] && break On Sun, Aug 4, 2013 at 12:36 AM, Hiroki Sato wrote: > Author: hrs > Date: Sun Aug 4 06:36:17 2013 > New Revision: 253924 > URL: http://svnweb.freebsd.org/changeset/base/253924 > > Log: > - Reimplement $gif_interfaces as a variant of $cloned_interfaces. > Newly-configured systems should use $cloned_interfaces. > > - Call clone_{up,down}() and ifnet_rename() in rc.d/netif {start,stop}. > ifnet_rename() now accepts an interface name list as its argument. > > - Add rc.d/netif clear. The "clear" subcommand is basically equivalent > to > "stop" but it does not call clone_down(). > > - Add "ifname:sticky" keyword into $cloned_interfaces. If :sticky is > specified, the interface will not be destroyed in rc.d/netif stop. > > - Add cloned_interfaces_sticky={YES,NO}. This variable globally sets > :sticky keyword above for all interfaces. The default value is NO. > When cloned_interfaces_sticky=YES, :nosticky keyword can be used to > override it on per interface basis. > > Modified: > head/etc/network.subr > head/etc/rc.d/netif > head/share/man/man5/rc.conf.5 > > Modified: head/etc/network.subr > > ============================================================================== > --- head/etc/network.subr Sun Aug 4 02:37:05 2013 (r253923) > +++ head/etc/network.subr Sun Aug 4 06:36:17 2013 (r253924) > @@ -660,6 +660,11 @@ ipv4_down() > IFS="$_ifs" > for _inet in $inetList ; do > # get rid of extraneous line > + case $_inet in > + "") break ;; > + inet\ *) ;; > + *) continue ;; > + esac > [ -z "$_inet" ] && break > > _inet=`expr "$_inet" : '.*\(inet > \([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}\).*'` > @@ -1192,18 +1197,62 @@ ifscript_down() > # > clone_up() > { > - local _prefix _list ifn > + local _prefix _list ifn ifopt _iflist _n tmpargs > _prefix= > _list= > + _iflist=$* > > # create_args_IF > for ifn in ${cloned_interfaces}; do > + # Parse ifn:ifopt. > + OIFS=$IFS; IFS=:; set -- $ifn; ifn=$1; ifopt=$2; IFS=$OIFS > + case $_iflist in > + ""|$ifn|$ifn\ *|*\ $ifn\ *|*\ $ifn) ;; > + *) continue ;; > + esac > + # Skip if ifn already exists. > + if ${IFCONFIG_CMD} $ifn > /dev/null 2>&1; then > + continue > + fi > ${IFCONFIG_CMD} ${ifn} create `get_if_var ${ifn} > create_args_IF` > if [ $? -eq 0 ]; then > _list="${_list}${_prefix}${ifn}" > [ -z "$_prefix" ] && _prefix=' ' > fi > done > + if [ -n "$gif_interfaces" ]; then > + warn "\$gif_interfaces is obsolete. Use > \$cloned_interfaces instead." > + fi > + for ifn in ${gif_interfaces}; do > + # Parse ifn:ifopt. > + OIFS=$IFS; IFS=:; set -- $ifn; ifn=$1; ifopt=$2; IFS=$OIFS > + case $_iflist in > + ""|$ifn|$ifn\ *|*\ $ifn\ *|*\ $ifn) ;; > + *) continue ;; > + esac > + # Skip if ifn already exists. > + if ${IFCONFIG_CMD} $ifn > /dev/null 2>&1; then > + continue > + fi > + case $ifn in > + gif[0-9]*) > + ${IFCONFIG_CMD} $ifn create > + ;; > + *) > + _n=$(${IFCONFIG_CMD} gif create) > + ${IFCONFIG_CMD} $_n name $ifn > + ;; > + esac > + if [ $? -eq 0 ]; then > + _list="${_list}${_prefix}${ifn}" > + [ -z "$_prefix" ] && _prefix=' ' > + fi > + tmpargs=$(get_if_var $ifn gifconfig_IF) > + eval ifconfig_${ifn}=\"tunnel \$tmpargs\" > + done > + if [ -n "${_list}" ]; then > + echo "Created clone interfaces: ${_list}." > + fi > debug "Cloned: ${_list}" > } > > @@ -1213,17 +1262,42 @@ clone_up() > # > clone_down() > { > - local _prefix _list ifn > + local _prefix _list ifn ifopt _iflist _sticky > _prefix= > _list= > + _iflist=$* > > - for ifn in ${cloned_interfaces}; do > + : ${cloned_interfaces_sticky:=NO} > + if checkyesno cloned_interfaces_sticky; then > + _sticky=1 > + else > + _sticky=0 > + fi > + for ifn in ${cloned_interfaces} ${gif_interfaces}; do > + # Parse ifn:ifopt. > + OIFS=$IFS; IFS=:; set -- $ifn; ifn=$1; ifopt=$2; IFS=$OIFS > + case $ifopt:$_sticky in > + sticky:*) continue ;; # :sticky => not destroy > + nosticky:*) ;; # :nosticky => destroy > + *:1) continue ;; # global sticky knob == 1 > + esac > + case $_iflist in > + ""|$ifn|$ifn\ *|*\ $ifn\ *|*\ $ifn) ;; > + *) continue ;; > + esac > + # Skip if ifn does not exist. > + if ! ${IFCONFIG_CMD} $ifn > /dev/null 2>&1; then > + continue > + fi > ${IFCONFIG_CMD} -n ${ifn} destroy > if [ $? -eq 0 ]; then > _list="${_list}${_prefix}${ifn}" > [ -z "$_prefix" ] && _prefix=' ' > fi > done > + if [ -n "${_list}" ]; then > + echo "Destroyed clone interfaces: ${_list}." > + fi > debug "Destroyed clones: ${_list}" > } > > @@ -1347,32 +1421,6 @@ ng_create_one() > done > } > > -# gif_up > -# Create gif(4) tunnel interfaces. > -gif_up() > -{ > - local i peers > - > - for i in ${gif_interfaces}; do > - peers=`get_if_var $i gifconfig_IF` > - case ${peers} in > - '') > - continue > - ;; > - *) > - if expr $i : 'gif[0-9][0-9]*$' >/dev/null 2>&1; > then > - ${IFCONFIG_CMD} $i create >/dev/null 2>&1 > - else > - gif=`${IFCONFIG_CMD} gif create` > - ${IFCONFIG_CMD} $gif name $i > - fi > - ${IFCONFIG_CMD} $i tunnel ${peers} > - ${IFCONFIG_CMD} $i up > - ;; > - esac > - done > -} > - > # ng_fec_create ifn > # Configure Fast EtherChannel for interface $ifn. Returns 0 if > # FEC arguments were found and configured; returns !0 otherwise. > @@ -1470,15 +1518,15 @@ ipx_down() > return $_ret > } > > -# ifnet_rename > -# Rename all requested interfaces. > +# ifnet_rename [ifname] > +# Rename interfaces if ifconfig_IF_name is defined. > # > ifnet_rename() > { > local _if _ifname > > # ifconfig_IF_name > - for _if in `${IFCONFIG_CMD} -l`; do > + for _if in ${*:-$(${IFCONFIG_CMD} -l)}; do > _ifname=`get_if_var $_if ifconfig_IF_name` > if [ ! -z "$_ifname" ]; then > ${IFCONFIG_CMD} $_if name $_ifname > > Modified: head/etc/rc.d/netif > > ============================================================================== > --- head/etc/rc.d/netif Sun Aug 4 02:37:05 2013 (r253923) > +++ head/etc/rc.d/netif Sun Aug 4 06:36:17 2013 (r253924) > @@ -38,7 +38,8 @@ start_cmd="network_start" > stop_cmd="network_stop" > cloneup_cmd="clone_up" > clonedown_cmd="clone_down" > -extra_commands="cloneup clonedown" > +clear_cmd="doclear" > +extra_commands="cloneup clonedown clear" > cmdifn= > > set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces > @@ -60,18 +61,15 @@ network_start() > # disable SIGINT (Ctrl-c) when running at startup > trap : 2 > > - # Create cloned interfaces > - clone_up > - > # Create Fast EtherChannel interfaces > fec_up > + fi > > - # Create IPv6<-->IPv4 tunnels > - gif_up > + # Create cloned interfaces > + clone_up $cmdifn > > - # Rename interfaces. > - ifnet_rename > - fi > + # Rename interfaces. > + ifnet_rename $cmdifn > > # Configure the interface(s). > network_common ifn_start > @@ -92,6 +90,18 @@ network_start() > > network_stop() > { > + _clone_down=1 > + network_stop0 $* > +} > + > +doclear() > +{ > + _clone_down= > + network_stop0 $* > +} > + > +network_stop0() > +{ > local _if > > # Set the list of interfaces to work on. > @@ -101,6 +111,11 @@ network_stop() > # Deconfigure the interface(s) > network_common ifn_stop > > + # Destroy cloned interfaces > + if [ -n "$_clone_down" ]; then > + clone_down $cmdifn > + fi > + > if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then > for _if in $cmdifn; do > /etc/rc.d/routing stop any $_if > @@ -142,6 +157,16 @@ network_common() > _fail= > _ok= > for ifn in ${_cooked_list}; do > + # Skip if ifn does not exist. > + case $_func in > + ifn_stop) > + if ! ${IFCONFIG_CMD} $ifn > /dev/null 2>&1; then > + warn "$ifn does not exist. Skipped." > + _fail="${_fail} ${ifn}" > + continue > + fi > + ;; > + esac > if ${_func} ${ifn} $2; then > _ok="${_ok} ${ifn}" > if ipv6if ${ifn}; then > > Modified: head/share/man/man5/rc.conf.5 > > ============================================================================== > --- head/share/man/man5/rc.conf.5 Sun Aug 4 02:37:05 2013 > (r253923) > +++ head/share/man/man5/rc.conf.5 Sun Aug 4 06:36:17 2013 > (r253924) > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 12, 2013 > +.Dd July 22, 2013 > .Dt RC.CONF 5 > .Os > .Sh NAME > @@ -1651,11 +1651,33 @@ Further cloning arguments may be passed > command for each interface by setting the > .Va create_args_ Ns Aq Ar interface > variable. > +If an interface name is specified with > +.Dq :sticky > +keyword, > +the interface will not be destroyed even when > +.Pa rc.d/netif > +script is invoked with > +.Dq stop > +argument. > +This is useful when reconfiguring the interface without destroying it. > Entries in > .Va cloned_interfaces > are automatically appended to > .Va network_interfaces > for configuration. > +.It Va cloned_interfaces_sticky > +.Pq Vt bool > +This variable is to globally enable functionality of > +.Dq :sticky > +keyword in > +.Va cloned_interfaces > +for all interfaces. > +The default value is > +.Dq NO . > +Even if this variable is specified to > +.Dq YES , > +.Dq :nosticky > +keyword can be used to override it on per interface basis. > .It Va fec_interfaces > .Pq Vt str > Set to the list of > @@ -1685,6 +1707,8 @@ ifconfig_fec0="DHCP" > .Ed > .It Va gif_interfaces > .Pq Vt str > +This variable is deprecated in favor of > +.Va cloned_interfaces . > Set to the list of > .Xr gif 4 > tunnel interfaces to configure on this host. > From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 15:58: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 ESMTP id 2ED2AC3B; Thu, 22 Aug 2013 15:58:50 +0000 (UTC) (envelope-from joel@vnode.se) Received: from mail.vnode.se (mail.vnode.se [212.247.52.13]) by mx1.freebsd.org (Postfix) with ESMTP id A923F273F; Thu, 22 Aug 2013 15:58:49 +0000 (UTC) Received: from mail.vnode.se (localhost [127.0.0.1]) by mail.vnode.se (Postfix) with ESMTP id D620BE3F07A; Thu, 22 Aug 2013 17:58:41 +0200 (CEST) X-Virus-Scanned: amavisd-new at vnode.se Received: from mail.vnode.se ([127.0.0.1]) by mail.vnode.se (mail.vnode.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JeZ+u40GYyZE; Thu, 22 Aug 2013 17:58:39 +0200 (CEST) Received: from devbox.vnode.local (unknown [83.223.1.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.vnode.se (Postfix) with ESMTPSA id BF970E3F079; Thu, 22 Aug 2013 17:58:37 +0200 (CEST) Date: Thu, 22 Aug 2013 17:58:35 +0200 From: Joel Dahl To: Peter Wemm Subject: Re: svn commit: r254273 - in head: . include lib lib/libc/iconv lib/libiconv_compat lib/libkiconv share/mk sys/sys tools/build/mk Message-ID: <20130822155835.GA52789@devbox.vnode.local> References: <201308130715.r7D7F1nu076335@svn.freebsd.org> <3887D7C7-D766-40DF-B154-D05768B86AA6@FreeBSD.org> <20130818195304.GA81160@devbox.vnode.local> <20130818224244.GA59141@stack.nl> <52114FED.3010106@wemm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52114FED.3010106@wemm.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: src-committers@freebsd.org, Jilles Tjoelker , Peter Wemm , svn-src-all@freebsd.org, Dimitry Andric , gabor@freebsd.org, svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Thu, 22 Aug 2013 15:58:50 -0000 On Sun, Aug 18, 2013 at 03:51:25PM -0700, Peter Wemm wrote: > On 8/18/13 3:42 PM, Jilles Tjoelker wrote: > > On Sun, Aug 18, 2013 at 09:53:04PM +0200, Joel Dahl wrote: > >> On Sun, Aug 18, 2013 at 12:34:30AM +0200, Dimitry Andric wrote: > >>> On Aug 13, 2013, at 09:15, Peter Wemm wrote: > >>>> Author: peter > >>>> Date: Tue Aug 13 07:15:01 2013 > >>>> New Revision: 254273 > >>>> URL: http://svnweb.freebsd.org/changeset/base/254273 > > > >>>> Log: > >>>> The iconv in libc did two things - implement the standard APIs, the GNU > >>>> extensions and also tried to be link time compatible with ports libiconv. > >>>> This splits that functionality and enables the parts that shouldn't > >>>> interfere with the port by default. > > > >>>> WITH_ICONV (now on by default) - adds iconv.h, iconv_open(3) etc. > >>>> WITH_LIBICONV_COMPAT (off by default) adds the libiconv_open etc API, linker > >>>> symbols and even a stub libiconv.so.3 that are good enough to be able > >>>> to 'pkg delete -f libiconv' on a running system and reasonably expect it > >>>> to work. > > > >>>> I have tortured many machines over the last few days to try and reduce > >>>> the possibilities of foot-shooting as much as I can. I've successfully > >>>> recompiled to enable and disable the libiconv_compat modes, ports that use > >>>> libiconv alongside system iconv etc. If you don't enable the > >>>> WITH_LIBICONV_COMPAT switch, they don't share symbol space. > > > >>>> This is an extension of behavior on other system. iconv(3) is a standard > >>>> libc interface and libiconv port expects to be able to run alongside it on > >>>> systems that have it. > > > >>> Unfortunately I expect this will break many ports, when the libiconv > >>> port is installed. A simple example is the following: > >> > > > >> It also breaks installworld when /usr/src and /usr/obj are NFS exported > >> read-only. > > > > I think it has to do with share/i18n/csmapper and share/i18n/esdb using > > directories as make targets. This apparently causes these files to be > > rebuilt at 'make installworld' time, which is always bad but is only > > detected when /usr/obj is read-only. > > > > A hack that works is to enclose the four targets depending on ${SUBDIR} > > in .if !make(install) . > > > > Unfortunately, the Makefiles were written to depend on the directories > > as make targets fairly deeply, so a real fix is harder. > > I was looking at this yesterday, but was tied up with other things. I'll > take a look at it today after getting a few other things done. It should be > easy enough to replicate by changing /usr/obj to readonly on test systems. FWIW, this is still broken. -- Joel From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 16:00: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 ESMTP id 31C24DCF; Thu, 22 Aug 2013 16:00:10 +0000 (UTC) (envelope-from joel@FreeBSD.org) 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 2061A2777; Thu, 22 Aug 2013 16:00: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 r7MG09U1073845; Thu, 22 Aug 2013 16:00:09 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MG09bu073844; Thu, 22 Aug 2013 16:00:09 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201308221600.r7MG09bu073844@svn.freebsd.org> From: Joel Dahl Date: Thu, 22 Aug 2013 16:00:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254658 - head/share/man/man9 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.14 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: Thu, 22 Aug 2013 16:00:10 -0000 Author: joel (doc committer) Date: Thu Aug 22 16:00:09 2013 New Revision: 254658 URL: http://svnweb.freebsd.org/changeset/base/254658 Log: Minor mdoc nit. Modified: head/share/man/man9/atomic.9 Modified: head/share/man/man9/atomic.9 ============================================================================== --- head/share/man/man9/atomic.9 Thu Aug 22 14:02:34 2013 (r254657) +++ head/share/man/man9/atomic.9 Thu Aug 22 16:00:09 2013 (r254658) @@ -266,7 +266,6 @@ and do not have any variants with memory The .Fn atomic_store functions are only provided with release memory barriers. -.Pp .Bl -hang .It Fn atomic_swap p v .Bd -literal -compact From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 16:01:21 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 ESMTP id 30B22F74; Thu, 22 Aug 2013 16:01:21 +0000 (UTC) (envelope-from joel@FreeBSD.org) 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 1EF0F2797; Thu, 22 Aug 2013 16:01:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7MG1KWQ076075; Thu, 22 Aug 2013 16:01:20 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MG1K4L076074; Thu, 22 Aug 2013 16:01:20 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201308221601.r7MG1K4L076074@svn.freebsd.org> From: Joel Dahl Date: Thu, 22 Aug 2013 16:01:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254659 - head/usr.bin/dtc 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.14 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: Thu, 22 Aug 2013 16:01:21 -0000 Author: joel (doc committer) Date: Thu Aug 22 16:01:20 2013 New Revision: 254659 URL: http://svnweb.freebsd.org/changeset/base/254659 Log: Remove EOL whitespace. Modified: head/usr.bin/dtc/dtc.1 Modified: head/usr.bin/dtc/dtc.1 ============================================================================== --- head/usr.bin/dtc/dtc.1 Thu Aug 22 16:00:09 2013 (r254658) +++ head/usr.bin/dtc/dtc.1 Thu Aug 22 16:01:20 2013 (r254659) @@ -141,11 +141,11 @@ or to be used for device tree source files that contain conditional components. This tool supports two extensions to the standard to support conditional compilation of device trees. -The first is an +The first is an .Ar /include/if [property]/ "file.dts" directive that is allowed at the start of a file and which will only include the specified file if it the specified property is passed with this flag. -The second is the +The second is the .Ar $NAME format for property values. These allow property value to be specified on the command line. From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 16:02: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 ESMTP id 52D9E17C; Thu, 22 Aug 2013 16:02:21 +0000 (UTC) (envelope-from joel@FreeBSD.org) 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 412BC27A6; Thu, 22 Aug 2013 16:02:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7MG2LUU076273; Thu, 22 Aug 2013 16:02:21 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MG2LxO076272; Thu, 22 Aug 2013 16:02:21 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201308221602.r7MG2LxO076272@svn.freebsd.org> From: Joel Dahl Date: Thu, 22 Aug 2013 16:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254660 - head/lib/libc/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.14 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: Thu, 22 Aug 2013 16:02:21 -0000 Author: joel (doc committer) Date: Thu Aug 22 16:02:20 2013 New Revision: 254660 URL: http://svnweb.freebsd.org/changeset/base/254660 Log: Remove EOL whitespace. Modified: head/lib/libc/sys/chflags.2 Modified: head/lib/libc/sys/chflags.2 ============================================================================== --- head/lib/libc/sys/chflags.2 Thu Aug 22 16:01:20 2013 (r254659) +++ head/lib/libc/sys/chflags.2 Thu Aug 22 16:02:20 2013 (r254660) @@ -198,7 +198,7 @@ the system is in single-user mode. for details.) .Pp The implementation of all flags is filesystem-dependent. -See the description of the +See the description of the .Dv UF_ARCHIVE flag above for one example of the differences in behavior. Care should be exercised when writing applications to account for From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 16:39:59 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 ESMTP id 8E937C3; Thu, 22 Aug 2013 16:39:59 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 7D1962A22; Thu, 22 Aug 2013 16:39:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7MGdxKn094109; Thu, 22 Aug 2013 16:39:59 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MGdxjN094108; Thu, 22 Aug 2013 16:39:59 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308221639.r7MGdxjN094108@svn.freebsd.org> From: Jung-uk Kim Date: Thu, 22 Aug 2013 16:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254663 - head/sys/pc98/pc98 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.14 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: Thu, 22 Aug 2013 16:39:59 -0000 Author: jkim Date: Thu Aug 22 16:39:59 2013 New Revision: 254663 URL: http://svnweb.freebsd.org/changeset/base/254663 Log: MFi386: r254619 Reimplement atomic_load_acq_64() and atomic_store_rel_64() for i386. Noticed by: tinderbox Modified: head/sys/pc98/pc98/machdep.c Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Thu Aug 22 16:34:03 2013 (r254662) +++ head/sys/pc98/pc98/machdep.c Thu Aug 22 16:39:59 2013 (r254663) @@ -1359,21 +1359,6 @@ idle_sysctl(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, idle_sysctl, "A", "currently selected idle function"); -uint64_t (*atomic_load_acq_64)(volatile uint64_t *) = - atomic_load_acq_64_i386; -void (*atomic_store_rel_64)(volatile uint64_t *, uint64_t) = - atomic_store_rel_64_i386; - -static void -cpu_probe_cmpxchg8b(void) -{ - - if ((cpu_feature & CPUID_CX8) != 0) { - atomic_load_acq_64 = atomic_load_acq_64_i586; - atomic_store_rel_64 = atomic_store_rel_64_i586; - } -} - /* * Reset registers to default values on exec. */ @@ -2422,8 +2407,6 @@ init386(first) thread0.td_pcb->pcb_cr3 = (int)IdlePTD; thread0.td_pcb->pcb_ext = 0; thread0.td_frame = &proc0_tf; - - cpu_probe_cmpxchg8b(); } void From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 18:05: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 ESMTP id B80AD87E; Thu, 22 Aug 2013 18:05:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) 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 8C50A20B2; Thu, 22 Aug 2013 18:05: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 r7MI5Vro039607; Thu, 22 Aug 2013 18:05:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MI5VvQ039606; Thu, 22 Aug 2013 18:05:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308221805.r7MI5VvQ039606@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 22 Aug 2013 18:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254666 - 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.14 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: Thu, 22 Aug 2013 18:05:31 -0000 Author: kib Date: Thu Aug 22 18:05:31 2013 New Revision: 254666 URL: http://svnweb.freebsd.org/changeset/base/254666 Log: Use the generation count of the pv list to work around LOR between pmap lock and pv list lock, and use the shared locking on pvh_global_lock in pmap_remove_write(), same as it was done for pmap_ts_referenced(). Noted and reviewed by: alc (previous version) Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Aug 22 17:33:50 2013 (r254665) +++ head/sys/amd64/amd64/pmap.c Thu Aug 22 18:05:31 2013 (r254666) @@ -4765,10 +4765,12 @@ pmap_remove_write(vm_page_t m) { struct md_page *pvh; pmap_t pmap; + struct rwlock *lock; pv_entry_t next_pv, pv; pd_entry_t *pde; pt_entry_t oldpte, *pte; vm_offset_t va; + int pvh_gen, md_gen; KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_write: page %p is not managed", m)); @@ -4781,23 +4783,51 @@ pmap_remove_write(vm_page_t m) VM_OBJECT_ASSERT_WLOCKED(m->object); if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; - rw_wlock(&pvh_global_lock); + rw_rlock(&pvh_global_lock); + lock = VM_PAGE_TO_PV_LIST_LOCK(m); + pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); +retry_pv_loop: + rw_wlock(lock); if ((m->flags & PG_FICTITIOUS) != 0) goto small_mappings; - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_next, next_pv) { pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); + if (!PMAP_TRYLOCK(pmap)) { + pvh_gen = pvh->pv_gen; + rw_wunlock(lock); + PMAP_LOCK(pmap); + rw_wlock(lock); + if (pvh_gen != pvh->pv_gen) { + PMAP_UNLOCK(pmap); + rw_wunlock(lock); + goto retry_pv_loop; + } + } va = pv->pv_va; pde = pmap_pde(pmap, va); if ((*pde & PG_RW) != 0) - (void)pmap_demote_pde(pmap, pde, va); + (void)pmap_demote_pde_locked(pmap, pde, va, &lock); + KASSERT(lock == VM_PAGE_TO_PV_LIST_LOCK(m), + ("inconsistent pv lock %p %p for page %p", + lock, VM_PAGE_TO_PV_LIST_LOCK(m), m)); PMAP_UNLOCK(pmap); } small_mappings: TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); + if (!PMAP_TRYLOCK(pmap)) { + pvh_gen = pvh->pv_gen; + md_gen = m->md.pv_gen; + rw_wunlock(lock); + PMAP_LOCK(pmap); + rw_wlock(lock); + if (pvh_gen != pvh->pv_gen || + md_gen != m->md.pv_gen) { + PMAP_UNLOCK(pmap); + rw_wunlock(lock); + goto retry_pv_loop; + } + } pde = pmap_pde(pmap, pv->pv_va); KASSERT((*pde & PG_PS) == 0, ("pmap_remove_write: found a 2mpage in page %p's pv list", @@ -4815,8 +4845,9 @@ retry: } PMAP_UNLOCK(pmap); } + rw_wunlock(lock); vm_page_aflag_clear(m, PGA_WRITEABLE); - rw_wunlock(&pvh_global_lock); + rw_runlock(&pvh_global_lock); } /* From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 18:12: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 ESMTP id 8347EEC8; Thu, 22 Aug 2013 18:12:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) 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 6F7F221D3; Thu, 22 Aug 2013 18:12:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7MICRHf044106; Thu, 22 Aug 2013 18:12:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MICOkj044092; Thu, 22 Aug 2013 18:12:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308221812.r7MICOkj044092@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 22 Aug 2013 18:12:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254667 - in head/sys: amd64/amd64 arm/arm i386/i386 i386/xen ia64/ia64 mips/mips powerpc/aim powerpc/booke sparc64/sparc64 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.14 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: Thu, 22 Aug 2013 18:12:27 -0000 Author: kib Date: Thu Aug 22 18:12:24 2013 New Revision: 254667 URL: http://svnweb.freebsd.org/changeset/base/254667 Log: Revert r254501. Instead, reuse the type stability of the struct pmap which is the part of struct vmspace, allocated from UMA_ZONE_NOFREE zone. Initialize the pmap lock in the vmspace zone init function, and remove pmap lock initialization and destruction from pmap_pinit() and pmap_release(). Suggested and reviewed by: alc (previous version) Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap-v6.c head/sys/arm/arm/pmap.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c head/sys/ia64/ia64/pmap.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/vm_map.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/amd64/amd64/pmap.c Thu Aug 22 18:12:24 2013 (r254667) @@ -1687,8 +1687,6 @@ pmap_pinit(pmap_t pmap) vm_page_t pml4pg; int i; - PMAP_LOCK_INIT(pmap); - /* * allocate the page directory page */ @@ -1959,9 +1957,6 @@ pmap_release(pmap_t pmap) KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_release: pmap has reserved page table page(s)")); - rw_wlock(&pvh_global_lock); - rw_wunlock(&pvh_global_lock); - m = PHYS_TO_VM_PAGE(pmap->pm_pml4[PML4PML4I] & PG_FRAME); for (i = 0; i < NKPML4E; i++) /* KVA */ @@ -1973,7 +1968,6 @@ pmap_release(pmap_t pmap) m->wire_count--; atomic_subtract_int(&cnt.v_wire_count, 1); vm_page_free_zero(m); - PMAP_LOCK_DESTROY(pmap); } static int Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/arm/arm/pmap-v6.c Thu Aug 22 18:12:24 2013 (r254667) @@ -1814,7 +1814,6 @@ pmap_release(pmap_t pmap) } pmap_free_l1(pmap); - PMAP_LOCK_DESTROY(pmap); dprintf("pmap_release()\n"); } @@ -3225,7 +3224,6 @@ pmap_pinit(pmap_t pmap) { PDEBUG(1, printf("pmap_pinit: pmap = %08x\n", (uint32_t) pmap)); - PMAP_LOCK_INIT(pmap); pmap_alloc_l1(pmap); bzero(pmap->pm_l2, sizeof(pmap->pm_l2)); Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/arm/arm/pmap.c Thu Aug 22 18:12:24 2013 (r254667) @@ -2479,7 +2479,6 @@ pmap_release(pmap_t pmap) } pmap_free_l1(pmap); - PMAP_LOCK_DESTROY(pmap); dprintf("pmap_release()\n"); } @@ -3819,7 +3818,6 @@ pmap_pinit(pmap_t pmap) { PDEBUG(1, printf("pmap_pinit: pmap = %08x\n", (uint32_t) pmap)); - PMAP_LOCK_INIT(pmap); pmap_alloc_l1(pmap); bzero(pmap->pm_l2, sizeof(pmap->pm_l2)); Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/i386/i386/pmap.c Thu Aug 22 18:12:24 2013 (r254667) @@ -1738,8 +1738,6 @@ pmap_pinit(pmap_t pmap) vm_paddr_t pa; int i; - PMAP_LOCK_INIT(pmap); - /* * No need to allocate page table space yet but we do need a valid * page directory table. @@ -2051,7 +2049,6 @@ pmap_release(pmap_t pmap) atomic_subtract_int(&cnt.v_wire_count, 1); vm_page_free_zero(m); } - PMAP_LOCK_DESTROY(pmap); } static int Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/i386/xen/pmap.c Thu Aug 22 18:12:24 2013 (r254667) @@ -1452,8 +1452,6 @@ pmap_pinit(pmap_t pmap) mtx_lock(&createdelete_lock); #endif - PMAP_LOCK_INIT(pmap); - /* * No need to allocate page table space yet but we do need a valid * page directory table. @@ -1821,7 +1819,6 @@ pmap_release(pmap_t pmap) #ifdef PAE pmap_qremove((vm_offset_t)pmap->pm_pdpt, 1); #endif - PMAP_LOCK_DESTROY(pmap); #ifdef HAMFISTED_LOCKING mtx_unlock(&createdelete_lock); Modified: head/sys/ia64/ia64/pmap.c ============================================================================== --- head/sys/ia64/ia64/pmap.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/ia64/ia64/pmap.c Thu Aug 22 18:12:24 2013 (r254667) @@ -622,6 +622,8 @@ pmap_free_rid(uint32_t rid) void pmap_pinit0(struct pmap *pmap) { + + PMAP_LOCK_INIT(pmap); /* kernel_pmap is the same as any other pmap. */ pmap_pinit(pmap); } @@ -635,7 +637,6 @@ pmap_pinit(struct pmap *pmap) { int i; - PMAP_LOCK_INIT(pmap); for (i = 0; i < IA64_VM_MINKERN_REGION; i++) pmap->pm_rid[i] = pmap_allocate_rid(); TAILQ_INIT(&pmap->pm_pvchunk); @@ -660,7 +661,6 @@ pmap_release(pmap_t pmap) for (i = 0; i < IA64_VM_MINKERN_REGION; i++) if (pmap->pm_rid[i]) pmap_free_rid(pmap->pm_rid[i]); - PMAP_LOCK_DESTROY(pmap); } /* Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/mips/mips/pmap.c Thu Aug 22 18:12:24 2013 (r254667) @@ -1070,8 +1070,6 @@ pmap_pinit(pmap_t pmap) vm_page_t ptdpg; int i; - PMAP_LOCK_INIT(pmap); - /* * allocate the page directory page */ @@ -1231,7 +1229,6 @@ pmap_release(pmap_t pmap) ptdpg->wire_count--; atomic_subtract_int(&cnt.v_wire_count, 1); vm_page_free_zero(ptdpg); - PMAP_LOCK_DESTROY(pmap); } /* Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/powerpc/aim/mmu_oea.c Thu Aug 22 18:12:24 2013 (r254667) @@ -1655,7 +1655,6 @@ moea_pinit(mmu_t mmu, pmap_t pmap) u_int entropy; KASSERT((int)pmap < VM_MIN_KERNEL_ADDRESS, ("moea_pinit: virt pmap")); - PMAP_LOCK_INIT(pmap); RB_INIT(&pmap->pmap_pvo); entropy = 0; @@ -1719,6 +1718,7 @@ void moea_pinit0(mmu_t mmu, pmap_t pm) { + PMAP_LOCK_INIT(pm); moea_pinit(mmu, pm); bzero(&pm->pm_stats, sizeof(pm->pm_stats)); } @@ -1824,7 +1824,6 @@ moea_release(mmu_t mmu, pmap_t pmap) idx /= VSID_NBPW; moea_vsid_bitmap[idx] &= ~mask; mtx_unlock(&moea_vsid_mutex); - PMAP_LOCK_DESTROY(pmap); } /* Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/powerpc/aim/mmu_oea64.c Thu Aug 22 18:12:24 2013 (r254667) @@ -1879,7 +1879,7 @@ moea64_get_unique_vsid(void) { void moea64_pinit(mmu_t mmu, pmap_t pmap) { - PMAP_LOCK_INIT(pmap); + RB_INIT(&pmap->pmap_pvo); pmap->pm_slb_tree_root = slb_alloc_tree(); @@ -1893,7 +1893,6 @@ moea64_pinit(mmu_t mmu, pmap_t pmap) int i; uint32_t hash; - PMAP_LOCK_INIT(pmap); RB_INIT(&pmap->pmap_pvo); if (pmap_bootstrapped) @@ -1920,6 +1919,8 @@ moea64_pinit(mmu_t mmu, pmap_t pmap) void moea64_pinit0(mmu_t mmu, pmap_t pm) { + + PMAP_LOCK_INIT(pm); moea64_pinit(mmu, pm); bzero(&pm->pm_stats, sizeof(pm->pm_stats)); } @@ -2074,8 +2075,6 @@ moea64_release(mmu_t mmu, pmap_t pmap) moea64_release_vsid(VSID_TO_HASH(pmap->pm_sr[0])); #endif - - PMAP_LOCK_DESTROY(pmap); } /* Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/powerpc/booke/pmap.c Thu Aug 22 18:12:24 2013 (r254667) @@ -1477,6 +1477,7 @@ static void mmu_booke_pinit0(mmu_t mmu, pmap_t pmap) { + PMAP_LOCK_INIT(pmap); mmu_booke_pinit(mmu, pmap); PCPU_SET(curpmap, pmap); } @@ -1495,7 +1496,6 @@ mmu_booke_pinit(mmu_t mmu, pmap_t pmap) KASSERT((pmap != kernel_pmap), ("pmap_pinit: initializing kernel_pmap")); - PMAP_LOCK_INIT(pmap); for (i = 0; i < MAXCPU; i++) pmap->pm_tid[i] = TID_NONE; CPU_ZERO(&kernel_pmap->pm_active); @@ -1516,8 +1516,6 @@ mmu_booke_release(mmu_t mmu, pmap_t pmap KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); - - PMAP_LOCK_DESTROY(pmap); } /* Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/sparc64/sparc64/pmap.c Thu Aug 22 18:12:24 2013 (r254667) @@ -1204,8 +1204,6 @@ pmap_pinit(pmap_t pm) vm_page_t m; int i; - PMAP_LOCK_INIT(pm); - /* * Allocate KVA space for the TSB. */ @@ -1299,7 +1297,6 @@ pmap_release(pmap_t pm) vm_page_free_zero(m); } VM_OBJECT_WUNLOCK(obj); - PMAP_LOCK_DESTROY(pm); } /* Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Thu Aug 22 18:05:31 2013 (r254666) +++ head/sys/vm/vm_map.c Thu Aug 22 18:12:24 2013 (r254667) @@ -226,6 +226,7 @@ vmspace_zinit(void *mem, int size, int f vm->vm_map.pmap = NULL; (void)vm_map_zinit(&vm->vm_map, sizeof(vm->vm_map), flags); + PMAP_LOCK_INIT(vmspace_pmap(vm)); return (0); } From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 18:26: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 ESMTP id A00C57B9; Thu, 22 Aug 2013 18:26:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) 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 7F9D92316; Thu, 22 Aug 2013 18:26: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 r7MIQk09050805; Thu, 22 Aug 2013 18:26:46 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MIQjOS050794; Thu, 22 Aug 2013 18:26:45 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308221826.r7MIQjOS050794@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 22 Aug 2013 18:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254668 - in head/sys: kern 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.14 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: Thu, 22 Aug 2013 18:26:46 -0000 Author: kib Date: Thu Aug 22 18:26:45 2013 New Revision: 254668 URL: http://svnweb.freebsd.org/changeset/base/254668 Log: Both cluster_rbuild() and cluster_wbuild() sometimes set the pages shared busy without first draining the hard busy state. Previously it went unnoticed since VPO_BUSY and m->busy fields were distinct, and vm_page_io_start() did not verified that the passed page has VPO_BUSY flag cleared, but such page state is wrong. New implementation is more strict and catched this case. Drain the busy state as needed, before calling vm_page_sbusy(). Tested by: pho, jkim Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_cluster.c head/sys/sys/buf.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Aug 22 18:12:24 2013 (r254667) +++ head/sys/kern/vfs_bio.c Thu Aug 22 18:26:45 2013 (r254668) @@ -108,7 +108,6 @@ static void vm_hold_load_pages(struct bu static void vfs_page_set_valid(struct buf *bp, vm_ooffset_t off, vm_page_t m); static void vfs_page_set_validclean(struct buf *bp, vm_ooffset_t off, vm_page_t m); -static void vfs_drain_busy_pages(struct buf *bp); static void vfs_clean_pages_dirty_buf(struct buf *bp); static void vfs_setdirty_locked_object(struct buf *bp); static void vfs_vmio_release(struct buf *bp); @@ -3983,7 +3982,7 @@ vfs_page_set_validclean(struct buf *bp, * Ensure that all buffer pages are not exclusive busied. If any page is * exclusive busy, drain it. */ -static void +void vfs_drain_busy_pages(struct buf *bp) { vm_page_t m; Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Thu Aug 22 18:12:24 2013 (r254667) +++ head/sys/kern/vfs_cluster.c Thu Aug 22 18:26:45 2013 (r254668) @@ -315,7 +315,7 @@ cluster_rbuild(struct vnode *vp, u_quad_ daddr_t bn; off_t off; long tinc, tsize; - int i, inc, j, toff; + int i, inc, j, k, toff; KASSERT(size == vp->v_mount->mnt_stat.f_iosize, ("cluster_rbuild: size %ld != f_iosize %jd\n", @@ -378,7 +378,15 @@ cluster_rbuild(struct vnode *vp, u_quad_ inc = btodb(size); bo = &vp->v_bufobj; for (bn = blkno, i = 0; i < run; ++i, bn += inc) { - if (i != 0) { + if (i == 0) { + VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); + vfs_drain_busy_pages(tbp); + vm_object_pip_add(tbp->b_bufobj->bo_object, + tbp->b_npages); + for (k = 0; k < tbp->b_npages; k++) + vm_page_sbusy(tbp->b_pages[k]); + VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); + } else { if ((bp->b_npages * PAGE_SIZE) + round_page(size) > vp->v_mount->mnt_iosize_max) { break; @@ -424,14 +432,23 @@ cluster_rbuild(struct vnode *vp, u_quad_ if ((tbp->b_pages[j]->valid & vm_page_bits(toff, tinc)) != 0) break; + if (vm_page_xbusied(tbp->b_pages[j])) + break; + vm_object_pip_add(tbp->b_bufobj->bo_object, 1); + vm_page_sbusy(tbp->b_pages[j]); off += tinc; tsize -= tinc; } - VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); if (tsize > 0) { +clean_sbusy: + vm_object_pip_add(tbp->b_bufobj->bo_object, -j); + for (k = 0; k < j; k++) + vm_page_sunbusy(tbp->b_pages[k]); + VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); bqrelse(tbp); break; } + VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object); /* * Set a read-ahead mark as appropriate @@ -451,8 +468,8 @@ cluster_rbuild(struct vnode *vp, u_quad_ if (tbp->b_blkno == tbp->b_lblkno) { tbp->b_blkno = bn; } else if (tbp->b_blkno != bn) { - brelse(tbp); - break; + VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); + goto clean_sbusy; } } /* @@ -466,10 +483,8 @@ cluster_rbuild(struct vnode *vp, u_quad_ for (j = 0; j < tbp->b_npages; j += 1) { vm_page_t m; m = tbp->b_pages[j]; - vm_page_sbusy(m); - vm_object_pip_add(m->object, 1); if ((bp->b_npages == 0) || - (bp->b_pages[bp->b_npages-1] != m)) { + (bp->b_pages[bp->b_npages-1] != m)) { bp->b_pages[bp->b_npages] = m; bp->b_npages++; } @@ -944,7 +959,9 @@ cluster_wbuild(struct vnode *vp, long si vm_page_t m; VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); - if (i != 0) { /* if not first buffer */ + if (i == 0) { + vfs_drain_busy_pages(tbp); + } else { /* if not first buffer */ for (j = 0; j < tbp->b_npages; j += 1) { m = tbp->b_pages[j]; if (vm_page_xbusied(m)) { Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Thu Aug 22 18:12:24 2013 (r254667) +++ head/sys/sys/buf.h Thu Aug 22 18:26:45 2013 (r254668) @@ -501,6 +501,7 @@ void bufstrategy(struct bufobj *, struct void brelse(struct buf *); void bqrelse(struct buf *); int vfs_bio_awrite(struct buf *); +void vfs_drain_busy_pages(struct buf *bp); struct buf * getpbuf(int *); struct buf *incore(struct bufobj *, daddr_t); struct buf *gbincore(struct bufobj *, daddr_t); From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 19:28:14 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 ESMTP id 6E94F26F; Thu, 22 Aug 2013 19:28:14 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) 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 5CD4A2818; Thu, 22 Aug 2013 19:28:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7MJSElv082840; Thu, 22 Aug 2013 19:28:14 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MJSE4r082838; Thu, 22 Aug 2013 19:28:14 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201308221928.r7MJSE4r082838@svn.freebsd.org> From: Michael Tuexen Date: Thu, 22 Aug 2013 19:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254670 - 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.14 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: Thu, 22 Aug 2013 19:28:14 -0000 Author: tuexen Date: Thu Aug 22 19:28:13 2013 New Revision: 254670 URL: http://svnweb.freebsd.org/changeset/base/254670 Log: Make also the features of the association 64-bit. When exporting to xinpcb, just export the lower 32-bit. Using there also 64-bits will break the ABI and will be committed separetly. MFC after: 2 weeks X-MFC with: 254248 Modified: head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.c Modified: head/sys/netinet/sctp_structs.h ============================================================================== --- head/sys/netinet/sctp_structs.h Thu Aug 22 18:41:28 2013 (r254669) +++ head/sys/netinet/sctp_structs.h Thu Aug 22 19:28:13 2013 (r254670) @@ -1205,7 +1205,7 @@ struct sctp_association { /* JRS 5/21/07 - CMT PF variable */ uint8_t sctp_cmt_pf; uint8_t use_precise_time; - uint32_t sctp_features; + uint64_t sctp_features; uint16_t port; /* remote UDP encapsulation port */ /* * The mapping array is used to track out of order sequences above Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Thu Aug 22 18:41:28 2013 (r254669) +++ head/sys/netinet/sctp_sysctl.c Thu Aug 22 19:28:13 2013 (r254670) @@ -402,7 +402,7 @@ sctp_assoclist(SYSCTL_HANDLER_ARGS) xinpcb.last = 0; xinpcb.local_port = ntohs(inp->sctp_lport); xinpcb.flags = inp->sctp_flags; - xinpcb.features = inp->sctp_features; + xinpcb.features = (uint32_t) inp->sctp_features; xinpcb.total_sends = inp->total_sends; xinpcb.total_recvs = inp->total_recvs; xinpcb.total_nospaces = inp->total_nospaces; From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 20:07: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 ESMTP id 1DE2028B; Thu, 22 Aug 2013 20:07:07 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) 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 0BDA92B28; Thu, 22 Aug 2013 20:07: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 r7MK76KN003472; Thu, 22 Aug 2013 20:07:06 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MK76N3003470; Thu, 22 Aug 2013 20:07:06 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201308222007.r7MK76N3003470@svn.freebsd.org> From: "Justin T. Gibbs" Date: Thu, 22 Aug 2013 20:07:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254671 - in head/sys/i386: i386 xen 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.14 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: Thu, 22 Aug 2013 20:07:07 -0000 Author: gibbs Date: Thu Aug 22 20:07:06 2013 New Revision: 254671 URL: http://svnweb.freebsd.org/changeset/base/254671 Log: Rename definition of HYPERVISOR_VIRT_START to avoid conflict with upstream Xen definition found in xen/interface/arch-x86/xen-x86_32.h. Submitted by: Roger Pau Monné Reviewed by: gibbs MFC after: 2 weeks Modified: head/sys/i386/i386/genassym.c head/sys/i386/xen/locore.s Modified: head/sys/i386/i386/genassym.c ============================================================================== --- head/sys/i386/i386/genassym.c Thu Aug 22 19:28:13 2013 (r254670) +++ head/sys/i386/i386/genassym.c Thu Aug 22 20:07:06 2013 (r254671) @@ -246,9 +246,8 @@ ASSYM(BUS_SPACE_HANDLE_IAT, offsetof(str #endif #ifdef XEN -#include ASSYM(PC_CR3, offsetof(struct pcpu, pc_cr3)); -ASSYM(HYPERVISOR_VIRT_START, __HYPERVISOR_VIRT_START); +ASSYM(XEN_HYPERVISOR_VIRT_START, HYPERVISOR_VIRT_START); #endif #ifdef HWPMC_HOOKS Modified: head/sys/i386/xen/locore.s ============================================================================== --- head/sys/i386/xen/locore.s Thu Aug 22 19:28:13 2013 (r254670) +++ head/sys/i386/xen/locore.s Thu Aug 22 20:07:06 2013 (r254671) @@ -76,7 +76,7 @@ ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, KERNBASE) ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, btext) ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypercall_page) - ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long, HYPERVISOR_VIRT_START) + ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long, XEN_HYPERVISOR_VIRT_START) #if 0 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel") #endif From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 20:29:59 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 ESMTP id 12786E86; Thu, 22 Aug 2013 20:29:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) 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 DAD062F2B; Thu, 22 Aug 2013 20:29: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 r7MKTwVU014902; Thu, 22 Aug 2013 20:29:58 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MKTwWL014898; Thu, 22 Aug 2013 20:29:58 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201308222029.r7MKTwWL014898@svn.freebsd.org> From: Michael Tuexen Date: Thu, 22 Aug 2013 20:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254672 - in head/sys: netinet 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.14 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: Thu, 22 Aug 2013 20:29:59 -0000 Author: tuexen Date: Thu Aug 22 20:29:57 2013 New Revision: 254672 URL: http://svnweb.freebsd.org/changeset/base/254672 Log: Export the inpcb features as a 64-bit entity. Bump __FreeBSD_version to 1000048 since the modified structure is user visible and used by netstat, for example. Modified: head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_uio.h head/sys/sys/param.h Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Thu Aug 22 20:07:06 2013 (r254671) +++ head/sys/netinet/sctp_sysctl.c Thu Aug 22 20:29:57 2013 (r254672) @@ -402,7 +402,7 @@ sctp_assoclist(SYSCTL_HANDLER_ARGS) xinpcb.last = 0; xinpcb.local_port = ntohs(inp->sctp_lport); xinpcb.flags = inp->sctp_flags; - xinpcb.features = (uint32_t) inp->sctp_features; + xinpcb.features = inp->sctp_features; xinpcb.total_sends = inp->total_sends; xinpcb.total_recvs = inp->total_recvs; xinpcb.total_nospaces = inp->total_nospaces; Modified: head/sys/netinet/sctp_uio.h ============================================================================== --- head/sys/netinet/sctp_uio.h Thu Aug 22 20:07:06 2013 (r254671) +++ head/sys/netinet/sctp_uio.h Thu Aug 22 20:29:57 2013 (r254672) @@ -1149,7 +1149,7 @@ union sctp_sockstore { struct xsctp_inpcb { uint32_t last; uint32_t flags; - uint32_t features; + uint64_t features; uint32_t total_sends; uint32_t total_recvs; uint32_t total_nospaces; @@ -1157,7 +1157,7 @@ struct xsctp_inpcb { uint16_t local_port; uint16_t qlen; uint16_t maxqlen; - uint32_t extra_padding[32]; /* future */ + uint32_t extra_padding[31]; /* future */ }; struct xsctp_tcb { Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Aug 22 20:07:06 2013 (r254671) +++ head/sys/sys/param.h Thu Aug 22 20:29:57 2013 (r254672) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000047 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000048 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@FreeBSD.ORG Thu Aug 22 22:01:57 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 ESMTP id 27296D66; Thu, 22 Aug 2013 22:01:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) 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 F09372788; Thu, 22 Aug 2013 22:01: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 r7MM1uJr067521; Thu, 22 Aug 2013 22:01:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7MM1upF067520; Thu, 22 Aug 2013 22:01:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308222201.r7MM1upF067520@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 22 Aug 2013 22:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254673 - head/share/man/man9 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.14 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: Thu, 22 Aug 2013 22:01:57 -0000 Author: kib Date: Thu Aug 22 22:01:56 2013 New Revision: 254673 URL: http://svnweb.freebsd.org/changeset/base/254673 Log: Update the manual page for vm_page_grab(9). Reviewed and edited by: alc Sponsored by: The FreeBSD Foundation Modified: head/share/man/man9/vm_page_grab.9 Modified: head/share/man/man9/vm_page_grab.9 ============================================================================== --- head/share/man/man9/vm_page_grab.9 Thu Aug 22 20:29:57 2013 (r254672) +++ head/share/man/man9/vm_page_grab.9 Thu Aug 22 22:01:56 2013 (r254673) @@ -1,5 +1,9 @@ .\" .\" Copyright (C) 2001 Chad David . All rights reserved. +.\" Copyright (c) 2013 The FreeBSD Foundation +.\" +.\" Portions of this documentation were written by Konstantin Belousov +.\" under sponsorship from the FreeBSD Foundation. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -26,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 7, 2001 +.Dd August 23, 2013 .Dt VM_PAGE_GRAB 9 .Os .Sh NAME @@ -48,21 +52,31 @@ If the page exists and is busy, .Fn vm_page_grab will sleep while waiting for it. If the page does not exist, it is allocated. +The function sleeps until the allocation request can be satisfied. +.Pp +The function requires the +.Fa object +to be locked on entry, and returns with the object locked. +If the +.Fn vm_page_grab +function sleeps for any reason, the object lock is temporary dropped. .Pp -If -.Dv VM_ALLOC_RETRY -is not set in -.Fa allocflags -and the function sleeps, either getting the page from the object -or while allocating it, -.Dv NULL -is returned. +The +.Fn vm_page_grab +supports all of the flags supported by +.Xr vm_page_alloc . +In addition, +.Fn vm_page_grab +supports the following flags: +.Bl -tag -width ".Dv VM_ALLOC_IGN_SBUSY" +.It Dv VM_ALLOC_IGN_SBUSY +When waiting for the busy state of the existing page to drain, +only test for exclusive busy; ignore the shared busy counter. +.El .Sh RETURN VALUES -If successful, +The .Fn vm_page_grab -returns the page; otherwise, -.Dv NULL -is returned. +always returns the page. .Sh SEE ALSO .Xr vm_page_alloc 9 .Sh AUTHORS From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 10:57: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 ESMTP id 17E6B208; Fri, 23 Aug 2013 10:57:06 +0000 (UTC) (envelope-from des@FreeBSD.org) 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 051B72D9A; Fri, 23 Aug 2013 10:57: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 r7NAv5Bi075680; Fri, 23 Aug 2013 10:57:05 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NAv5ip075679; Fri, 23 Aug 2013 10:57:05 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201308231057.r7NAv5ip075679@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Fri, 23 Aug 2013 10:57:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254684 - head/usr.sbin/rtadvd 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.14 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: Fri, 23 Aug 2013 10:57:06 -0000 Author: des Date: Fri Aug 23 10:57:05 2013 New Revision: 254684 URL: http://svnweb.freebsd.org/changeset/base/254684 Log: Set the back pointer from the prefix to the interface before adding the prefix to the interface's prefix list. This shouldn't make a difference, since rtadvd(8) is single-threaded, but I've seen it crash in delete_prefix() with pfx_rainfo == NULL, and this is the only place where a prefix can be added to the list with a NULL pfx_rainfo. MFC after: 3 days Modified: head/usr.sbin/rtadvd/config.c Modified: head/usr.sbin/rtadvd/config.c ============================================================================== --- head/usr.sbin/rtadvd/config.c Fri Aug 23 08:26:52 2013 (r254683) +++ head/usr.sbin/rtadvd/config.c Fri Aug 23 10:57:05 2013 (r254684) @@ -1125,9 +1125,9 @@ add_prefix(struct rainfo *rai, struct in pfx->pfx_onlinkflg = ipr->ipr_raf_onlink; pfx->pfx_autoconfflg = ipr->ipr_raf_auto; pfx->pfx_origin = PREFIX_FROM_DYNAMIC; + pfx->pfx_rainfo = rai; TAILQ_INSERT_TAIL(&rai->rai_prefix, pfx, pfx_next); - pfx->pfx_rainfo = rai; syslog(LOG_DEBUG, "<%s> new prefix %s/%d was added on %s", __func__, From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 12:28: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 ESMTP id 9DC89298; Fri, 23 Aug 2013 12:28:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) 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 71037238C; Fri, 23 Aug 2013 12:28: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 r7NCSBHP023547; Fri, 23 Aug 2013 12:28:11 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NCSBMS023546; Fri, 23 Aug 2013 12:28:11 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201308231228.r7NCSBMS023546@svn.freebsd.org> From: Ed Maste Date: Fri, 23 Aug 2013 12:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254686 - head/contrib/libexecinfo 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.14 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: Fri, 23 Aug 2013 12:28:11 -0000 Author: emaste Date: Fri Aug 23 12:28:10 2013 New Revision: 254686 URL: http://svnweb.freebsd.org/changeset/base/254686 Log: Import NetBSD libexecinfo 20130822 to contrib Added: head/contrib/libexecinfo/ - copied from r254685, vendor/NetBSD/libexecinfo/ From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 12:35: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 ESMTP id E19979C0; Fri, 23 Aug 2013 12:35:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) 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 B51302438; Fri, 23 Aug 2013 12:35: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 r7NCZmui028196; Fri, 23 Aug 2013 12:35:48 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NCZmFO028195; Fri, 23 Aug 2013 12:35:48 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201308231235.r7NCZmFO028195@svn.freebsd.org> From: Ed Maste Date: Fri, 23 Aug 2013 12:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254687 - head/contrib/libexecinfo 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.14 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: Fri, 23 Aug 2013 12:35:49 -0000 Author: emaste Date: Fri Aug 23 12:35:48 2013 New Revision: 254687 URL: http://svnweb.freebsd.org/changeset/base/254687 Log: Remove accidental import of libexecinfo at wrong directory level Deleted: head/contrib/libexecinfo/ From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 12:38:52 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 ESMTP id 887DFB10; Fri, 23 Aug 2013 12:38:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) 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 5AE832449; Fri, 23 Aug 2013 12:38: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 r7NCcqIv029127; Fri, 23 Aug 2013 12:38:52 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NCcqG4029126; Fri, 23 Aug 2013 12:38:52 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201308231238.r7NCcqG4029126@svn.freebsd.org> From: Ed Maste Date: Fri, 23 Aug 2013 12:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254688 - head/contrib/libexecinfo 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.14 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: Fri, 23 Aug 2013 12:38:52 -0000 Author: emaste Date: Fri Aug 23 12:38:51 2013 New Revision: 254688 URL: http://svnweb.freebsd.org/changeset/base/254688 Log: Import NetBSD libexecinfo 20130822 to contrib Added: head/contrib/libexecinfo/ - copied from r254687, vendor/NetBSD/libexecinfo/dist/ From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 12:42:14 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 ESMTP id AFE85C6C; Fri, 23 Aug 2013 12:42:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) 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 9D9562483; Fri, 23 Aug 2013 12:42:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NCgEko032214; Fri, 23 Aug 2013 12:42:14 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NCgEDU032212; Fri, 23 Aug 2013 12:42:14 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201308231242.r7NCgEDU032212@svn.freebsd.org> From: Ed Maste Date: Fri, 23 Aug 2013 12:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254689 - head/contrib/libexecinfo 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.14 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: Fri, 23 Aug 2013 12:42:14 -0000 Author: emaste Date: Fri Aug 23 12:42:13 2013 New Revision: 254689 URL: http://svnweb.freebsd.org/changeset/base/254689 Log: FreeBSD compatibility for libexecinfo Modified: head/contrib/libexecinfo/backtrace.c head/contrib/libexecinfo/symtab.c Modified: head/contrib/libexecinfo/backtrace.c ============================================================================== --- head/contrib/libexecinfo/backtrace.c Fri Aug 23 12:38:51 2013 (r254688) +++ head/contrib/libexecinfo/backtrace.c Fri Aug 23 12:42:13 2013 (r254689) @@ -33,6 +33,7 @@ __RCSID("$NetBSD: backtrace.c,v 1.2 2012 #include #include +#define _WITH_DPRINTF #include #include #include Modified: head/contrib/libexecinfo/symtab.c ============================================================================== --- head/contrib/libexecinfo/symtab.c Fri Aug 23 12:38:51 2013 (r254688) +++ head/contrib/libexecinfo/symtab.c Fri Aug 23 12:42:13 2013 (r254689) @@ -33,6 +33,7 @@ __RCSID("$NetBSD: symtab.c,v 1.1 2012/05 #include #include +#include #include #include #include From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 13:14:19 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 ESMTP id 5C0E79AB; Fri, 23 Aug 2013 13:14:19 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) 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 3B715266F; Fri, 23 Aug 2013 13:14:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NDEJIl048843; Fri, 23 Aug 2013 13:14:19 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NDEImx048841; Fri, 23 Aug 2013 13:14:18 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201308231314.r7NDEImx048841@svn.freebsd.org> From: Sean Bruno Date: Fri, 23 Aug 2013 13:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254690 - in head/sys/mips: atheros 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.14 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: Fri, 23 Aug 2013 13:14:19 -0000 Author: sbruno Date: Fri Aug 23 13:14:18 2013 New Revision: 254690 URL: http://svnweb.freebsd.org/changeset/base/254690 Log: Some vendors store the mac addresses of arge(4) as a literal sring in the form xx:xx:xx:xx:xx:xx complete with ":" characters taking of 18 bytes instead of 6 integers. Expose a "readascii" tuneable to handle this case. Remove restriction on eepromac assignement for the first dev instance only. Add eepromac address for DIR-825 to hints file. Add readascii hint for DIR-825 Reviewed by: adrian@ Modified: head/sys/mips/atheros/if_arge.c head/sys/mips/conf/DIR-825.hints Modified: head/sys/mips/atheros/if_arge.c ============================================================================== --- head/sys/mips/atheros/if_arge.c Fri Aug 23 12:42:13 2013 (r254689) +++ head/sys/mips/atheros/if_arge.c Fri Aug 23 13:14:18 2013 (r254690) @@ -371,6 +371,7 @@ arge_attach(device_t dev) uint32_t hint; long eeprom_mac_addr = 0; int miicfg = 0; + int readascii = 0; sc = device_get_softc(dev); sc->arge_dev = dev; @@ -384,16 +385,28 @@ arge_attach(device_t dev) * Since multiple units seem to use this feature, include * a method of setting the MAC address based on an flash location * in CPU address space. + * + * Some vendors have decided to store the mac address as a literal + * string of 18 characters in xx:xx:xx:xx:xx:xx format instead of + * an array of numbers. Expose a hint to turn on this conversion + * feature via strtol() */ - if (sc->arge_mac_unit == 0 && - resource_long_value(device_get_name(dev), device_get_unit(dev), + if (resource_long_value(device_get_name(dev), device_get_unit(dev), "eeprommac", &eeprom_mac_addr) == 0) { int i; const char *mac = (const char *) MIPS_PHYS_TO_KSEG1(eeprom_mac_addr); device_printf(dev, "Overriding MAC from EEPROM\n"); - for (i = 0; i < 6; i++) { - ar711_base_mac[i] = mac[i]; + if (resource_int_value(device_get_name(dev), device_get_unit(dev), + "readascii", &readascii) == 0) { + device_printf(dev, "Vendor stores MAC in ASCII format\n"); + for (i = 0; i < 6; i++) { + ar711_base_mac[i] = strtol(&(mac[i*3]), NULL, 16); + } + } else { + for (i = 0; i < 6; i++) { + ar711_base_mac[i] = mac[i]; + } } } Modified: head/sys/mips/conf/DIR-825.hints ============================================================================== --- head/sys/mips/conf/DIR-825.hints Fri Aug 23 12:42:13 2013 (r254689) +++ head/sys/mips/conf/DIR-825.hints Fri Aug 23 13:14:18 2013 (r254690) @@ -6,13 +6,14 @@ hint.arge.0.phymask=0x0 hint.arge.0.media=1000 hint.arge.0.fduplex=1 - -# XXX grab these from uboot? -# hint.arge.0.eeprommac=0x1f01fc00 +hint.arge.0.eeprommac=0x1f66ffa0 +hint.arge.0.readascii=1 hint.arge.1.phymask=0x0 hint.arge.1.media=1000 hint.arge.1.fduplex=1 +hint.arge.1.eeprommac=0x1f66ffb4 +hint.arge.1.readascii=1 # ath0 - slot 17 hint.pcib.0.bus.0.17.0.ath_fixup_addr=0x1f661000 From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 13:47: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 ESMTP id 9D91CA20; Fri, 23 Aug 2013 13:47:18 +0000 (UTC) (envelope-from emaste@FreeBSD.org) 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 8AD0E283F; Fri, 23 Aug 2013 13:47: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 r7NDlIU5066185; Fri, 23 Aug 2013 13:47:18 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NDlIon066184; Fri, 23 Aug 2013 13:47:18 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201308231347.r7NDlIon066184@svn.freebsd.org> From: Ed Maste Date: Fri, 23 Aug 2013 13:47:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254698 - head/contrib/libexecinfo 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.14 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: Fri, 23 Aug 2013 13:47:18 -0000 Author: emaste Date: Fri Aug 23 13:47:18 2013 New Revision: 254698 URL: http://svnweb.freebsd.org/changeset/base/254698 Log: Update libexecinfo man page for FreeBSD Sponsored by: DARPA, AFRL Modified: head/contrib/libexecinfo/backtrace.3 Modified: head/contrib/libexecinfo/backtrace.3 ============================================================================== --- head/contrib/libexecinfo/backtrace.3 Fri Aug 23 13:30:07 2013 (r254697) +++ head/contrib/libexecinfo/backtrace.3 Fri Aug 23 13:47:18 2013 (r254698) @@ -1,4 +1,5 @@ .\" $NetBSD: backtrace.3,v 1.4 2012/06/10 00:24:36 christos Exp $ +.\" $FreeBSD$ .\" .\" Copyright (c) 2012 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 26, 2012 +.Dd August 23, 2013 .Dt BACKTRACE 3 .Os .Sh NAME @@ -116,7 +117,7 @@ on failure. .Sh RETURN VALUES The .Fn backtrace -function returns the number of elements tht were filled in the backtrace. +function returns the number of elements that were filled in the backtrace. The .Fn backtrace_symbols and @@ -133,7 +134,9 @@ Diagnostic output may also be produced b The .Fn backtrace library of functions first appeared in -.Nx 7.0 . +.Nx 7.0 +and +.Fx 10.0 . .Sh BUGS .Bl -enum .It @@ -150,10 +153,9 @@ instead of .Ft size_t arguments. .It -Since -.Xr dladdr 3 -only deals with dynamic symbols, we need to find the symbols from the main -portion of the program. -For that we need to locate the executable, and we use procfs for -finding it, which is not portable. +The +.Fn backtrace_symbols +functions currently rely on +.Xr procfs 5 +to locate the executable. .El From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 13:47:42 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 ESMTP id 82816C35; Fri, 23 Aug 2013 13:47:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) 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 704852849; Fri, 23 Aug 2013 13:47:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NDlglM066393; Fri, 23 Aug 2013 13:47:42 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NDlgM2066392; Fri, 23 Aug 2013 13:47:42 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201308231347.r7NDlgM2066392@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Aug 2013 13:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254699 - 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.14 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: Fri, 23 Aug 2013 13:47:42 -0000 Author: jhb Date: Fri Aug 23 13:47:41 2013 New Revision: 254699 URL: http://svnweb.freebsd.org/changeset/base/254699 Log: Use tvtohz() to convert a socket buffer timeout to a tick value rather than using a home-rolled version. The home-rolled version could result in shorter-than-requested sleeps. Reported by: Vitja Makarov MFC after: 2 weeks Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Fri Aug 23 13:47:18 2013 (r254698) +++ head/sys/kern/uipc_socket.c Fri Aug 23 13:47:41 2013 (r254699) @@ -2699,21 +2699,16 @@ sosetopt(struct socket *so, struct socko if (error) goto bad; - /* assert(hz > 0); */ if (tv.tv_sec < 0 || tv.tv_sec > INT_MAX / hz || tv.tv_usec < 0 || tv.tv_usec >= 1000000) { error = EDOM; goto bad; } - /* assert(tick > 0); */ - /* assert(ULONG_MAX - INT_MAX >= 1000000); */ - val = (u_long)(tv.tv_sec * hz) + tv.tv_usec / tick; - if (val > INT_MAX) { + val = tvtohz(&tv); + if (val == INT_MAX) { error = EDOM; goto bad; } - if (val == 0 && tv.tv_usec != 0) - val = 1; switch (sopt->sopt_name) { case SO_SNDTIMEO: From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 13:59:51 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 ESMTP id DCE75DC8; Fri, 23 Aug 2013 13:59:50 +0000 (UTC) (envelope-from jilles@FreeBSD.org) 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 C91F22965; Fri, 23 Aug 2013 13:59: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 r7NDxopC072631; Fri, 23 Aug 2013 13:59:50 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NDxmF0072609; Fri, 23 Aug 2013 13:59:48 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201308231359.r7NDxmF0072609@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 23 Aug 2013 13:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254700 - in head/lib/libc: net posix1e resolv 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.14 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: Fri, 23 Aug 2013 13:59:51 -0000 Author: jilles Date: Fri Aug 23 13:59:47 2013 New Revision: 254700 URL: http://svnweb.freebsd.org/changeset/base/254700 Log: libc: Make various internal file descriptors from fopen() close-on-exec. Modified: head/lib/libc/net/ether_addr.c head/lib/libc/net/eui64.c head/lib/libc/net/getaddrinfo.c head/lib/libc/net/gethostbyht.c head/lib/libc/net/getnetbyht.c head/lib/libc/net/getprotoent.c head/lib/libc/net/getservent.c head/lib/libc/net/hesiod.c head/lib/libc/net/nsdispatch.c head/lib/libc/net/rcmd.c head/lib/libc/posix1e/mac.c head/lib/libc/resolv/res_init.c head/lib/libc/resolv/res_query.c Modified: head/lib/libc/net/ether_addr.c ============================================================================== --- head/lib/libc/net/ether_addr.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/net/ether_addr.c Fri Aug 23 13:59:47 2013 (r254700) @@ -148,7 +148,7 @@ ether_ntohost(char *hostname, const stru char *yp_domain; #endif - if ((fp = fopen(_PATH_ETHERS, "r")) == NULL) + if ((fp = fopen(_PATH_ETHERS, "re")) == NULL) return (1); while (fgets(buf,BUFSIZ,fp)) { if (buf[0] == '#') @@ -197,7 +197,7 @@ ether_hostton(const char *hostname, stru char *yp_domain; #endif - if ((fp = fopen(_PATH_ETHERS, "r")) == NULL) + if ((fp = fopen(_PATH_ETHERS, "re")) == NULL) return (1); while (fgets(buf,BUFSIZ,fp)) { if (buf[0] == '#') Modified: head/lib/libc/net/eui64.c ============================================================================== --- head/lib/libc/net/eui64.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/net/eui64.c Fri Aug 23 13:59:47 2013 (r254700) @@ -227,7 +227,7 @@ eui64_ntohost(char *hostname, size_t len char eui64_a[24]; char *yp_domain; #endif - if ((fp = fopen(_PATH_EUI64, "r")) == NULL) + if ((fp = fopen(_PATH_EUI64, "re")) == NULL) return (1); while (fgets(buf,BUFSIZ,fp)) { @@ -277,7 +277,7 @@ eui64_hostton(const char *hostname, stru int resultlen; char *yp_domain; #endif - if ((fp = fopen(_PATH_EUI64, "r")) == NULL) + if ((fp = fopen(_PATH_EUI64, "re")) == NULL) return (1); while (fgets(buf,BUFSIZ,fp)) { Modified: head/lib/libc/net/getaddrinfo.c ============================================================================== --- head/lib/libc/net/getaddrinfo.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/net/getaddrinfo.c Fri Aug 23 13:59:47 2013 (r254700) @@ -2240,7 +2240,7 @@ static void _sethtent(FILE **hostf) { if (!*hostf) - *hostf = fopen(_PATH_HOSTS, "r"); + *hostf = fopen(_PATH_HOSTS, "re"); else rewind(*hostf); } @@ -2264,7 +2264,7 @@ _gethtent(FILE **hostf, const char *name const char *addr; char hostbuf[8*1024]; - if (!*hostf && !(*hostf = fopen(_PATH_HOSTS, "r"))) + if (!*hostf && !(*hostf = fopen(_PATH_HOSTS, "re"))) return (NULL); again: if (!(p = fgets(hostbuf, sizeof hostbuf, *hostf))) Modified: head/lib/libc/net/gethostbyht.c ============================================================================== --- head/lib/libc/net/gethostbyht.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/net/gethostbyht.c Fri Aug 23 13:59:47 2013 (r254700) @@ -72,7 +72,7 @@ void _sethosthtent(int f, struct hostent_data *hed) { if (!hed->hostf) - hed->hostf = fopen(_PATH_HOSTS, "r"); + hed->hostf = fopen(_PATH_HOSTS, "re"); else rewind(hed->hostf); hed->stayopen = f; @@ -96,7 +96,7 @@ gethostent_p(struct hostent *he, struct int af, len; char hostbuf[BUFSIZ + 1]; - if (!hed->hostf && !(hed->hostf = fopen(_PATH_HOSTS, "r"))) { + if (!hed->hostf && !(hed->hostf = fopen(_PATH_HOSTS, "re"))) { RES_SET_H_ERRNO(statp, NETDB_INTERNAL); return (-1); } Modified: head/lib/libc/net/getnetbyht.c ============================================================================== --- head/lib/libc/net/getnetbyht.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/net/getnetbyht.c Fri Aug 23 13:59:47 2013 (r254700) @@ -63,7 +63,7 @@ _setnethtent(int f, struct netent_data * { if (ned->netf == NULL) - ned->netf = fopen(_PATH_NETWORKS, "r"); + ned->netf = fopen(_PATH_NETWORKS, "re"); else rewind(ned->netf); ned->stayopen |= f; @@ -89,7 +89,7 @@ getnetent_p(struct netent *ne, struct ne char line[BUFSIZ + 1]; if (ned->netf == NULL && - (ned->netf = fopen(_PATH_NETWORKS, "r")) == NULL) + (ned->netf = fopen(_PATH_NETWORKS, "re")) == NULL) return (-1); again: p = fgets(line, sizeof line, ned->netf); Modified: head/lib/libc/net/getprotoent.c ============================================================================== --- head/lib/libc/net/getprotoent.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/net/getprotoent.c Fri Aug 23 13:59:47 2013 (r254700) @@ -342,7 +342,7 @@ void __setprotoent_p(int f, struct protoent_data *ped) { if (ped->fp == NULL) - ped->fp = fopen(_PATH_PROTOCOLS, "r"); + ped->fp = fopen(_PATH_PROTOCOLS, "re"); else rewind(ped->fp); ped->stayopen |= f; @@ -365,7 +365,7 @@ __getprotoent_p(struct protoent *pe, str char *cp, **q, *endp; long l; - if (ped->fp == NULL && (ped->fp = fopen(_PATH_PROTOCOLS, "r")) == NULL) + if (ped->fp == NULL && (ped->fp = fopen(_PATH_PROTOCOLS, "re")) == NULL) return (-1); again: if ((p = fgets(ped->line, sizeof ped->line, ped->fp)) == NULL) Modified: head/lib/libc/net/getservent.c ============================================================================== --- head/lib/libc/net/getservent.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/net/getservent.c Fri Aug 23 13:59:47 2013 (r254700) @@ -335,7 +335,7 @@ files_servent(void *retval, void *mdata, if (st->fp == NULL) st->compat_mode_active = 0; - if (st->fp == NULL && (st->fp = fopen(_PATH_SERVICES, "r")) == NULL) { + if (st->fp == NULL && (st->fp = fopen(_PATH_SERVICES, "re")) == NULL) { *errnop = errno; return (NS_UNAVAIL); } @@ -449,7 +449,7 @@ files_setservent(void *retval, void *mda case SETSERVENT: f = va_arg(ap,int); if (st->fp == NULL) - st->fp = fopen(_PATH_SERVICES, "r"); + st->fp = fopen(_PATH_SERVICES, "re"); else rewind(st->fp); st->stayopen |= f; Modified: head/lib/libc/net/hesiod.c ============================================================================== --- head/lib/libc/net/hesiod.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/net/hesiod.c Fri Aug 23 13:59:47 2013 (r254700) @@ -286,7 +286,7 @@ read_config_file(ctx, filename) ctx->classes[1] = C_HS; /* Try to open the configuration file. */ - fp = fopen(filename, "r"); + fp = fopen(filename, "re"); if (!fp) { /* Use compiled in default domain names. */ ctx->lhs = strdup(DEF_LHS); Modified: head/lib/libc/net/nsdispatch.c ============================================================================== --- head/lib/libc/net/nsdispatch.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/net/nsdispatch.c Fri Aug 23 13:59:47 2013 (r254700) @@ -361,7 +361,7 @@ nss_configure(void) if (result != 0) goto fin2; } - _nsyyin = fopen(path, "r"); + _nsyyin = fopen(path, "re"); if (_nsyyin == NULL) goto fin; VECTOR_FREE(_nsmap, &_nsmapsize, sizeof(*_nsmap), Modified: head/lib/libc/net/rcmd.c ============================================================================== --- head/lib/libc/net/rcmd.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/net/rcmd.c Fri Aug 23 13:59:47 2013 (r254700) @@ -458,7 +458,7 @@ iruserok_sa(ra, rlen, superuser, ruser, raddr = (struct sockaddr *)&ss; first = 1; - hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "r"); + hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "re"); again: if (hostf) { if (__ivaliduser_sa(hostf, raddr, rlen, luser, ruser) == 0) { @@ -481,7 +481,7 @@ again: */ uid = geteuid(); (void)seteuid(pwd->pw_uid); - hostf = fopen(pbuf, "r"); + hostf = fopen(pbuf, "re"); (void)seteuid(uid); if (hostf == NULL) Modified: head/lib/libc/posix1e/mac.c ============================================================================== --- head/lib/libc/posix1e/mac.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/posix1e/mac.c Fri Aug 23 13:59:47 2013 (r254700) @@ -179,7 +179,7 @@ mac_init_internal(int ignore_errors) filename = getenv("MAC_CONFFILE"); else filename = MAC_CONFFILE; - file = fopen(filename, "r"); + file = fopen(filename, "re"); if (file == NULL) return (0); Modified: head/lib/libc/resolv/res_init.c ============================================================================== --- head/lib/libc/resolv/res_init.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/resolv/res_init.c Fri Aug 23 13:59:47 2013 (r254700) @@ -304,7 +304,7 @@ __res_vinit(res_state statp, int preinit line[sizeof(name) - 1] == '\t')) nserv = 0; - if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) { + if ((fp = fopen(_PATH_RESCONF, "re")) != NULL) { /* read the config file */ while (fgets(buf, sizeof(buf), fp) != NULL) { /* skip comments */ Modified: head/lib/libc/resolv/res_query.c ============================================================================== --- head/lib/libc/resolv/res_query.c Fri Aug 23 13:47:41 2013 (r254699) +++ head/lib/libc/resolv/res_query.c Fri Aug 23 13:59:47 2013 (r254700) @@ -457,7 +457,7 @@ res_hostalias(const res_state statp, con if (issetugid()) return (NULL); file = getenv("HOSTALIASES"); - if (file == NULL || (fp = fopen(file, "r")) == NULL) + if (file == NULL || (fp = fopen(file, "re")) == NULL) return (NULL); setbuf(fp, NULL); buf[sizeof(buf) - 1] = '\0'; From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 14:12: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 ESMTP id DC7DE5B1; Fri, 23 Aug 2013 14:12:39 +0000 (UTC) (envelope-from davide@FreeBSD.org) 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 BB0DF2A7C; Fri, 23 Aug 2013 14:12: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 r7NECdI0081567; Fri, 23 Aug 2013 14:12:39 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NECdG7081565; Fri, 23 Aug 2013 14:12:39 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201308231412.r7NECdG7081565@svn.freebsd.org> From: Davide Italiano Date: Fri, 23 Aug 2013 14:12:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254703 - in head: share/man/man9 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.14 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: Fri, 23 Aug 2013 14:12:40 -0000 Author: davide Date: Fri Aug 23 14:12:39 2013 New Revision: 254703 URL: http://svnweb.freebsd.org/changeset/base/254703 Log: Introduce callout_init_rm() so that callouts can be used in conjunction with rmlocks. This works only with non-sleepable rm because handlers run in SWI context. While here, document the new KPI in the timeout(9) manpage. Requested by: adrian, scottl Reviewed by: mav, remko(manpage) Modified: head/share/man/man9/timeout.9 head/sys/sys/callout.h Modified: head/share/man/man9/timeout.9 ============================================================================== --- head/share/man/man9/timeout.9 Fri Aug 23 14:03:48 2013 (r254702) +++ head/share/man/man9/timeout.9 Fri Aug 23 14:12:39 2013 (r254703) @@ -38,6 +38,7 @@ .Nm callout_handle_init , .Nm callout_init , .Nm callout_init_mtx , +.Nm callout_init_rm , .Nm callout_init_rw , .Nm callout_stop , .Nm callout_drain , @@ -73,6 +74,8 @@ struct callout_handle handle = CALLOUT_H .Fn callout_init "struct callout *c" "int mpsafe" .Ft void .Fn callout_init_mtx "struct callout *c" "struct mtx *mtx" "int flags" +.Fn void +.Fn callout_init_rm "struct callout *c" "struct rmlock *rm" "int flags" .Ft void .Fn callout_init_rw "struct callout *c" "struct rwlock *rw" "int flags" .Ft int @@ -203,6 +206,7 @@ Thus they are protected from re-entrancy The functions .Fn callout_init , .Fn callout_init_mtx , +.Fn callout_init_rm , .Fn callout_init_rw , .Fn callout_stop , .Fn callout_drain , @@ -252,15 +256,25 @@ after the callout function returns. .Pp The .Fn callout_init_rw -function serves the need of using rwlocks in conjunction with callouts. -The function does basically the same as -.Fn callout_init_mtx +and the +.Fn callout_init_rm +fuctions serve the need of using rwlocks and rmlocks in conjunction +with callouts. +The functions do the same as +.Fn callout_init with the possibility of specifying an extra .Fa rw +or +.Fa rm argument. -The usable lock classes are currently limited to mutexes and rwlocks, -because callout handlers run in softclock swi, so they cannot sleep nor -acquire sleepable locks like sx or lockmgr. +If an +.Fa rm +argument is specified, the lock should be created without passing the +.It Dv RM_SLEEPABLE +flag. +The usable lock classes are currently limited to mutexes, rwlocks and +non-sleepable rmlocks, because callout handlers run in softclock swi, +so they cannot sleep nor acquire sleepable locks like sx or lockmgr. The following .Fa flags may be specified: Modified: head/sys/sys/callout.h ============================================================================== --- head/sys/sys/callout.h Fri Aug 23 14:03:48 2013 (r254702) +++ head/sys/sys/callout.h Fri Aug 23 14:12:39 2013 (r254703) @@ -71,6 +71,9 @@ void _callout_init_lock(struct callout * #define callout_init_mtx(c, mtx, flags) \ _callout_init_lock((c), ((mtx) != NULL) ? &(mtx)->lock_object : \ NULL, (flags)) +#define callout_init_rm(c, rm, flags) + _callout_init_lock((c), ((rm != NULL) ? &(rm)->lock_object : \ + NULL, (flags)) #define callout_init_rw(c, rw, flags) \ _callout_init_lock((c), ((rw) != NULL) ? &(rw)->lock_object : \ NULL, (flags)) From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 14:23:54 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 ESMTP id DDBEFA01; Fri, 23 Aug 2013 14:23:54 +0000 (UTC) (envelope-from jilles@FreeBSD.org) 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 CB6AD2B05; Fri, 23 Aug 2013 14:23:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NENsZP087118; Fri, 23 Aug 2013 14:23:54 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NENs5C087117; Fri, 23 Aug 2013 14:23:54 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201308231423.r7NENs5C087117@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 23 Aug 2013 14:23:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254706 - head/lib/libc/include 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.14 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: Fri, 23 Aug 2013 14:23:54 -0000 Author: jilles Date: Fri Aug 23 14:23:54 2013 New Revision: 254706 URL: http://svnweb.freebsd.org/changeset/base/254706 Log: libc: Access some unexported variables more efficiently (related to stdio). Modified: head/lib/libc/include/libc_private.h Modified: head/lib/libc/include/libc_private.h ============================================================================== --- head/lib/libc/include/libc_private.h Fri Aug 23 14:18:24 2013 (r254705) +++ head/lib/libc/include/libc_private.h Fri Aug 23 14:23:54 2013 (r254706) @@ -83,7 +83,7 @@ void _rtld_error(const char *fmt, ...); #define FUNLOCKFILE(fp) if (__isthreaded) _funlockfile(fp) struct _spinlock; -extern struct _spinlock __stdio_thread_lock; +extern struct _spinlock __stdio_thread_lock __hidden; #define STDIO_THREAD_LOCK() \ do { \ if (__isthreaded) \ @@ -218,7 +218,7 @@ void _malloc_postfork(void); /* * Function to clean up streams, called from abort() and exit(). */ -extern void (*__cleanup)(void); +extern void (*__cleanup)(void) __hidden; /* * Get kern.osreldate to detect ABI revisions. Explicitly From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 14:31: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 ESMTP id 96313ECE; Fri, 23 Aug 2013 14:31:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) 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 83C0F2B76; Fri, 23 Aug 2013 14:31: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 r7NEV5I1091270; Fri, 23 Aug 2013 14:31:05 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NEV5OU091269; Fri, 23 Aug 2013 14:31:05 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201308231431.r7NEV5OU091269@svn.freebsd.org> From: Ed Maste Date: Fri, 23 Aug 2013 14:31:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254709 - head/lib/libexecinfo 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.14 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: Fri, 23 Aug 2013 14:31:05 -0000 Author: emaste Date: Fri Aug 23 14:31:05 2013 New Revision: 254709 URL: http://svnweb.freebsd.org/changeset/base/254709 Log: Add libexecinfo Makefile Sponsored by: DARPA, AFRL Added: head/lib/libexecinfo/ head/lib/libexecinfo/Makefile (contents, props changed) Added: head/lib/libexecinfo/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libexecinfo/Makefile Fri Aug 23 14:31:05 2013 (r254709) @@ -0,0 +1,19 @@ +# $FreeBSD$ + +LIBEXECINFO= ${.CURDIR}/../../contrib/libexecinfo + +LIB= execinfo + +.PATH: ${LIBEXECINFO} + +INCS= execinfo.h symtab.h unwind.h +SRCS= backtrace.c symtab.c unwind.c + +MAN= backtrace.3 + +MLINKS+= backtrace.3 backtrace_symbols.3 +MLINKS+= backtrace.3 backtrace_symbols_fmt.3 +MLINKS+= backtrace.3 backtrace_symbols_fd.3 +MLINKS+= backtrace.3 backtrace_symbols_fd_fmt.3 + +.include From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 14:33:57 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 ESMTP id 01153CB; Fri, 23 Aug 2013 14:33:56 +0000 (UTC) (envelope-from davide@FreeBSD.org) 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 E2C4B2B98; Fri, 23 Aug 2013 14:33: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 r7NEXuWR092071; Fri, 23 Aug 2013 14:33:56 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NEXuxP092070; Fri, 23 Aug 2013 14:33:56 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201308231433.r7NEXuxP092070@svn.freebsd.org> From: Davide Italiano Date: Fri, 23 Aug 2013 14:33:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254710 - head/share/man/man9 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.14 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: Fri, 23 Aug 2013 14:33:57 -0000 Author: davide Date: Fri Aug 23 14:33:56 2013 New Revision: 254710 URL: http://svnweb.freebsd.org/changeset/base/254710 Log: - Bump date. - Small mdoc fix. Submitted by: pluknet Modified: head/share/man/man9/timeout.9 Modified: head/share/man/man9/timeout.9 ============================================================================== --- head/share/man/man9/timeout.9 Fri Aug 23 14:31:05 2013 (r254709) +++ head/share/man/man9/timeout.9 Fri Aug 23 14:33:56 2013 (r254710) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 19, 2013 +.Dd August 23, 2013 .Dt TIMEOUT 9 .Os .Sh NAME @@ -270,7 +270,7 @@ argument. If an .Fa rm argument is specified, the lock should be created without passing the -.It Dv RM_SLEEPABLE +.Dv RM_SLEEPABLE flag. The usable lock classes are currently limited to mutexes, rwlocks and non-sleepable rmlocks, because callout handlers run in softclock swi, From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 14:40:11 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 ESMTP id E49AB295; Fri, 23 Aug 2013 14:40:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) 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 D0D1B2BD5; Fri, 23 Aug 2013 14:40: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 r7NEeATw095552; Fri, 23 Aug 2013 14:40:10 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NEeArT095549; Fri, 23 Aug 2013 14:40:10 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201308231440.r7NEeArT095549@svn.freebsd.org> From: Andriy Gapon Date: Fri, 23 Aug 2013 14:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254711 - 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.14 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: Fri, 23 Aug 2013 14:40:11 -0000 Author: avg Date: Fri Aug 23 14:40:09 2013 New Revision: 254711 URL: http://svnweb.freebsd.org/changeset/base/254711 Log: zfs: inline and remove zfs_vnode_lock It didn't serve any useful purpose, but obscured file and line information useful for debugging. MFC after: 5 days X-MFC with: r254445 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Aug 23 14:33:56 2013 (r254710) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Aug 23 14:40:09 2013 (r254711) @@ -156,7 +156,6 @@ extern int zfs_set_version(zfsvfs_t *zfs extern int zfsvfs_create(const char *name, zfsvfs_t **zfvp); extern void zfsvfs_free(zfsvfs_t *zfsvfs); extern int zfs_check_global_label(const char *dsname, const char *hexsl); -extern int zfs_vnode_lock(vnode_t *vp, int flags); #ifdef _KERNEL extern void zfsvfs_update_fromname(const char *oldname, const char *newname); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Aug 23 14:33:56 2013 (r254710) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Aug 23 14:40:09 2013 (r254711) @@ -1796,15 +1796,6 @@ zfs_statfs(vfs_t *vfsp, struct statfs *s return (0); } -int -zfs_vnode_lock(vnode_t *vp, int flags) -{ - - ASSERT(vp != NULL); - - return (vn_lock(vp, flags)); -} - static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp) { @@ -1821,7 +1812,7 @@ zfs_root(vfs_t *vfsp, int flags, vnode_t ZFS_EXIT(zfsvfs); if (error == 0) { - error = zfs_vnode_lock(*vpp, flags); + error = vn_lock(*vpp, flags); if (error == 0) (*vpp)->v_vflag |= VV_ROOT; } @@ -2082,7 +2073,7 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla *vpp = ZTOV(zp); ZFS_EXIT(zfsvfs); if (err == 0) - err = zfs_vnode_lock(*vpp, flags); + err = vn_lock(*vpp, flags); if (err != 0) *vpp = NULL; else @@ -2181,7 +2172,7 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int VN_HOLD(*vpp); } ZFS_EXIT(zfsvfs); - err = zfs_vnode_lock(*vpp, flags); + err = vn_lock(*vpp, flags); if (err != 0) *vpp = NULL; return (err); @@ -2208,7 +2199,7 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int *vpp = ZTOV(zp); ZFS_EXIT(zfsvfs); - err = zfs_vnode_lock(*vpp, flags | LK_RETRY); + err = vn_lock(*vpp, flags | LK_RETRY); if (err == 0) vnode_create_vobject(*vpp, zp->z_size, curthread); else Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Aug 23 14:33:56 2013 (r254710) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Aug 23 14:40:09 2013 (r254711) @@ -1526,7 +1526,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode VOP_UNLOCK(dvp, 0); } ZFS_EXIT(zfsvfs); - error = zfs_vnode_lock(*vpp, cnp->cn_lkflags); + error = vn_lock(*vpp, cnp->cn_lkflags); if (cnp->cn_flags & ISDOTDOT) vn_lock(dvp, ltype | LK_RETRY); if (error != 0) { From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 14:40: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 ESMTP id 9C46339D; Fri, 23 Aug 2013 14:40:17 +0000 (UTC) (envelope-from davide@FreeBSD.org) 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 8B07B2BD9; Fri, 23 Aug 2013 14:40: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 r7NEeHvd095742; Fri, 23 Aug 2013 14:40:17 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NEeHMr095741; Fri, 23 Aug 2013 14:40:17 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201308231440.r7NEeHMr095741@svn.freebsd.org> From: Davide Italiano Date: Fri, 23 Aug 2013 14:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254712 - 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.14 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: Fri, 23 Aug 2013 14:40:17 -0000 Author: davide Date: Fri Aug 23 14:40:17 2013 New Revision: 254712 URL: http://svnweb.freebsd.org/changeset/base/254712 Log: Fix the build and fix style. Pointy-hat to: davide Modified: head/sys/sys/callout.h Modified: head/sys/sys/callout.h ============================================================================== --- head/sys/sys/callout.h Fri Aug 23 14:40:09 2013 (r254711) +++ head/sys/sys/callout.h Fri Aug 23 14:40:17 2013 (r254712) @@ -71,8 +71,8 @@ void _callout_init_lock(struct callout * #define callout_init_mtx(c, mtx, flags) \ _callout_init_lock((c), ((mtx) != NULL) ? &(mtx)->lock_object : \ NULL, (flags)) -#define callout_init_rm(c, rm, flags) - _callout_init_lock((c), ((rm != NULL) ? &(rm)->lock_object : \ +#define callout_init_rm(c, rm, flags) \ + _callout_init_lock((c), ((rm != NULL) ? &(rm)->lock_object : \ NULL, (flags)) #define callout_init_rw(c, rw, flags) \ _callout_init_lock((c), ((rw) != NULL) ? &(rw)->lock_object : \ From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 14:41:28 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 ESMTP id 41400516; Fri, 23 Aug 2013 14:41:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) 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 2EBE32C08; Fri, 23 Aug 2013 14:41: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 r7NEfSb6096232; Fri, 23 Aug 2013 14:41:28 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NEfSjs096231; Fri, 23 Aug 2013 14:41:28 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201308231441.r7NEfSjs096231@svn.freebsd.org> From: Andriy Gapon Date: Fri, 23 Aug 2013 14:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254713 - head/sys/cddl/dev/fbt 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.14 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: Fri, 23 Aug 2013 14:41:28 -0000 Author: avg Date: Fri Aug 23 14:41:27 2013 New Revision: 254713 URL: http://svnweb.freebsd.org/changeset/base/254713 Log: fbt: drop a local write-only variable Discovered with: gcc46 MFC after: 4 days Modified: head/sys/cddl/dev/fbt/fbt.c Modified: head/sys/cddl/dev/fbt/fbt.c ============================================================================== --- head/sys/cddl/dev/fbt/fbt.c Fri Aug 23 14:40:17 2013 (r254712) +++ head/sys/cddl/dev/fbt/fbt.c Fri Aug 23 14:41:27 2013 (r254713) @@ -574,7 +574,6 @@ static int fbt_ctfoff_init(modctl_t *lf, linker_ctf_t *lc) { const Elf_Sym *symp = lc->symtab;; - const char *name; const ctf_header_t *hp = (const ctf_header_t *) lc->ctftab; const uint8_t *ctfdata = lc->ctftab + sizeof(ctf_header_t); int i; @@ -606,11 +605,6 @@ fbt_ctfoff_init(modctl_t *lf, linker_ctf continue; } - if (symp->st_name < lc->strcnt) - name = lc->strtab + symp->st_name; - else - name = "(?)"; - switch (ELF_ST_TYPE(symp->st_info)) { case STT_OBJECT: if (objtoff >= hp->cth_funcoff || From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 14:43: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 ESMTP id 074EE68A; Fri, 23 Aug 2013 14:43:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) 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 E8E0D2C25; Fri, 23 Aug 2013 14:43: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 r7NEhWwe096930; Fri, 23 Aug 2013 14:43:32 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NEhWw8096929; Fri, 23 Aug 2013 14:43:32 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201308231443.r7NEhWw8096929@svn.freebsd.org> From: Andriy Gapon Date: Fri, 23 Aug 2013 14:43:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254714 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.14 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: Fri, 23 Aug 2013 14:43:33 -0000 Author: avg Date: Fri Aug 23 14:43:32 2013 New Revision: 254714 URL: http://svnweb.freebsd.org/changeset/base/254714 Log: zfs: do not reject any operations on a pool just because it's a boot pool Unlike the upstream FreeBSD supports booting to all kinds of pools. Requested by: many Tested by: sbruno MFC after: 12 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Aug 23 14:41:27 2013 (r254713) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Aug 23 14:43:32 2013 (r254714) @@ -1828,6 +1828,7 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc) (void) nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_SPARES, &spares, &nspares); +#ifdef illumos /* * A root pool with concatenated devices is not supported. * Thus, can not add a device to a root pool. @@ -1843,6 +1844,7 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc) spa_close(spa, FTAG); return (SET_ERROR(EDOM)); } +#endif /* illumos */ if (error == 0) { error = spa_vdev_add(spa, config); From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 14:50:04 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 ESMTP id 8D99483D; Fri, 23 Aug 2013 14:50:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) 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 7B74C2C63; Fri, 23 Aug 2013 14:50:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NEo46E098938; Fri, 23 Aug 2013 14:50:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NEo4iC098937; Fri, 23 Aug 2013 14:50:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308231450.r7NEo4iC098937@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 23 Aug 2013 14:50:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254715 - 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.14 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: Fri, 23 Aug 2013 14:50:04 -0000 Author: kib Date: Fri Aug 23 14:50:03 2013 New Revision: 254715 URL: http://svnweb.freebsd.org/changeset/base/254715 Log: Since the 253927, which removed the soft busy call for the sf page, it does not make sense to wait for the soft busy state of the page to drain. The vm object lock is dropped immediately after, so the result of the wait is invalidated. It might make sense to not wait for the hard busy state as well, esp. for the fully valid page, but this is postponed for now. Reviewed by: alc Tested by: pho Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Fri Aug 23 14:43:32 2013 (r254714) +++ head/sys/kern/uipc_syscalls.c Fri Aug 23 14:50:03 2013 (r254715) @@ -2230,7 +2230,8 @@ retry_space: pindex = OFF_TO_IDX(off); VM_OBJECT_WLOCK(obj); pg = vm_page_grab(obj, pindex, VM_ALLOC_NOBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED); + VM_ALLOC_IGN_SBUSY | VM_ALLOC_NORMAL | + VM_ALLOC_WIRED); /* * Check if page is valid for what we need, From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 14:54: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 ESMTP id BDF579E7; Fri, 23 Aug 2013 14:54:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 94B0E2CB5; Fri, 23 Aug 2013 14:54:06 +0000 (UTC) Received: from jhbbsd.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C1A3EB924; Fri, 23 Aug 2013 10:54:01 -0400 (EDT) From: John Baldwin To: Davide Italiano Subject: Re: svn commit: r254703 - in head: share/man/man9 sys/sys Date: Fri, 23 Aug 2013 10:51:08 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p28; KDE/4.5.5; amd64; ; ) References: <201308231412.r7NECdG7081565@svn.freebsd.org> In-Reply-To: <201308231412.r7NECdG7081565@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201308231051.08997.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 23 Aug 2013 10:54:01 -0400 (EDT) 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.14 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: Fri, 23 Aug 2013 14:54:06 -0000 On Friday, August 23, 2013 10:12:39 am Davide Italiano wrote: > Author: davide > Date: Fri Aug 23 14:12:39 2013 > New Revision: 254703 > URL: http://svnweb.freebsd.org/changeset/base/254703 > > Log: > Introduce callout_init_rm() so that callouts can be used in conjunction > with rmlocks. This works only with non-sleepable rm because handlers run > in SWI context. While here, document the new KPI in the timeout(9) > manpage. It also only works with exclusive locks. (lc_unlock/lc_lock only handle write locks for rmlocks). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 14:54: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 ESMTP id 8ABE3AF9; Fri, 23 Aug 2013 14:54:15 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6044B2CB7; Fri, 23 Aug 2013 14:54:15 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1VCskg-0006pr-4O; Fri, 23 Aug 2013 14:54:14 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id r7NEsBGh047930; Fri, 23 Aug 2013 08:54:11 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/OzcZi8D3ikjFJO+F97r5I Subject: Re: svn commit: r254703 - in head: share/man/man9 sys/sys From: Ian Lepore To: Davide Italiano In-Reply-To: <201308231412.r7NECdG7081565@svn.freebsd.org> References: <201308231412.r7NECdG7081565@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Fri, 23 Aug 2013 08:54:11 -0600 Message-ID: <1377269651.1111.64.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port 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.14 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: Fri, 23 Aug 2013 14:54:15 -0000 On Fri, 2013-08-23 at 14:12 +0000, Davide Italiano wrote: > +#define callout_init_rm(c, rm, flags) A missing '\' at the end of this line is causing compilation failure. -- Ian From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 15:07:54 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 ESMTP id 9D5F7E8F; Fri, 23 Aug 2013 15:07:54 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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 8A8962D62; Fri, 23 Aug 2013 15:07:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NF7sO9008516; Fri, 23 Aug 2013 15:07:54 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NF7spP008515; Fri, 23 Aug 2013 15:07:54 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308231507.r7NF7spP008515@svn.freebsd.org> From: Ian Lepore Date: Fri, 23 Aug 2013 15:07:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254716 - head/sys/dev/mmc 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.14 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: Fri, 23 Aug 2013 15:07:54 -0000 Author: ian Date: Fri Aug 23 15:07:54 2013 New Revision: 254716 URL: http://svnweb.freebsd.org/changeset/base/254716 Log: Don't give up so easily on failure of CMD55 to put the card into app-cmd mode. We don't know why it failed, so we can't know that a retry will also fail (the low-level driver might have reset the controller state machine or something similar that would allow a retry to work). Modified: head/sys/dev/mmc/mmc.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Fri Aug 23 14:50:03 2013 (r254715) +++ head/sys/dev/mmc/mmc.c Fri Aug 23 15:07:54 2013 (r254716) @@ -106,7 +106,7 @@ struct mmc_ivars { #define CMD_RETRIES 3 -#define CARD_ID_FREQUENCY 400000 /* Spec requires 400KHz max during ID phase. */ +#define CARD_ID_FREQUENCY 400000 /* Spec requires 400kHz max during ID phase. */ static SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver"); @@ -447,8 +447,8 @@ mmc_wait_for_app_cmd(struct mmc_softc *s err = appcmd.error; if (err == MMC_ERR_NONE) { if (!(appcmd.resp[0] & R1_APP_CMD)) - return MMC_ERR_FAILED; /* Retries won't help. */ - if (mmc_wait_for_cmd(sc, cmd, 0) != 0) + err = MMC_ERR_FAILED; + else if (mmc_wait_for_cmd(sc, cmd, 0) != 0) err = MMC_ERR_FAILED; else err = cmd->error; From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 15:29: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 ESMTP id 18C2EA4C; Fri, 23 Aug 2013 15:29:47 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vc0-x229.google.com (mail-vc0-x229.google.com [IPv6:2607:f8b0:400c:c03::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 951562ED2; Fri, 23 Aug 2013 15:29:46 +0000 (UTC) Received: by mail-vc0-f169.google.com with SMTP id ib11so530825vcb.14 for ; Fri, 23 Aug 2013 08:29:45 -0700 (PDT) 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=KhQFOwx9xDErVqyz5jnCLJpVqZvLivfJoAbml3CBV8s=; b=G0lg5qXvppwtQ5ZmJ65PsOVCo7ldgMv7OZjl60OorA+UJodF/XylNXuXZ5VQY5Cvcs Ezy3/JrSxpdiZjQqq3UXqPQQZx99+LfZrZiAdUdJ3z0SVwxxPBg9+gG/ays8f564FxZG Wf6BCDGRlDzuwSXeIHB81f2PGnYhplCSzpJnEvEl++jcbGDDu1ZQzmyoctJpyonWNG3t SxzySlEaKtCe6so3zwnwu02o92LdKPsavDmvO85ZZQ/94//9MBqA9l9ReSpxBUM1U286 VCbAwwH0SxVT8b/87F9u2StQBsMjqkQewLRb6fdbSpaVFGYhRCD1ORC0Wc61JOiK2Rta m2MQ== MIME-Version: 1.0 X-Received: by 10.52.103.35 with SMTP id ft3mr108529vdb.5.1377271785679; Fri, 23 Aug 2013 08:29:45 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.220.65.132 with HTTP; Fri, 23 Aug 2013 08:29:45 -0700 (PDT) In-Reply-To: <201308231051.08997.jhb@freebsd.org> References: <201308231412.r7NECdG7081565@svn.freebsd.org> <201308231051.08997.jhb@freebsd.org> Date: Fri, 23 Aug 2013 17:29:45 +0200 X-Google-Sender-Auth: _kF8COaHH59vE4w7VIdavWq-fVU Message-ID: Subject: Re: svn commit: r254703 - in head: share/man/man9 sys/sys From: Davide Italiano To: John Baldwin 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.14 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: Fri, 23 Aug 2013 15:29:47 -0000 On Fri, Aug 23, 2013 at 4:51 PM, John Baldwin wrote: > On Friday, August 23, 2013 10:12:39 am Davide Italiano wrote: >> Author: davide >> Date: Fri Aug 23 14:12:39 2013 >> New Revision: 254703 >> URL: http://svnweb.freebsd.org/changeset/base/254703 >> >> Log: >> Introduce callout_init_rm() so that callouts can be used in conjunction >> with rmlocks. This works only with non-sleepable rm because handlers run >> in SWI context. While here, document the new KPI in the timeout(9) >> manpage. > > It also only works with exclusive locks. (lc_unlock/lc_lock only handle > write locks for rmlocks). > > -- > John Baldwin Thanks for pointing out this. I think it would be nice to have lc_lock/lc_unlock working both for shared and exclusive locks but I'm not 100% sure about all the implications/complications. From what I see for rwlocks asserting if a lock is held in read-mode is really cheap (check against a flag) while for rmlocks the assertion relies on traversing the tracker list for the rmlock so I'm worried this operation could be expensive. What's your opinion about? Thanks, -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 16:54: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 ESMTP id A6D86F48; Fri, 23 Aug 2013 16:54:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 9354A23F3; Fri, 23 Aug 2013 16:54: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 r7NGscdh061510; Fri, 23 Aug 2013 16:54:38 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NGscB7061509; Fri, 23 Aug 2013 16:54:38 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308231654.r7NGscB7061509@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 23 Aug 2013 16:54:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254717 - 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.14 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: Fri, 23 Aug 2013 16:54:38 -0000 Author: jkim Date: Fri Aug 23 16:54:38 2013 New Revision: 254717 URL: http://svnweb.freebsd.org/changeset/base/254717 Log: Fix a whitespace. Modified: head/sys/kern/vfs_cluster.c Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Fri Aug 23 15:07:54 2013 (r254716) +++ head/sys/kern/vfs_cluster.c Fri Aug 23 16:54:38 2013 (r254717) @@ -961,7 +961,7 @@ cluster_wbuild(struct vnode *vp, long si VM_OBJECT_WLOCK(tbp->b_bufobj->bo_object); if (i == 0) { vfs_drain_busy_pages(tbp); - } else { /* if not first buffer */ + } else { /* if not first buffer */ for (j = 0; j < tbp->b_npages; j += 1) { m = tbp->b_pages[j]; if (vm_page_xbusied(m)) { From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 17:27: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 ESMTP id D8687A53; Fri, 23 Aug 2013 17:27:13 +0000 (UTC) (envelope-from alc@FreeBSD.org) 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 ABF4D25C8; Fri, 23 Aug 2013 17:27: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 r7NHRDHl077454; Fri, 23 Aug 2013 17:27:13 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NHRDUI077451; Fri, 23 Aug 2013 17:27:13 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201308231727.r7NHRDUI077451@svn.freebsd.org> From: Alan Cox Date: Fri, 23 Aug 2013 17:27:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254719 - 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.14 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: Fri, 23 Aug 2013 17:27:13 -0000 Author: alc Date: Fri Aug 23 17:27:12 2013 New Revision: 254719 URL: http://svnweb.freebsd.org/changeset/base/254719 Log: Addendum to r254141: The call to vm_radix_insert() in vm_page_cache() can reclaim the last preexisting cached page in the object, resulting in a call to vdrop(). Detect this scenario so that the vnode's hold count is correctly maintained. Otherwise, we panic. Reported by: scottl Tested by: pho Discussed with: attilio, jeff, kib Modified: head/sys/vm/vm_page.c head/sys/vm/vm_radix.c head/sys/vm/vm_radix.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Aug 23 17:03:43 2013 (r254718) +++ head/sys/vm/vm_page.c Fri Aug 23 17:27:12 2013 (r254719) @@ -2558,6 +2558,15 @@ vm_page_cache(vm_page_t m) vm_page_free(m); return; } + + /* + * The above call to vm_radix_insert() could reclaim the one pre- + * existing cached page from this object, resulting in a call to + * vdrop(). + */ + if (!cache_was_empty) + cache_was_empty = vm_radix_is_singleton(&object->cache); + m->flags |= PG_CACHED; cnt.v_cache_count++; PCPU_INC(cnt.v_tcached); Modified: head/sys/vm/vm_radix.c ============================================================================== --- head/sys/vm/vm_radix.c Fri Aug 23 17:03:43 2013 (r254718) +++ head/sys/vm/vm_radix.c Fri Aug 23 17:27:12 2013 (r254719) @@ -432,6 +432,21 @@ restart: } /* + * Returns TRUE if the specified radix tree contains a single leaf and FALSE + * otherwise. + */ +boolean_t +vm_radix_is_singleton(struct vm_radix *rtree) +{ + struct vm_radix_node *rnode; + + rnode = vm_radix_getroot(rtree); + if (rnode == NULL) + return (FALSE); + return (vm_radix_isleaf(rnode)); +} + +/* * Returns the value stored at the index. If the index is not present, * NULL is returned. */ Modified: head/sys/vm/vm_radix.h ============================================================================== --- head/sys/vm/vm_radix.h Fri Aug 23 17:03:43 2013 (r254718) +++ head/sys/vm/vm_radix.h Fri Aug 23 17:27:12 2013 (r254719) @@ -37,6 +37,7 @@ void vm_radix_init(void); int vm_radix_insert(struct vm_radix *rtree, vm_page_t page); +boolean_t vm_radix_is_singleton(struct vm_radix *rtree); vm_page_t vm_radix_lookup(struct vm_radix *rtree, vm_pindex_t index); vm_page_t vm_radix_lookup_ge(struct vm_radix *rtree, vm_pindex_t index); vm_page_t vm_radix_lookup_le(struct vm_radix *rtree, vm_pindex_t index); From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 18:03: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 ESMTP id CD3FBAFA; Fri, 23 Aug 2013 18:03:18 +0000 (UTC) (envelope-from np@FreeBSD.org) 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 BAF0127F1; Fri, 23 Aug 2013 18:03: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 r7NI3Ieb096430; Fri, 23 Aug 2013 18:03:18 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NI3I6a096429; Fri, 23 Aug 2013 18:03:18 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201308231803.r7NI3I6a096429@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 23 Aug 2013 18:03:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254727 - head/sys/dev/cxgbe 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.14 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: Fri, 23 Aug 2013 18:03:18 -0000 Author: np Date: Fri Aug 23 18:03:18 2013 New Revision: 254727 URL: http://svnweb.freebsd.org/changeset/base/254727 Log: There is no need to hold the freelist lock around alloc/free of software descriptors. This also silences WITNESS warnings when the software descriptors are allocated with M_WAITOK. MFC after: 1 week Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Fri Aug 23 18:02:39 2013 (r254726) +++ head/sys/dev/cxgbe/t4_sge.c Fri Aug 23 18:03:18 2013 (r254727) @@ -1802,9 +1802,7 @@ alloc_iq_fl(struct port_info *pi, struct /* Allocate space for one software descriptor per buffer. */ fl->cap = (fl->qsize - spg_len / RX_FL_ESIZE) * 8; - FL_LOCK(fl); rc = alloc_fl_sdesc(fl); - FL_UNLOCK(fl); if (rc != 0) { device_printf(sc->dev, "failed to setup fl software descriptors: %d\n", @@ -1937,11 +1935,8 @@ free_iq_fl(struct port_info *pi, struct free_ring(sc, fl->desc_tag, fl->desc_map, fl->ba, fl->desc); - if (fl->sdesc) { - FL_LOCK(fl); + if (fl->sdesc) free_fl_sdesc(fl); - FL_UNLOCK(fl); - } if (mtx_initialized(&fl->fl_lock)) mtx_destroy(&fl->fl_lock); @@ -2788,8 +2783,6 @@ alloc_fl_sdesc(struct sge_fl *fl) bus_dma_tag_t tag; int i, rc; - FL_LOCK_ASSERT_OWNED(fl); - fl->sdesc = malloc(fl->cap * sizeof(struct fl_sdesc), M_CXGBE, M_ZERO | M_WAITOK); @@ -2828,8 +2821,6 @@ free_fl_sdesc(struct sge_fl *fl) struct fl_sdesc *sd; int i; - FL_LOCK_ASSERT_OWNED(fl); - sd = fl->sdesc; for (i = 0; i < fl->cap; i++, sd++) { From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 18:06:42 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 ESMTP id BC769DD; Fri, 23 Aug 2013 18:06:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) 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 8F24B2858; Fri, 23 Aug 2013 18:06:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NI6gMs097584; Fri, 23 Aug 2013 18:06:42 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NI6gJS097583; Fri, 23 Aug 2013 18:06:42 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201308231806.r7NI6gJS097583@svn.freebsd.org> From: Ed Maste Date: Fri, 23 Aug 2013 18:06:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254729 - head/contrib/llvm/tools/lldb 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.14 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: Fri, 23 Aug 2013 18:06:42 -0000 Author: emaste Date: Fri Aug 23 18:06:42 2013 New Revision: 254729 URL: http://svnweb.freebsd.org/changeset/base/254729 Log: Merge lldb r188801 to contrib/llvm/tools/lldb/ Added: head/contrib/llvm/tools/lldb/ - copied from r254727, vendor/lldb/dist/ From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 18:45:40 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 ESMTP id 4E49ED39; Fri, 23 Aug 2013 18:45:40 +0000 (UTC) (envelope-from np@FreeBSD.org) 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 3C8D12B18; Fri, 23 Aug 2013 18:45:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NIjewi017737; Fri, 23 Aug 2013 18:45:40 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NIjeJP017736; Fri, 23 Aug 2013 18:45:40 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201308231845.r7NIjeJP017736@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 23 Aug 2013 18:45:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254731 - head/sys/dev/cxgb/ulp/iw_cxgb 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.14 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: Fri, 23 Aug 2013 18:45:40 -0000 Author: np Date: Fri Aug 23 18:45:39 2013 New Revision: 254731 URL: http://svnweb.freebsd.org/changeset/base/254731 Log: Whitespace cleanup. Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c ============================================================================== --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c Fri Aug 23 18:38:43 2013 (r254730) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_qp.c Fri Aug 23 18:45:39 2013 (r254731) @@ -1097,9 +1097,8 @@ out: * If free is 1, then we've disassociated the EP from the QP * and we need to dereference the EP. */ - if (free) + if (free) put_ep(&ep->com); - CTR2(KTR_IW_CXGB, "%s exit state %d", __FUNCTION__, qhp->attr.state); return ret; From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 18:52: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 ESMTP id 44523136; Fri, 23 Aug 2013 18:52:37 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 3252B2B95; Fri, 23 Aug 2013 18:52: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 r7NIqb5l021828; Fri, 23 Aug 2013 18:52:37 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NIqbY6021827; Fri, 23 Aug 2013 18:52:37 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308231852.r7NIqbY6021827@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 23 Aug 2013 18:52:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254733 - head/sys/boot/i386/libi386 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.14 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: Fri, 23 Aug 2013 18:52:37 -0000 Author: jkim Date: Fri Aug 23 18:52:36 2013 New Revision: 254733 URL: http://svnweb.freebsd.org/changeset/base/254733 Log: Set the hint for physical address of RSDP in hexadecimal as before r223262. Modified: head/sys/boot/i386/libi386/biosacpi.c Modified: head/sys/boot/i386/libi386/biosacpi.c ============================================================================== --- head/sys/boot/i386/libi386/biosacpi.c Fri Aug 23 18:50:47 2013 (r254732) +++ head/sys/boot/i386/libi386/biosacpi.c Fri Aug 23 18:52:36 2013 (r254733) @@ -61,7 +61,7 @@ biosacpi_detect(void) return; /* export values from the RSDP */ - sprintf(buf, "%u", VTOP(rsdp)); + sprintf(buf, "0x%08x", VTOP(rsdp)); setenv("hint.acpi.0.rsdp", buf, 1); revision = rsdp->Revision; if (revision == 0) From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 18:54: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 ESMTP id 548153CA; Fri, 23 Aug 2013 18:54:28 +0000 (UTC) (envelope-from np@FreeBSD.org) 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 4234C2BC6; Fri, 23 Aug 2013 18:54: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 r7NIsSw6022381; Fri, 23 Aug 2013 18:54:28 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NIsSvA022380; Fri, 23 Aug 2013 18:54:28 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201308231854.r7NIsSvA022380@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 23 Aug 2013 18:54:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254734 - head/sys/ofed/include/linux 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.14 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: Fri, 23 Aug 2013 18:54:28 -0000 Author: np Date: Fri Aug 23 18:54:27 2013 New Revision: 254734 URL: http://svnweb.freebsd.org/changeset/base/254734 Log: Fix implementation of sock_getname. MFC after: 1 week Modified: head/sys/ofed/include/linux/net.h Modified: head/sys/ofed/include/linux/net.h ============================================================================== --- head/sys/ofed/include/linux/net.h Fri Aug 23 18:52:36 2013 (r254733) +++ head/sys/ofed/include/linux/net.h Fri Aug 23 18:54:27 2013 (r254734) @@ -44,7 +44,7 @@ static inline int sock_getname(struct socket *so, struct sockaddr *addr, int *sockaddr_len, int peer) { - struct sockaddr **nam; + struct sockaddr *nam; int error; nam = NULL; @@ -52,15 +52,15 @@ sock_getname(struct socket *so, struct s if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) return (-ENOTCONN); - error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, nam); + error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, &nam); } else - error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, nam); + error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, &nam); if (error) return (-error); - *addr = **nam; + *addr = *nam; *sockaddr_len = addr->sa_len; - free(*nam, M_SONAME); + free(nam, M_SONAME); return (0); } From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 18:55:12 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 ESMTP id 30AAA508; Fri, 23 Aug 2013 18:55:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F2FE42BD0; Fri, 23 Aug 2013 18:55:11 +0000 (UTC) Received: from jhbbsd.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 57E75B98A; Fri, 23 Aug 2013 14:55:10 -0400 (EDT) From: John Baldwin To: Davide Italiano Subject: Re: svn commit: r254703 - in head: share/man/man9 sys/sys Date: Fri, 23 Aug 2013 12:58:50 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p28; KDE/4.5.5; amd64; ; ) References: <201308231412.r7NECdG7081565@svn.freebsd.org> <201308231051.08997.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201308231258.50969.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 23 Aug 2013 14:55:10 -0400 (EDT) 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.14 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: Fri, 23 Aug 2013 18:55:12 -0000 On Friday, August 23, 2013 11:29:45 am Davide Italiano wrote: > On Fri, Aug 23, 2013 at 4:51 PM, John Baldwin wrote: > > On Friday, August 23, 2013 10:12:39 am Davide Italiano wrote: > >> Author: davide > >> Date: Fri Aug 23 14:12:39 2013 > >> New Revision: 254703 > >> URL: http://svnweb.freebsd.org/changeset/base/254703 > >> > >> Log: > >> Introduce callout_init_rm() so that callouts can be used in conjunction > >> with rmlocks. This works only with non-sleepable rm because handlers run > >> in SWI context. While here, document the new KPI in the timeout(9) > >> manpage. > > > > It also only works with exclusive locks. (lc_unlock/lc_lock only handle > > write locks for rmlocks). > > > > -- > > John Baldwin > > Thanks for pointing out this. > I think it would be nice to have lc_lock/lc_unlock working both for > shared and exclusive locks but I'm not 100% sure about all the > implications/complications. From what I see for rwlocks asserting if a > lock is held in read-mode is really cheap (check against a flag) while > for rmlocks the assertion relies on traversing the tracker list for > the rmlock so I'm worried this operation could be expensive. What's > your opinion about? The much bigger problem is you need an rmtracker object to pass to the lock/unlock routines. You could make this work hackishly in the callout case by special casing rm locks that use read locking and using a tracker on softclock's stack, but it is much harder to fix this for the rm_sleep() case where the sequence is lc_unlock/lc_lock. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 19:12:30 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 ESMTP id 5F840C82; Fri, 23 Aug 2013 19:12:30 +0000 (UTC) (envelope-from np@FreeBSD.org) 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 4D3152D22; Fri, 23 Aug 2013 19:12: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 r7NJCUVn032462; Fri, 23 Aug 2013 19:12:30 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NJCTR6032458; Fri, 23 Aug 2013 19:12:29 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201308231912.r7NJCTR6032458@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 23 Aug 2013 19:12:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254735 - in head/sys: contrib/rdma/krping modules/rdma 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.14 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: Fri, 23 Aug 2013 19:12:30 -0000 Author: np Date: Fri Aug 23 19:12:29 2013 New Revision: 254735 URL: http://svnweb.freebsd.org/changeset/base/254735 Log: Assorted fixes to krping. Disconnect the rest of sys/contrib/rdma from the build while here. sys/ofed has more recent RDMA code and should be used instead. We should probably move krping out of sys/contrib/rdma and get rid of the rest of it. Obtained from: Chelsio Modified: head/sys/contrib/rdma/krping/krping.c head/sys/contrib/rdma/krping/krping.h head/sys/contrib/rdma/krping/krping_dev.c head/sys/modules/rdma/Makefile Modified: head/sys/contrib/rdma/krping/krping.c ============================================================================== --- head/sys/contrib/rdma/krping/krping.c Fri Aug 23 18:54:27 2013 (r254734) +++ head/sys/contrib/rdma/krping/krping.c Fri Aug 23 19:12:29 2013 (r254735) @@ -119,7 +119,7 @@ static void krping_wait(struct krping_cb int rc; mtx_lock(&cb->lock); while (cb->state < state) { - rc = msleep(cb, &cb->lock, 0, "krping", 0); + rc = msleep(cb, &cb->lock, PCATCH, "krping", 0); if (rc && rc != ERESTART) { cb->state = ERROR; break; @@ -188,7 +188,12 @@ static int krping_cma_event_handler(stru case RDMA_CM_EVENT_DEVICE_REMOVAL: DEBUG_LOG(PFX "cma detected device removal!!!!\n"); - break; + cb->state = ERROR; + wakeup(cb); + mtx_unlock(&cb->lock); + krping_wait(cb, CLEANUP); + tsleep(cb, 0, "krping", 5000); + return 0; default: log(LOG_ERR, "oof bad type!\n"); @@ -603,6 +608,8 @@ static int krping_setup_qp(struct krping } DEBUG_LOG(PFX "created pd %p\n", cb->pd); + strlcpy(cb->name, cb->pd->device->name, sizeof(cb->name)); + cb->cq = ib_create_cq(cm_id->device, krping_cq_event_handler, NULL, cb, cb->txdepth * 2, 0); if (IS_ERR(cb->cq)) { @@ -1164,7 +1171,7 @@ static void krping_wlat_test_server(stru } wlat_test(cb); - + krping_wait(cb, ERROR); } static void krping_bw_test_server(struct krping_cb *cb) @@ -1776,6 +1783,12 @@ int krping_doit(char *cmd) else krping_run_client(cb); DEBUG_LOG(PFX "destroy cm_id %p\n", cb->cm_id); + + mtx_lock(&cb->lock); + cb->state = CLEANUP; + wakeup(cb); + mtx_unlock(&cb->lock); + rdma_destroy_id(cb->cm_id); out: mtx_lock(&krping_mutex); Modified: head/sys/contrib/rdma/krping/krping.h ============================================================================== --- head/sys/contrib/rdma/krping/krping.h Fri Aug 23 18:54:27 2013 (r254734) +++ head/sys/contrib/rdma/krping/krping.h Fri Aug 23 19:12:29 2013 (r254735) @@ -37,7 +37,8 @@ enum test_state { RDMA_READ_COMPLETE, RDMA_WRITE_ADV, RDMA_WRITE_COMPLETE, - ERROR + ERROR, + CLEANUP }; struct krping_rdma_info { @@ -100,13 +101,15 @@ struct krping_cb { /* listener on service side. */ struct rdma_cm_id *child_cm_id; /* connection on server side */ TAILQ_ENTRY(krping_cb) list; - + int rlat; /* run read latency test */ int wlat; /* run write latency test */ int bw; /* run write bw test */ int duplex; /* run write bw full duplex test */ int poll; /* poll vs block in rlat */ int txdepth; + + char name[16]; }; static __inline uint64_t Modified: head/sys/contrib/rdma/krping/krping_dev.c ============================================================================== --- head/sys/contrib/rdma/krping/krping_dev.c Fri Aug 23 18:54:27 2013 (r254734) +++ head/sys/contrib/rdma/krping/krping_dev.c Fri Aug 23 19:12:29 2013 (r254735) @@ -112,12 +112,11 @@ krping_read(struct cdev *dev, struct uio mtx_unlock(&krping_mutex); while (!TAILQ_EMPTY(©_cbs)) { - cb = TAILQ_FIRST(©_cbs); TAILQ_REMOVE(©_cbs, cb, list); if (cb->pd) { uprintf("krping: %4d %10s %10u %10u %10u %10u %10u %10u %10u %10u\n", - num++, cb->pd->device->name, cb->stats.send_bytes, + num++, cb->name, cb->stats.send_bytes, cb->stats.send_msgs, cb->stats.recv_bytes, cb->stats.recv_msgs, cb->stats.write_bytes, cb->stats.write_msgs, Modified: head/sys/modules/rdma/Makefile ============================================================================== --- head/sys/modules/rdma/Makefile Fri Aug 23 18:54:27 2013 (r254734) +++ head/sys/modules/rdma/Makefile Fri Aug 23 19:12:29 2013 (r254735) @@ -1,9 +1,9 @@ # $FreeBSD$ -SUBDIR= addr -SUBDIR+= cma -SUBDIR+= iwcm -SUBDIR+= core +#SUBDIR= addr +#SUBDIR+= cma +#SUBDIR+= iwcm +#SUBDIR+= core SUBDIR+= krping .include From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 20:12:08 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 ESMTP id E0746D2C for ; Fri, 23 Aug 2013 20:12:07 +0000 (UTC) (envelope-from scott4long@yahoo.com) Received: from nm5-vm0.bullet.mail.bf1.yahoo.com (nm5-vm0.bullet.mail.bf1.yahoo.com [98.139.213.150]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 67BC72144 for ; Fri, 23 Aug 2013 20:12:07 +0000 (UTC) Received: from [98.139.212.152] by nm5.bullet.mail.bf1.yahoo.com with NNFMP; 23 Aug 2013 20:12:04 -0000 Received: from [98.139.213.11] by tm9.bullet.mail.bf1.yahoo.com with NNFMP; 23 Aug 2013 20:12:04 -0000 Received: from [127.0.0.1] by smtp111.mail.bf1.yahoo.com with NNFMP; 23 Aug 2013 20:12:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1377288724; bh=bFkuJy0ApGy9taqJTauzjLKWKQgT7MP20OvHIBhv33w=; 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=iGuzL34vO7hno0SNUjtbeXOZlX/Qztql+qNCV+Wqzy51knlouYC3qysV2vEP9HKPahfiZggIZJSuLJmZTpSsTAS99Y8dQ4dnyVlspb8G5aLq3Mph+sAvJY0ynYMsXseXytpTh7QZrYni1SmRKKG2HjQVAbA+JGiiBMs2nm+NvJY= X-Yahoo-Newman-Id: 735067.71430.bm@smtp111.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: cftSODcVM1kGWBHWA6BwLWUru5EkPenx_aH6owiGJ3WUOXk 9TZ2S9d1QsvPHIyuFQIWFZR4woR4aVDhEHEHBOjRR2DhdEv7jYJTKsIE9lRw Vnm2XyqADyQFg8bzbOeCIzyKAxe0_grFyEOnpZYO0bvKxiIQ3iKNkSOtOr62 UtmHs.Vrxuq5uPHA2trCRf3XowMjlJGHOgrcw0OmRSlSiRCv8uWK5Dy64aHP dtUDPQWrKR3QAxpNzTVRHPNt293ZkOH2zK.HsKugI7FPsBY5lzj7StOoeOCb s3bMXq0.5t1vH6EQeBo3hpQEnQQPnNaG.EuyOGmt2qDVsfaao2WSTfk1SzX1 UbQyxvXconWA8GM.io673OE457v4kmMZ7kios4gOq93lvq5hDw_u80VKsPj1 hxUxuZ5rdbk139SHXyRnvJYKjo7.k6MGyN28M1SLwv77fHcPv1Zp.8_h7E28 Rvz2kdlP_uYicLUBHFlcEYMD5j2f5P43Muw0yTRO83iHk9knLYqHa1adM2P3 prhb.NYLjsWjmLK.uJpC5IDAInkNKP62xYJkfZ4.5qGmdm8rCoFDMhYT2 X-Yahoo-SMTP: clhABp.swBB7fs.LwIJpv3jkWgo2NU8- X-Rocket-Received: from phobos.samsco.home (scott4long@168.103.85.57 with ) by smtp111.mail.bf1.yahoo.com with SMTP; 23 Aug 2013 13:12:04 -0700 PDT Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: svn commit: r254615 - head/sys/dev/mps From: Scott Long In-Reply-To: Date: Fri, 23 Aug 2013 10:00:59 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <74108713-986A-4CBD-A441-395C7B54456A@yahoo.com> References: <201308212130.r7LLUvO5008991@svn.freebsd.org> <20130822142107.GA49996@nargothrond.kdm.org> To: Dmitry Morozovsky X-Mailer: Apple Mail (2.1508) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Kenneth D. Merry" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Fri, 23 Aug 2013 20:12:08 -0000 On Aug 22, 2013, at 7:58 AM, Dmitry Morozovsky wrote: > On Thu, 22 Aug 2013, Kenneth D. Merry wrote: >=20 >>>> Fix mps(4) driver breakage that came in in change 253550 that >>>> manifested itself in out of chain frame conditions. >>>>=20 >>>> When the driver ran out of chain frames, the request in question >>>> would get completed early, and go through = mpssas_scsiio_complete(). >=20 >>> what is real impact of the bug? >>=20 >> Your system will essentially hang, certainly as far as anything = connected >> to the controller in question. >=20 > [snip] >=20 >> 5. Look for an out of chain frames message on the console. To see = how far >> you are towards using the chain frames, run 'sysctl dev.mps'. You = can see >> how many chain frames you have free, and how many requests have = failed. >>=20 >> This change just needs to be merged along with the other changes to = avoid >> having the regression in stable. >=20 > Thank you very much for the explanation. We use a couple of servers = with mps=20 > (and many spindles there), all on stable/9 from this summer, and you = commit=20 > turns on an alarm light in my head ;) I'll confirm with my netflix hat on that this isn't a problem in 9. Scott From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 20:39: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 ESMTP id 9275C4CC; Fri, 23 Aug 2013 20:39:41 +0000 (UTC) (envelope-from andreast@FreeBSD.org) 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 800B22282; Fri, 23 Aug 2013 20:39: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 r7NKdfWB075161; Fri, 23 Aug 2013 20:39:41 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NKdfpL075160; Fri, 23 Aug 2013 20:39:41 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201308232039.r7NKdfpL075160@svn.freebsd.org> From: Andreas Tobler Date: Fri, 23 Aug 2013 20:39:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254737 - head/sys/powerpc/powermac 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.14 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: Fri, 23 Aug 2013 20:39:41 -0000 Author: andreast Date: Fri Aug 23 20:39:41 2013 New Revision: 254737 URL: http://svnweb.freebsd.org/changeset/base/254737 Log: Return EIO iso -1, the kiic_transfer has an signed return. Submitted by: Luiz Otavio O Souza Modified: head/sys/powerpc/powermac/kiic.c Modified: head/sys/powerpc/powermac/kiic.c ============================================================================== --- head/sys/powerpc/powermac/kiic.c Fri Aug 23 20:37:44 2013 (r254736) +++ head/sys/powerpc/powermac/kiic.c Fri Aug 23 20:39:41 2013 (r254737) @@ -420,7 +420,7 @@ kiic_transfer(device_t dev, struct iic_m device_printf(sc->sc_dev, "I2C error\n"); sc->sc_flags = 0; mtx_unlock(&sc->sc_mutex); - return (-1); + return (EIO); } } From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 20:47: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 ESMTP id 4E256686; Fri, 23 Aug 2013 20:47:18 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) 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 38E992309; Fri, 23 Aug 2013 20:47: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 r7NKlIxR079491; Fri, 23 Aug 2013 20:47:18 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NKlHHD079485; Fri, 23 Aug 2013 20:47:17 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201308232047.r7NKlHHD079485@svn.freebsd.org> From: Bryan Venteicher Date: Fri, 23 Aug 2013 20:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254738 - in head: share/man/man4 sys/conf sys/dev/vmware sys/dev/vmware/vmxnet3 sys/modules sys/modules/vmware sys/modules/vmware/vmxnet3 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.14 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: Fri, 23 Aug 2013 20:47:18 -0000 Author: bryanv Date: Fri Aug 23 20:47:16 2013 New Revision: 254738 URL: http://svnweb.freebsd.org/changeset/base/254738 Log: Add vmx(4), a VMware VMXNET3 ethernet driver ported from OpenBSD Added: head/share/man/man4/vmx.4 (contents, props changed) head/sys/dev/vmware/ head/sys/dev/vmware/vmxnet3/ head/sys/dev/vmware/vmxnet3/if_vmx.c (contents, props changed) head/sys/dev/vmware/vmxnet3/if_vmxreg.h (contents, props changed) head/sys/dev/vmware/vmxnet3/if_vmxvar.h (contents, props changed) head/sys/modules/vmware/ head/sys/modules/vmware/Makefile (contents, props changed) head/sys/modules/vmware/vmxnet3/ head/sys/modules/vmware/vmxnet3/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Fri Aug 23 20:39:41 2013 (r254737) +++ head/share/man/man4/Makefile Fri Aug 23 20:47:16 2013 (r254738) @@ -539,6 +539,7 @@ MAN= aac.4 \ ${_virtio_scsi.4} \ vkbd.4 \ vlan.4 \ + ${_vmx.4} \ vpo.4 \ vr.4 \ vte.4 \ @@ -706,6 +707,7 @@ MLINKS+=ural.4 if_ural.4 MLINKS+=${_urtw.4} ${_if_urtw.4} MLINKS+=vge.4 if_vge.4 MLINKS+=vlan.4 if_vlan.4 +MLINKS+=${_vmx.4} ${_if_vmx.4} MLINKS+=vpo.4 imm.4 MLINKS+=vr.4 if_vr.4 MLINKS+=vte.4 if_vte.4 @@ -758,6 +760,7 @@ _if_nfe.4= if_nfe.4 _if_nve.4= if_nve.4 _if_nxge.4= if_nxge.4 _if_urtw.4= if_urtw.4 +_if_vmx.4= if_vmx.4 _if_vtnet.4= if_vtnet.4 _if_vxge.4= if_vxge.4 _if_wpi.4= if_wpi.4 @@ -777,6 +780,7 @@ _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 _virtio_scsi.4= virtio_scsi.4 +_vmx.4= vmx.4 _vtnet.4= vtnet.4 _vxge.4= vxge.4 _padlock.4= padlock.4 Added: head/share/man/man4/vmx.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/vmx.4 Fri Aug 23 20:47:16 2013 (r254738) @@ -0,0 +1,224 @@ +.\" +.\" Copyright (c) 2006,2013 Reyk Floeter +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $OpenBSD: src/share/man/man4/vmx.4,v 1.1 2013/05/31 20:18:44 reyk Exp $ +.\" +.\" $FreeBSD$ +.\" +.Dd August 4, 2013 +.Dt VMX 4 +.Os +.Sh NAME +.Nm vmx +.Nd VMware VMXNET3 Virtual Interface Controller device +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device vmx" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_vmx_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the VMXNET3 virtual NIC available in virtual +machines by VMware. +It appears as a simple Ethernet device but is actually a virtual network +interface to the underlying host operating system. +.Pp +This driver supports the +.Ic VMXNET3 +driver protocol, as an alternative to the emulated +.Xr pcn 4 , +.Xr em 4 +interfaces also available in the VMware environment. +The +.Nm +driver is optimized for the virtual machine, it can provide advanced +capabilities depending on the underlying host operating system and +the physical network interface controller of the host. +The +.Nm +driver supports features like multiqueue support, IPv6 +checksum offloading, MSI/MSI-X support and hardware VLAN tagging in +VMware's VLAN Guest Tagging (VGT) mode. +.Pp +The +.Nm +driver supports VMXNET3 VMware virtual NICs provided by the virtual +machine hardware version 7 or newer, as provided by the following +products: +.Pp +.Bl -bullet -compact -offset indent +.It +VMware ESX/ESXi 4.0 and newer +.It +VMware Server 2.0 and newer +.It +VMware Workstation 6.5 and newer +.It +VMware Fusion 2.0 and newer +.El +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Sh EXAMPLES +The following entry must be added to the VMware configuration file +to provide the +.Nm +device: +.Bd -literal -offset indent +ethernet0.virtualDev = "vmxnet3" +.Ed +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr em 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr pcn 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was ported from +.Ox +by +.An Bryan Venteicher Aq bryanv@freebsd.org . +The +.Ox +driver was written by +.An Tsubai Masanari . +.\" +.\" Copyright (c) 2006,2013 Reyk Floeter +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $OpenBSD: src/share/man/man4/vmx.4,v 1.1 2013/05/31 20:18:44 reyk Exp $ +.\" +.\" $FreeBSD$ +.\" +.Dd August 4, 2013 +.Dt VMX 4 +.Os +.Sh NAME +.Nm vmx +.Nd VMware VMXNET3 Virtual Interface Controller device +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device vmx" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_vmx_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the VMXNET3 virtual NIC available in virtual +machines by VMware. +It appears as a simple Ethernet device but is actually a virtual network +interface to the underlying host operating system. +.Pp +This driver supports the +.Ic VMXNET3 +driver protocol, as an alternative to the emulated +.Xr pcn 4 , +.Xr em 4 +interfaces also available in the VMware environment. +The +.Nm +driver is optimized for the virtual machine, it can provide advanced +capabilities depending on the underlying host operating system and +the physical network interface controller of the host. +The +.Nm +driver supports features like multiqueue support, IPv6 +checksum offloading, MSI/MSI-X support and hardware VLAN tagging in +VMware's VLAN Guest Tagging (VGT) mode. +.Pp +The +.Nm +driver supports VMXNET3 VMware virtual NICs provided by the virtual +machine hardware version 7 or newer, as provided by the following +products: +.Pp +.Bl -bullet -compact -offset indent +.It +VMware ESX/ESXi 4.0 and newer +.It +VMware Server 2.0 and newer +.It +VMware Workstation 6.5 and newer +.It +VMware Fusion 2.0 and newer +.El +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Sh EXAMPLES +The following entry must be added to the VMware configuration file +to provide the +.Nm +device: +.Bd -literal -offset indent +ethernet0.virtualDev = "vmxnet3" +.Ed +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr em 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr pcn 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was ported from +.Ox +by +.An Bryan Venteicher Aq bryanv@freebsd.org . +The +.Ox +driver was written by +.An Tsubai Masanari . Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Fri Aug 23 20:39:41 2013 (r254737) +++ head/sys/conf/files.amd64 Fri Aug 23 20:47:16 2013 (r254738) @@ -304,6 +304,7 @@ dev/tpm/tpm_acpi.c optional tpm acpi dev/tpm/tpm_isa.c optional tpm isa dev/uart/uart_cpu_x86.c optional uart dev/viawd/viawd.c optional viawd +dev/vmware/vmxnet3/if_vmx.c optional vmx dev/wbwd/wbwd.c optional wbwd dev/wpi/if_wpi.c optional wpi dev/isci/isci.c optional isci Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Fri Aug 23 20:39:41 2013 (r254737) +++ head/sys/conf/files.i386 Fri Aug 23 20:47:16 2013 (r254738) @@ -267,6 +267,7 @@ dev/tpm/tpm_acpi.c optional tpm acpi dev/tpm/tpm_isa.c optional tpm isa dev/uart/uart_cpu_x86.c optional uart dev/viawd/viawd.c optional viawd +dev/vmware/vmxnet3/if_vmx.c optional vmx dev/acpica/acpi_if.m standard dev/acpi_support/acpi_wmi_if.m standard dev/wbwd/wbwd.c optional wbwd Added: head/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/vmware/vmxnet3/if_vmx.c Fri Aug 23 20:47:16 2013 (r254738) @@ -0,0 +1,3305 @@ +/*- + * Copyright (c) 2013 Tsubai Masanari + * Copyright (c) 2013 Bryan Venteicher + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $OpenBSD: src/sys/dev/pci/if_vmx.c,v 1.11 2013/06/22 00:28:10 uebayasi Exp $ + */ + +/* Driver for VMware vmxnet3 virtual ethernet devices. */ + +#include +__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 "if_vmxreg.h" +#include "if_vmxvar.h" + +#include "opt_inet.h" +#include "opt_inet6.h" + +/* Always enable for now - useful for queue hangs. */ +#define VMXNET3_DEBUG_SYSCTL + +#ifdef VMXNET3_FAILPOINTS +#include +static SYSCTL_NODE(DEBUG_FP, OID_AUTO, vmxnet3, CTLFLAG_RW, 0, + "vmxnet3 fail points"); +#define VMXNET3_FP _debug_fail_point_vmxnet3 +#endif + +static int vmxnet3_probe(device_t); +static int vmxnet3_attach(device_t); +static int vmxnet3_detach(device_t); +static int vmxnet3_shutdown(device_t); + +static int vmxnet3_alloc_resources(struct vmxnet3_softc *); +static void vmxnet3_free_resources(struct vmxnet3_softc *); +static int vmxnet3_check_version(struct vmxnet3_softc *); +static void vmxnet3_initial_config(struct vmxnet3_softc *); + +static int vmxnet3_alloc_msix_interrupts(struct vmxnet3_softc *); +static int vmxnet3_alloc_msi_interrupts(struct vmxnet3_softc *); +static int vmxnet3_alloc_legacy_interrupts(struct vmxnet3_softc *); +static int vmxnet3_alloc_interrupt(struct vmxnet3_softc *, int, int, + struct vmxnet3_interrupt *); +static int vmxnet3_alloc_intr_resources(struct vmxnet3_softc *); +static int vmxnet3_setup_msix_interrupts(struct vmxnet3_softc *); +static int vmxnet3_setup_legacy_interrupt(struct vmxnet3_softc *); +static int vmxnet3_setup_interrupts(struct vmxnet3_softc *); +static int vmxnet3_alloc_interrupts(struct vmxnet3_softc *); + +static void vmxnet3_free_interrupt(struct vmxnet3_softc *, + struct vmxnet3_interrupt *); +static void vmxnet3_free_interrupts(struct vmxnet3_softc *); + +static int vmxnet3_init_rxq(struct vmxnet3_softc *, int); +static int vmxnet3_init_txq(struct vmxnet3_softc *, int); +static int vmxnet3_alloc_rxtx_queues(struct vmxnet3_softc *); +static void vmxnet3_destroy_rxq(struct vmxnet3_rxqueue *); +static void vmxnet3_destroy_txq(struct vmxnet3_txqueue *); +static void vmxnet3_free_rxtx_queues(struct vmxnet3_softc *); + +static int vmxnet3_alloc_shared_data(struct vmxnet3_softc *); +static void vmxnet3_free_shared_data(struct vmxnet3_softc *); +static int vmxnet3_alloc_txq_data(struct vmxnet3_softc *); +static void vmxnet3_free_txq_data(struct vmxnet3_softc *); +static int vmxnet3_alloc_rxq_data(struct vmxnet3_softc *); +static void vmxnet3_free_rxq_data(struct vmxnet3_softc *); +static int vmxnet3_alloc_queue_data(struct vmxnet3_softc *); +static void vmxnet3_free_queue_data(struct vmxnet3_softc *); +static int vmxnet3_alloc_mcast_table(struct vmxnet3_softc *); +static void vmxnet3_init_shared_data(struct vmxnet3_softc *); +static void vmxnet3_reinit_interface(struct vmxnet3_softc *); +static void vmxnet3_reinit_shared_data(struct vmxnet3_softc *); +static int vmxnet3_alloc_data(struct vmxnet3_softc *); +static void vmxnet3_free_data(struct vmxnet3_softc *); +static int vmxnet3_setup_interface(struct vmxnet3_softc *); + +static void vmxnet3_evintr(struct vmxnet3_softc *); +static void vmxnet3_txq_eof(struct vmxnet3_txqueue *); +static void vmxnet3_rx_csum(struct vmxnet3_rxcompdesc *, struct mbuf *); +static int vmxnet3_newbuf(struct vmxnet3_softc *, struct vmxnet3_rxring *); +static void vmxnet3_rxq_eof_discard(struct vmxnet3_rxqueue *, + struct vmxnet3_rxring *, int); +static void vmxnet3_rxq_eof(struct vmxnet3_rxqueue *); +static void vmxnet3_legacy_intr(void *); +static void vmxnet3_txq_intr(void *); +static void vmxnet3_rxq_intr(void *); +static void vmxnet3_event_intr(void *); + +static void vmxnet3_txstop(struct vmxnet3_softc *, struct vmxnet3_txqueue *); +static void vmxnet3_rxstop(struct vmxnet3_softc *, struct vmxnet3_rxqueue *); +static void vmxnet3_stop(struct vmxnet3_softc *); + +static void vmxnet3_txinit(struct vmxnet3_softc *, struct vmxnet3_txqueue *); +static int vmxnet3_rxinit(struct vmxnet3_softc *, struct vmxnet3_rxqueue *); +static int vmxnet3_reinit_queues(struct vmxnet3_softc *); +static int vmxnet3_enable_device(struct vmxnet3_softc *); +static void vmxnet3_reinit_rxfilters(struct vmxnet3_softc *); +static int vmxnet3_reinit(struct vmxnet3_softc *); +static void vmxnet3_init_locked(struct vmxnet3_softc *); +static void vmxnet3_init(void *); + +static int vmxnet3_txq_offload_ctx(struct mbuf *, int *, int *, int *); +static int vmxnet3_txq_load_mbuf(struct vmxnet3_txqueue *, struct mbuf **, + bus_dmamap_t, bus_dma_segment_t [], int *); +static void vmxnet3_txq_unload_mbuf(struct vmxnet3_txqueue *, bus_dmamap_t); +static int vmxnet3_txq_encap(struct vmxnet3_txqueue *, struct mbuf **); +static void vmxnet3_start_locked(struct ifnet *); +static void vmxnet3_start(struct ifnet *); + +static void vmxnet3_update_vlan_filter(struct vmxnet3_softc *, int, + uint16_t); +static void vmxnet3_register_vlan(void *, struct ifnet *, uint16_t); +static void vmxnet3_unregister_vlan(void *, struct ifnet *, uint16_t); +static void vmxnet3_set_rxfilter(struct vmxnet3_softc *); +static int vmxnet3_change_mtu(struct vmxnet3_softc *, int); +static int vmxnet3_ioctl(struct ifnet *, u_long, caddr_t); + +static int vmxnet3_watchdog(struct vmxnet3_txqueue *); +static void vmxnet3_tick(void *); +static void vmxnet3_link_status(struct vmxnet3_softc *); +static void vmxnet3_media_status(struct ifnet *, struct ifmediareq *); +static int vmxnet3_media_change(struct ifnet *); +static void vmxnet3_set_lladdr(struct vmxnet3_softc *); +static void vmxnet3_get_lladdr(struct vmxnet3_softc *); + +static void vmxnet3_setup_txq_sysctl(struct vmxnet3_txqueue *, + struct sysctl_ctx_list *, struct sysctl_oid_list *); +static void vmxnet3_setup_rxq_sysctl(struct vmxnet3_rxqueue *, + struct sysctl_ctx_list *, struct sysctl_oid_list *); +static void vmxnet3_setup_queue_sysctl(struct vmxnet3_softc *, + struct sysctl_ctx_list *, struct sysctl_oid_list *); +static void vmxnet3_setup_sysctl(struct vmxnet3_softc *); + +static void vmxnet3_write_bar0(struct vmxnet3_softc *, bus_size_t, + uint32_t); +static uint32_t vmxnet3_read_bar1(struct vmxnet3_softc *, bus_size_t); +static void vmxnet3_write_bar1(struct vmxnet3_softc *, bus_size_t, + uint32_t); +static void vmxnet3_write_cmd(struct vmxnet3_softc *, uint32_t); +static uint32_t vmxnet3_read_cmd(struct vmxnet3_softc *, uint32_t); + +static void vmxnet3_enable_intr(struct vmxnet3_softc *, int); +static void vmxnet3_disable_intr(struct vmxnet3_softc *, int); +static void vmxnet3_enable_all_intrs(struct vmxnet3_softc *); +static void vmxnet3_disable_all_intrs(struct vmxnet3_softc *); + +static int vmxnet3_dma_malloc(struct vmxnet3_softc *, bus_size_t, + bus_size_t, struct vmxnet3_dma_alloc *); +static void vmxnet3_dma_free(struct vmxnet3_softc *, + struct vmxnet3_dma_alloc *); + +typedef enum { + VMXNET3_BARRIER_RD, + VMXNET3_BARRIER_WR, + VMXNET3_BARRIER_RDWR, +} vmxnet3_barrier_t; + +static void vmxnet3_barrier(struct vmxnet3_softc *, vmxnet3_barrier_t); + +static device_method_t vmxnet3_methods[] = { + /* Device interface. */ + DEVMETHOD(device_probe, vmxnet3_probe), + DEVMETHOD(device_attach, vmxnet3_attach), + DEVMETHOD(device_detach, vmxnet3_detach), + DEVMETHOD(device_shutdown, vmxnet3_shutdown), + + DEVMETHOD_END +}; + +static driver_t vmxnet3_driver = { + "vmx", vmxnet3_methods, sizeof(struct vmxnet3_softc) +}; + +static devclass_t vmxnet3_devclass; +DRIVER_MODULE(vmx, pci, vmxnet3_driver, vmxnet3_devclass, 0, 0); + +MODULE_DEPEND(vmx, pci, 1, 1, 1); +MODULE_DEPEND(vmx, ether, 1, 1, 1); + +#define VMXNET3_VMWARE_VENDOR_ID 0x15AD +#define VMXNET3_VMWARE_DEVICE_ID 0x07B0 + +static int +vmxnet3_probe(device_t dev) +{ + + if (pci_get_vendor(dev) == VMXNET3_VMWARE_VENDOR_ID && + pci_get_device(dev) == VMXNET3_VMWARE_DEVICE_ID) { + device_set_desc(dev, "VMware VMXNET3 Ethernet Adapter"); + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +vmxnet3_attach(device_t dev) +{ + struct vmxnet3_softc *sc; + int error; + + sc = device_get_softc(dev); + sc->vmx_dev = dev; + + pci_enable_busmaster(dev); + + VMXNET3_CORE_LOCK_INIT(sc, device_get_nameunit(dev)); + callout_init_mtx(&sc->vmx_tick, &sc->vmx_mtx, 0); + + vmxnet3_initial_config(sc); + + error = vmxnet3_alloc_resources(sc); + if (error) + goto fail; + + error = vmxnet3_check_version(sc); + if (error) + goto fail; + + error = vmxnet3_alloc_rxtx_queues(sc); + if (error) + goto fail; + + error = vmxnet3_alloc_interrupts(sc); + if (error) + goto fail; + + error = vmxnet3_alloc_data(sc); + if (error) + goto fail; + + error = vmxnet3_setup_interface(sc); + if (error) + goto fail; + + error = vmxnet3_setup_interrupts(sc); + if (error) { + ether_ifdetach(sc->vmx_ifp); + device_printf(dev, "could not set up interrupt\n"); + goto fail; + } + + vmxnet3_setup_sysctl(sc); + vmxnet3_link_status(sc); + +fail: + if (error) + vmxnet3_detach(dev); + + return (error); +} + +static int +vmxnet3_detach(device_t dev) +{ + struct vmxnet3_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + ifp = sc->vmx_ifp; + + if (device_is_attached(dev)) { + ether_ifdetach(ifp); + VMXNET3_CORE_LOCK(sc); + vmxnet3_stop(sc); + VMXNET3_CORE_UNLOCK(sc); + callout_drain(&sc->vmx_tick); + } + + if (sc->vmx_vlan_attach != NULL) { + EVENTHANDLER_DEREGISTER(vlan_config, sc->vmx_vlan_attach); + sc->vmx_vlan_attach = NULL; + } + if (sc->vmx_vlan_detach != NULL) { + EVENTHANDLER_DEREGISTER(vlan_config, sc->vmx_vlan_detach); + sc->vmx_vlan_detach = NULL; + } + + vmxnet3_free_interrupts(sc); + + if (ifp != NULL) { + if_free(ifp); + sc->vmx_ifp = NULL; + } + + ifmedia_removeall(&sc->vmx_media); + + vmxnet3_free_data(sc); + vmxnet3_free_resources(sc); + vmxnet3_free_rxtx_queues(sc); + + VMXNET3_CORE_LOCK_DESTROY(sc); + + return (0); +} + +static int +vmxnet3_shutdown(device_t dev) +{ + + return (0); +} + +static int +vmxnet3_alloc_resources(struct vmxnet3_softc *sc) +{ + device_t dev; + int rid; + + dev = sc->vmx_dev; + + rid = PCIR_BAR(0); + sc->vmx_res0 = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->vmx_res0 == NULL) { + device_printf(dev, + "could not map BAR0 memory\n"); + return (ENXIO); + } + + sc->vmx_iot0 = rman_get_bustag(sc->vmx_res0); + sc->vmx_ioh0 = rman_get_bushandle(sc->vmx_res0); + + rid = PCIR_BAR(1); + sc->vmx_res1 = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->vmx_res1 == NULL) { + device_printf(dev, + "could not map BAR1 memory\n"); + return (ENXIO); + } + + sc->vmx_iot1 = rman_get_bustag(sc->vmx_res1); + sc->vmx_ioh1 = rman_get_bushandle(sc->vmx_res1); + + if (pci_find_cap(dev, PCIY_MSIX, NULL) == 0) { + rid = PCIR_BAR(2); + sc->vmx_msix_res = bus_alloc_resource_any(dev, + SYS_RES_MEMORY, &rid, RF_ACTIVE); + } + + if (sc->vmx_msix_res == NULL) + sc->vmx_flags |= VMXNET3_FLAG_NO_MSIX; + + return (0); +} + +static void +vmxnet3_free_resources(struct vmxnet3_softc *sc) +{ + device_t dev; + int rid; + + dev = sc->vmx_dev; + + if (sc->vmx_res0 != NULL) { + rid = PCIR_BAR(0); + bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->vmx_res0); + sc->vmx_res0 = NULL; + } + + if (sc->vmx_res1 != NULL) { + rid = PCIR_BAR(1); + bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->vmx_res1); + sc->vmx_res1 = NULL; + } + + if (sc->vmx_msix_res != NULL) { + rid = PCIR_BAR(2); + bus_release_resource(dev, SYS_RES_MEMORY, rid, + sc->vmx_msix_res); + sc->vmx_msix_res = NULL; + } +} + +static int +vmxnet3_check_version(struct vmxnet3_softc *sc) +{ + device_t dev; + uint32_t version; + + dev = sc->vmx_dev; + + version = vmxnet3_read_bar1(sc, VMXNET3_BAR1_VRRS); + if ((version & 0x01) == 0) { + device_printf(dev, "unsupported hardware version %#x\n", + version); + return (ENOTSUP); + } else + vmxnet3_write_bar1(sc, VMXNET3_BAR1_VRRS, 1); + + version = vmxnet3_read_bar1(sc, VMXNET3_BAR1_UVRS); + if ((version & 0x01) == 0) { + device_printf(dev, "unsupported UPT version %#x\n", version); + return (ENOTSUP); + } else + vmxnet3_write_bar1(sc, VMXNET3_BAR1_UVRS, 1); + + return (0); +} + +static void +vmxnet3_initial_config(struct vmxnet3_softc *sc) +{ + + sc->vmx_ntxqueues = 1; + sc->vmx_nrxqueues = 1; + sc->vmx_ntxdescs = VMXNET3_MAX_TX_NDESC; + sc->vmx_nrxdescs = VMXNET3_MAX_RX_NDESC; + sc->vmx_max_rxsegs = VMXNET3_MAX_RX_SEGS; +} + +static int +vmxnet3_alloc_msix_interrupts(struct vmxnet3_softc *sc) +{ + device_t dev; + int nmsix, cnt, required; + + dev = sc->vmx_dev; + + if (sc->vmx_flags & VMXNET3_FLAG_NO_MSIX) + return (1); + + /* Allocate an additional vector for the events interrupt. */ + required = sc->vmx_nrxqueues + sc->vmx_ntxqueues + 1; + + nmsix = pci_msix_count(dev); + if (nmsix < required) + return (1); + + cnt = required; + if (pci_alloc_msix(dev, &cnt) == 0 && cnt >= required) { + sc->vmx_nintrs = required; + return (0); + } else + pci_release_msi(dev); + + return (1); +} + +static int +vmxnet3_alloc_msi_interrupts(struct vmxnet3_softc *sc) +{ + device_t dev; + int nmsi, cnt, required; + + dev = sc->vmx_dev; + required = 1; + + nmsi = pci_msi_count(dev); + if (nmsi < required) + return (1); + + cnt = required; + if (pci_alloc_msi(dev, &cnt) == 0 && cnt >= required) { + sc->vmx_nintrs = 1; + return (0); + } else + pci_release_msi(dev); + + return (1); +} + +static int +vmxnet3_alloc_legacy_interrupts(struct vmxnet3_softc *sc) +{ + + sc->vmx_nintrs = 1; + return (0); +} + +static int +vmxnet3_alloc_interrupt(struct vmxnet3_softc *sc, int rid, int flags, + struct vmxnet3_interrupt *intr) +{ + struct resource *irq; + + irq = bus_alloc_resource_any(sc->vmx_dev, SYS_RES_IRQ, &rid, flags); + if (irq == NULL) + return (ENXIO); + + intr->vmxi_irq = irq; + intr->vmxi_rid = rid; + + return (0); +} + +static int +vmxnet3_alloc_intr_resources(struct vmxnet3_softc *sc) +{ + int i, rid, flags, error; + + rid = 0; + flags = RF_ACTIVE; + + if (sc->vmx_intr_type == VMXNET3_IT_LEGACY) + flags |= RF_SHAREABLE; + else + rid = 1; + + for (i = 0; i < sc->vmx_nintrs; i++, rid++) { + error = vmxnet3_alloc_interrupt(sc, rid, flags, + &sc->vmx_intrs[i]); + if (error) + return (error); + } + + return (0); +} + +/* + * NOTE: We only support the simple case of each Rx and Tx queue on its + * own MSIX vector. This is good enough until we support mulitqueue. + */ +static int +vmxnet3_setup_msix_interrupts(struct vmxnet3_softc *sc) +{ + device_t dev; + struct vmxnet3_txqueue *txq; + struct vmxnet3_rxqueue *rxq; + struct vmxnet3_interrupt *intr; + enum intr_type type; + int i, error; + + dev = sc->vmx_dev; + intr = &sc->vmx_intrs[0]; + type = INTR_TYPE_NET | INTR_MPSAFE; + + for (i = 0; i < sc->vmx_ntxqueues; i++, intr++) { + txq = &sc->vmx_txq[i]; + error = bus_setup_intr(dev, intr->vmxi_irq, type, NULL, + vmxnet3_txq_intr, txq, &intr->vmxi_handler); + if (error) + return (error); + txq->vxtxq_intr_idx = intr->vmxi_rid - 1; + } + + for (i = 0; i < sc->vmx_nrxqueues; i++, intr++) { + rxq = &sc->vmx_rxq[i]; + error = bus_setup_intr(dev, intr->vmxi_irq, type, NULL, + vmxnet3_rxq_intr, rxq, &intr->vmxi_handler); + if (error) + return (error); + rxq->vxrxq_intr_idx = intr->vmxi_rid - 1; + } + + error = bus_setup_intr(dev, intr->vmxi_irq, type, NULL, + vmxnet3_event_intr, sc, &intr->vmxi_handler); + if (error) + return (error); + sc->vmx_event_intr_idx = intr->vmxi_rid - 1; + + return (0); +} + +static int +vmxnet3_setup_legacy_interrupt(struct vmxnet3_softc *sc) +{ + struct vmxnet3_interrupt *intr; + int i, error; + + intr = &sc->vmx_intrs[0]; + error = bus_setup_intr(sc->vmx_dev, intr->vmxi_irq, + INTR_TYPE_NET | INTR_MPSAFE, NULL, vmxnet3_legacy_intr, sc, + &intr->vmxi_handler); + + for (i = 0; i < sc->vmx_ntxqueues; i++) + sc->vmx_txq[i].vxtxq_intr_idx = 0; + for (i = 0; i < sc->vmx_nrxqueues; i++) + sc->vmx_rxq[i].vxrxq_intr_idx = 0; + sc->vmx_event_intr_idx = 0; + + return (error); +} + +/* + * XXX BMV Should probably reorganize the attach and just do + * this in vmxnet3_init_shared_data(). + */ +static void +vmxnet3_set_interrupt_idx(struct vmxnet3_softc *sc) +{ + struct vmxnet3_txqueue *txq; + struct vmxnet3_txq_shared *txs; + struct vmxnet3_rxqueue *rxq; + struct vmxnet3_rxq_shared *rxs; + int i; + + sc->vmx_ds->evintr = sc->vmx_event_intr_idx; + + for (i = 0; i < sc->vmx_ntxqueues; i++) { + txq = &sc->vmx_txq[i]; + txs = txq->vxtxq_ts; + txs->intr_idx = txq->vxtxq_intr_idx; + } + + for (i = 0; i < sc->vmx_nrxqueues; i++) { + rxq = &sc->vmx_rxq[i]; + rxs = rxq->vxrxq_rs; + rxs->intr_idx = rxq->vxrxq_intr_idx; + } +} + +static int +vmxnet3_setup_interrupts(struct vmxnet3_softc *sc) +{ + int error; + + error = vmxnet3_alloc_intr_resources(sc); + if (error) + return (error); + + switch (sc->vmx_intr_type) { + case VMXNET3_IT_MSIX: + error = vmxnet3_setup_msix_interrupts(sc); + break; + case VMXNET3_IT_MSI: + case VMXNET3_IT_LEGACY: + error = vmxnet3_setup_legacy_interrupt(sc); + break; + default: + panic("%s: invalid interrupt type %d", __func__, + sc->vmx_intr_type); + } + + if (error == 0) + vmxnet3_set_interrupt_idx(sc); + + return (error); +} + +static int +vmxnet3_alloc_interrupts(struct vmxnet3_softc *sc) +{ + device_t dev; + uint32_t config; + int error; + + dev = sc->vmx_dev; + config = vmxnet3_read_cmd(sc, VMXNET3_CMD_GET_INTRCFG); + + sc->vmx_intr_type = config & 0x03; + sc->vmx_intr_mask_mode = (config >> 2) & 0x03; + + switch (sc->vmx_intr_type) { + case VMXNET3_IT_AUTO: + sc->vmx_intr_type = VMXNET3_IT_MSIX; + /* FALLTHROUGH */ + case VMXNET3_IT_MSIX: + error = vmxnet3_alloc_msix_interrupts(sc); + if (error == 0) + break; + sc->vmx_intr_type = VMXNET3_IT_MSI; + /* FALLTHROUGH */ + case VMXNET3_IT_MSI: + error = vmxnet3_alloc_msi_interrupts(sc); + if (error == 0) + break; + sc->vmx_intr_type = VMXNET3_IT_LEGACY; + /* FALLTHROUGH */ + case VMXNET3_IT_LEGACY: + error = vmxnet3_alloc_legacy_interrupts(sc); + if (error == 0) + break; + /* FALLTHROUGH */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 20:56:17 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 ESMTP id 93EE0D94; Fri, 23 Aug 2013 20:56:17 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) 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 7F35D23B1; Fri, 23 Aug 2013 20:56: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 r7NKuH0T084202; Fri, 23 Aug 2013 20:56:17 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NKuH32084201; Fri, 23 Aug 2013 20:56:17 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201308232056.r7NKuH32084201@svn.freebsd.org> From: Bryan Venteicher Date: Fri, 23 Aug 2013 20:56:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254739 - head/share/man/man4 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.14 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: Fri, 23 Aug 2013 20:56:17 -0000 Author: bryanv Date: Fri Aug 23 20:56:17 2013 New Revision: 254739 URL: http://svnweb.freebsd.org/changeset/base/254739 Log: Remove duplicate copy of the man page Pointed out by: jmallett Modified: head/share/man/man4/vmx.4 Modified: head/share/man/man4/vmx.4 ============================================================================== --- head/share/man/man4/vmx.4 Fri Aug 23 20:47:16 2013 (r254738) +++ head/share/man/man4/vmx.4 Fri Aug 23 20:56:17 2013 (r254739) @@ -110,115 +110,3 @@ The .Ox driver was written by .An Tsubai Masanari . -.\" -.\" Copyright (c) 2006,2013 Reyk Floeter -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.\" $OpenBSD: src/share/man/man4/vmx.4,v 1.1 2013/05/31 20:18:44 reyk Exp $ -.\" -.\" $FreeBSD$ -.\" -.Dd August 4, 2013 -.Dt VMX 4 -.Os -.Sh NAME -.Nm vmx -.Nd VMware VMXNET3 Virtual Interface Controller device -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following line in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device vmx" -.Ed -.Pp -Alternatively, to load the driver as a -module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -if_vmx_load="YES" -.Ed -.Sh DESCRIPTION -The -.Nm -driver provides support for the VMXNET3 virtual NIC available in virtual -machines by VMware. -It appears as a simple Ethernet device but is actually a virtual network -interface to the underlying host operating system. -.Pp -This driver supports the -.Ic VMXNET3 -driver protocol, as an alternative to the emulated -.Xr pcn 4 , -.Xr em 4 -interfaces also available in the VMware environment. -The -.Nm -driver is optimized for the virtual machine, it can provide advanced -capabilities depending on the underlying host operating system and -the physical network interface controller of the host. -The -.Nm -driver supports features like multiqueue support, IPv6 -checksum offloading, MSI/MSI-X support and hardware VLAN tagging in -VMware's VLAN Guest Tagging (VGT) mode. -.Pp -The -.Nm -driver supports VMXNET3 VMware virtual NICs provided by the virtual -machine hardware version 7 or newer, as provided by the following -products: -.Pp -.Bl -bullet -compact -offset indent -.It -VMware ESX/ESXi 4.0 and newer -.It -VMware Server 2.0 and newer -.It -VMware Workstation 6.5 and newer -.It -VMware Fusion 2.0 and newer -.El -.Pp -For more information on configuring this device, see -.Xr ifconfig 8 . -.Sh EXAMPLES -The following entry must be added to the VMware configuration file -to provide the -.Nm -device: -.Bd -literal -offset indent -ethernet0.virtualDev = "vmxnet3" -.Ed -.Sh SEE ALSO -.Xr altq 4 , -.Xr arp 4 , -.Xr em 4 , -.Xr netintro 4 , -.Xr ng_ether 4 , -.Xr pcn 4 , -.Xr vlan 4 , -.Xr ifconfig 8 -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was ported from -.Ox -by -.An Bryan Venteicher Aq bryanv@freebsd.org . -The -.Ox -driver was written by -.An Tsubai Masanari . From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 22:52: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 ESMTP id 5EABD963; Fri, 23 Aug 2013 22:52:21 +0000 (UTC) (envelope-from delphij@FreeBSD.org) 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 49C582A11; Fri, 23 Aug 2013 22:52:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NMqLke045339; Fri, 23 Aug 2013 22:52:21 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NMqKWQ045334; Fri, 23 Aug 2013 22:52:20 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201308232252.r7NMqKWQ045334@svn.freebsd.org> From: Xin LI Date: Fri, 23 Aug 2013 22:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254741 - in head: sys/fs/tmpfs sys/kern sys/sys usr.sbin/jail 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.14 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: Fri, 23 Aug 2013 22:52:21 -0000 Author: delphij Date: Fri Aug 23 22:52:20 2013 New Revision: 254741 URL: http://svnweb.freebsd.org/changeset/base/254741 Log: Allow tmpfs be mounted inside jail. Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/kern/kern_jail.c head/sys/sys/jail.h head/usr.sbin/jail/jail.8 Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Fri Aug 23 21:46:11 2013 (r254740) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Fri Aug 23 22:52:20 2013 (r254741) @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -138,6 +140,7 @@ tmpfs_mount(struct mount *mp) sizeof(struct tmpfs_dirent) + sizeof(struct tmpfs_node)); struct tmpfs_mount *tmp; struct tmpfs_node *root; + struct thread *td = curthread; int error; /* Size counters. */ u_quad_t pages; @@ -150,6 +153,9 @@ tmpfs_mount(struct mount *mp) struct vattr va; + if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_TMPFS)) + return (EPERM); + if (vfs_filteropt(mp->mnt_optnew, tmpfs_opts)) return (EINVAL); @@ -420,4 +426,4 @@ struct vfsops tmpfs_vfsops = { .vfs_statfs = tmpfs_statfs, .vfs_fhtovp = tmpfs_fhtovp, }; -VFS_SET(tmpfs_vfsops, tmpfs, 0); +VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Fri Aug 23 21:46:11 2013 (r254740) +++ head/sys/kern/kern_jail.c Fri Aug 23 22:52:20 2013 (r254741) @@ -206,6 +206,7 @@ static char *pr_allow_names[] = { "allow.mount.nullfs", "allow.mount.zfs", "allow.mount.procfs", + "allow.mount.tmpfs", }; const size_t pr_allow_names_size = sizeof(pr_allow_names); @@ -221,6 +222,7 @@ static char *pr_allow_nonames[] = { "allow.mount.nonullfs", "allow.mount.nozfs", "allow.mount.noprocfs", + "allow.mount.notmpfs", }; const size_t pr_allow_nonames_size = sizeof(pr_allow_nonames); @@ -4228,6 +4230,10 @@ SYSCTL_PROC(_security_jail, OID_AUTO, mo CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT_PROCFS, sysctl_jail_default_allow, "I", "Processes in jail can mount the procfs file system"); +SYSCTL_PROC(_security_jail, OID_AUTO, mount_tmpfs_allowed, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + NULL, PR_ALLOW_MOUNT_TMPFS, sysctl_jail_default_allow, "I", + "Processes in jail can mount the tmpfs file system"); SYSCTL_PROC(_security_jail, OID_AUTO, mount_zfs_allowed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, PR_ALLOW_MOUNT_ZFS, sysctl_jail_default_allow, "I", @@ -4380,6 +4386,8 @@ SYSCTL_JAIL_PARAM(_allow_mount, nullfs, "B", "Jail may mount the nullfs file system"); SYSCTL_JAIL_PARAM(_allow_mount, procfs, CTLTYPE_INT | CTLFLAG_RW, "B", "Jail may mount the procfs file system"); +SYSCTL_JAIL_PARAM(_allow_mount, tmpfs, CTLTYPE_INT | CTLFLAG_RW, + "B", "Jail may mount the tmpfs file system"); SYSCTL_JAIL_PARAM(_allow_mount, zfs, CTLTYPE_INT | CTLFLAG_RW, "B", "Jail may mount the zfs file system"); Modified: head/sys/sys/jail.h ============================================================================== --- head/sys/sys/jail.h Fri Aug 23 21:46:11 2013 (r254740) +++ head/sys/sys/jail.h Fri Aug 23 22:52:20 2013 (r254741) @@ -227,7 +227,8 @@ struct prison_racct { #define PR_ALLOW_MOUNT_NULLFS 0x0100 #define PR_ALLOW_MOUNT_ZFS 0x0200 #define PR_ALLOW_MOUNT_PROCFS 0x0400 -#define PR_ALLOW_ALL 0x07ff +#define PR_ALLOW_MOUNT_TMPFS 0x0800 +#define PR_ALLOW_ALL 0x0fff /* * OSD methods Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Fri Aug 23 21:46:11 2013 (r254740) +++ head/usr.sbin/jail/jail.8 Fri Aug 23 22:52:20 2013 (r254741) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2012 +.Dd August 23, 2013 .Dt JAIL 8 .Os .Sh NAME @@ -545,6 +545,14 @@ This permission is effective only togeth and if .Va enforce_statfs is set to a value lower than 2. +.It Va allow.mount.tmpfs +privileged users inside the jail will be able to mount and unmount the +tmpfs file system. +This permission is effective only together with +.Va allow.mount +and if +.Va enforce_statfs +is set to a value lower than 2. .It Va allow.mount.zfs privileged users inside the jail will be able to mount and unmount the ZFS file system. From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 22:55: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 ESMTP id E69C1B3F; Fri, 23 Aug 2013 22:55:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) 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 D3DF82A33; Fri, 23 Aug 2013 22:55: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 r7NMtqIX046460; Fri, 23 Aug 2013 22:55:52 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NMtq84046459; Fri, 23 Aug 2013 22:55:52 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201308232255.r7NMtq84046459@svn.freebsd.org> From: Mark Johnston Date: Fri, 23 Aug 2013 22:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254742 - head/sys/dev/mfi 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.14 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: Fri, 23 Aug 2013 22:55:53 -0000 Author: markj Date: Fri Aug 23 22:55:52 2013 New Revision: 254742 URL: http://svnweb.freebsd.org/changeset/base/254742 Log: Hold mfi_io_lock across calls to xpt_rescan() and xpt_alloc_ccb_nowait(). xpt_rescan() expects the SIM lock to be held, and we trip a mtx_assert if the driver initiates multiple rescans in quick succession. Reported by: sbruno Tested by: sbruno MFC after: 1 week Modified: head/sys/dev/mfi/mfi_cam.c Modified: head/sys/dev/mfi/mfi_cam.c ============================================================================== --- head/sys/dev/mfi/mfi_cam.c Fri Aug 23 22:52:20 2013 (r254741) +++ head/sys/dev/mfi/mfi_cam.c Fri Aug 23 22:55:52 2013 (r254742) @@ -308,17 +308,16 @@ mfip_cam_rescan(struct mfi_softc *sc, ui return; } camsc->state = MFIP_STATE_RESCAN; - mtx_unlock(&sc->mfi_io_lock); ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { + mtx_unlock(&sc->mfi_io_lock); device_printf(sc->mfi_dev, "Cannot allocate ccb for bus rescan.\n"); return; } sim = camsc->sim; - mtx_lock(&sc->mfi_io_lock); if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sim), tid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_free_ccb(ccb); @@ -327,11 +326,8 @@ mfip_cam_rescan(struct mfi_softc *sc, ui "Cannot create path for bus rescan.\n"); return; } - mtx_unlock(&sc->mfi_io_lock); - xpt_rescan(ccb); - mtx_lock(&sc->mfi_io_lock); camsc->state = MFIP_STATE_NONE; mtx_unlock(&sc->mfi_io_lock); } From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 23:12:17 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 ESMTP id 2FCECE80; Fri, 23 Aug 2013 23:12:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) 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 1D0F02B25; Fri, 23 Aug 2013 23:12: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 r7NNCGpo056593; Fri, 23 Aug 2013 23:12:16 GMT (envelope-from asomers@svn.freebsd.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NNCGMU056592; Fri, 23 Aug 2013 23:12:16 GMT (envelope-from asomers@svn.freebsd.org) Message-Id: <201308232312.r7NNCGMU056592@svn.freebsd.org> From: Alan Somers Date: Fri, 23 Aug 2013 23:12:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254743 - head/etc 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.14 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: Fri, 23 Aug 2013 23:12:17 -0000 Author: asomers Date: Fri Aug 23 23:12:16 2013 New Revision: 254743 URL: http://svnweb.freebsd.org/changeset/base/254743 Log: Correctly remove an interface's ipv4 address when the user calls "/etc/rc.d/netif stop XXX". The old globbing pattern failed to account for the possibility of a tab occuring before "inet". Reviewed by: will Approved by: ken (mentor, implicit) MFC after: Never (bug affects head only) Sponsored by: Spectra Logic Modified: head/etc/network.subr Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Fri Aug 23 22:55:52 2013 (r254742) +++ head/etc/network.subr Fri Aug 23 23:12:16 2013 (r254743) @@ -661,9 +661,9 @@ ipv4_down() for _inet in $inetList ; do # get rid of extraneous line case $_inet in - "") break ;; - inet\ *) ;; - *) continue ;; + "") break ;; + \ inet\ *|inet\ *) ;; + *) continue ;; esac [ -z "$_inet" ] && break From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 23:21: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 ESMTP id C9BF21FC; Fri, 23 Aug 2013 23:21:25 +0000 (UTC) (envelope-from delphij@FreeBSD.org) 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 B50D32B9B; Fri, 23 Aug 2013 23:21: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 r7NNLPnt061304; Fri, 23 Aug 2013 23:21:25 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NNLOf8061299; Fri, 23 Aug 2013 23:21:24 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201308232321.r7NNLOf8061299@svn.freebsd.org> From: Xin LI Date: Fri, 23 Aug 2013 23:21:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254744 - in head: cddl/contrib/opensolaris/common/ctf sys/cddl/contrib/opensolaris/uts/common/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.14 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: Fri, 23 Aug 2013 23:21:26 -0000 Author: delphij Date: Fri Aug 23 23:21:24 2013 New Revision: 254744 URL: http://svnweb.freebsd.org/changeset/base/254744 Log: MFV r254422: Illumos DTrace issues: 3089 want ::typedef 3094 libctf should support removing a dynamic type 3095 libctf does not validate arrays correctly 3096 libctf does not validate function types correctly Modified: head/cddl/contrib/opensolaris/common/ctf/ctf_create.c head/cddl/contrib/opensolaris/common/ctf/ctf_error.c head/cddl/contrib/opensolaris/common/ctf/ctf_impl.h head/cddl/contrib/opensolaris/common/ctf/ctf_open.c head/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/common/ctf/ctf_create.c ============================================================================== --- head/cddl/contrib/opensolaris/common/ctf/ctf_create.c Fri Aug 23 23:12:16 2013 (r254743) +++ head/cddl/contrib/opensolaris/common/ctf/ctf_create.c Fri Aug 23 23:21:24 2013 (r254744) @@ -24,13 +24,15 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + */ #include #include #include #include +#include /* * This static string is used as the template for initially populating a @@ -167,6 +169,51 @@ ctf_copy_membnames(ctf_dtdef_t *dtd, uch } /* + * Only types of dyanmic CTF containers contain reference counts. These + * containers are marked RD/WR. Because of that we basically make this a no-op + * for compatability with non-dynamic CTF sections. This is also a no-op for + * types which are not dynamic types. It is the responsibility of the caller to + * make sure it is a valid type. We help that caller out on debug builds. + * + * Note that the reference counts are not maintained for types that are not + * within this container. In other words if we have a type in a parent, that + * will not have its reference count increased. On the flip side, the parent + * will not be allowed to remove dynamic types if it has children. + */ +static void +ctf_ref_inc(ctf_file_t *fp, ctf_id_t tid) +{ + ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, tid); + + if (dtd == NULL) + return; + + if (!(fp->ctf_flags & LCTF_RDWR)) + return; + + dtd->dtd_ref++; +} + +/* + * Just as with ctf_ref_inc, this is a no-op on non-writeable containers and the + * caller should ensure that this is already a valid type. + */ +static void +ctf_ref_dec(ctf_file_t *fp, ctf_id_t tid) +{ + ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, tid); + + if (dtd == NULL) + return; + + if (!(fp->ctf_flags & LCTF_RDWR)) + return; + + ASSERT(dtd->dtd_ref >= 1); + dtd->dtd_ref--; +} + +/* * If the specified CTF container is writable and has been modified, reload * this container with the updated type definitions. In order to make this * code and the rest of libctf as simple as possible, we perform updates by @@ -180,6 +227,10 @@ ctf_copy_membnames(ctf_dtdef_t *dtd, uch * ctf_bufopen() will return a new ctf_file_t, but we want to keep the fp * constant for the caller, so after ctf_bufopen() returns, we use bcopy to * swap the interior of the old and new ctf_file_t's, and then free the old. + * + * Note that the lists of dynamic types stays around and the resulting container + * is still writeable. Furthermore, the reference counts that are on the dtd's + * are still valid. */ int ctf_update(ctf_file_t *fp) @@ -432,6 +483,7 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef ctf_dtdef_t *p, **q = &fp->ctf_dthash[h]; ctf_dmdef_t *dmd, *nmd; size_t len; + int kind, i; for (p = *q; p != NULL; p = p->dtd_hash) { if (p != dtd) @@ -443,7 +495,8 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef if (p != NULL) *q = p->dtd_hash; - switch (CTF_INFO_KIND(dtd->dtd_data.ctt_info)) { + kind = CTF_INFO_KIND(dtd->dtd_data.ctt_info); + switch (kind) { case CTF_K_STRUCT: case CTF_K_UNION: case CTF_K_ENUM: @@ -454,14 +507,33 @@ ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef ctf_free(dmd->dmd_name, len); fp->ctf_dtstrlen -= len; } + if (kind != CTF_K_ENUM) + ctf_ref_dec(fp, dmd->dmd_type); nmd = ctf_list_next(dmd); ctf_free(dmd, sizeof (ctf_dmdef_t)); } break; case CTF_K_FUNCTION: + ctf_ref_dec(fp, dtd->dtd_data.ctt_type); + for (i = 0; i < CTF_INFO_VLEN(dtd->dtd_data.ctt_info); i++) + if (dtd->dtd_u.dtu_argv[i] != 0) + ctf_ref_dec(fp, dtd->dtd_u.dtu_argv[i]); ctf_free(dtd->dtd_u.dtu_argv, sizeof (ctf_id_t) * CTF_INFO_VLEN(dtd->dtd_data.ctt_info)); break; + case CTF_K_ARRAY: + ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_contents); + ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_index); + break; + case CTF_K_TYPEDEF: + ctf_ref_dec(fp, dtd->dtd_data.ctt_type); + break; + case CTF_K_POINTER: + case CTF_K_VOLATILE: + case CTF_K_CONST: + case CTF_K_RESTRICT: + ctf_ref_dec(fp, dtd->dtd_data.ctt_type); + break; } if (dtd->dtd_name) { @@ -495,7 +567,9 @@ ctf_dtd_lookup(ctf_file_t *fp, ctf_id_t * Discard all of the dynamic type definitions that have been added to the * container since the last call to ctf_update(). We locate such types by * scanning the list and deleting elements that have type IDs greater than - * ctf_dtoldid, which is set by ctf_update(), above. + * ctf_dtoldid, which is set by ctf_update(), above. Note that to work properly + * with our reference counting schemes, we must delete the dynamic list in + * reverse. */ int ctf_discard(ctf_file_t *fp) @@ -508,11 +582,11 @@ ctf_discard(ctf_file_t *fp) if (!(fp->ctf_flags & LCTF_DIRTY)) return (0); /* no update required */ - for (dtd = ctf_list_next(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) { + for (dtd = ctf_list_prev(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) { if (dtd->dtd_type <= fp->ctf_dtoldid) continue; /* skip types that have been committed */ - ntd = ctf_list_next(dtd); + ntd = ctf_list_prev(dtd); ctf_dtd_delete(fp, dtd); } @@ -614,6 +688,8 @@ ctf_add_reftype(ctf_file_t *fp, uint_t f if ((type = ctf_add_generic(fp, flag, NULL, &dtd)) == CTF_ERR) return (CTF_ERR); /* errno is set for us */ + ctf_ref_inc(fp, ref); + dtd->dtd_data.ctt_info = CTF_TYPE_INFO(kind, flag, 0); dtd->dtd_data.ctt_type = (ushort_t)ref; @@ -645,16 +721,29 @@ ctf_add_array(ctf_file_t *fp, uint_t fla { ctf_dtdef_t *dtd; ctf_id_t type; + ctf_file_t *fpd; if (arp == NULL) return (ctf_set_errno(fp, EINVAL)); + fpd = fp; + if (ctf_lookup_by_id(&fpd, arp->ctr_contents) == NULL && + ctf_dtd_lookup(fp, arp->ctr_contents) == NULL) + return (ctf_set_errno(fp, ECTF_BADID)); + + fpd = fp; + if (ctf_lookup_by_id(&fpd, arp->ctr_index) == NULL && + ctf_dtd_lookup(fp, arp->ctr_index) == NULL) + return (ctf_set_errno(fp, ECTF_BADID)); + if ((type = ctf_add_generic(fp, flag, NULL, &dtd)) == CTF_ERR) return (CTF_ERR); /* errno is set for us */ dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_ARRAY, flag, 0); dtd->dtd_data.ctt_size = 0; dtd->dtd_u.dtu_arr = *arp; + ctf_ref_inc(fp, arp->ctr_contents); + ctf_ref_inc(fp, arp->ctr_index); return (type); } @@ -662,6 +751,7 @@ ctf_add_array(ctf_file_t *fp, uint_t fla int ctf_set_array(ctf_file_t *fp, ctf_id_t type, const ctf_arinfo_t *arp) { + ctf_file_t *fpd; ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, type); if (!(fp->ctf_flags & LCTF_RDWR)) @@ -670,8 +760,22 @@ ctf_set_array(ctf_file_t *fp, ctf_id_t t if (dtd == NULL || CTF_INFO_KIND(dtd->dtd_data.ctt_info) != CTF_K_ARRAY) return (ctf_set_errno(fp, ECTF_BADID)); + fpd = fp; + if (ctf_lookup_by_id(&fpd, arp->ctr_contents) == NULL && + ctf_dtd_lookup(fp, arp->ctr_contents) == NULL) + return (ctf_set_errno(fp, ECTF_BADID)); + + fpd = fp; + if (ctf_lookup_by_id(&fpd, arp->ctr_index) == NULL && + ctf_dtd_lookup(fp, arp->ctr_index) == NULL) + return (ctf_set_errno(fp, ECTF_BADID)); + + ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_contents); + ctf_ref_dec(fp, dtd->dtd_u.dtu_arr.ctr_index); fp->ctf_flags |= LCTF_DIRTY; dtd->dtd_u.dtu_arr = *arp; + ctf_ref_inc(fp, arp->ctr_contents); + ctf_ref_inc(fp, arp->ctr_index); return (0); } @@ -683,7 +787,9 @@ ctf_add_function(ctf_file_t *fp, uint_t ctf_dtdef_t *dtd; ctf_id_t type; uint_t vlen; + int i; ctf_id_t *vdat = NULL; + ctf_file_t *fpd; if (ctc == NULL || (ctc->ctc_flags & ~CTF_FUNC_VARARG) != 0 || (ctc->ctc_argc != 0 && argv == NULL)) @@ -696,6 +802,18 @@ ctf_add_function(ctf_file_t *fp, uint_t if (vlen > CTF_MAX_VLEN) return (ctf_set_errno(fp, EOVERFLOW)); + fpd = fp; + if (ctf_lookup_by_id(&fpd, ctc->ctc_return) == NULL && + ctf_dtd_lookup(fp, ctc->ctc_return) == NULL) + return (ctf_set_errno(fp, ECTF_BADID)); + + for (i = 0; i < ctc->ctc_argc; i++) { + fpd = fp; + if (ctf_lookup_by_id(&fpd, argv[i]) == NULL && + ctf_dtd_lookup(fp, argv[i]) == NULL) + return (ctf_set_errno(fp, ECTF_BADID)); + } + if (vlen != 0 && (vdat = ctf_alloc(sizeof (ctf_id_t) * vlen)) == NULL) return (ctf_set_errno(fp, EAGAIN)); @@ -707,6 +825,10 @@ ctf_add_function(ctf_file_t *fp, uint_t dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_FUNCTION, flag, vlen); dtd->dtd_data.ctt_type = (ushort_t)ctc->ctc_return; + ctf_ref_inc(fp, ctc->ctc_return); + for (i = 0; i < ctc->ctc_argc; i++) + ctf_ref_inc(fp, argv[i]); + bcopy(argv, vdat, sizeof (ctf_id_t) * ctc->ctc_argc); if (ctc->ctc_flags & CTF_FUNC_VARARG) vdat[vlen - 1] = 0; /* add trailing zero to indicate varargs */ @@ -825,8 +947,11 @@ ctf_add_typedef(ctf_file_t *fp, uint_t f { ctf_dtdef_t *dtd; ctf_id_t type; + ctf_file_t *fpd; - if (ref == CTF_ERR || ref < 0 || ref > CTF_MAX_TYPE) + fpd = fp; + if (ref == CTF_ERR || (ctf_lookup_by_id(&fpd, ref) == NULL && + ctf_dtd_lookup(fp, ref) == NULL)) return (ctf_set_errno(fp, EINVAL)); if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR) @@ -834,6 +959,7 @@ ctf_add_typedef(ctf_file_t *fp, uint_t f dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_TYPEDEF, flag, 0); dtd->dtd_data.ctt_type = (ushort_t)ref; + ctf_ref_inc(fp, ref); return (type); } @@ -1008,6 +1134,45 @@ ctf_add_member(ctf_file_t *fp, ctf_id_t if (s != NULL) fp->ctf_dtstrlen += strlen(s) + 1; + ctf_ref_inc(fp, type); + fp->ctf_flags |= LCTF_DIRTY; + return (0); +} + +/* + * This removes a type from the dynamic section. This will fail if the type is + * referenced by another type. Note that the CTF ID is never reused currently by + * CTF. Note that if this container is a parent container then we just outright + * refuse to remove the type. There currently is no notion of searching for the + * ctf_dtdef_t in parent containers. If there is, then this constraint could + * become finer grained. + */ +int +ctf_delete_type(ctf_file_t *fp, ctf_id_t type) +{ + ctf_file_t *fpd; + ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, type); + + if (!(fp->ctf_flags & LCTF_RDWR)) + return (ctf_set_errno(fp, ECTF_RDONLY)); + + /* + * We want to give as useful an errno as possible. That means that we + * want to distinguish between a type which does not exist and one for + * which the type is not dynamic. + */ + fpd = fp; + if (ctf_lookup_by_id(&fpd, type) == NULL && + ctf_dtd_lookup(fp, type) == NULL) + return (CTF_ERR); /* errno is set for us */ + + if (dtd == NULL) + return (ctf_set_errno(fp, ECTF_NOTDYN)); + + if (dtd->dtd_ref != 0 || fp->ctf_refcnt > 1) + return (ctf_set_errno(fp, ECTF_REFERENCED)); + + ctf_dtd_delete(fp, dtd); fp->ctf_flags |= LCTF_DIRTY; return (0); } @@ -1103,6 +1268,9 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_fil ctf_hash_t *hp; ctf_helem_t *hep; + if (dst_fp == src_fp) + return (src_type); + if (!(dst_fp->ctf_flags & LCTF_RDWR)) return (ctf_set_errno(dst_fp, ECTF_RDONLY)); @@ -1313,6 +1481,14 @@ ctf_add_type(ctf_file_t *dst_fp, ctf_fil if (errs) return (CTF_ERR); /* errno is set for us */ + + /* + * Now that we know that we can't fail, we go through and bump + * all the reference counts on the member types. + */ + for (dmd = ctf_list_next(&dtd->dtd_u.dtu_members); + dmd != NULL; dmd = ctf_list_next(dmd)) + ctf_ref_inc(dst_fp, dmd->dmd_type); break; } Modified: head/cddl/contrib/opensolaris/common/ctf/ctf_error.c ============================================================================== --- head/cddl/contrib/opensolaris/common/ctf/ctf_error.c Fri Aug 23 23:12:16 2013 (r254743) +++ head/cddl/contrib/opensolaris/common/ctf/ctf_error.c Fri Aug 23 23:21:24 2013 (r254744) @@ -23,8 +23,9 @@ * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2012, Joyent, Inc. + */ #include @@ -73,6 +74,8 @@ static const char *const _ctf_errlist[] "Limit on number of dynamic types reached", /* ECTF_FULL */ "Duplicate member name definition", /* ECTF_DUPMEMBER */ "Conflicting type is already defined", /* ECTF_CONFLICT */ + "Type has outstanding references", /* ECTF_REFERENCED */ + "Type is not a dynamic type" /* ECTF_NOTDYN */ }; static const int _ctf_nerr = sizeof (_ctf_errlist) / sizeof (_ctf_errlist[0]); Modified: head/cddl/contrib/opensolaris/common/ctf/ctf_impl.h ============================================================================== --- head/cddl/contrib/opensolaris/common/ctf/ctf_impl.h Fri Aug 23 23:12:16 2013 (r254743) +++ head/cddl/contrib/opensolaris/common/ctf/ctf_impl.h Fri Aug 23 23:21:24 2013 (r254744) @@ -24,12 +24,13 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2012, Joyent, Inc. All rights reserved. + */ #ifndef _CTF_IMPL_H #define _CTF_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -149,6 +150,7 @@ typedef struct ctf_dtdef { char *dtd_name; /* name associated with definition (if any) */ ctf_id_t dtd_type; /* type identifier for this definition */ ctf_type_t dtd_data; /* type node (see ) */ + int dtd_ref; /* recfount for dyanmic types */ union { ctf_list_t dtu_members; /* struct, union, or enum */ ctf_arinfo_t dtu_arr; /* array */ @@ -269,7 +271,9 @@ enum { ECTF_DTFULL, /* CTF type is full (no more members allowed) */ ECTF_FULL, /* CTF container is full */ ECTF_DUPMEMBER, /* duplicate member name definition */ - ECTF_CONFLICT /* conflicting type definition present */ + ECTF_CONFLICT, /* conflicting type definition present */ + ECTF_REFERENCED, /* type has outstanding references */ + ECTF_NOTDYN /* type is not a dynamic type */ }; extern ssize_t ctf_get_ctt_size(const ctf_file_t *, const ctf_type_t *, Modified: head/cddl/contrib/opensolaris/common/ctf/ctf_open.c ============================================================================== --- head/cddl/contrib/opensolaris/common/ctf/ctf_open.c Fri Aug 23 23:12:16 2013 (r254743) +++ head/cddl/contrib/opensolaris/common/ctf/ctf_open.c Fri Aug 23 23:21:24 2013 (r254744) @@ -24,8 +24,9 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2012, Joyent, Inc. All rights reserved. + */ #include #include @@ -810,8 +811,12 @@ ctf_close(ctf_file_t *fp) if (fp->ctf_parent != NULL) ctf_close(fp->ctf_parent); - for (dtd = ctf_list_next(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) { - ntd = ctf_list_next(dtd); + /* + * Note, to work properly with reference counting on the dynamic + * section, we must delete the list in reverse. + */ + for (dtd = ctf_list_prev(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) { + ntd = ctf_list_prev(dtd); ctf_dtd_delete(fp, dtd); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h Fri Aug 23 23:12:16 2013 (r254743) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h Fri Aug 23 23:21:24 2013 (r254744) @@ -23,6 +23,9 @@ * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2012, Joyent, Inc. All rights reserved. + */ /* * This header file defines the interfaces available from the CTF debugger @@ -40,8 +43,6 @@ #ifndef _CTF_API_H #define _CTF_API_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -227,6 +228,8 @@ extern int ctf_add_member(ctf_file_t *, extern int ctf_set_array(ctf_file_t *, ctf_id_t, const ctf_arinfo_t *); +extern int ctf_delete_type(ctf_file_t *, ctf_id_t); + extern int ctf_update(ctf_file_t *); extern int ctf_discard(ctf_file_t *); extern int ctf_write(ctf_file_t *, int); From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 23:26:03 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 ESMTP id 02273367; Fri, 23 Aug 2013 23:26:02 +0000 (UTC) (envelope-from jkim@FreeBSD.org) 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 DE9462BBB; Fri, 23 Aug 2013 23:26:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7NNQ2en062746; Fri, 23 Aug 2013 23:26:02 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NNPwvV062677; Fri, 23 Aug 2013 23:25:58 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308232325.r7NNPwvV062677@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 23 Aug 2013 23:25:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254745 - in head/sys/contrib/dev/acpica: . common compiler components/debugger components/events components/hardware components/namespace components/tables components/utilities include... 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.14 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: Fri, 23 Aug 2013 23:26:03 -0000 Author: jkim Date: Fri Aug 23 23:25:58 2013 New Revision: 254745 URL: http://svnweb.freebsd.org/changeset/base/254745 Log: Merge ACPICA 20130823. Modified: head/sys/contrib/dev/acpica/acpica_prep.sh head/sys/contrib/dev/acpica/changes.txt (contents, props changed) head/sys/contrib/dev/acpica/common/adisasm.c head/sys/contrib/dev/acpica/common/adwalk.c head/sys/contrib/dev/acpica/common/dmextern.c head/sys/contrib/dev/acpica/common/dmtable.c head/sys/contrib/dev/acpica/compiler/aslcompile.c head/sys/contrib/dev/acpica/compiler/aslglobal.h head/sys/contrib/dev/acpica/compiler/aslload.c head/sys/contrib/dev/acpica/compiler/aslmain.c head/sys/contrib/dev/acpica/compiler/asloptions.c head/sys/contrib/dev/acpica/compiler/dtcompile.c head/sys/contrib/dev/acpica/components/debugger/dbcmds.c head/sys/contrib/dev/acpica/components/debugger/dbfileio.c head/sys/contrib/dev/acpica/components/debugger/dbinput.c head/sys/contrib/dev/acpica/components/debugger/dbnames.c head/sys/contrib/dev/acpica/components/events/evgpeutil.c head/sys/contrib/dev/acpica/components/events/evmisc.c head/sys/contrib/dev/acpica/components/events/evregion.c head/sys/contrib/dev/acpica/components/events/evsci.c head/sys/contrib/dev/acpica/components/events/evxface.c head/sys/contrib/dev/acpica/components/hardware/hwxface.c head/sys/contrib/dev/acpica/components/namespace/nsaccess.c head/sys/contrib/dev/acpica/components/namespace/nsdump.c head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c head/sys/contrib/dev/acpica/components/tables/tbinstal.c head/sys/contrib/dev/acpica/components/tables/tbprint.c head/sys/contrib/dev/acpica/components/tables/tbxfroot.c head/sys/contrib/dev/acpica/components/utilities/utdebug.c head/sys/contrib/dev/acpica/components/utilities/utglobal.c head/sys/contrib/dev/acpica/include/acdebug.h head/sys/contrib/dev/acpica/include/acdisasm.h head/sys/contrib/dev/acpica/include/acevents.h head/sys/contrib/dev/acpica/include/acexcep.h head/sys/contrib/dev/acpica/include/acglobal.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acnamesp.h head/sys/contrib/dev/acpica/include/acpiosxf.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/actypes.h head/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c Directory Properties: head/sys/contrib/dev/acpica/ (props changed) head/sys/contrib/dev/acpica/common/ (props changed) head/sys/contrib/dev/acpica/compiler/ (props changed) head/sys/contrib/dev/acpica/components/debugger/ (props changed) head/sys/contrib/dev/acpica/components/events/ (props changed) head/sys/contrib/dev/acpica/components/hardware/ (props changed) head/sys/contrib/dev/acpica/components/namespace/ (props changed) head/sys/contrib/dev/acpica/components/tables/ (props changed) head/sys/contrib/dev/acpica/components/utilities/ (props changed) head/sys/contrib/dev/acpica/include/ (props changed) head/sys/contrib/dev/acpica/os_specific/ (props changed) Modified: head/sys/contrib/dev/acpica/acpica_prep.sh ============================================================================== --- head/sys/contrib/dev/acpica/acpica_prep.sh Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/acpica_prep.sh Fri Aug 23 23:25:58 2013 (r254745) @@ -21,7 +21,7 @@ stripdirs="generate libraries tests tool stripfiles="Makefile README accygwin.h acefi.h achaiku.h acintel.h \ aclinux.h acmacosx.h acmsvc.h acnetbsd.h acos2.h acwin.h \ acwin64.h new_table.txt osfreebsdtbl.c oslinuxtbl.c osunixdir.c \ - oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c" + osunixmap.c oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c" # include files to canonify src_headers="acapps.h acbuffer.h accommon.h acconfig.h acdebug.h \ Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/changes.txt Fri Aug 23 23:25:58 2013 (r254745) @@ -1,4 +1,88 @@ ---------------------------------------- +23 August 2013. Summary of changes for version 20130823: + +1) ACPICA kernel-resident subsystem: + +Implemented support for host-installed System Control Interrupt (SCI) +handlers. Certain ACPI functionality requires the host to handle raw +SCIs. For example, the "SCI Doorbell" that is defined for memory power +state support requires the host device driver to handle SCIs to examine +if the doorbell has been activated. Multiple SCI handlers can be +installed to allow for future expansion. New external interfaces are +AcpiInstallSciHandler, AcpiRemoveSciHandler; see the ACPICA reference for +details. Lv Zheng, Bob Moore. ACPICA BZ 1032. + +Operation region support: Never locally free the handler "context" +pointer. This change removes some dangerous code that attempts to free +the handler context pointer in some (rare) circumstances. The owner of +the handler owns this pointer and the ACPICA code should never touch it. +Although not seen to be an issue in any kernel, it did show up as a +problem (fault) under AcpiExec. Also, set the internal storage field for +the context pointer to zero when the region is deactivated, simply for +sanity. David Box. ACPICA BZ 1039. + +AcpiRead: On error, do not modify the return value target location. If an +error happens in the middle of a split 32/32 64-bit I/O operation, do not +modify the target of the return value pointer. Makes the code consistent +with the rest of ACPICA. Bjorn Helgaas. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 96.7K Code, 27.1K Data, 123.9K Total + Debug Version: 184.4K Code, 76.8K Data, 261.2K Total + Previous Release: + Non-Debug Version: 96.2K Code, 27.1K Data, 123.3K Total + Debug Version: 185.4K Code, 77.1K Data, 262.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +AcpiDump: Implemented several new features and fixed some problems: +1) Added support to dump the RSDP, RSDT, and XSDT tables. +2) Added support for multiple table instances (SSDT, UEFI). +3) Added option to dump "customized" (overridden) tables (-c). +4) Fixed a problem where some table filenames were improperly +constructed. +5) Improved some error messages, removed some unnecessary messages. + +iASL: Implemented additional support for disassembly of ACPI tables that +contain invocations of external control methods. The -fe option +allows the import of a file that specifies the external methods along +with the required number of arguments for each -- allowing for the +correct disassembly of the table. This is a workaround for a limitation +of AML code where the disassembler often cannot determine the number of +arguments required for an external control method and generates incorrect +ASL code. See the iASL reference for details. ACPICA BZ 1030. + +Debugger: Implemented a new command (paths) that displays the full +pathnames (namepaths) and object types of all objects in the namespace. +This is an alternative to the namespace command. + +Debugger: Implemented a new command (sci) that invokes the SCI dispatch +mechanism and any installed handlers. + +iASL: Fixed a possible segfault for "too many parent prefixes" condition. +This can occur if there are too many parent prefixes in a namepath (for +example, ^^^^^^PCI0.ECRD). ACPICA BZ 1035. + +Application OSLs: Set the return value for the PCI read functions. These +functions simply return AE_OK, but should set the return value to zero +also. This change implements this. ACPICA BZ 1038. + +Debugger: Prevent possible command line buffer overflow. Increase the +size of a couple of the debugger line buffers, and ensure that overflow +cannot happen. ACPICA BZ 1037. + +iASL: Changed to abort immediately on serious errors during the parsing +phase. Due to the nature of ASL, there is no point in attempting to +compile these types of errors, and they typically end up causing a +cascade of hundreds of errors which obscure the original problem. + +---------------------------------------- 25 July 2013. Summary of changes for version 20130725: 1) ACPICA kernel-resident subsystem: Modified: head/sys/contrib/dev/acpica/common/adisasm.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adisasm.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/common/adisasm.c Fri Aug 23 23:25:58 2013 (r254745) @@ -341,6 +341,10 @@ AdAmlDisassemble ( { AcpiDmClearExternalList (); } + + /* Load any externals defined in the optional external ref file */ + + AcpiDmGetExternalsFromFile (); } else { Modified: head/sys/contrib/dev/acpica/common/adwalk.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adwalk.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/common/adwalk.c Fri Aug 23 23:25:58 2013 (r254745) @@ -373,10 +373,18 @@ AcpiDmDumpDescending ( switch (Op->Common.AmlOpcode) { case AML_BYTE_OP: + + AcpiOsPrintf ("%2.2X", (UINT32) Op->Common.Value.Integer); + break; + case AML_WORD_OP: + + AcpiOsPrintf ("%4.4X", (UINT32) Op->Common.Value.Integer); + break; + case AML_DWORD_OP: - AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer); + AcpiOsPrintf ("%8.8X", (UINT32) Op->Common.Value.Integer); break; case AML_QWORD_OP: Modified: head/sys/contrib/dev/acpica/common/dmextern.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmextern.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/common/dmextern.c Fri Aug 23 23:25:58 2013 (r254745) @@ -46,7 +46,9 @@ #include #include #include +#include #include +#include /* @@ -87,6 +89,8 @@ static const char *AcpiGbl_DmT /* 19 */ ", FieldUnitObj" }; +#define METHOD_SEPARATORS " \t,()\n" + /* Local prototypes */ @@ -99,6 +103,12 @@ AcpiDmNormalizeParentPrefix ( ACPI_PARSE_OBJECT *Op, char *Path); +static void +AcpiDmAddToExternalListFromFile ( + char *Path, + UINT8 Type, + UINT32 Value); + /******************************************************************************* * @@ -444,7 +454,7 @@ AcpiDmAddToExternalList ( (NextExternal->Value != Value)) { ACPI_ERROR ((AE_INFO, - "Argument count mismatch for method %s %u %u", + "External method arg count mismatch %s: Current %u, attempted %u", NextExternal->Path, NextExternal->Value, Value)); } @@ -536,6 +546,275 @@ AcpiDmAddToExternalList ( /******************************************************************************* * + * FUNCTION: AcpiDmGetExternalsFromFile + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Process the optional external reference file. + * + * Each line in the file should be of the form: + * External (, MethodObj, ) + * + * Example: + * External (_SB_.PCI0.XHC_.PS0X, MethodObj, 4) + * + ******************************************************************************/ + +void +AcpiDmGetExternalsFromFile ( + void) +{ + FILE *ExternalRefFile; + char *Token; + char *MethodName; + UINT32 ArgCount; + UINT32 ImportCount = 0; + + + if (!Gbl_ExternalRefFilename) + { + return; + } + + /* Open the file */ + + ExternalRefFile = fopen (Gbl_ExternalRefFilename, "r"); + if (!ExternalRefFile) + { + fprintf (stderr, "Could not open external reference file \"%s\"\n", + Gbl_ExternalRefFilename); + return; + } + + /* Each line defines a method */ + + while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ExternalRefFile)) + { + Token = strtok (StringBuffer, METHOD_SEPARATORS); /* "External" */ + if (!Token) continue; + if (strcmp (Token, "External")) continue; + + MethodName = strtok (NULL, METHOD_SEPARATORS); /* Method namepath */ + if (!MethodName) continue; + + Token = strtok (NULL, METHOD_SEPARATORS); /* "MethodObj" */ + if (!Token) continue; + if (strcmp (Token, "MethodObj")) continue; + + Token = strtok (NULL, METHOD_SEPARATORS); /* Arg count */ + if (!Token) continue; + + /* Convert arg count string to an integer */ + + errno = 0; + ArgCount = strtoul (Token, NULL, 0); + if (errno) + { + fprintf (stderr, "Invalid argument count (%s)\n", Token); + continue; + } + if (ArgCount > 7) + { + fprintf (stderr, "Invalid argument count (%u)\n", ArgCount); + continue; + } + + /* Add this external to the global list */ + + AcpiOsPrintf ("%s: Importing method external (%u arguments) %s\n", + Gbl_ExternalRefFilename, ArgCount, MethodName); + + AcpiDmAddToExternalListFromFile (MethodName, ACPI_TYPE_METHOD, ArgCount | 0x80); + ImportCount++; + } + + if (!ImportCount) + { + fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n", + Gbl_ExternalRefFilename); + } + else + { + /* Add the external(s) to the namespace */ + + AcpiDmAddExternalsToNamespace (); + + AcpiOsPrintf ("%s: Imported %u external method definitions\n", + Gbl_ExternalRefFilename, ImportCount); + } + + fclose (ExternalRefFile); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmAddToExternalListFromFile + * + * PARAMETERS: Path - Internal (AML) path to the object + * Type - ACPI object type to be added + * Value - Arg count if adding a Method object + * + * RETURN: None + * + * DESCRIPTION: Insert a new name into the global list of Externals which + * will in turn be later emitted as an External() declaration + * in the disassembled output. + * + ******************************************************************************/ + +static void +AcpiDmAddToExternalListFromFile ( + char *Path, + UINT8 Type, + UINT32 Value) +{ + char *InternalPath; + char *ExternalPath; + ACPI_EXTERNAL_LIST *NewExternal; + ACPI_EXTERNAL_LIST *NextExternal; + ACPI_EXTERNAL_LIST *PrevExternal = NULL; + ACPI_STATUS Status; + BOOLEAN Resolved = FALSE; + + + if (!Path) + { + return; + } + + /* TBD: Add a flags parameter */ + + if (Type == ACPI_TYPE_METHOD) + { + if (Value & 0x80) + { + Resolved = TRUE; + } + Value &= 0x07; + } + + /* + * We don't want External() statements to contain a leading '\'. + * This prevents duplicate external statements of the form: + * + * External (\ABCD) + * External (ABCD) + * + * This would cause a compile time error when the disassembled + * output file is recompiled. + */ + if ((*Path == AML_ROOT_PREFIX) && (Path[1])) + { + Path++; + } + + /* Check all existing externals to ensure no duplicates */ + + NextExternal = AcpiGbl_ExternalList; + while (NextExternal) + { + if (!ACPI_STRCMP (Path, NextExternal->Path)) + { + /* Duplicate method, check that the Value (ArgCount) is the same */ + + if ((NextExternal->Type == ACPI_TYPE_METHOD) && + (NextExternal->Value != Value)) + { + ACPI_ERROR ((AE_INFO, + "(File) External method arg count mismatch %s: Current %u, override to %u", + NextExternal->Path, NextExternal->Value, Value)); + + /* Override, since new value came from external reference file */ + + NextExternal->Value = Value; + } + + /* Allow upgrade of type from ANY */ + + else if (NextExternal->Type == ACPI_TYPE_ANY) + { + NextExternal->Type = Type; + NextExternal->Value = Value; + } + + return; + } + + NextExternal = NextExternal->Next; + } + + /* Get the internal pathname (AML format) */ + + Status = AcpiNsInternalizeName (Path, &InternalPath); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Allocate and init a new External() descriptor */ + + NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST)); + if (!NewExternal) + { + ACPI_FREE (InternalPath); + return; + } + + /* Must copy and normalize the input path */ + + AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, NULL, &ExternalPath); + + NewExternal->Path = ExternalPath; + NewExternal->Type = Type; + NewExternal->Value = Value; + NewExternal->Resolved = Resolved; + NewExternal->Length = (UINT16) ACPI_STRLEN (Path); + NewExternal->InternalPath = InternalPath; + + /* Set flag to indicate External->InternalPath needs to be freed */ + + NewExternal->Flags |= ACPI_IPATH_ALLOCATED | ACPI_FROM_REFERENCE_FILE; + + /* Link the new descriptor into the global list, alphabetically ordered */ + + NextExternal = AcpiGbl_ExternalList; + while (NextExternal) + { + if (AcpiUtStricmp (NewExternal->Path, NextExternal->Path) < 0) + { + if (PrevExternal) + { + PrevExternal->Next = NewExternal; + } + else + { + AcpiGbl_ExternalList = NewExternal; + } + + NewExternal->Next = NextExternal; + return; + } + + PrevExternal = NextExternal; + NextExternal = NextExternal->Next; + } + + if (PrevExternal) + { + PrevExternal->Next = NewExternal; + } + else + { + AcpiGbl_ExternalList = NewExternal; + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmAddExternalsToNamespace * * PARAMETERS: None @@ -563,7 +842,7 @@ AcpiDmAddExternalsToNamespace ( Status = AcpiNsLookup (NULL, External->InternalPath, External->Type, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE, + ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); if (ACPI_FAILURE (Status)) @@ -731,7 +1010,8 @@ AcpiDmEmitExternals ( NextExternal->Path, AcpiDmGetObjectTypeName (NextExternal->Type)); - AcpiOsPrintf (") // Warning: Unresolved Method, " + AcpiOsPrintf ( + ") // Warning: Unresolved Method, " "guessing %u arguments (may be incorrect, see warning above)\n", NextExternal->Value); @@ -743,9 +1023,45 @@ AcpiDmEmitExternals ( AcpiOsPrintf ("\n"); + + /* Emit externals that were imported from a file */ + + if (Gbl_ExternalRefFilename) + { + AcpiOsPrintf ( + " /*\n * External declarations that were imported from\n" + " * the reference file [%s]\n */\n", + Gbl_ExternalRefFilename); + + NextExternal = AcpiGbl_ExternalList; + while (NextExternal) + { + if (!NextExternal->Emitted && (NextExternal->Flags & ACPI_FROM_REFERENCE_FILE)) + { + AcpiOsPrintf (" External (%s%s", + NextExternal->Path, + AcpiDmGetObjectTypeName (NextExternal->Type)); + + if (NextExternal->Type == ACPI_TYPE_METHOD) + { + AcpiOsPrintf (") // %u Arguments\n", + NextExternal->Value); + } + else + { + AcpiOsPrintf (")\n"); + } + NextExternal->Emitted = TRUE; + } + + NextExternal = NextExternal->Next; + } + + AcpiOsPrintf ("\n"); + } + /* - * Walk the list of externals (unresolved references) - * found during the AML parsing + * Walk the list of externals found during the AML parsing */ while (AcpiGbl_ExternalList) { Modified: head/sys/contrib/dev/acpica/common/dmtable.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtable.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/common/dmtable.c Fri Aug 23 23:25:58 2013 (r254745) @@ -446,7 +446,7 @@ AcpiDmDumpDataTable ( Length = Table->Length; AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); } - else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP)) + else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature)) { Length = AcpiDmDumpRsdp (Table); } Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompile.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/compiler/aslcompile.c Fri Aug 23 23:25:58 2013 (r254745) @@ -593,10 +593,15 @@ CmDoCompile ( AslCompilerparse(); UtEndEvent (Event); - /* Flush out any remaining source after parse tree is complete */ + /* Check for parse errors */ - Event = UtBeginEvent ("Flush source input"); - CmFlushSourceCode (); + Status = AslCheckForErrorExit (); + if (ACPI_FAILURE (Status)) + { + fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n"); + LsDumpParseTree (); + goto ErrorExit; + } /* Did the parse tree get successfully constructed? */ @@ -606,16 +611,18 @@ CmDoCompile ( * If there are no errors, then we have some sort of * internal problem. */ - Status = AslCheckForErrorExit (); - if (Status == AE_OK) - { - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, - NULL, "- Could not resolve parse tree root node"); - } + AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, + NULL, "- Could not resolve parse tree root node"); goto ErrorExit; } + + /* Flush out any remaining source after parse tree is complete */ + + Event = UtBeginEvent ("Flush source input"); + CmFlushSourceCode (); + /* Optional parse tree dump, compiler debug output only */ LsDumpParseTree (); Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslglobal.h Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/compiler/aslglobal.h Fri Aug 23 23:25:58 2013 (r254745) @@ -186,6 +186,7 @@ ASL_EXTERN char ASL_ ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL); ASL_EXTERN char *Gbl_CurrentInputFilename; +ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalRefFilename, NULL); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); Modified: head/sys/contrib/dev/acpica/compiler/aslload.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslload.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/compiler/aslload.c Fri Aug 23 23:25:58 2013 (r254745) @@ -487,6 +487,10 @@ LdNamespace1Begin ( ACPI_TYPE_LOCAL_SCOPE, ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node)); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* * However, this is an error -- primarily because the MS Modified: head/sys/contrib/dev/acpica/compiler/aslmain.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmain.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/compiler/aslmain.c Fri Aug 23 23:25:58 2013 (r254745) @@ -138,6 +138,7 @@ Usage ( ACPI_OPTION ("-dc ", "Disassemble AML and immediately compile it"); ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)"); ACPI_OPTION ("-e ", "Include ACPI table(s) for external symbol resolution"); + ACPI_OPTION ("-fe ", "Specify external symbol declaration file"); ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); ACPI_OPTION ("-in", "Ignore NoOp opcodes"); ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file"); Modified: head/sys/contrib/dev/acpica/compiler/asloptions.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asloptions.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/compiler/asloptions.c Fri Aug 23 23:25:58 2013 (r254745) @@ -68,7 +68,7 @@ AslDoResponseFile ( #define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:fgh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z" +#define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z" /******************************************************************************* @@ -136,8 +136,7 @@ AslCommandLine ( if (BadCommandLine) { - printf ("\n"); - Usage (); + printf ("Use -h option for help information\n"); exit (1); } @@ -276,9 +275,30 @@ AslDoOptions ( } break; - case 'f': /* Ignore errors and force creation of aml file */ + case 'f': + + switch (AcpiGbl_Optarg[0]) + { + case '^': /* Ignore errors and force creation of aml file */ + + Gbl_IgnoreErrors = TRUE; + break; + + case 'e': /* Disassembler: Get external declaration file */ + + if (AcpiGetoptArgument (argc, argv)) + { + return (-1); + } + + Gbl_ExternalRefFilename = AcpiGbl_Optarg; + break; - Gbl_IgnoreErrors = TRUE; + default: + + printf ("Unknown option: -f%s\n", AcpiGbl_Optarg); + return (-1); + } break; case 'G': Modified: head/sys/contrib/dev/acpica/compiler/dtcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/dtcompile.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/compiler/dtcompile.c Fri Aug 23 23:25:58 2013 (r254745) @@ -317,7 +317,7 @@ DtCompileDataTable ( DtSetTableLength (); return (Status); } - else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDP)) + else if (ACPI_VALIDATE_RSDP_SIG (Signature)) { Status = DtCompileRsdp (FieldList); return (Status); Modified: head/sys/contrib/dev/acpica/components/debugger/dbcmds.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbcmds.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/components/debugger/dbcmds.c Fri Aug 23 23:25:58 2013 (r254745) @@ -1211,6 +1211,14 @@ AcpiDbGenerateGpe ( (void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber); } + +void +AcpiDbGenerateSci ( + void) +{ + AcpiEvSciDispatch (); +} + #endif /* !ACPI_REDUCED_HARDWARE */ #endif /* ACPI_DEBUGGER */ Modified: head/sys/contrib/dev/acpica/components/debugger/dbfileio.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbfileio.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/components/debugger/dbfileio.c Fri Aug 23 23:25:58 2013 (r254745) @@ -142,7 +142,8 @@ AcpiDbOpenDebugFile ( } AcpiOsPrintf ("Debug output file %s opened\n", Name); - ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name); + ACPI_STRNCPY (AcpiGbl_DbDebugFilename, Name, + sizeof (AcpiGbl_DbDebugFilename)); AcpiGbl_DbOutputToFile = TRUE; #endif @@ -274,11 +275,9 @@ AcpiDbReadTable ( fseek (fp, 0, SEEK_SET); - /* The RSDT, FACS and S3PT tables do not have standard ACPI headers */ + /* The RSDP table does not have standard ACPI header */ - if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") || - ACPI_COMPARE_NAME (TableHeader.Signature, "FACS") || - ACPI_COMPARE_NAME (TableHeader.Signature, "S3PT")) + if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ")) { *TableLength = FileSize; StandardHeader = FALSE; Modified: head/sys/contrib/dev/acpica/components/debugger/dbinput.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbinput.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/components/debugger/dbinput.c Fri Aug 23 23:25:58 2013 (r254745) @@ -132,12 +132,14 @@ enum AcpiExDebuggerCommands CMD_OPEN, CMD_OSI, CMD_OWNER, + CMD_PATHS, CMD_PREDEFINED, CMD_PREFIX, CMD_QUIT, CMD_REFERENCES, CMD_RESOURCES, CMD_RESULTS, + CMD_SCI, CMD_SET, CMD_SLEEP, CMD_STATS, @@ -203,12 +205,14 @@ static const ACPI_DB_COMMAND_INFO Acpi {"OPEN", 1}, {"OSI", 0}, {"OWNER", 1}, + {"PATHS", 0}, {"PREDEFINED", 0}, {"PREFIX", 0}, {"QUIT", 0}, {"REFERENCES", 1}, {"RESOURCES", 0}, {"RESULTS", 0}, + {"SCI", 0}, {"SET", 3}, {"SLEEP", 0}, {"STATS", 1}, @@ -259,22 +263,19 @@ static const ACPI_DB_COMMAND_HELP Acpi {0, "\nNamespace Access Commands:", "\n"}, {1, " Businfo", "Display system bus info\n"}, {1, " Disassemble ", "Disassemble a control method\n"}, - {1, " Event ", "Generate AcpiEvent (Fixed/GPE)\n"}, {1, " Find (? is wildcard)", "Find ACPI name(s) with wildcards\n"}, - {1, " Gpe ", "Simulate a GPE\n"}, - {1, " Gpes", "Display info on all GPEs\n"}, {1, " Integrity", "Validate namespace integrity\n"}, {1, " Methods", "Display list of loaded control methods\n"}, {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"}, {1, " Notify ", "Send a notification on Object\n"}, {1, " Objects ", "Display all objects of the given type\n"}, {1, " Owner [Depth]", "Display loaded namespace by object owner\n"}, + {1, " Paths", "Display full pathnames of namespace objects\n"}, {1, " Predefined", "Check all predefined names\n"}, {1, " Prefix []", "Set or Get current execution prefix\n"}, {1, " References ", "Find all references to object at addr\n"}, {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, {1, " Set N ", "Set value for named integer\n"}, - {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, {1, " Template ", "Format/dump a Buffer/ResourceTemplate\n"}, {1, " Terminate", "Delete namespace and all internal objects\n"}, {1, " Type ", "Display object type\n"}, @@ -288,7 +289,7 @@ static const ACPI_DB_COMMAND_HELP Acpi {5, " Execute [Arguments]", "Execute control method\n"}, {1, " Hex Integer", "Integer method argument\n"}, {1, " \"Ascii String\"", "String method argument\n"}, - {1, " (Byte List)", "Buffer method argument\n"}, + {1, " (Hex Byte List)", "Buffer method argument\n"}, {1, " [Package Element List]", "Package method argument\n"}, {1, " Go", "Allow method to run to completion\n"}, {1, " Information", "Display info about the current method\n"}, @@ -303,6 +304,13 @@ static const ACPI_DB_COMMAND_HELP Acpi {1, " Tree", "Display control method calling tree\n"}, {1, " ", "Single step next AML opcode (over calls)\n"}, + {0, "\nHardware Related Commands:", "\n"}, + {1, " Event ", "Generate AcpiEvent (Fixed/GPE)\n"}, + {1, " Gpe ", "Simulate a GPE\n"}, + {1, " Gpes", "Display info on all GPEs\n"}, + {1, " Sci", "Generate an SCI\n"}, + {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, + {0, "\nFile I/O Commands:", "\n"}, {1, " Close", "Close debug output file\n"}, {1, " Load ", "Load ACPI table from a file\n"}, @@ -1002,6 +1010,11 @@ AcpiDbCommandDispatch ( AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; + case CMD_PATHS: + + AcpiDbDumpNamespacePaths (); + break; + case CMD_PREDEFINED: AcpiDbCheckPredefinedNames (); @@ -1027,6 +1040,11 @@ AcpiDbCommandDispatch ( AcpiDbDisplayResults (); break; + case CMD_SCI: + + AcpiDbGenerateSci (); + break; + case CMD_SET: AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], Modified: head/sys/contrib/dev/acpica/components/debugger/dbnames.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbnames.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/components/debugger/dbnames.c Fri Aug 23 23:25:58 2013 (r254745) @@ -256,6 +256,37 @@ AcpiDbDumpNamespace ( /******************************************************************************* * + * FUNCTION: AcpiDbDumpNamespacePaths + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Dump entire namespace with full object pathnames and object + * type information. Alternative to "namespace" command. + * + ******************************************************************************/ + +void +AcpiDbDumpNamespacePaths ( + void) +{ + + AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); + AcpiOsPrintf ("ACPI Namespace (from root):\n"); + + /* Display the entire namespace */ + + AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); + AcpiNsDumpObjectPaths (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, + ACPI_UINT32_MAX, ACPI_OWNER_ID_MAX, AcpiGbl_RootNode); + + AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbDumpNamespaceByOwner * * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed Modified: head/sys/contrib/dev/acpica/components/events/evgpeutil.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evgpeutil.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/components/events/evgpeutil.c Fri Aug 23 23:25:58 2013 (r254745) @@ -216,7 +216,7 @@ AcpiEvGetGpeDevice ( * * FUNCTION: AcpiEvGetGpeXruptBlock * - * PARAMETERS: InterruptNumber - Interrupt for a GPE block + * PARAMETERS: InterruptNumber - Interrupt for a GPE block * * RETURN: A GPE interrupt block * Modified: head/sys/contrib/dev/acpica/components/events/evmisc.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evmisc.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/components/events/evmisc.c Fri Aug 23 23:25:58 2013 (r254745) @@ -292,15 +292,6 @@ AcpiEvTerminate ( Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL); - /* Remove SCI handler */ - - Status = AcpiEvRemoveSciHandler (); - if (ACPI_FAILURE(Status)) - { - ACPI_ERROR ((AE_INFO, - "Could not remove SCI handler")); - } - Status = AcpiEvRemoveGlobalLockHandler (); if (ACPI_FAILURE(Status)) { @@ -311,6 +302,15 @@ AcpiEvTerminate ( AcpiGbl_EventsInitialized = FALSE; } + /* Remove SCI handlers */ + + Status = AcpiEvRemoveAllSciHandlers (); + if (ACPI_FAILURE(Status)) + { + ACPI_ERROR ((AE_INFO, + "Could not remove SCI handler")); + } + /* Deallocate all handler objects installed within GPE info structs */ Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL); Modified: head/sys/contrib/dev/acpica/components/events/evregion.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evregion.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/components/events/evregion.c Fri Aug 23 23:25:58 2013 (r254745) @@ -234,18 +234,12 @@ AcpiEvAddressSpaceDispatch ( { RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE; - if (RegionObj2->Extra.RegionContext) - { - /* The handler for this region was already installed */ - - ACPI_FREE (RegionContext); - } - else + /* + * Save the returned context for use in all accesses to + * the handler for this particular region + */ + if (!(RegionObj2->Extra.RegionContext)) { - /* - * Save the returned context for use in all accesses to - * this particular region - */ RegionObj2->Extra.RegionContext = RegionContext; } } @@ -261,7 +255,6 @@ AcpiEvAddressSpaceDispatch ( ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - /* * Special handling for GenericSerialBus and GeneralPurposeIo: * There are three extra parameters that must be passed to the @@ -424,6 +417,15 @@ AcpiEvDetachRegion( Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE, HandlerObj->AddressSpace.Context, RegionContext); + /* + * RegionContext should have been released by the deactivate + * operation. We don't need access to it anymore here. + */ + if (RegionContext) + { + *RegionContext = NULL; + } + /* Init routine may fail, Just ignore errors */ if (ACPI_FAILURE (Status)) Modified: head/sys/contrib/dev/acpica/components/events/evsci.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evsci.c Fri Aug 23 23:21:24 2013 (r254744) +++ head/sys/contrib/dev/acpica/components/events/evsci.c Fri Aug 23 23:25:58 2013 (r254745) @@ -61,6 +61,57 @@ AcpiEvSciXruptHandler ( /******************************************************************************* * + * FUNCTION: AcpiEvSciDispatch + * + * PARAMETERS: None + * + * RETURN: Status code indicates whether interrupt was handled. + * + * DESCRIPTION: Dispatch the SCI to all host-installed SCI handlers. + * + ******************************************************************************/ + +UINT32 +AcpiEvSciDispatch ( + void) +{ + ACPI_SCI_HANDLER_INFO *SciHandler; + ACPI_CPU_FLAGS Flags; + UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; + + + ACPI_FUNCTION_NAME (EvSciDispatch); + + + /* Are there any host-installed SCI handlers? */ + + if (!AcpiGbl_SciHandlerList) + { + return (IntStatus); + } + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Invoke all host-installed SCI handlers */ + + SciHandler = AcpiGbl_SciHandlerList; + while (SciHandler) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Aug 23 23:58:57 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 ESMTP id EDCA0F20; Fri, 23 Aug 2013 23:58:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) 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 D9BD22D34; Fri, 23 Aug 2013 23:58: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 r7NNwuhp078711; Fri, 23 Aug 2013 23:58:56 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7NNwu34078710; Fri, 23 Aug 2013 23:58:56 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201308232358.r7NNwu34078710@svn.freebsd.org> From: Xin LI Date: Fri, 23 Aug 2013 23:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254752 - head/cddl/contrib/opensolaris/lib/libctf/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.14 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: Fri, 23 Aug 2013 23:58:57 -0000 Author: delphij Date: Fri Aug 23 23:58:56 2013 New Revision: 254752 URL: http://svnweb.freebsd.org/changeset/base/254752 Log: MFV r254746: To quote original Illumos ticket: libctf thinks that any ELF file containing more than 65536 sections is corrupt, because it doesn't understand the SHN_XINDEX magic. Illumos DTrace issues: 4005 libctf can't deal with extended sections Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c Fri Aug 23 23:47:59 2013 (r254751) +++ head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c Fri Aug 23 23:58:56 2013 (r254752) @@ -216,6 +216,7 @@ ctf_fdopen(int fd, int *errp) { ctf_sect_t ctfsect, symsect, strsect; ctf_file_t *fp = NULL; + size_t shstrndx, shnum; struct stat64 st; ssize_t nbytes; @@ -278,11 +279,10 @@ ctf_fdopen(int fd, int *errp) #else uchar_t order = ELFDATA2LSB; #endif - GElf_Half i, n; GElf_Shdr *sp; void *strs_map; - size_t strs_mapsz; + size_t strs_mapsz, i; char *strs; if (hdr.e32.e_ident[EI_DATA] != order) @@ -298,11 +298,38 @@ ctf_fdopen(int fd, int *errp) ehdr_to_gelf(&e32, &hdr.e64); } - if (hdr.e64.e_shstrndx >= hdr.e64.e_shnum) + shnum = hdr.e64.e_shnum; + shstrndx = hdr.e64.e_shstrndx; + + /* Extended ELF sections */ + if ((shstrndx == SHN_XINDEX) || (shnum == 0)) { + if (hdr.e32.e_ident[EI_CLASS] == ELFCLASS32) { + Elf32_Shdr x32; + + if (pread64(fd, &x32, sizeof (x32), + hdr.e64.e_shoff) != sizeof (x32)) + return (ctf_set_open_errno(errp, + errno)); + + shnum = x32.sh_size; + shstrndx = x32.sh_link; + } else { + Elf64_Shdr x64; + + if (pread64(fd, &x64, sizeof (x64), + hdr.e64.e_shoff) != sizeof (x64)) + return (ctf_set_open_errno(errp, + errno)); + + shnum = x64.sh_size; + shstrndx = x64.sh_link; + } + } + + if (shstrndx >= shnum) return (ctf_set_open_errno(errp, ECTF_CORRUPT)); - n = hdr.e64.e_shnum; - nbytes = sizeof (GElf_Shdr) * n; + nbytes = sizeof (GElf_Shdr) * shnum; if ((sp = malloc(nbytes)) == NULL) return (ctf_set_open_errno(errp, errno)); @@ -314,7 +341,7 @@ ctf_fdopen(int fd, int *errp) if (hdr.e32.e_ident[EI_CLASS] == ELFCLASS32) { Elf32_Shdr *sp32; - nbytes = sizeof (Elf32_Shdr) * n; + nbytes = sizeof (Elf32_Shdr) * shnum; if ((sp32 = malloc(nbytes)) == NULL || pread64(fd, sp32, nbytes, hdr.e64.e_shoff) != nbytes) { @@ -322,7 +349,7 @@ ctf_fdopen(int fd, int *errp) return (ctf_set_open_errno(errp, errno)); } - for (i = 0; i < n; i++) + for (i = 0; i < shnum; i++) shdr_to_gelf(&sp32[i], &sp[i]); free(sp32); @@ -336,14 +363,14 @@ ctf_fdopen(int fd, int *errp) * Now mmap the section header strings section so that we can * perform string comparison on the section names. */ - strs_mapsz = sp[hdr.e64.e_shstrndx].sh_size + - (sp[hdr.e64.e_shstrndx].sh_offset & ~_PAGEMASK); + strs_mapsz = sp[shstrndx].sh_size + + (sp[shstrndx].sh_offset & ~_PAGEMASK); strs_map = mmap64(NULL, strs_mapsz, PROT_READ, MAP_PRIVATE, - fd, sp[hdr.e64.e_shstrndx].sh_offset & _PAGEMASK); + fd, sp[shstrndx].sh_offset & _PAGEMASK); strs = (char *)strs_map + - (sp[hdr.e64.e_shstrndx].sh_offset & ~_PAGEMASK); + (sp[shstrndx].sh_offset & ~_PAGEMASK); if (strs_map == MAP_FAILED) { free(sp); @@ -354,15 +381,15 @@ ctf_fdopen(int fd, int *errp) * Iterate over the section header array looking for the CTF * section and symbol table. The strtab is linked to symtab. */ - for (i = 0; i < n; i++) { + for (i = 0; i < shnum; i++) { const GElf_Shdr *shp = &sp[i]; const GElf_Shdr *lhp = &sp[shp->sh_link]; - if (shp->sh_link >= hdr.e64.e_shnum) + if (shp->sh_link >= shnum) continue; /* corrupt sh_link field */ - if (shp->sh_name >= sp[hdr.e64.e_shstrndx].sh_size || - lhp->sh_name >= sp[hdr.e64.e_shstrndx].sh_size) + if (shp->sh_name >= sp[shstrndx].sh_size || + lhp->sh_name >= sp[shstrndx].sh_size) continue; /* corrupt sh_name field */ if (shp->sh_type == SHT_PROGBITS && From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 00:19:28 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 ESMTP id 7EB072AD; Sat, 24 Aug 2013 00:19:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) 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 50C7F2E33; Sat, 24 Aug 2013 00:19: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 r7O0JSHg090335; Sat, 24 Aug 2013 00:19:28 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7O0JQmt090316; Sat, 24 Aug 2013 00:19:26 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201308240019.r7O0JQmt090316@svn.freebsd.org> From: Xin LI Date: Sat, 24 Aug 2013 00:19:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254753 - 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.14 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: Sat, 24 Aug 2013 00:19:28 -0000 Author: delphij Date: Sat Aug 24 00:19:26 2013 New Revision: 254753 URL: http://svnweb.freebsd.org/changeset/base/254753 Log: MFV r254747: Fix a panic from dbuf_free_range() from dmu_free_object() while doing zfs receive. This is a regression from FreeBSD r253821. Illumos ZFS issues: 4047 panic from dbuf_free_range() from dmu_free_object() while doing zfs receive Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Aug 23 23:58:56 2013 (r254752) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Aug 24 00:19:26 2013 (r254753) @@ -40,6 +40,12 @@ #include #include +/* + * Number of times that zfs_free_range() took the slow path while doing + * a zfs receive. A nonzero value indicates a potential performance problem. + */ +uint64_t zfs_free_range_recv_miss; + static void dbuf_destroy(dmu_buf_impl_t *db); static boolean_t dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx); static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx); @@ -819,20 +825,22 @@ dbuf_free_range(dnode_t *dn, uint64_t st } dprintf_dnode(dn, "start=%llu end=%llu\n", start, end); - if (dmu_objset_is_receiving(dn->dn_objset)) { + mutex_enter(&dn->dn_dbufs_mtx); + if (start >= dn->dn_unlisted_l0_blkid * dn->dn_datablksz) { + /* There can't be any dbufs in this range; no need to search. */ + mutex_exit(&dn->dn_dbufs_mtx); + return; + } else if (dmu_objset_is_receiving(dn->dn_objset)) { /* - * When processing a free record from a zfs receive, - * there should have been no previous modifications to the - * data in this range. Therefore there should be no dbufs - * in the range. Searching dn_dbufs for these non-existent - * dbufs can be very expensive, so simply ignore this. + * If we are receiving, we expect there to be no dbufs in + * the range to be freed, because receive modifies each + * block at most once, and in offset order. If this is + * not the case, it can lead to performance problems, + * so note that we unexpectedly took the slow path. */ - VERIFY3P(dbuf_find(dn, 0, start), ==, NULL); - VERIFY3P(dbuf_find(dn, 0, end), ==, NULL); - return; + atomic_inc_64(&zfs_free_range_recv_miss); } - mutex_enter(&dn->dn_dbufs_mtx); for (db = list_head(&dn->dn_dbufs); db; db = db_next) { db_next = list_next(&dn->dn_dbufs, db); ASSERT(db->db_blkid != DMU_BONUS_BLKID); @@ -1720,6 +1728,9 @@ dbuf_create(dnode_t *dn, uint8_t level, return (odb); } list_insert_head(&dn->dn_dbufs, db); + if (db->db_level == 0 && db->db_blkid >= + dn->dn_unlisted_l0_blkid) + dn->dn_unlisted_l0_blkid = db->db_blkid + 1; db->db_state = DB_UNCACHED; mutex_exit(&dn->dn_dbufs_mtx); arc_space_consume(sizeof (dmu_buf_impl_t), ARC_SPACE_OTHER); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Fri Aug 23 23:58:56 2013 (r254752) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Aug 24 00:19:26 2013 (r254753) @@ -575,98 +575,93 @@ dmu_prefetch(objset_t *os, uint64_t obje * the end so that the file gets shorter over time (if we crashes in the * middle, this will leave us in a better state). We find allocated file * data by simply searching the allocated level 1 indirects. + * + * On input, *start should be the first offset that does not need to be + * freed (e.g. "offset + length"). On return, *start will be the first + * offset that should be freed. */ static int -get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t limit) +get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t minimum) { - uint64_t len = *start - limit; - uint64_t blkcnt = 0; - uint64_t maxblks = DMU_MAX_ACCESS / (1ULL << (dn->dn_indblkshift + 1)); + uint64_t maxblks = DMU_MAX_ACCESS >> (dn->dn_indblkshift + 1); + /* bytes of data covered by a level-1 indirect block */ uint64_t iblkrange = dn->dn_datablksz * EPB(dn->dn_indblkshift, SPA_BLKPTRSHIFT); - ASSERT(limit <= *start); + ASSERT3U(minimum, <=, *start); - if (len <= iblkrange * maxblks) { - *start = limit; + if (*start - minimum <= iblkrange * maxblks) { + *start = minimum; return (0); } ASSERT(ISP2(iblkrange)); - while (*start > limit && blkcnt < maxblks) { + for (uint64_t blks = 0; *start > minimum && blks < maxblks; blks++) { int err; - /* find next allocated L1 indirect */ + /* + * dnode_next_offset(BACKWARDS) will find an allocated L1 + * indirect block at or before the input offset. We must + * decrement *start so that it is at the end of the region + * to search. + */ + (*start)--; err = dnode_next_offset(dn, DNODE_FIND_BACKWARDS, start, 2, 1, 0); - /* if there are no more, then we are done */ + /* if there are no indirect blocks before start, we are done */ if (err == ESRCH) { - *start = limit; - return (0); - } else if (err) { + *start = minimum; + break; + } else if (err != 0) { return (err); } - blkcnt += 1; - /* reset offset to end of "next" block back */ + /* set start to the beginning of this L1 indirect */ *start = P2ALIGN(*start, iblkrange); - if (*start <= limit) - *start = limit; - else - *start -= 1; } + if (*start < minimum) + *start = minimum; return (0); } static int dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset, - uint64_t length, boolean_t free_dnode) + uint64_t length) { - dmu_tx_t *tx; - uint64_t object_size, start, end, len; - boolean_t trunc = (length == DMU_OBJECT_END); - int align, err; - - align = 1 << dn->dn_datablkshift; - ASSERT(align > 0); - object_size = align == 1 ? dn->dn_datablksz : - (dn->dn_maxblkid + 1) << dn->dn_datablkshift; - - end = offset + length; - if (trunc || end > object_size) - end = object_size; - if (end <= offset) + uint64_t object_size = (dn->dn_maxblkid + 1) * dn->dn_datablksz; + int err; + + if (offset >= object_size) return (0); - length = end - offset; - while (length) { - start = end; - /* assert(offset <= start) */ - err = get_next_chunk(dn, &start, offset); + if (length == DMU_OBJECT_END || offset + length > object_size) + length = object_size - offset; + + while (length != 0) { + uint64_t chunk_end, chunk_begin; + + chunk_end = chunk_begin = offset + length; + + /* move chunk_begin backwards to the beginning of this chunk */ + err = get_next_chunk(dn, &chunk_begin, offset); if (err) return (err); - len = trunc ? DMU_OBJECT_END : end - start; + ASSERT3U(chunk_begin, >=, offset); + ASSERT3U(chunk_begin, <=, chunk_end); - tx = dmu_tx_create(os); - dmu_tx_hold_free(tx, dn->dn_object, start, len); + dmu_tx_t *tx = dmu_tx_create(os); + dmu_tx_hold_free(tx, dn->dn_object, + chunk_begin, chunk_end - chunk_begin); err = dmu_tx_assign(tx, TXG_WAIT); if (err) { dmu_tx_abort(tx); return (err); } - - dnode_free_range(dn, start, trunc ? -1 : len, tx); - - if (start == 0 && free_dnode) { - ASSERT(trunc); - dnode_free(dn, tx); - } - - length -= end - start; - + dnode_free_range(dn, chunk_begin, chunk_end - chunk_begin, tx); dmu_tx_commit(tx); - end = start; + + length -= chunk_end - chunk_begin; } return (0); } @@ -681,38 +676,32 @@ dmu_free_long_range(objset_t *os, uint64 err = dnode_hold(os, object, FTAG, &dn); if (err != 0) return (err); - err = dmu_free_long_range_impl(os, dn, offset, length, FALSE); + err = dmu_free_long_range_impl(os, dn, offset, length); dnode_rele(dn, FTAG); return (err); } int -dmu_free_object(objset_t *os, uint64_t object) +dmu_free_long_object(objset_t *os, uint64_t object) { - dnode_t *dn; dmu_tx_t *tx; int err; - err = dnode_hold_impl(os, object, DNODE_MUST_BE_ALLOCATED, - FTAG, &dn); + err = dmu_free_long_range(os, object, 0, DMU_OBJECT_END); if (err != 0) return (err); - if (dn->dn_nlevels == 1) { - tx = dmu_tx_create(os); - dmu_tx_hold_bonus(tx, object); - dmu_tx_hold_free(tx, dn->dn_object, 0, DMU_OBJECT_END); - err = dmu_tx_assign(tx, TXG_WAIT); - if (err == 0) { - dnode_free_range(dn, 0, DMU_OBJECT_END, tx); - dnode_free(dn, tx); - dmu_tx_commit(tx); - } else { - dmu_tx_abort(tx); - } + + tx = dmu_tx_create(os); + dmu_tx_hold_bonus(tx, object); + dmu_tx_hold_free(tx, object, 0, DMU_OBJECT_END); + err = dmu_tx_assign(tx, TXG_WAIT); + if (err == 0) { + err = dmu_object_free(os, object, tx); + dmu_tx_commit(tx); } else { - err = dmu_free_long_range_impl(os, dn, 0, DMU_OBJECT_END, TRUE); + dmu_tx_abort(tx); } - dnode_rele(dn, FTAG); + return (err); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Aug 23 23:58:56 2013 (r254752) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sat Aug 24 00:19:26 2013 (r254753) @@ -1286,7 +1286,7 @@ restore_freeobjects(struct restorearg *r if (dmu_object_info(os, obj, NULL) != 0) continue; - err = dmu_free_object(os, obj); + err = dmu_free_long_object(os, obj); if (err != 0) return (err); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Fri Aug 23 23:58:56 2013 (r254752) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Sat Aug 24 00:19:26 2013 (r254753) @@ -615,7 +615,8 @@ dmu_tx_hold_free(dmu_tx_t *tx, uint64_t * if they are blocksize-aligned. */ if (dn->dn_datablkshift == 0) { - dmu_tx_count_write(txh, off, len); + if (off != 0 || len < dn->dn_datablksz) + dmu_tx_count_write(txh, off, len); } else { /* first block will be modified if it is not aligned */ if (!IS_P2ALIGNED(off, 1 << dn->dn_datablkshift)) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Fri Aug 23 23:58:56 2013 (r254752) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Sat Aug 24 00:19:26 2013 (r254753) @@ -117,6 +117,7 @@ dnode_cons(void *arg, void *unused, int dn->dn_id_flags = 0; dn->dn_dbufs_count = 0; + dn->dn_unlisted_l0_blkid = 0; list_create(&dn->dn_dbufs, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); @@ -170,6 +171,7 @@ dnode_dest(void *arg, void *unused) ASSERT0(dn->dn_id_flags); ASSERT0(dn->dn_dbufs_count); + ASSERT0(dn->dn_unlisted_l0_blkid); list_destroy(&dn->dn_dbufs); } @@ -475,6 +477,7 @@ dnode_destroy(dnode_t *dn) dn->dn_newuid = 0; dn->dn_newgid = 0; dn->dn_id_flags = 0; + dn->dn_unlisted_l0_blkid = 0; dmu_zfetch_rele(&dn->dn_zfetch); kmem_cache_free(dnode_cache, dn); @@ -705,6 +708,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *n ASSERT(list_is_empty(&ndn->dn_dbufs)); list_move_tail(&ndn->dn_dbufs, &odn->dn_dbufs); ndn->dn_dbufs_count = odn->dn_dbufs_count; + ndn->dn_unlisted_l0_blkid = odn->dn_unlisted_l0_blkid; ndn->dn_bonus = odn->dn_bonus; ndn->dn_have_spill = odn->dn_have_spill; ndn->dn_zio = odn->dn_zio; @@ -739,6 +743,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *n list_create(&odn->dn_dbufs, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); odn->dn_dbufs_count = 0; + odn->dn_unlisted_l0_blkid = 0; odn->dn_bonus = NULL; odn->dn_zfetch.zf_dnode = NULL; @@ -1528,7 +1533,7 @@ dnode_free_range(dnode_t *dn, uint64_t o blkshift = dn->dn_datablkshift; epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - if (len == -1ULL) { + if (len == DMU_OBJECT_END) { len = UINT64_MAX - off; trunc = TRUE; } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Fri Aug 23 23:58:56 2013 (r254752) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Sat Aug 24 00:19:26 2013 (r254753) @@ -896,7 +896,7 @@ dsl_destroy_head(const char *name) for (uint64_t obj = 0; error == 0; error = dmu_object_next(os, &obj, FALSE, prev_snap_txg)) - (void) dmu_free_object(os, obj); + (void) dmu_free_long_object(os, obj); /* sync out all frees */ txg_wait_synced(dmu_objset_pool(os), 0); dmu_objset_disown(os, FTAG); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Fri Aug 23 23:58:56 2013 (r254752) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Sat Aug 24 00:19:26 2013 (r254753) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ @@ -583,7 +583,7 @@ int dmu_free_range(objset_t *os, uint64_ uint64_t size, dmu_tx_t *tx); int dmu_free_long_range(objset_t *os, uint64_t object, uint64_t offset, uint64_t size); -int dmu_free_object(objset_t *os, uint64_t object); +int dmu_free_long_object(objset_t *os, uint64_t object); /* * Convenience functions. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Fri Aug 23 23:58:56 2013 (r254752) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Sat Aug 24 00:19:26 2013 (r254753) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #ifndef _SYS_DNODE_H @@ -188,6 +188,8 @@ typedef struct dnode { /* protected by dn_dbufs_mtx; declared here to fill 32-bit hole */ uint32_t dn_dbufs_count; /* count of dn_dbufs */ + /* There are no level-0 blocks of this blkid or higher in dn_dbufs */ + uint64_t dn_unlisted_l0_blkid; /* protected by os_lock: */ list_node_t dn_dirty_link[TXG_SIZE]; /* next on dataset's dirty */ From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 00:29: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 ESMTP id 755EB5A8; Sat, 24 Aug 2013 00:29:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) 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 612232EB3; Sat, 24 Aug 2013 00:29:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7O0TZnc095314; Sat, 24 Aug 2013 00:29:35 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7O0TZUe095311; Sat, 24 Aug 2013 00:29:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201308240029.r7O0TZUe095311@svn.freebsd.org> From: Xin LI Date: Sat, 24 Aug 2013 00:29:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254755 - head/cddl/contrib/opensolaris/lib/libzfs/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.14 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: Sat, 24 Aug 2013 00:29:35 -0000 Author: delphij Date: Sat Aug 24 00:29:34 2013 New Revision: 254755 URL: http://svnweb.freebsd.org/changeset/base/254755 Log: MFV r254748: Fix memory leak in libzfs's iter_dependents_cb(). Illumos ZFS issues: 4061 libzfs: memory leak in iter_dependents_cb() Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Aug 24 00:26:15 2013 (r254754) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Aug 24 00:29:34 2013 (r254755) @@ -21,10 +21,10 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012 Pawel Jakub Dawidek . * All rights reserved. + * Copyright 2013 Nexenta Systems, Inc. All rights reserved. */ #include @@ -452,8 +452,12 @@ iter_dependents_cb(zfs_handle_t *zhp, vo } ida->stack = isf.next; } + if (!first && err == 0) err = ida->func(zhp, ida->data); + else + zfs_close(zhp); + return (err); } From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 00:30: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 ESMTP id 56E776E2; Sat, 24 Aug 2013 00:30:33 +0000 (UTC) (envelope-from alfred@FreeBSD.org) 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 435792EDE; Sat, 24 Aug 2013 00:30: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 r7O0UXFn096212; Sat, 24 Aug 2013 00:30:33 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7O0UXK0096211; Sat, 24 Aug 2013 00:30:33 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201308240030.r7O0UXK0096211@svn.freebsd.org> From: Alfred Perlstein Date: Sat, 24 Aug 2013 00:30:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254756 - 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.14 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: Sat, 24 Aug 2013 00:30:33 -0000 Author: alfred Date: Sat Aug 24 00:30:32 2013 New Revision: 254756 URL: http://svnweb.freebsd.org/changeset/base/254756 Log: Grow some spares in struct vfsops. This should hopefully prevent ABI breakage on adding new vfsops in 10.x. Modified: head/sys/sys/mount.h Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Sat Aug 24 00:29:34 2013 (r254755) +++ head/sys/sys/mount.h Sat Aug 24 00:30:32 2013 (r254756) @@ -628,6 +628,7 @@ struct vfsops { vfs_susp_clean_t *vfs_susp_clean; vfs_notify_lowervp_t *vfs_reclaim_lowervp; vfs_notify_lowervp_t *vfs_unlink_lowervp; + vfs_mount_t *vfs_spare[6]; /* spares for ABI compat */ }; vfs_statfs_t __vfs_statfs; From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 00:42: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 ESMTP id 0F565959; Sat, 24 Aug 2013 00:42:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) 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 E0E742F65; Sat, 24 Aug 2013 00:42: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 r7O0gb9n003320; Sat, 24 Aug 2013 00:42:37 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7O0gb1u003318; Sat, 24 Aug 2013 00:42:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201308240042.r7O0gb1u003318@svn.freebsd.org> From: Xin LI Date: Sat, 24 Aug 2013 00:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254757 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.14 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: Sat, 24 Aug 2013 00:42:38 -0000 Author: delphij Date: Sat Aug 24 00:42:37 2013 New Revision: 254757 URL: http://svnweb.freebsd.org/changeset/base/254757 Log: MFV r254749: Don't hold dd_lock for long by breaking it when not doing dsl_dir accounting. It is not necessary to hold the lock while manipulating the parent's accounting, because there is no interface for userland to see a consistent picture of both parent and child at the same time anyway. Illumos ZFS issues: 4046 dsl_dataset_t ds_dir->dd_lock is highly contended Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Aug 24 00:30:32 2013 (r254756) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Aug 24 00:42:37 2013 (r254757) @@ -101,9 +101,8 @@ dsl_dataset_block_born(dsl_dataset_t *ds used, compressed, uncompressed); return; } - dmu_buf_will_dirty(ds->ds_dbuf, tx); - mutex_enter(&ds->ds_dir->dd_lock); + dmu_buf_will_dirty(ds->ds_dbuf, tx); mutex_enter(&ds->ds_lock); delta = parent_delta(ds, used); ds->ds_phys->ds_referenced_bytes += used; @@ -115,7 +114,6 @@ dsl_dataset_block_born(dsl_dataset_t *ds compressed, uncompressed, tx); dsl_dir_transfer_space(ds->ds_dir, used - delta, DD_USED_REFRSRV, DD_USED_HEAD, tx); - mutex_exit(&ds->ds_dir->dd_lock); } int @@ -150,7 +148,6 @@ dsl_dataset_block_kill(dsl_dataset_t *ds dprintf_bp(bp, "freeing ds=%llu", ds->ds_object); dsl_free(tx->tx_pool, tx->tx_txg, bp); - mutex_enter(&ds->ds_dir->dd_lock); mutex_enter(&ds->ds_lock); ASSERT(ds->ds_phys->ds_unique_bytes >= used || !DS_UNIQUE_IS_ACCURATE(ds)); @@ -161,7 +158,6 @@ dsl_dataset_block_kill(dsl_dataset_t *ds delta, -compressed, -uncompressed, tx); dsl_dir_transfer_space(ds->ds_dir, -used - delta, DD_USED_REFRSRV, DD_USED_HEAD, tx); - mutex_exit(&ds->ds_dir->dd_lock); } else { dprintf_bp(bp, "putting on dead list: %s", ""); if (async) { @@ -596,31 +592,6 @@ dsl_dataset_name(dsl_dataset_t *ds, char } } -static int -dsl_dataset_namelen(dsl_dataset_t *ds) -{ - int result; - - if (ds == NULL) { - result = 3; /* "mos" */ - } else { - result = dsl_dir_namelen(ds->ds_dir); - VERIFY0(dsl_dataset_get_snapname(ds)); - if (ds->ds_snapname[0]) { - ++result; /* adding one for the @-sign */ - if (!MUTEX_HELD(&ds->ds_lock)) { - mutex_enter(&ds->ds_lock); - result += strlen(ds->ds_snapname); - mutex_exit(&ds->ds_lock); - } else { - result += strlen(ds->ds_snapname); - } - } - } - - return (result); -} - void dsl_dataset_rele(dsl_dataset_t *ds, void *tag) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Sat Aug 24 00:30:32 2013 (r254756) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Sat Aug 24 00:42:37 2013 (r254757) @@ -845,11 +845,21 @@ dsl_dir_diduse_space(dsl_dir_t *dd, dd_u int64_t used, int64_t compressed, int64_t uncompressed, dmu_tx_t *tx) { int64_t accounted_delta; + + /* + * dsl_dataset_set_refreservation_sync_impl() calls this with + * dd_lock held, so that it can atomically update + * ds->ds_reserved and the dsl_dir accounting, so that + * dsl_dataset_check_quota() can see dataset and dir accounting + * consistently. + */ boolean_t needlock = !MUTEX_HELD(&dd->dd_lock); ASSERT(dmu_tx_is_syncing(tx)); ASSERT(type < DD_USED_NUM); + dmu_buf_will_dirty(dd->dd_dbuf, tx); + if (needlock) mutex_enter(&dd->dd_lock); accounted_delta = parent_delta(dd, dd->dd_phys->dd_used_bytes, used); @@ -858,7 +868,6 @@ dsl_dir_diduse_space(dsl_dir_t *dd, dd_u dd->dd_phys->dd_compressed_bytes >= -compressed); ASSERT(uncompressed >= 0 || dd->dd_phys->dd_uncompressed_bytes >= -uncompressed); - dmu_buf_will_dirty(dd->dd_dbuf, tx); dd->dd_phys->dd_used_bytes += used; dd->dd_phys->dd_uncompressed_bytes += uncompressed; dd->dd_phys->dd_compressed_bytes += compressed; @@ -891,8 +900,6 @@ void dsl_dir_transfer_space(dsl_dir_t *dd, int64_t delta, dd_used_t oldtype, dd_used_t newtype, dmu_tx_t *tx) { - boolean_t needlock = !MUTEX_HELD(&dd->dd_lock); - ASSERT(dmu_tx_is_syncing(tx)); ASSERT(oldtype < DD_USED_NUM); ASSERT(newtype < DD_USED_NUM); @@ -900,17 +907,15 @@ dsl_dir_transfer_space(dsl_dir_t *dd, in if (delta == 0 || !(dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN)) return; - if (needlock) - mutex_enter(&dd->dd_lock); + dmu_buf_will_dirty(dd->dd_dbuf, tx); + mutex_enter(&dd->dd_lock); ASSERT(delta > 0 ? dd->dd_phys->dd_used_breakdown[oldtype] >= delta : dd->dd_phys->dd_used_breakdown[newtype] >= -delta); ASSERT(dd->dd_phys->dd_used_bytes >= ABS(delta)); - dmu_buf_will_dirty(dd->dd_dbuf, tx); dd->dd_phys->dd_used_breakdown[oldtype] -= delta; dd->dd_phys->dd_used_breakdown[newtype] += delta; - if (needlock) - mutex_exit(&dd->dd_lock); + mutex_exit(&dd->dd_lock); } typedef struct dsl_dir_set_qr_arg { From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 00:54: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 ESMTP id DDFD5D46; Sat, 24 Aug 2013 00:54:47 +0000 (UTC) (envelope-from delphij@FreeBSD.org) 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 CAEFA2FF7; Sat, 24 Aug 2013 00:54: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 r7O0slDR008886; Sat, 24 Aug 2013 00:54:47 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7O0sl1F008885; Sat, 24 Aug 2013 00:54:47 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201308240054.r7O0sl1F008885@svn.freebsd.org> From: Xin LI Date: Sat, 24 Aug 2013 00:54:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254758 - head/cddl/contrib/opensolaris/cmd/zpool 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.14 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: Sat, 24 Aug 2013 00:54:47 -0000 Author: delphij Date: Sat Aug 24 00:54:47 2013 New Revision: 254758 URL: http://svnweb.freebsd.org/changeset/base/254758 Log: MFV r254751: Don't treat the parameter as a number (pool GUID) when there is error converting it from string, instead, treat it as the pool name. Illumos ZFS issues: 1765 assert triggered in libzfs_import.c trying to import pool name beginning with a number Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sat Aug 24 00:42:37 2013 (r254757) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sat Aug 24 00:54:47 2013 (r254758) @@ -25,6 +25,7 @@ * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012 by Frederik Wessels. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. + * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved. */ #include @@ -2128,8 +2129,10 @@ zpool_do_import(int argc, char **argv) errno = 0; searchguid = strtoull(argv[0], &endptr, 10); - if (errno != 0 || *endptr != '\0') + if (errno != 0 || *endptr != '\0') { searchname = argv[0]; + searchguid = 0; + } found_config = NULL; /* From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 01:50: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 ESMTP id 2BBFE425; Sat, 24 Aug 2013 01:50:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) 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 180632239; Sat, 24 Aug 2013 01:50: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 r7O1oXWE036618; Sat, 24 Aug 2013 01:50:33 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7O1oVKk036604; Sat, 24 Aug 2013 01:50:31 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201308240150.r7O1oVKk036604@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 24 Aug 2013 01:50:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254759 - head/sys/cam/ctl 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.14 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: Sat, 24 Aug 2013 01:50:33 -0000 Author: trasz Date: Sat Aug 24 01:50:31 2013 New Revision: 254759 URL: http://svnweb.freebsd.org/changeset/base/254759 Log: CTL changes required for iSCSI target, most notably LUN remapping and a mechanism to allow CTL frontends for retrieving LUN options. Reviewed by: ken (earlier version) Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl.h head/sys/cam/ctl/ctl_backend.h head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_frontend.h head/sys/cam/ctl/ctl_io.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sat Aug 24 00:54:47 2013 (r254758) +++ head/sys/cam/ctl/ctl.c Sat Aug 24 01:50:31 2013 (r254759) @@ -894,8 +894,13 @@ ctl_isc_event_handler(ctl_ha_channel cha struct ctl_lun *lun; struct ctl_page_index *page_index; struct copan_aps_subpage *current_sp; + uint32_t targ_lun; - lun = ctl_softc->ctl_luns[msg_info.hdr.nexus.targ_lun]; + targ_lun = msg_info.hdr.nexus.targ_lun; + if (msg_info.hdr.nexus.lun_map_fn != NULL) + targ_lun = msg_info.hdr.nexus.lun_map_fn(msg_info.hdr.nexus.lun_map_arg, targ_lun); + + lun = ctl_softc->ctl_luns[targ_lun]; page_index = &lun->mode_pages.index[index_to_aps_page]; current_sp = (struct copan_aps_subpage *) (page_index->page_data + @@ -1098,7 +1103,8 @@ ctl_init(void) mtx_unlock(&softc->ctl_lock); return (error); } - printf("ctl: CAM Target Layer loaded\n"); + if (bootverbose) + printf("ctl: CAM Target Layer loaded\n"); /* * Initialize the initiator and portname mappings @@ -1194,7 +1200,8 @@ ctl_shutdown(void) free(control_softc, M_DEVBUF); control_softc = NULL; - printf("ctl: CAM Target Layer unloaded\n"); + if (bootverbose) + printf("ctl: CAM Target Layer unloaded\n"); } static int @@ -1678,12 +1685,16 @@ ctl_serialize_other_sc_cmd(struct ctl_sc union ctl_ha_msg msg_info; struct ctl_lun *lun; int retval = 0; + uint32_t targ_lun; ctl_softc = control_softc; if (have_lock == 0) mtx_lock(&ctl_softc->ctl_lock); - lun = ctl_softc->ctl_luns[ctsio->io_hdr.nexus.targ_lun]; + targ_lun = ctsio->io_hdr.nexus.targ_lun; + if (ctsio->io_hdr.nexus.lun_map_fn != NULL) + targ_lun = ctsio->io_hdr.nexus.lun_map_fn(ctsio->io_hdr.nexus.lun_map_arg, targ_lun); + lun = ctl_softc->ctl_luns[targ_lun]; if (lun==NULL) { /* @@ -2980,6 +2991,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, struct sbuf *sb; struct ctl_lun *lun; struct ctl_lun_list *list; + struct ctl_be_lun_option *opt; list = (struct ctl_lun_list *)addr; @@ -3097,17 +3109,16 @@ ctl_ioctl(struct cdev *dev, u_long cmd, if (retval != 0) break; - if (lun->backend->lun_info == NULL) { - retval = sbuf_printf(sb, "\n"); + if (lun->backend->lun_info != NULL) { + retval = lun->backend->lun_info(lun->be_lun->be_lun, sb); + if (retval != 0) + break; + } + STAILQ_FOREACH(opt, &lun->be_lun->options, links) { + retval = sbuf_printf(sb, "<%s>%s", opt->name, opt->value, opt->name); if (retval != 0) break; - continue; } - - retval =lun->backend->lun_info(lun->be_lun->be_lun, sb); - - if (retval != 0) - break; retval = sbuf_printf(sb, "\n"); @@ -4432,9 +4443,14 @@ ctl_free_lun(struct ctl_lun *lun) */ for (io = (union ctl_io *)STAILQ_FIRST(&softc->rtr_queue); io != NULL; io = next_io) { + uint32_t targ_lun; + next_io = (union ctl_io *)STAILQ_NEXT(&io->io_hdr, links); + targ_lun = io->io_hdr.nexus.targ_lun; + if (io->io_hdr.nexus.lun_map_fn != NULL) + targ_lun = io->io_hdr.nexus.lun_map_fn(io->io_hdr.nexus.lun_map_arg, targ_lun); if ((io->io_hdr.nexus.targ_target.id == lun->target.id) - && (io->io_hdr.nexus.targ_lun == lun->lun)) + && (targ_lun == lun->lun)) STAILQ_REMOVE(&softc->rtr_queue, &io->io_hdr, ctl_io_hdr, links); } @@ -8247,12 +8263,16 @@ ctl_hndl_per_res_out_on_other_sc(union c struct ctl_lun *lun; struct ctl_softc *softc; int i; + uint32_t targ_lun; softc = control_softc; mtx_lock(&softc->ctl_lock); - lun = softc->ctl_luns[msg->hdr.nexus.targ_lun]; + targ_lun = msg->hdr.nexus.targ_lun; + if (msg->hdr.nexus.lun_map_fn != NULL) + targ_lun = msg->hdr.nexus.lun_map_fn(msg->hdr.nexus.lun_map_arg, targ_lun); + lun = softc->ctl_luns[targ_lun]; switch(msg->pr.pr_info.action) { case CTL_PR_REG_KEY: if (!lun->per_res[msg->pr.pr_info.residx].registered) { @@ -8601,7 +8621,7 @@ ctl_report_luns(struct ctl_scsiio *ctsio int num_luns, retval; uint32_t alloc_len, lun_datalen; int num_filled, well_known; - uint32_t initidx; + uint32_t initidx, targ_lun_id, lun_id; retval = CTL_RETVAL_COMPLETE; well_known = 0; @@ -8662,63 +8682,47 @@ ctl_report_luns(struct ctl_scsiio *ctsio lun_data = (struct scsi_report_luns_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; - if (lun_datalen < alloc_len) { - ctsio->residual = alloc_len - lun_datalen; - ctsio->kern_data_len = lun_datalen; - ctsio->kern_total_len = lun_datalen; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } - ctsio->kern_data_resid = 0; - ctsio->kern_rel_offset = 0; - ctsio->kern_sg_entries = 0; - initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); - /* - * We set this to the actual data length, regardless of how much - * space we actually have to return results. If the user looks at - * this value, he'll know whether or not he allocated enough space - * and reissue the command if necessary. We don't support well - * known logical units, so if the user asks for that, return none. - */ - scsi_ulto4b(lun_datalen - 8, lun_data->length); - mtx_lock(&control_softc->ctl_lock); - for (num_filled = 0, lun = STAILQ_FIRST(&control_softc->lun_list); - (lun != NULL) && (num_filled < num_luns); - lun = STAILQ_NEXT(lun, links)) { + for (targ_lun_id = 0, num_filled = 0; targ_lun_id < CTL_MAX_LUNS && num_filled < num_luns; targ_lun_id++) { + lun_id = targ_lun_id; + if (ctsio->io_hdr.nexus.lun_map_fn != NULL) + lun_id = ctsio->io_hdr.nexus.lun_map_fn(ctsio->io_hdr.nexus.lun_map_arg, lun_id); + if (lun_id >= CTL_MAX_LUNS) + continue; + lun = control_softc->ctl_luns[lun_id]; + if (lun == NULL) + continue; - if (lun->lun <= 0xff) { + if (targ_lun_id <= 0xff) { /* * Peripheral addressing method, bus number 0. */ lun_data->luns[num_filled].lundata[0] = RPL_LUNDATA_ATYP_PERIPH; - lun_data->luns[num_filled].lundata[1] = lun->lun; + lun_data->luns[num_filled].lundata[1] = targ_lun_id; num_filled++; - } else if (lun->lun <= 0x3fff) { + } else if (targ_lun_id <= 0x3fff) { /* * Flat addressing method. */ lun_data->luns[num_filled].lundata[0] = RPL_LUNDATA_ATYP_FLAT | - (lun->lun & RPL_LUNDATA_FLAT_LUN_MASK); + (targ_lun_id & RPL_LUNDATA_FLAT_LUN_MASK); #ifdef OLDCTLHEADERS (SRLD_ADDR_FLAT << SRLD_ADDR_SHIFT) | - (lun->lun & SRLD_BUS_LUN_MASK); + (targ_lun_id & SRLD_BUS_LUN_MASK); #endif lun_data->luns[num_filled].lundata[1] = #ifdef OLDCTLHEADERS - lun->lun >> SRLD_BUS_LUN_BITS; + targ_lun_id >> SRLD_BUS_LUN_BITS; #endif - lun->lun >> RPL_LUNDATA_FLAT_LUN_BITS; + targ_lun_id >> RPL_LUNDATA_FLAT_LUN_BITS; num_filled++; } else { printf("ctl_report_luns: bogus LUN number %jd, " - "skipping\n", (intmax_t)lun->lun); + "skipping\n", (intmax_t)targ_lun_id); } /* * According to SPC-3, rev 14 section 6.21: @@ -8743,6 +8747,35 @@ ctl_report_luns(struct ctl_scsiio *ctsio mtx_unlock(&control_softc->ctl_lock); /* + * It's quite possible that we've returned fewer LUNs than we allocated + * space for. Trim it. + */ + lun_datalen = sizeof(*lun_data) + + (num_filled * sizeof(struct scsi_report_luns_lundata)); + + if (lun_datalen < alloc_len) { + ctsio->residual = alloc_len - lun_datalen; + ctsio->kern_data_len = lun_datalen; + ctsio->kern_total_len = lun_datalen; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + ctsio->kern_sg_entries = 0; + + /* + * We set this to the actual data length, regardless of how much + * space we actually have to return results. If the user looks at + * this value, he'll know whether or not he allocated enough space + * and reissue the command if necessary. We don't support well + * known logical units, so if the user asks for that, return none. + */ + scsi_ulto4b(lun_datalen - 8, lun_data->length); + + /* * We can only return SCSI_STATUS_CHECK_COND when we can't satisfy * this request. */ @@ -9077,6 +9110,14 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio int devid_len; ctl_softc = control_softc; + + mtx_lock(&ctl_softc->ctl_lock); + fe = ctl_softc->ctl_ports[ctl_port_idx(ctsio->io_hdr.nexus.targ_port)]; + mtx_unlock(&ctl_softc->ctl_lock); + + if (fe->devid != NULL) + return ((fe->devid)(ctsio, alloc_len)); + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; devid_len = sizeof(struct scsi_vpd_device_id) + @@ -9130,8 +9171,6 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio mtx_lock(&ctl_softc->ctl_lock); - fe = ctl_softc->ctl_ports[ctl_port_idx(ctsio->io_hdr.nexus.targ_port)]; - /* * For Fibre channel, */ @@ -10350,7 +10389,7 @@ ctl_scsiio_precheck(struct ctl_softc *ct struct ctl_lun *lun; struct ctl_cmd_entry *entry; uint8_t opcode; - uint32_t initidx; + uint32_t initidx, targ_lun; int retval; retval = 0; @@ -10361,9 +10400,12 @@ ctl_scsiio_precheck(struct ctl_softc *ct mtx_lock(&ctl_softc->ctl_lock); - if ((ctsio->io_hdr.nexus.targ_lun < CTL_MAX_LUNS) - && (ctl_softc->ctl_luns[ctsio->io_hdr.nexus.targ_lun] != NULL)) { - lun = ctl_softc->ctl_luns[ctsio->io_hdr.nexus.targ_lun]; + targ_lun = ctsio->io_hdr.nexus.targ_lun; + if (ctsio->io_hdr.nexus.lun_map_fn != NULL) + targ_lun = ctsio->io_hdr.nexus.lun_map_fn(ctsio->io_hdr.nexus.lun_map_arg, targ_lun); + if ((targ_lun < CTL_MAX_LUNS) + && (ctl_softc->ctl_luns[targ_lun] != NULL)) { + lun = ctl_softc->ctl_luns[targ_lun]; /* * If the LUN is invalid, pretend that it doesn't exist. * It will go away as soon as all pending I/O has been @@ -10403,6 +10445,7 @@ ctl_scsiio_precheck(struct ctl_softc *ct ctl_set_unsupported_lun(ctsio); mtx_unlock(&ctl_softc->ctl_lock); ctl_done((union ctl_io *)ctsio); + CTL_DEBUG_PRINT(("ctl_scsiio_precheck: bailing out due to invalid LUN\n")); goto bailout; } else { /* @@ -10769,6 +10812,7 @@ ctl_abort_task(union ctl_io *io) char printbuf[128]; #endif int found; + uint32_t targ_lun; ctl_softc = control_softc; found = 0; @@ -10776,9 +10820,12 @@ ctl_abort_task(union ctl_io *io) /* * Look up the LUN. */ - if ((io->io_hdr.nexus.targ_lun < CTL_MAX_LUNS) - && (ctl_softc->ctl_luns[io->io_hdr.nexus.targ_lun] != NULL)) - lun = ctl_softc->ctl_luns[io->io_hdr.nexus.targ_lun]; + targ_lun = io->io_hdr.nexus.targ_lun; + if (io->io_hdr.nexus.lun_map_fn != NULL) + targ_lun = io->io_hdr.nexus.lun_map_fn(io->io_hdr.nexus.lun_map_arg, targ_lun); + if ((targ_lun < CTL_MAX_LUNS) + && (ctl_softc->ctl_luns[targ_lun] != NULL)) + lun = ctl_softc->ctl_luns[targ_lun]; else goto bailout; @@ -10968,6 +11015,8 @@ ctl_run_task_queue(struct ctl_softc *ctl int retval; targ_lun = io->io_hdr.nexus.targ_lun; + if (io->io_hdr.nexus.lun_map_fn != NULL) + targ_lun = io->io_hdr.nexus.lun_map_fn(io->io_hdr.nexus.lun_map_arg, targ_lun); if ((targ_lun < CTL_MAX_LUNS) && (ctl_softc->ctl_luns[targ_lun] != NULL)) @@ -11042,7 +11091,7 @@ ctl_run_task_queue(struct ctl_softc *ctl (uintmax_t)io->io_hdr.nexus.initid.id, io->io_hdr.nexus.targ_port, (uintmax_t)io->io_hdr.nexus.targ_target.id, - io->io_hdr.nexus.targ_lun, + io->io_hdr.nexus.targ_lun /* XXX */, (io->io_hdr.io_type == CTL_IO_TASK) ? io->taskio.tag_num : io->scsiio.tag_num); STAILQ_REMOVE(&ctl_softc->task_queue, &io->io_hdr, @@ -11066,10 +11115,14 @@ ctl_handle_isc(union ctl_io *io) int free_io; struct ctl_lun *lun; struct ctl_softc *ctl_softc; + uint32_t targ_lun; ctl_softc = control_softc; - lun = ctl_softc->ctl_luns[io->io_hdr.nexus.targ_lun]; + targ_lun = io->io_hdr.nexus.targ_lun; + if (io->io_hdr.nexus.lun_map_fn != NULL) + targ_lun = io->io_hdr.nexus.lun_map_fn(io->io_hdr.nexus.lun_map_arg, targ_lun); + lun = ctl_softc->ctl_luns[targ_lun]; switch (io->io_hdr.msg_type) { case CTL_MSG_SERIALIZE: @@ -12625,7 +12678,7 @@ ctl_queue_sense(union ctl_io *io) { struct ctl_lun *lun; struct ctl_softc *ctl_softc; - uint32_t initidx; + uint32_t initidx, targ_lun; ctl_softc = control_softc; @@ -12644,9 +12697,12 @@ ctl_queue_sense(union ctl_io *io) * If we don't have a LUN for this, just toss the sense * information. */ - if ((io->io_hdr.nexus.targ_lun < CTL_MAX_LUNS) - && (ctl_softc->ctl_luns[io->io_hdr.nexus.targ_lun] != NULL)) - lun = ctl_softc->ctl_luns[io->io_hdr.nexus.targ_lun]; + targ_lun = io->io_hdr.nexus.targ_lun; + if (io->io_hdr.nexus.lun_map_fn != NULL) + targ_lun = io->io_hdr.nexus.lun_map_fn(io->io_hdr.nexus.lun_map_arg, targ_lun); + if ((targ_lun < CTL_MAX_LUNS) + && (ctl_softc->ctl_luns[targ_lun] != NULL)) + lun = ctl_softc->ctl_luns[targ_lun]; else goto bailout; @@ -13047,6 +13103,8 @@ ctl_isc_start(struct ctl_ha_component *c { ctl_ha_comp_status ret = CTL_HA_COMP_STATUS_OK; + printf("%s: go\n", __func__); + // UNKNOWN->HA or UNKNOWN->SINGLE (bootstrap) if (c->state == CTL_HA_STATE_UNKNOWN ) { ctl_is_single = 0; Modified: head/sys/cam/ctl/ctl.h ============================================================================== --- head/sys/cam/ctl/ctl.h Sat Aug 24 00:54:47 2013 (r254758) +++ head/sys/cam/ctl/ctl.h Sat Aug 24 01:50:31 2013 (r254759) @@ -52,6 +52,7 @@ typedef enum { CTL_PORT_SCSI = 0x02, CTL_PORT_IOCTL = 0x04, CTL_PORT_INTERNAL = 0x08, + CTL_PORT_ISCSI = 0x10, CTL_PORT_ALL = 0xff, CTL_PORT_ISC = 0x100 // FC port for inter-shelf communication } ctl_port_type; Modified: head/sys/cam/ctl/ctl_backend.h ============================================================================== --- head/sys/cam/ctl/ctl_backend.h Sat Aug 24 00:54:47 2013 (r254758) +++ head/sys/cam/ctl/ctl_backend.h Sat Aug 24 01:50:31 2013 (r254759) @@ -173,6 +173,12 @@ typedef void (*be_lun_config_t)(void *be * The links field is for CTL internal use only, and should not be used by * the backend. */ +struct ctl_be_lun_option { + STAILQ_ENTRY(ctl_be_lun_option) links; + char *name; + char *value; +}; + struct ctl_be_lun { uint8_t lun_type; /* passed to CTL */ ctl_backend_lun_flags flags; /* passed to CTL */ @@ -187,6 +193,7 @@ struct ctl_be_lun { be_lun_config_t lun_config_status; /* passed to CTL */ struct ctl_backend_driver *be; /* passed to CTL */ void *ctl_lun; /* used by CTL */ + STAILQ_HEAD(, ctl_be_lun_option) options; /* passed to CTL */ STAILQ_ENTRY(ctl_be_lun) links; /* used by CTL */ }; Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Sat Aug 24 00:54:47 2013 (r254758) +++ head/sys/cam/ctl/ctl_backend_block.c Sat Aug 24 01:50:31 2013 (r254759) @@ -1639,6 +1639,7 @@ ctl_be_block_create(struct ctl_be_block_ STAILQ_INIT(&be_lun->input_queue); STAILQ_INIT(&be_lun->config_write_queue); STAILQ_INIT(&be_lun->datamove_queue); + STAILQ_INIT(&be_lun->ctl_be_lun.options); sprintf(be_lun->lunname, "cblk%d", softc->num_luns); mtx_init(&be_lun->lock, be_lun->lunname, NULL, MTX_DEF); @@ -1740,6 +1741,16 @@ ctl_be_block_create(struct ctl_be_block_ } num_threads = tmp_num_threads; + } else if (strcmp(req->kern_be_args[i].kname, "file") != 0 && + strcmp(req->kern_be_args[i].kname, "dev") != 0) { + struct ctl_be_lun_option *opt; + + opt = malloc(sizeof(*opt), M_CTLBLK, M_WAITOK); + opt->name = malloc(strlen(req->kern_be_args[i].kname) + 1, M_CTLBLK, M_WAITOK); + strcpy(opt->name, req->kern_be_args[i].kname); + opt->value = malloc(strlen(req->kern_be_args[i].kvalue) + 1, M_CTLBLK, M_WAITOK); + strcpy(opt->value, req->kern_be_args[i].kvalue); + STAILQ_INSERT_TAIL(&be_lun->ctl_be_lun.options, opt, links); } } Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Sat Aug 24 00:54:47 2013 (r254758) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Sat Aug 24 01:50:31 2013 (r254759) @@ -491,7 +491,7 @@ ctl_backend_ramdisk_create(struct ctl_be struct ctl_lun_create_params *params; uint32_t blocksize; char tmpstr[32]; - int retval; + int i, retval; retval = 0; params = &req->reqdata.create; @@ -509,6 +509,7 @@ ctl_backend_ramdisk_create(struct ctl_be sizeof(*be_lun)); goto bailout_error; } + STAILQ_INIT(&be_lun->ctl_be_lun.options); if (params->flags & CTL_LUN_FLAG_DEV_TYPE) be_lun->ctl_be_lun.lun_type = params->device_type; @@ -545,6 +546,17 @@ ctl_backend_ramdisk_create(struct ctl_be be_lun->softc = softc; + for (i = 0; i < req->num_be_args; i++) { + struct ctl_be_lun_option *opt; + + opt = malloc(sizeof(*opt), M_RAMDISK, M_WAITOK); + opt->name = malloc(strlen(req->kern_be_args[i].kname) + 1, M_RAMDISK, M_WAITOK); + strcpy(opt->name, req->kern_be_args[i].kname); + opt->value = malloc(strlen(req->kern_be_args[i].kvalue) + 1, M_RAMDISK, M_WAITOK); + strcpy(opt->value, req->kern_be_args[i].kvalue); + STAILQ_INSERT_TAIL(&be_lun->ctl_be_lun.options, opt, links); + } + be_lun->flags = CTL_BE_RAMDISK_LUN_UNCONFIGURED; be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; be_lun->ctl_be_lun.be_lun = be_lun; Modified: head/sys/cam/ctl/ctl_frontend.h ============================================================================== --- head/sys/cam/ctl/ctl_frontend.h Sat Aug 24 00:54:47 2013 (r254758) +++ head/sys/cam/ctl/ctl_frontend.h Sat Aug 24 01:50:31 2013 (r254759) @@ -49,6 +49,9 @@ typedef enum { typedef void (*port_func_t)(void *onoff_arg); typedef int (*targ_func_t)(void *arg, struct ctl_id targ_id); typedef int (*lun_func_t)(void *arg, struct ctl_id targ_id, int lun_id); +typedef int (*fe_ioctl_t)(struct cdev *dev, u_long cmd, caddr_t addr, int flag, + struct thread *td); +typedef int (*fe_devid_t)(struct ctl_scsiio *ctsio, int alloc_len); /* * The ctl_frontend structure is the registration mechanism between a FETD @@ -213,6 +216,8 @@ struct ctl_frontend { targ_func_t targ_disable; /* passed to CTL */ lun_func_t lun_enable; /* passed to CTL */ lun_func_t lun_disable; /* passed to CTL */ + fe_ioctl_t ioctl; /* passed to CTL */ + fe_devid_t devid; /* passed to CTL */ void *targ_lun_arg; /* passed to CTL */ void (*fe_datamove)(union ctl_io *io); /* passed to CTL */ void (*fe_done)(union ctl_io *io); /* passed to CTL */ Modified: head/sys/cam/ctl/ctl_io.h ============================================================================== --- head/sys/cam/ctl/ctl_io.h Sat Aug 24 00:54:47 2013 (r254758) +++ head/sys/cam/ctl/ctl_io.h Sat Aug 24 01:50:31 2013 (r254759) @@ -204,6 +204,8 @@ struct ctl_nexus { uint32_t targ_port; /* Target port, filled in by PORT */ struct ctl_id targ_target; /* Destination target */ uint32_t targ_lun; /* Destination lun */ + uint32_t (*lun_map_fn)(void *arg, uint32_t lun); + void *lun_map_arg; }; typedef enum { From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 04:52:23 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 ESMTP id A9E95DDA; Sat, 24 Aug 2013 04:52:23 +0000 (UTC) (envelope-from ken@FreeBSD.org) 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 9616D2B39; Sat, 24 Aug 2013 04:52:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7O4qN67033909; Sat, 24 Aug 2013 04:52:23 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7O4qMji033904; Sat, 24 Aug 2013 04:52:22 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201308240452.r7O4qMji033904@svn.freebsd.org> From: "Kenneth D. Merry" Date: Sat, 24 Aug 2013 04:52:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254760 - in head: share/man/man4 sys/cam/scsi sys/kern 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.14 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: Sat, 24 Aug 2013 04:52:23 -0000 Author: ken Date: Sat Aug 24 04:52:22 2013 New Revision: 254760 URL: http://svnweb.freebsd.org/changeset/base/254760 Log: Add support to physio(9) for devices that don't want I/O split and configure sa(4) to request no I/O splitting by default. For tape devices, the user needs to be able to clearly understand what blocksize is actually being used when writing to a tape device. The previous behavior of physio(9) was that it would split up any I/O that was too large for the device, or too large to fit into MAXPHYS. This means that if, for instance, the user wrote a 1MB block to a tape device, and MAXPHYS was 128KB, the 1MB write would be split into 8 128K chunks. This would be done without informing the user. This has suboptimal effects, especially when trying to communicate status to the user. In the event of an error writing to a tape (e.g. physical end of tape) in the middle of a 1MB block that has been split into 8 pieces, the user could have the first two 128K pieces written successfully, the third returned with an error, and the last 5 returned with 0 bytes written. If the user is using a standard write(2) system call, all he will see is the ENOSPC error. He won't have a clue how much actually got written. (With a writev(2) system call, he should be able to determine how much got written in addition to the error.) The solution is to prevent physio(9) from splitting the I/O. The new cdev flag, SI_NOSPLIT, tells physio that the driver does not want I/O to be split beforehand. Although the sa(4) driver now enables SI_NOSPLIT by default, that can be disabled by two loader tunables for now. It will not be configurable starting in FreeBSD 11.0. kern.cam.sa.allow_io_split allows the user to configure I/O splitting for all sa(4) driver instances. kern.cam.sa.%d.allow_io_split allows the user to configure I/O splitting for a specific sa(4) instance. There are also now three sa(4) driver sysctl variables that let the users see some sa(4) driver values. kern.cam.sa.%d.allow_io_split shows whether I/O splitting is turned on. kern.cam.sa.%d.maxio shows the maximum I/O size allowed by kernel configuration parameters (e.g. MAXPHYS, DFLTPHYS) and the capabilities of the controller. kern.cam.sa.%d.cpi_maxio shows the maximum I/O size supported by the controller. Note that a better long term solution would be to implement support for chaining buffers, so that that MAXPHYS is no longer a limiting factor for I/O size to tape and disk devices. At that point, the controller and the tape drive would become the limiting factors. sys/conf.h: Add a new cdev flag, SI_NOSPLIT, that allows a driver to tell physio not to split up I/O. sys/param.h: Bump __FreeBSD_version to 1000049 for the addition of the SI_NOSPLIT cdev flag. kern_physio.c: If the SI_NOSPLIT flag is set on the cdev, return any I/O that is larger than si_iosize_max or MAXPHYS, has more than one segment, or would have to be split because of misalignment with EFBIG. (File too large). In the event of an error, print a console message to give the user a clue about what happened. scsi_sa.c: Set the SI_NOSPLIT cdev flag on the devices created for the sa(4) driver by default. Add tunables to control whether we allow I/O splitting in physio(9). Explain in the comments that allowing I/O splitting will be deprecated for the sa(4) driver in FreeBSD 11.0. Add sysctl variables to display the maximum I/O size we can do (which could be further limited by read block limits) and the maximum I/O size that the controller can do. Limit our maximum I/O size (recorded in the cdev's si_iosize_max) by MAXPHYS. This isn't strictly necessary, because physio(9) will limit it to MAXPHYS, but it will provide some clarity for the application. Record the controller's maximum I/O size reported in the Path Inquiry CCB. sa.4: Document the block size behavior, and explain that the option of allowing physio(9) to split the I/O will disappear in FreeBSD 11.0. Sponsored by: Spectra Logic Modified: head/share/man/man4/sa.4 head/sys/cam/scsi/scsi_sa.c head/sys/kern/kern_physio.c head/sys/sys/conf.h head/sys/sys/param.h Modified: head/share/man/man4/sa.4 ============================================================================== --- head/share/man/man4/sa.4 Sat Aug 24 01:50:31 2013 (r254759) +++ head/share/man/man4/sa.4 Sat Aug 24 04:52:22 2013 (r254760) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 6, 1999 +.Dd August 23, 2013 .Dt SA 4 .Os .Sh NAME @@ -159,6 +159,70 @@ of 0. (As above, if the file mark is never read, it remains for the next process to read if in no-rewind mode.) .El +.Sh BLOCK SIZES +By default, the driver will NOT accept reads or writes to a tape device that +are larger than may be written to or read from the mounted tape using a single +write or read request. +Because of this, the application author may have confidence that his wishes +are respected in terms of the block size written to tape. +For example, if the user tries to write a 256KB block to the tape, but the +controller can handle no more than 128KB, the write will fail. +The previous +.Fx +behavior, prior to +.Fx +10.0, +was to break up large reads or writes into smaller blocks when going to the +tape. +The problem with that behavior, though, is that it hides the actual on-tape +block size from the application writer, at least in variable block mode. +.Pp +If the user would like his large reads and writes broken up into separate +pieces, he may set the following loader tunables. +Note that these tunables WILL GO AWAY in +.Fx 11.0 . +They are provided for transition purposes only. +.Bl -tag -width 12 +.It kern.cam.sa.allow_io_split +.Pp +This variable, when set to 1, will configure all +.Nm +devices to split large buffers into smaller pieces when needed. +.It kern.cam.sa.%d.allow_io_split +.Pp +This variable, when set to 1, will configure the given +.Nm +unit to split large buffers into multiple pieces. +This will override the global setting, if it exists. +.El +.Pp +There are several +.Xr sysctl 8 +variables available to view block handling parameters: +.Bl -tag -width 12 +.It kern.cam.sa.%d.allow_io_split +.Pp +This variable allows the user to see, but not modify, the current I/O split +setting. +The user is not permitted to modify this setting so that there is no chance +of behavior changing for the application while a tape is mounted. +.It kern.cam.sa.%d.maxio +.Pp +This variable shows the maximum I/O size in bytes that is allowed by the +combination of kernel tuning parameters (MAXPHYS, DFLTPHYS) and the +capabilities of the controller that is attached to the tape drive. +Applications may look at this value for a guide on how large an I/O may be +permitted, but should keep in mind that the actual maximum may be +restricted further by the tape drive via the +.Tn SCSI +READ BLOCK LIMITS command. +.It kern.cam.sa.%d.cpi_maxio +.Pp +This variable shows the maximum I/O size supported by the controller, in +bytes, that is reported via the CAM Path Inquiry CCB (XPT_PATH_INQ). +If this is 0, that means that the controller has not reported a maximum I/O +size. +.El .Sh FILE MARK HANDLING The handling of file marks on write is automatic. If the user has Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Sat Aug 24 01:50:31 2013 (r254759) +++ head/sys/cam/scsi/scsi_sa.c Sat Aug 24 04:52:22 2013 (r254760) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); #include #ifdef _KERNEL #include +#include +#include #endif #include #include @@ -223,6 +225,8 @@ struct sa_softc { u_int32_t max_blk; u_int32_t min_blk; u_int32_t maxio; + u_int32_t cpi_maxio; + int allow_io_split; u_int32_t comp_algorithm; u_int32_t saved_comp_algorithm; u_int32_t media_blksize; @@ -268,6 +272,10 @@ struct sa_softc { open_rdonly : 1, /* open read-only */ open_pending_mount : 1, /* open pending mount */ ctrl_mode : 1; /* control device open */ + + struct task sysctl_task; + struct sysctl_ctx_list sysctl_ctx; + struct sysctl_oid *sysctl_tree; }; struct sa_quirk_entry { @@ -426,6 +434,22 @@ static int sardpos(struct cam_periph *p static int sasetpos(struct cam_periph *periph, int, u_int32_t *); +#ifndef SA_DEFAULT_IO_SPLIT +#define SA_DEFAULT_IO_SPLIT 0 +#endif + +static int sa_allow_io_split = SA_DEFAULT_IO_SPLIT; + +/* + * Tunable to allow the user to set a global allow_io_split value. Note + * that this WILL GO AWAY in FreeBSD 11.0. Silently splitting the I/O up + * is bad behavior, because it hides the true tape block size from the + * application. + */ +TUNABLE_INT("kern.cam.sa.allow_io_split", &sa_allow_io_split); +static SYSCTL_NODE(_kern_cam, OID_AUTO, sa, CTLFLAG_RD, 0, + "CAM Sequential Access Tape Driver"); + static struct periph_driver sadriver = { sainit, "sa", @@ -1448,6 +1472,49 @@ saasync(void *callback_arg, u_int32_t co } } +static void +sasysctlinit(void *context, int pending) +{ + struct cam_periph *periph; + struct sa_softc *softc; + char tmpstr[80], tmpstr2[80]; + + periph = (struct cam_periph *)context; + /* + * If the periph is invalid, no need to setup the sysctls. + */ + if (periph->flags & CAM_PERIPH_INVALID) + goto bailout; + + softc = (struct sa_softc *)periph->softc; + + snprintf(tmpstr, sizeof(tmpstr), "CAM SA unit %d", periph->unit_number); + snprintf(tmpstr2, sizeof(tmpstr2), "%u", periph->unit_number); + + sysctl_ctx_init(&softc->sysctl_ctx); + softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx, + SYSCTL_STATIC_CHILDREN(_kern_cam_sa), OID_AUTO, tmpstr2, + CTLFLAG_RD, 0, tmpstr); + if (softc->sysctl_tree == NULL) + goto bailout; + + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "allow_io_split", CTLTYPE_INT | CTLFLAG_RDTUN, + &softc->allow_io_split, 0, "Allow Splitting I/O"); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "maxio", CTLTYPE_INT | CTLFLAG_RD, + &softc->maxio, 0, "Maximum I/O size"); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "cpi_maxio", CTLTYPE_INT | CTLFLAG_RD, + &softc->cpi_maxio, 0, "Maximum Controller I/O size"); + +bailout: + /* + * Release the reference that was held when this task was enqueued. + */ + cam_periph_release(periph); +} + static cam_status saregister(struct cam_periph *periph, void *arg) { @@ -1455,6 +1522,7 @@ saregister(struct cam_periph *periph, vo struct ccb_getdev *cgd; struct ccb_pathinq cpi; caddr_t match; + char tmpstr[80]; int i; cgd = (struct ccb_getdev *)arg; @@ -1509,21 +1577,55 @@ saregister(struct cam_periph *periph, vo XPORT_DEVSTAT_TYPE(cpi.transport), DEVSTAT_PRIORITY_TAPE); /* - * If maxio isn't set, we fall back to DFLTPHYS. If it is set, we - * take it whether or not it's larger than MAXPHYS. physio will - * break it down into pieces small enough to fit in a buffer. + * Load the default value that is either compiled in, or loaded + * in the global kern.cam.sa.allow_io_split tunable. + */ + softc->allow_io_split = sa_allow_io_split; + + /* + * Load a per-instance tunable, if it exists. NOTE that this + * tunable WILL GO AWAY in FreeBSD 11.0. + */ + snprintf(tmpstr, sizeof(tmpstr), "kern.cam.sa.%u.allow_io_split", + periph->unit_number); + TUNABLE_INT_FETCH(tmpstr, &softc->allow_io_split); + + /* + * If maxio isn't set, we fall back to DFLTPHYS. Otherwise we take + * the smaller of cpi.maxio or MAXPHYS. */ if (cpi.maxio == 0) softc->maxio = DFLTPHYS; + else if (cpi.maxio > MAXPHYS) + softc->maxio = MAXPHYS; else softc->maxio = cpi.maxio; /* + * Record the controller's maximum I/O size so we can report it to + * the user later. + */ + softc->cpi_maxio = cpi.maxio; + + /* + * By default we tell physio that we do not want our I/O split. + * The user needs to have a 1:1 mapping between the size of his + * write to a tape character device and the size of the write + * that actually goes down to the drive. + */ + if (softc->allow_io_split == 0) + softc->si_flags = SI_NOSPLIT; + else + softc->si_flags = 0; + + TASK_INIT(&softc->sysctl_task, 0, sasysctlinit, periph); + + /* * If the SIM supports unmapped I/O, let physio know that we can * handle unmapped buffers. */ if (cpi.hba_misc & PIM_UNMAPPED) - softc->si_flags = SI_UNMAPPED; + softc->si_flags |= SI_UNMAPPED; softc->devs.ctl_dev = make_dev(&sa_cdevsw, SAMINOR(SA_CTLDEV, 0, SA_ATYPE_R), UID_ROOT, GID_OPERATOR, @@ -1586,6 +1688,13 @@ saregister(struct cam_periph *periph, vo cam_periph_lock(periph); /* + * Bump the peripheral refcount for the sysctl thread, in case we + * get invalidated before the thread has a chance to run. + */ + cam_periph_acquire(periph); + taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task); + + /* * Add an async callback so that we get * notified if this device goes away. */ Modified: head/sys/kern/kern_physio.c ============================================================================== --- head/sys/kern/kern_physio.c Sat Aug 24 01:50:31 2013 (r254759) +++ head/sys/kern/kern_physio.c Sat Aug 24 04:52:22 2013 (r254760) @@ -54,6 +54,36 @@ physio(struct cdev *dev, struct uio *uio dev->si_iosize_max = DFLTPHYS; } + /* + * If the driver does not want I/O to be split, that means that we + * need to reject any requests that will not fit into one buffer. + */ + if ((dev->si_flags & SI_NOSPLIT) && + ((uio->uio_resid > dev->si_iosize_max) || + (uio->uio_resid > MAXPHYS) || + (uio->uio_iovcnt > 1))) { + /* + * Tell the user why his I/O was rejected. + */ + if (uio->uio_resid > dev->si_iosize_max) + printf("%s: request size %zd > si_iosize_max=%d, " + "cannot split request\n", devtoname(dev), + uio->uio_resid, dev->si_iosize_max); + + if (uio->uio_resid > MAXPHYS) + printf("%s: request size %zd > MAXPHYS=%d, " + "cannot split request\n", devtoname(dev), + uio->uio_resid, MAXPHYS); + + if (uio->uio_iovcnt > 1) + printf("%s: request vectors=%d > 1, " + "cannot split request\n", devtoname(dev), + uio->uio_iovcnt); + + error = EFBIG; + goto doerror; + } + for (i = 0; i < uio->uio_iovcnt; i++) { while (uio->uio_iov[i].iov_len) { bp->b_flags = 0; @@ -83,6 +113,17 @@ physio(struct cdev *dev, struct uio *uio */ iolen = ((vm_offset_t) bp->b_data) & PAGE_MASK; if ((bp->b_bcount + iolen) > bp->b_kvasize) { + /* + * This device does not want I/O to be split. + */ + if (dev->si_flags & SI_NOSPLIT) { + printf("%s: request ptr %#jx is not " + "on a page boundary, cannot split " + "request\n", devtoname(dev), + (uintmax_t)bp->b_data); + error = EFBIG; + goto doerror; + } bp->b_bcount = bp->b_kvasize; if (iolen != 0) bp->b_bcount -= PAGE_SIZE; Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Sat Aug 24 01:50:31 2013 (r254759) +++ head/sys/sys/conf.h Sat Aug 24 04:52:22 2013 (r254760) @@ -62,6 +62,7 @@ struct cdev { #define SI_DUMPDEV 0x0080 /* is kernel dumpdev */ #define SI_CLONELIST 0x0200 /* on a clone list */ #define SI_UNMAPPED 0x0400 /* can handle unmapped I/O */ +#define SI_NOSPLIT 0x0800 /* I/O should not be split up */ struct timespec si_atime; struct timespec si_ctime; struct timespec si_mtime; Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Aug 24 01:50:31 2013 (r254759) +++ head/sys/sys/param.h Sat Aug 24 04:52:22 2013 (r254760) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000048 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000049 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 09:42: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 ESMTP id 9D346E3E; Sat, 24 Aug 2013 09:42:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) 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 717CC24AC; Sat, 24 Aug 2013 09:42: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 r7O9gFrv083078; Sat, 24 Aug 2013 09:42:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7O9gFaI083076; Sat, 24 Aug 2013 09:42:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201308240942.r7O9gFaI083076@svn.freebsd.org> From: Alexander Motin Date: Sat, 24 Aug 2013 09:42:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254766 - in head/sys: cam geom 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.14 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: Sat, 24 Aug 2013 09:42:15 -0000 Author: mav Date: Sat Aug 24 09:42:14 2013 New Revision: 254766 URL: http://svnweb.freebsd.org/changeset/base/254766 Log: Add new attribute lunname to report only textual LUN-specific device IDs. While lunid attribute prefers to report numeric ones, having both may be useful in some situations. Modified: head/sys/cam/cam_xpt.c head/sys/geom/geom_disk.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sat Aug 24 08:47:09 2013 (r254765) +++ head/sys/cam/cam_xpt.c Sat Aug 24 09:42:14 2013 (r254766) @@ -1091,7 +1091,8 @@ xpt_getattr(char *buf, size_t len, const cdai.buftype = CDAI_TYPE_SERIAL_NUM; else if (!strcmp(attr, "GEOM::physpath")) cdai.buftype = CDAI_TYPE_PHYS_PATH; - else if (!strcmp(attr, "GEOM::lunid")) { + else if (strcmp(attr, "GEOM::lunid") == 0 || + strcmp(attr, "GEOM::lunname") == 0) { cdai.buftype = CDAI_TYPE_SCSI_DEVID; cdai.bufsiz = CAM_SCSI_DEVID_MAXLEN; } else @@ -1108,11 +1109,14 @@ xpt_getattr(char *buf, size_t len, const if (cdai.provsiz == 0) goto out; if (cdai.buftype == CDAI_TYPE_SCSI_DEVID) { - idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, - cdai.provsiz, scsi_devid_is_lun_naa); - if (idd == NULL) + if (strcmp(attr, "GEOM::lunid") == 0) { idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, - cdai.provsiz, scsi_devid_is_lun_eui64); + cdai.provsiz, scsi_devid_is_lun_naa); + if (idd == NULL) + idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, + cdai.provsiz, scsi_devid_is_lun_eui64); + } else + idd = NULL; if (idd == NULL) idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, cdai.provsiz, scsi_devid_is_lun_t10); Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Sat Aug 24 08:47:09 2013 (r254765) +++ head/sys/geom/geom_disk.c Sat Aug 24 09:42:14 2013 (r254766) @@ -460,6 +460,12 @@ g_disk_dumpconf(struct sbuf *sb, const c if (dp->d_getattr(bp) == 0) sbuf_printf(sb, "%s%s\n", indent, buf); + bp->bio_attribute = "GEOM::lunname"; + bp->bio_length = DISK_IDENT_SIZE; + bp->bio_data = buf; + if (dp->d_getattr(bp) == 0) + sbuf_printf(sb, "%s%s\n", + indent, buf); g_destroy_bio(bp); g_free(buf); } else From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 09:57: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 ESMTP id B59AB2D6; Sat, 24 Aug 2013 09:57:32 +0000 (UTC) (envelope-from jilles@FreeBSD.org) 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 A1813252D; Sat, 24 Aug 2013 09:57: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 r7O9vWiF089801; Sat, 24 Aug 2013 09:57:32 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7O9vW3N089800; Sat, 24 Aug 2013 09:57:32 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201308240957.r7O9vW3N089800@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 24 Aug 2013 09:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254767 - head/bin/sh 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.14 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: Sat, 24 Aug 2013 09:57:32 -0000 Author: jilles Date: Sat Aug 24 09:57:32 2013 New Revision: 254767 URL: http://svnweb.freebsd.org/changeset/base/254767 Log: sh: Do not prematurely discard stopped jobs in a wait builtin. If a job is specified to 'wait', wait for it to complete. Formerly, in interactive mode, the job was deleted if it stopped. If no jobs are specified in interactive mode, 'wait' still waits for all jobs to complete or stop. In non-interactive mode, WUNTRACED is not passed to wait3() so stopped jobs are not detected. PR: bin/181435 Modified: head/bin/sh/jobs.c Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Sat Aug 24 09:42:14 2013 (r254766) +++ head/bin/sh/jobs.c Sat Aug 24 09:57:32 2013 (r254767) @@ -495,14 +495,10 @@ waitcmdloop(struct job *job) in_waitcmd++; do { if (job != NULL) { - if (job->state) { + if (job->state == JOBDONE) { status = job->ps[job->nprocs - 1].status; if (WIFEXITED(status)) retval = WEXITSTATUS(status); -#if JOBS - else if (WIFSTOPPED(status)) - retval = WSTOPSIG(status) + 128; -#endif else retval = WTERMSIG(status) + 128; if (! iflag || ! job->changed) From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 10:06:53 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 ESMTP id 6B304788; Sat, 24 Aug 2013 10:06:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) 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 55D6625B2; Sat, 24 Aug 2013 10:06:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OA6r7Q095170; Sat, 24 Aug 2013 10:06:53 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OA6qXU095163; Sat, 24 Aug 2013 10:06:52 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201308241006.r7OA6qXU095163@svn.freebsd.org> From: Ed Maste Date: Sat, 24 Aug 2013 10:06:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254768 - in head/contrib/llvm/tools/lldb: include/lldb/Expression source/Expression source/Host/common source/Plugins/Disassembler/llvm source/Plugins/Instruction/ARM 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.14 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: Sat, 24 Aug 2013 10:06:53 -0000 Author: emaste Date: Sat Aug 24 10:06:51 2013 New Revision: 254768 URL: http://svnweb.freebsd.org/changeset/base/254768 Log: Revert lldb changes due to post-3.3 clang and llvm API changes Revisions: svn git 183929 99447a6 183862 15c1774 source/Host/common/FileSpec.cpp 184954 007e7bc 184948 4dc3761 source/Expression/ClangExpressionParser.cpp 182099 b31044e 181387 779e6ac include/lldb/Expression/IRExecutionUnit.h source/Expression/IRExecutionUnit.cpp 184177 0b2934b 182650 f2dcf35 181703 7bef4e2 source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp 182683 0d91b80 source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Sponsored by: DARPA, AFRL Modified: head/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h head/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp head/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp head/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp head/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp head/contrib/llvm/tools/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Modified: head/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h ============================================================================== --- head/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h Sat Aug 24 09:57:32 2013 (r254767) +++ head/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h Sat Aug 24 10:06:51 2013 (r254768) @@ -336,13 +336,7 @@ private: /// @return /// True in case of failure, false in case of success. //------------------------------------------------------------------ - virtual bool finalizeMemory(std::string *ErrMsg) { - // TODO: Ensure that the instruction cache is flushed because - // relocations are updated by dy-load. See: - // sys::Memory::InvalidateInstructionCache - // llvm::SectionMemoryManager - return false; - } + bool applyPermissions(std::string *ErrMsg) { return false; } //------------------------------------------------------------------ /// Passthrough interface stub @@ -352,6 +346,38 @@ private: //------------------------------------------------------------------ /// Passthrough interface stub //------------------------------------------------------------------ + virtual uint8_t* startExceptionTable(const llvm::Function* F, + uintptr_t &ActualSize); + + //------------------------------------------------------------------ + /// Complete the exception table for a function, and add it to the + /// m_exception_tables map + /// + /// @param[in] F + /// The function whose exception table is being written. + /// + /// @param[in] TableStart + /// The first byte of the exception table. + /// + /// @param[in] TableEnd + /// The last byte of the exception table. + /// + /// @param[in] FrameRegister + /// I don't know what this does, but it's passed through. + //------------------------------------------------------------------ + virtual void endExceptionTable(const llvm::Function *F, + uint8_t *TableStart, + uint8_t *TableEnd, + uint8_t* FrameRegister); + + //------------------------------------------------------------------ + /// Passthrough interface stub + //------------------------------------------------------------------ + virtual void deallocateExceptionTable(void *ET); + + //------------------------------------------------------------------ + /// Passthrough interface stub + //------------------------------------------------------------------ virtual size_t GetDefaultCodeSlabSize() { return m_default_mm_ap->GetDefaultCodeSlabSize(); } Modified: head/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp Sat Aug 24 09:57:32 2013 (r254767) +++ head/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp Sat Aug 24 10:06:51 2013 (r254768) @@ -52,7 +52,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/FileSystem.h" +#include "llvm/Support/PathV1.h" #include "llvm/Support/TargetSelect.h" #if defined(__FreeBSD__) @@ -81,16 +81,19 @@ using namespace lldb_private; //===----------------------------------------------------------------------===// std::string GetBuiltinIncludePath(const char *Argv0) { - SmallString<128> P(llvm::sys::fs::getMainExecutable( - Argv0, (void *)(intptr_t) GetBuiltinIncludePath)); - - if (!P.empty()) { - llvm::sys::path::remove_filename(P); // Remove /clang from foo/bin/clang - llvm::sys::path::remove_filename(P); // Remove /bin from foo/bin - + llvm::sys::Path P = + llvm::sys::Path::GetMainExecutable(Argv0, + (void*)(intptr_t) GetBuiltinIncludePath); + + if (!P.isEmpty()) { + P.eraseComponent(); // Remove /clang from foo/bin/clang + P.eraseComponent(); // Remove /bin from foo/bin + // Get foo/lib/clang//include - llvm::sys::path::append(P, "lib", "clang", CLANG_VERSION_STRING, - "include"); + P.appendComponent("lib"); + P.appendComponent("clang"); + P.appendComponent(CLANG_VERSION_STRING); + P.appendComponent("include"); } return P.str(); Modified: head/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp Sat Aug 24 09:57:32 2013 (r254767) +++ head/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp Sat Aug 24 10:06:51 2013 (r254768) @@ -563,6 +563,28 @@ IRExecutionUnit::MemoryManager::dealloca m_default_mm_ap->deallocateFunctionBody(Body); } +uint8_t* +IRExecutionUnit::MemoryManager::startExceptionTable(const llvm::Function* F, + uintptr_t &ActualSize) +{ + return m_default_mm_ap->startExceptionTable(F, ActualSize); +} + +void +IRExecutionUnit::MemoryManager::endExceptionTable(const llvm::Function *F, + uint8_t *TableStart, + uint8_t *TableEnd, + uint8_t* FrameRegister) +{ + m_default_mm_ap->endExceptionTable(F, TableStart, TableEnd, FrameRegister); +} + +void +IRExecutionUnit::MemoryManager::deallocateExceptionTable(void *ET) +{ + m_default_mm_ap->deallocateExceptionTable (ET); +} + lldb::addr_t IRExecutionUnit::GetRemoteAddressForLocal (lldb::addr_t local_address) { Modified: head/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp Sat Aug 24 09:57:32 2013 (r254767) +++ head/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp Sat Aug 24 10:06:51 2013 (r254768) @@ -553,8 +553,9 @@ FileSpec::ResolveExecutableLocation () if (file_cstr) { const std::string file_str (file_cstr); - std::string path = llvm::sys::FindProgramByName (file_str); - llvm::StringRef dir_ref = llvm::sys::path::parent_path(path); + llvm::sys::Path path = llvm::sys::Program::FindProgramByName (file_str); + const std::string &path_str = path.str(); + llvm::StringRef dir_ref = llvm::sys::path::parent_path(path_str); //llvm::StringRef dir_ref = path.getDirname(); if (! dir_ref.empty()) { Modified: head/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Sat Aug 24 09:57:32 2013 (r254767) +++ head/contrib/llvm/tools/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Sat Aug 24 10:06:51 2013 (r254768) @@ -10,7 +10,6 @@ #include "DisassemblerLLVMC.h" #include "llvm-c/Disassembler.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCDisassembler.h" @@ -18,7 +17,6 @@ #include "llvm/MC/MCInstPrinter.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" -#include "llvm/MC/MCRelocationInfo.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MemoryObject.h" @@ -442,30 +440,23 @@ DisassemblerLLVMC::LLVMCDisassembler::LL m_subtarget_info_ap.reset(curr_target->createMCSubtargetInfo(triple, "", features_str)); - m_asm_info_ap.reset(curr_target->createMCAsmInfo(*curr_target->createMCRegInfo(triple), triple)); - + m_asm_info_ap.reset(curr_target->createMCAsmInfo(triple)); + if (m_instr_info_ap.get() == NULL || m_reg_info_ap.get() == NULL || m_subtarget_info_ap.get() == NULL || m_asm_info_ap.get() == NULL) { m_is_valid = false; return; } - m_context_ap.reset(new llvm::MCContext(m_asm_info_ap.get(), m_reg_info_ap.get(), 0)); + m_context_ap.reset(new llvm::MCContext(*m_asm_info_ap.get(), *(m_reg_info_ap.get()), 0)); m_disasm_ap.reset(curr_target->createMCDisassembler(*m_subtarget_info_ap.get())); - if (m_disasm_ap.get() && m_context_ap.get()) + if (m_disasm_ap.get()) { - llvm::OwningPtr RelInfo(curr_target->createMCRelocationInfo(triple, *m_context_ap.get())); - if (!RelInfo) - { - m_is_valid = false; - return; - } m_disasm_ap->setupForSymbolicDisassembly(NULL, - DisassemblerLLVMC::SymbolLookupCallback, - (void *) &owner, - m_context_ap.get(), - RelInfo); + DisassemblerLLVMC::SymbolLookupCallback, + (void *) &owner, + m_context_ap.get()); unsigned asm_printer_variant; if (flavor == ~0U) Modified: head/contrib/llvm/tools/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Sat Aug 24 09:57:32 2013 (r254767) +++ head/contrib/llvm/tools/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Sat Aug 24 10:06:51 2013 (r254768) @@ -25,7 +25,7 @@ #include "Utility/ARM_DWARF_Registers.h" #include "llvm/Support/MathExtras.h" // for SignExtend32 template function - // and countTrailingZeros function + // and CountTrailingZeros_32 function using namespace lldb; using namespace lldb_private; @@ -47,7 +47,7 @@ using namespace lldb_private; static uint32_t CountITSize (uint32_t ITMask) { // First count the trailing zeros of the IT mask. - uint32_t TZ = llvm::countTrailingZeros(ITMask); + uint32_t TZ = llvm::CountTrailingZeros_32(ITMask); if (TZ > 3) { #ifdef LLDB_CONFIGURATION_DEBUG From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 10:14:00 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 ESMTP id B43078FE; Sat, 24 Aug 2013 10:14:00 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 87C7225FC; Sat, 24 Aug 2013 10:14: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 r7OAE0HL099798; Sat, 24 Aug 2013 10:14:00 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OAE0Qs099791; Sat, 24 Aug 2013 10:14:00 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241014.r7OAE0Qs099791@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 10:14:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254769 - 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.14 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: Sat, 24 Aug 2013 10:14:00 -0000 Author: andre Date: Sat Aug 24 10:13:59 2013 New Revision: 254769 URL: http://svnweb.freebsd.org/changeset/base/254769 Log: Introduce typedef for pfil hook callback function and replace all spelled out occurrences with it. Reviewed by: eri Modified: head/sys/net/pfil.c head/sys/net/pfil.h Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Sat Aug 24 10:06:51 2013 (r254768) +++ head/sys/net/pfil.c Sat Aug 24 10:13:59 2013 (r254769) @@ -225,8 +225,7 @@ pfil_head_get(int type, u_long val) * PFIL_WAITOK OK to call malloc with M_WAITOK. */ int -pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int, - struct inpcb *), void *arg, int flags, struct pfil_head *ph) +pfil_add_hook(pfil_func_t func, void *arg, int flags, struct pfil_head *ph) { struct packet_filter_hook *pfh1 = NULL; struct packet_filter_hook *pfh2 = NULL; @@ -285,8 +284,7 @@ error: * list. */ int -pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int, - struct inpcb *), void *arg, int flags, struct pfil_head *ph) +pfil_remove_hook(pfil_func_t func, void *arg, int flags, struct pfil_head *ph) { int err = 0; @@ -334,9 +332,7 @@ pfil_list_add(pfil_list_t *list, struct * specified list. */ static int -pfil_list_remove(pfil_list_t *list, - int (*func)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), - void *arg) +pfil_list_remove(pfil_list_t *list, pfil_func_t func, void *arg) { struct packet_filter_hook *pfh; Modified: head/sys/net/pfil.h ============================================================================== --- head/sys/net/pfil.h Sat Aug 24 10:06:51 2013 (r254768) +++ head/sys/net/pfil.h Sat Aug 24 10:13:59 2013 (r254769) @@ -43,14 +43,16 @@ struct mbuf; struct ifnet; struct inpcb; +typedef int (*pfil_func_t)(void *, struct mbuf **, struct ifnet *, int, + struct inpcb *); + /* * The packet filter hooks are designed for anything to call them to * possibly intercept the packet. */ struct packet_filter_hook { TAILQ_ENTRY(packet_filter_hook) pfil_link; - int (*pfil_func)(void *, struct mbuf **, struct ifnet *, int, - struct inpcb *); + pfil_func_t pfil_func; void *pfil_arg; }; @@ -87,10 +89,8 @@ struct pfil_head { LIST_ENTRY(pfil_head) ph_list; }; -int pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *, - int, struct inpcb *), void *, int, struct pfil_head *); -int pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, - int, struct inpcb *), void *, int, struct pfil_head *); +int pfil_add_hook(pfil_func_t, void *, int, struct pfil_head *); +int pfil_remove_hook(pfil_func_t, void *, int, struct pfil_head *); int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *, int, struct inpcb *inp); From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 10:30: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 ESMTP id 0FD6BB0E; Sat, 24 Aug 2013 10:30:21 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 F0F532674; Sat, 24 Aug 2013 10:30:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OAUKZg008697; Sat, 24 Aug 2013 10:30:20 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OAUK6f008696; Sat, 24 Aug 2013 10:30:20 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241030.r7OAUK6f008696@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 10:30:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254770 - 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.14 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: Sat, 24 Aug 2013 10:30:21 -0000 Author: andre Date: Sat Aug 24 10:30:20 2013 New Revision: 254770 URL: http://svnweb.freebsd.org/changeset/base/254770 Log: Convert one instance of pfil hook callback missed in r254769. Modified: head/sys/net/pfil.c Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Sat Aug 24 10:13:59 2013 (r254769) +++ head/sys/net/pfil.c Sat Aug 24 10:30:20 2013 (r254770) @@ -53,10 +53,7 @@ MTX_SYSINIT(pfil_heads_lock, &pfil_globa MTX_DEF); static int pfil_list_add(pfil_list_t *, struct packet_filter_hook *, int); - -static int pfil_list_remove(pfil_list_t *, - int (*)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *), - void *); +static int pfil_list_remove(pfil_list_t *, pfil_func_t, void *); LIST_HEAD(pfilheadhead, pfil_head); VNET_DEFINE(struct pfilheadhead, pfil_head_list); From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 10:36: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 ESMTP id 58D23DAF; Sat, 24 Aug 2013 10:36:34 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 2857C26C7; Sat, 24 Aug 2013 10:36: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 r7OAaYpH010899; Sat, 24 Aug 2013 10:36:34 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OAaXTl010897; Sat, 24 Aug 2013 10:36:33 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241036.r7OAaXTl010897@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 10:36:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254771 - 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.14 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: Sat, 24 Aug 2013 10:36:34 -0000 Author: andre Date: Sat Aug 24 10:36:33 2013 New Revision: 254771 URL: http://svnweb.freebsd.org/changeset/base/254771 Log: Internalize pfil_hook_get(). There are no outside consumers of this API, it is only safe for internal use and even the pfil(9) man page says so in the BUGS section. Reviewed by: eri Modified: head/sys/net/pfil.c head/sys/net/pfil.h Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Sat Aug 24 10:30:20 2013 (r254770) +++ head/sys/net/pfil.c Sat Aug 24 10:36:33 2013 (r254771) @@ -52,6 +52,7 @@ static struct mtx pfil_global_lock; MTX_SYSINIT(pfil_heads_lock, &pfil_global_lock, "pfil_head_list lock", MTX_DEF); +static struct packet_filter_hook *pfil_hook_get(int, struct pfil_head *); static int pfil_list_add(pfil_list_t *, struct packet_filter_hook *, int); static int pfil_list_remove(pfil_list_t *, pfil_func_t, void *); @@ -89,6 +90,18 @@ pfil_run_hooks(struct pfil_head *ph, str return (rv); } +static struct packet_filter_hook * +pfil_hook_get(int dir, struct pfil_head *ph) +{ + + if (dir == PFIL_IN) + return (TAILQ_FIRST(&ph->ph_in)); + else if (dir == PFIL_OUT) + return (TAILQ_FIRST(&ph->ph_out)); + else + return (NULL); +} + /* * pfil_try_rlock() acquires rm reader lock for specified head * if this is immediately possible. Modified: head/sys/net/pfil.h ============================================================================== --- head/sys/net/pfil.h Sat Aug 24 10:30:20 2013 (r254770) +++ head/sys/net/pfil.h Sat Aug 24 10:36:33 2013 (r254771) @@ -132,16 +132,4 @@ struct pfil_head *pfil_head_get(int, u_l #define PFIL_LIST_LOCK() mtx_lock(&pfil_global_lock) #define PFIL_LIST_UNLOCK() mtx_unlock(&pfil_global_lock) -static __inline struct packet_filter_hook * -pfil_hook_get(int dir, struct pfil_head *ph) -{ - - if (dir == PFIL_IN) - return (TAILQ_FIRST(&ph->ph_in)); - else if (dir == PFIL_OUT) - return (TAILQ_FIRST(&ph->ph_out)); - else - return (NULL); -} - #endif /* _NET_PFIL_H_ */ From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 10:38: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 ESMTP id AD136EFC; Sat, 24 Aug 2013 10:38:02 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 9926826D7; Sat, 24 Aug 2013 10:38:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OAc2Kt011438; Sat, 24 Aug 2013 10:38:02 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OAc2hY011437; Sat, 24 Aug 2013 10:38:02 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241038.r7OAc2hY011437@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 10:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254772 - head/share/man/man9 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.14 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: Sat, 24 Aug 2013 10:38:02 -0000 Author: andre Date: Sat Aug 24 10:38:02 2013 New Revision: 254772 URL: http://svnweb.freebsd.org/changeset/base/254772 Log: pfil_hook_get() has been internalized in r254771 and is no longer part of the API. It wasn't safe for external use in any case. Modified: head/share/man/man9/pfil.9 Modified: head/share/man/man9/pfil.9 ============================================================================== --- head/share/man/man9/pfil.9 Sat Aug 24 10:36:33 2013 (r254771) +++ head/share/man/man9/pfil.9 Sat Aug 24 10:38:02 2013 (r254772) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 22, 2012 +.Dd August 23, 2013 .Dt PFIL 9 .Os .Sh NAME @@ -36,7 +36,6 @@ .Nm pfil_head_register , .Nm pfil_head_unregister , .Nm pfil_head_get , -.Nm pfil_hook_get , .Nm pfil_add_hook , .Nm pfil_remove_hook , .Nm pfil_run_hooks , @@ -56,8 +55,6 @@ .Fn pfil_head_unregister "struct pfil_head *head" .Ft "struct pfil_head *" .Fn pfil_head_get "int af" "u_long dlt" -.Ft "struct packet_filter_hook *" -.Fn pfil_hook_get "int dir" "struct pfil_head *head" .Ft void .Fn pfil_add_hook "int (*func)()" "void *arg" "int flags" "struct pfil_head *" .Ft void @@ -245,11 +242,7 @@ lock export was added in .Fx 10.0 . .Sh BUGS The -.Fn pfil_hook_get -function -is only safe for internal use. -.Pp -When a +.Fn When a .Vt pfil_head is being modified, no traffic is diverted (to avoid deadlock). From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 11:17: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 ESMTP id D63AE624; Sat, 24 Aug 2013 11:17:25 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 C2FFC285B; Sat, 24 Aug 2013 11:17: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 r7OBHPet032343; Sat, 24 Aug 2013 11:17:25 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OBHPQ1032341; Sat, 24 Aug 2013 11:17:25 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241117.r7OBHPQ1032341@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 11:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254773 - 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.14 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: Sat, 24 Aug 2013 11:17:26 -0000 Author: andre Date: Sat Aug 24 11:17:25 2013 New Revision: 254773 URL: http://svnweb.freebsd.org/changeset/base/254773 Log: Resolve the confusion between the head_list and the hook list. The linked list of pfil hooks is changed to "chain" and this term is applied consistently. The head_list remains with "list" term. Add KASSERT to vnet_pfil_uninit(). Update and extend comments. Reviewed by: eri (previous version) Modified: head/sys/net/pfil.c head/sys/net/pfil.h Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Sat Aug 24 10:38:02 2013 (r254772) +++ head/sys/net/pfil.c Sat Aug 24 11:17:25 2013 (r254773) @@ -52,9 +52,9 @@ static struct mtx pfil_global_lock; MTX_SYSINIT(pfil_heads_lock, &pfil_global_lock, "pfil_head_list lock", MTX_DEF); -static struct packet_filter_hook *pfil_hook_get(int, struct pfil_head *); -static int pfil_list_add(pfil_list_t *, struct packet_filter_hook *, int); -static int pfil_list_remove(pfil_list_t *, pfil_func_t, void *); +static struct packet_filter_hook *pfil_chain_get(int, struct pfil_head *); +static int pfil_chain_add(pfil_chain_t *, struct packet_filter_hook *, int); +static int pfil_chain_remove(pfil_chain_t *, pfil_func_t, void *); LIST_HEAD(pfilheadhead, pfil_head); VNET_DEFINE(struct pfilheadhead, pfil_head_list); @@ -63,7 +63,7 @@ VNET_DEFINE(struct rmlock, pfil_lock); #define V_pfil_lock VNET(pfil_lock) /* - * pfil_run_hooks() runs the specified packet filter hooks. + * pfil_run_hooks() runs the specified packet filter hook chain. */ int pfil_run_hooks(struct pfil_head *ph, struct mbuf **mp, struct ifnet *ifp, @@ -76,8 +76,8 @@ pfil_run_hooks(struct pfil_head *ph, str PFIL_RLOCK(ph, &rmpt); KASSERT(ph->ph_nhooks >= 0, ("Pfil hook count dropped < 0")); - for (pfh = pfil_hook_get(dir, ph); pfh != NULL; - pfh = TAILQ_NEXT(pfh, pfil_link)) { + for (pfh = pfil_chain_get(dir, ph); pfh != NULL; + pfh = TAILQ_NEXT(pfh, pfil_chain)) { if (pfh->pfil_func != NULL) { rv = (*pfh->pfil_func)(pfh->pfil_arg, &m, ifp, dir, inp); @@ -91,7 +91,7 @@ pfil_run_hooks(struct pfil_head *ph, str } static struct packet_filter_hook * -pfil_hook_get(int dir, struct pfil_head *ph) +pfil_chain_get(int dir, struct pfil_head *ph) { if (dir == PFIL_IN) @@ -163,6 +163,7 @@ pfil_wowned(struct pfil_head *ph) return (PFIL_WOWNED(ph)); } + /* * pfil_head_register() registers a pfil_head with the packet filter hook * mechanism. @@ -202,9 +203,9 @@ pfil_head_unregister(struct pfil_head *p PFIL_LIST_LOCK(); LIST_REMOVE(ph, ph_list); PFIL_LIST_UNLOCK(); - TAILQ_FOREACH_SAFE(pfh, &ph->ph_in, pfil_link, pfnext) + TAILQ_FOREACH_SAFE(pfh, &ph->ph_in, pfil_chain, pfnext) free(pfh, M_IFADDR); - TAILQ_FOREACH_SAFE(pfh, &ph->ph_out, pfil_link, pfnext) + TAILQ_FOREACH_SAFE(pfh, &ph->ph_out, pfil_chain, pfnext) free(pfh, M_IFADDR); PFIL_LOCK_DESTROY(ph); return (0); @@ -261,7 +262,7 @@ pfil_add_hook(pfil_func_t func, void *ar if (flags & PFIL_IN) { pfh1->pfil_func = func; pfh1->pfil_arg = arg; - err = pfil_list_add(&ph->ph_in, pfh1, flags & ~PFIL_OUT); + err = pfil_chain_add(&ph->ph_in, pfh1, flags & ~PFIL_OUT); if (err) goto locked_error; ph->ph_nhooks++; @@ -269,10 +270,10 @@ pfil_add_hook(pfil_func_t func, void *ar if (flags & PFIL_OUT) { pfh2->pfil_func = func; pfh2->pfil_arg = arg; - err = pfil_list_add(&ph->ph_out, pfh2, flags & ~PFIL_IN); + err = pfil_chain_add(&ph->ph_out, pfh2, flags & ~PFIL_IN); if (err) { if (flags & PFIL_IN) - pfil_list_remove(&ph->ph_in, func, arg); + pfil_chain_remove(&ph->ph_in, func, arg); goto locked_error; } ph->ph_nhooks++; @@ -291,7 +292,7 @@ error: /* * pfil_remove_hook removes a specific function from the packet filter hook - * list. + * chain. */ int pfil_remove_hook(pfil_func_t func, void *arg, int flags, struct pfil_head *ph) @@ -300,12 +301,12 @@ pfil_remove_hook(pfil_func_t func, void PFIL_WLOCK(ph); if (flags & PFIL_IN) { - err = pfil_list_remove(&ph->ph_in, func, arg); + err = pfil_chain_remove(&ph->ph_in, func, arg); if (err == 0) ph->ph_nhooks--; } if ((err == 0) && (flags & PFIL_OUT)) { - err = pfil_list_remove(&ph->ph_out, func, arg); + err = pfil_chain_remove(&ph->ph_out, func, arg); if (err == 0) ph->ph_nhooks--; } @@ -313,15 +314,18 @@ pfil_remove_hook(pfil_func_t func, void return (err); } +/* + * Internal: Add a new pfil hook into a hook chain. + */ static int -pfil_list_add(pfil_list_t *list, struct packet_filter_hook *pfh1, int flags) +pfil_chain_add(pfil_chain_t *chain, struct packet_filter_hook *pfh1, int flags) { struct packet_filter_hook *pfh; /* * First make sure the hook is not already there. */ - TAILQ_FOREACH(pfh, list, pfil_link) + TAILQ_FOREACH(pfh, chain, pfil_chain) if (pfh->pfil_func == pfh1->pfil_func && pfh->pfil_arg == pfh1->pfil_arg) return (EEXIST); @@ -331,24 +335,23 @@ pfil_list_add(pfil_list_t *list, struct * the same path is followed in or out of the kernel. */ if (flags & PFIL_IN) - TAILQ_INSERT_HEAD(list, pfh1, pfil_link); + TAILQ_INSERT_HEAD(chain, pfh1, pfil_chain); else - TAILQ_INSERT_TAIL(list, pfh1, pfil_link); + TAILQ_INSERT_TAIL(chain, pfh1, pfil_chain); return (0); } /* - * pfil_list_remove is an internal function that takes a function off the - * specified list. + * Internal: Remove a pfil hook from a hook chain. */ static int -pfil_list_remove(pfil_list_t *list, pfil_func_t func, void *arg) +pfil_chain_remove(pfil_chain_t *chain, pfil_func_t func, void *arg) { struct packet_filter_hook *pfh; - TAILQ_FOREACH(pfh, list, pfil_link) + TAILQ_FOREACH(pfh, chain, pfil_chain) if (pfh->pfil_func == func && pfh->pfil_arg == arg) { - TAILQ_REMOVE(list, pfh, pfil_link); + TAILQ_REMOVE(chain, pfh, pfil_chain); free(pfh, M_IFADDR); return (0); } @@ -375,7 +378,8 @@ static int vnet_pfil_uninit(const void *unused) { - /* XXX should panic if list is not empty */ + KASSERT(LIST_EMPTY(&V_pfil_head_list), + ("%s: pfil_head_list %p not empty", __func__, &V_pfil_head_list)); PFIL_LOCK_DESTROY_REAL(&V_pfil_lock); return (0); } Modified: head/sys/net/pfil.h ============================================================================== --- head/sys/net/pfil.h Sat Aug 24 10:38:02 2013 (r254772) +++ head/sys/net/pfil.h Sat Aug 24 11:17:25 2013 (r254773) @@ -48,10 +48,11 @@ typedef int (*pfil_func_t)(void *, struc /* * The packet filter hooks are designed for anything to call them to - * possibly intercept the packet. + * possibly intercept the packet. Multiple filter hooks are chained + * together and after each other in the specified order. */ struct packet_filter_hook { - TAILQ_ENTRY(packet_filter_hook) pfil_link; + TAILQ_ENTRY(packet_filter_hook) pfil_chain; pfil_func_t pfil_func; void *pfil_arg; }; @@ -61,16 +62,20 @@ struct packet_filter_hook { #define PFIL_WAITOK 0x00000004 #define PFIL_ALL (PFIL_IN|PFIL_OUT) -typedef TAILQ_HEAD(pfil_list, packet_filter_hook) pfil_list_t; +typedef TAILQ_HEAD(pfil_chain, packet_filter_hook) pfil_chain_t; #define PFIL_TYPE_AF 1 /* key is AF_* type */ #define PFIL_TYPE_IFNET 2 /* key is ifnet pointer */ #define PFIL_FLAG_PRIVATE_LOCK 0x01 /* Personal lock instead of global */ +/* + * A pfil head is created by each protocol or packet intercept point. + * For packet is then run through the hook chain for inspection. + */ struct pfil_head { - pfil_list_t ph_in; - pfil_list_t ph_out; + pfil_chain_t ph_in; + pfil_chain_t ph_out; int ph_type; int ph_nhooks; #if defined( __linux__ ) || defined( _WIN32 ) @@ -89,11 +94,20 @@ struct pfil_head { LIST_ENTRY(pfil_head) ph_list; }; +/* Public functions for pfil hook management by packet filters. */ +struct pfil_head *pfil_head_get(int, u_long); int pfil_add_hook(pfil_func_t, void *, int, struct pfil_head *); int pfil_remove_hook(pfil_func_t, void *, int, struct pfil_head *); + +/* Public functions to run the packet inspection by protocols. */ int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *, int, struct inpcb *inp); +/* Public functions for pfil head management by protocols. */ +int pfil_head_register(struct pfil_head *); +int pfil_head_unregister(struct pfil_head *); + +/* Internal pfil locking functions. */ struct rm_priotracker; /* Do not require including rmlock header */ int pfil_try_rlock(struct pfil_head *, struct rm_priotracker *); void pfil_rlock(struct pfil_head *, struct rm_priotracker *); @@ -102,11 +116,6 @@ void pfil_wlock(struct pfil_head *); void pfil_wunlock(struct pfil_head *); int pfil_wowned(struct pfil_head *ph); -int pfil_head_register(struct pfil_head *); -int pfil_head_unregister(struct pfil_head *); - -struct pfil_head *pfil_head_get(int, u_long); - #define PFIL_HOOKED(p) ((p)->ph_nhooks > 0) #define PFIL_LOCK_INIT_REAL(l, t) \ rm_init_flags(l, "PFil " t " rmlock", RM_RECURSE) From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 11:24: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 ESMTP id 522108C0; Sat, 24 Aug 2013 11:24:16 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 2591028AE; Sat, 24 Aug 2013 11:24: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 r7OBOGMa036421; Sat, 24 Aug 2013 11:24:16 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OBOFDL036419; Sat, 24 Aug 2013 11:24:15 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241124.r7OBOFDL036419@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 11:24:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254774 - 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.14 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: Sat, 24 Aug 2013 11:24:16 -0000 Author: andre Date: Sat Aug 24 11:24:15 2013 New Revision: 254774 URL: http://svnweb.freebsd.org/changeset/base/254774 Log: ename PFIL_LIST_[UN]LOCK() to PFIL_HEADLIST_[UN]LOCK() to avoid confusion with the pfil_head chain locking macros. Modified: head/sys/net/pfil.c head/sys/net/pfil.h Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Sat Aug 24 11:17:25 2013 (r254773) +++ head/sys/net/pfil.c Sat Aug 24 11:24:15 2013 (r254774) @@ -173,11 +173,11 @@ pfil_head_register(struct pfil_head *ph) { struct pfil_head *lph; - PFIL_LIST_LOCK(); + PFIL_HEADLIST_LOCK(); LIST_FOREACH(lph, &V_pfil_head_list, ph_list) { if (ph->ph_type == lph->ph_type && ph->ph_un.phu_val == lph->ph_un.phu_val) { - PFIL_LIST_UNLOCK(); + PFIL_HEADLIST_UNLOCK(); return (EEXIST); } } @@ -186,7 +186,7 @@ pfil_head_register(struct pfil_head *ph) TAILQ_INIT(&ph->ph_in); TAILQ_INIT(&ph->ph_out); LIST_INSERT_HEAD(&V_pfil_head_list, ph, ph_list); - PFIL_LIST_UNLOCK(); + PFIL_HEADLIST_UNLOCK(); return (0); } @@ -200,9 +200,9 @@ pfil_head_unregister(struct pfil_head *p { struct packet_filter_hook *pfh, *pfnext; - PFIL_LIST_LOCK(); + PFIL_HEADLIST_LOCK(); LIST_REMOVE(ph, ph_list); - PFIL_LIST_UNLOCK(); + PFIL_HEADLIST_UNLOCK(); TAILQ_FOREACH_SAFE(pfh, &ph->ph_in, pfil_chain, pfnext) free(pfh, M_IFADDR); TAILQ_FOREACH_SAFE(pfh, &ph->ph_out, pfil_chain, pfnext) @@ -219,11 +219,11 @@ pfil_head_get(int type, u_long val) { struct pfil_head *ph; - PFIL_LIST_LOCK(); + PFIL_HEADLIST_LOCK(); LIST_FOREACH(ph, &V_pfil_head_list, ph_list) if (ph->ph_type == type && ph->ph_un.phu_val == val) break; - PFIL_LIST_UNLOCK(); + PFIL_HEADLIST_UNLOCK(); return (ph); } Modified: head/sys/net/pfil.h ============================================================================== --- head/sys/net/pfil.h Sat Aug 24 11:17:25 2013 (r254773) +++ head/sys/net/pfil.h Sat Aug 24 11:24:15 2013 (r254774) @@ -138,7 +138,9 @@ int pfil_wowned(struct pfil_head *ph); #define PFIL_RUNLOCK(p, t) rm_runlock((p)->ph_plock, (t)) #define PFIL_WUNLOCK(p) rm_wunlock((p)->ph_plock) #define PFIL_WOWNED(p) rm_wowned((p)->ph_plock) -#define PFIL_LIST_LOCK() mtx_lock(&pfil_global_lock) -#define PFIL_LIST_UNLOCK() mtx_unlock(&pfil_global_lock) + +/* Internal locking macros for global/vnet pfil_head_list. */ +#define PFIL_HEADLIST_LOCK() mtx_lock(&pfil_global_lock) +#define PFIL_HEADLIST_UNLOCK() mtx_unlock(&pfil_global_lock) #endif /* _NET_PFIL_H_ */ From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 11:57:03 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 ESMTP id 298D72DB; Sat, 24 Aug 2013 11:57:03 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 16F9E2A48; Sat, 24 Aug 2013 11:57:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OBv2eF052726; Sat, 24 Aug 2013 11:57:02 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OBv2ZR052725; Sat, 24 Aug 2013 11:57:02 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241157.r7OBv2ZR052725@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 11:57:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254775 - head/share/man/man9 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.14 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: Sat, 24 Aug 2013 11:57:03 -0000 Author: andre Date: Sat Aug 24 11:57:02 2013 New Revision: 254775 URL: http://svnweb.freebsd.org/changeset/base/254775 Log: Adjust for the pfil_func_t typedef added in r254769. Modified: head/share/man/man9/pfil.9 Modified: head/share/man/man9/pfil.9 ============================================================================== --- head/share/man/man9/pfil.9 Sat Aug 24 11:24:15 2013 (r254774) +++ head/share/man/man9/pfil.9 Sat Aug 24 11:57:02 2013 (r254775) @@ -49,6 +49,8 @@ .In sys/mbuf.h .In net/if.h .In net/pfil.h +.Bd -literal +typedef int (*pfil_func_t)(void *arg, struct mbuf **mp, struct ifnet *, int dir, struct inpcb); .Ft int .Fn pfil_head_register "struct pfil_head *head" .Ft int @@ -56,11 +58,9 @@ .Ft "struct pfil_head *" .Fn pfil_head_get "int af" "u_long dlt" .Ft void -.Fn pfil_add_hook "int (*func)()" "void *arg" "int flags" "struct pfil_head *" +.Fn pfil_add_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *" .Ft void -.Fn pfil_remove_hook "int (*func)()" "void *arg" "int flags" "struct pfil_head *" -.Ft int -.Fn (*func) "void *arg" "struct mbuf **mp" "struct ifnet *" "int dir" "struct inpcb *" +.Fn pfil_remove_hook "pfil_func_t" "void *arg" "int flags" "struct pfil_head *" .Ft int .Fn pfil_run_hooks "struct pfil_head *head" "struct mbuf **mp" "struct ifnet *" "int dir" "struct inpcb *" .Ft void From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 11:59: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 ESMTP id 355DB428; Sat, 24 Aug 2013 11:59:53 +0000 (UTC) (envelope-from trociny@FreeBSD.org) 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 2238E2A58; Sat, 24 Aug 2013 11:59:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OBxrsp053601; Sat, 24 Aug 2013 11:59:53 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OBxq2E053594; Sat, 24 Aug 2013 11:59:52 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201308241159.r7OBxq2E053594@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 24 Aug 2013 11:59:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254776 - head/sys/netpfil/ipfw 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.14 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: Sat, 24 Aug 2013 11:59:53 -0000 Author: trociny Date: Sat Aug 24 11:59:51 2013 New Revision: 254776 URL: http://svnweb.freebsd.org/changeset/base/254776 Log: Make ipfw nat init/unint work correctly for VIMAGE: * Do per vnet instance cleanup (previously it was only for vnet0 on module unload, and led to libalias leaks and possible panics due to stale pointer dereferences). * Instead of protecting ipfw hooks registering/deregistering by only vnet0 lock (which does not prevent pointers access from another vnets), introduce per vnet ipfw_nat_loaded variable. The variable is set after hooks are registered and unset before they are deregistered. * Devirtualize ifaddr_event_tag as we run only one event handler for all vnets. * It is supposed that ifaddr_change event handler is called in the interface vnet context, so add an assertion. Reviewed by: zec MFC after: 2 weeks Modified: head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_nat.c head/sys/netpfil/ipfw/ip_fw_private.h Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Sat Aug 24 11:57:02 2013 (r254775) +++ head/sys/netpfil/ipfw/ip_fw2.c Sat Aug 24 11:59:51 2013 (r254776) @@ -142,6 +142,8 @@ VNET_DEFINE(int, verbose_limit); /* layer3_chain contains the list of rules for layer 3 */ VNET_DEFINE(struct ip_fw_chain, layer3_chain); +VNET_DEFINE(int, ipfw_nat_ready) = 0; + ipfw_nat_t *ipfw_nat_ptr = NULL; struct cfg_nat *(*lookup_nat_ptr)(struct nat_list *, int); ipfw_nat_cfg_t *ipfw_nat_cfg_ptr; Modified: head/sys/netpfil/ipfw/ip_fw_nat.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_nat.c Sat Aug 24 11:57:02 2013 (r254775) +++ head/sys/netpfil/ipfw/ip_fw_nat.c Sat Aug 24 11:59:51 2013 (r254776) @@ -53,8 +53,7 @@ __FBSDID("$FreeBSD$"); #include /* XXX for in_cksum */ -static VNET_DEFINE(eventhandler_tag, ifaddr_event_tag); -#define V_ifaddr_event_tag VNET(ifaddr_event_tag) +static eventhandler_tag ifaddr_event_tag; static void ifaddr_change(void *arg __unused, struct ifnet *ifp) @@ -63,6 +62,8 @@ ifaddr_change(void *arg __unused, struct struct ifaddr *ifa; struct ip_fw_chain *chain; + KASSERT(curvnet == ifp->if_vnet, + ("curvnet(%p) differs from iface vnet(%p)", curvnet, ifp->if_vnet)); chain = &V_layer3_chain; IPFW_WLOCK(chain); /* Check every nat entry... */ @@ -589,11 +590,38 @@ ipfw_nat_get_log(struct sockopt *sopt) return(0); } +static int +vnet_ipfw_nat_init(const void *arg __unused) +{ + + V_ipfw_nat_ready = 1; + return (0); +} + +static int +vnet_ipfw_nat_uninit(const void *arg __unused) +{ + struct cfg_nat *ptr, *ptr_temp; + struct ip_fw_chain *chain; + + chain = &V_layer3_chain; + IPFW_WLOCK(chain); + LIST_FOREACH_SAFE(ptr, &chain->nat, _next, ptr_temp) { + LIST_REMOVE(ptr, _next); + del_redir_spool_cfg(ptr, &ptr->redir_chain); + LibAliasUninit(ptr->lib); + free(ptr, M_IPFW); + } + flush_nat_ptrs(chain, -1 /* flush all */); + V_ipfw_nat_ready = 0; + IPFW_WUNLOCK(chain); + return (0); +} + static void ipfw_nat_init(void) { - IPFW_WLOCK(&V_layer3_chain); /* init ipfw hooks */ ipfw_nat_ptr = ipfw_nat; lookup_nat_ptr = lookup_nat; @@ -601,28 +629,16 @@ ipfw_nat_init(void) ipfw_nat_del_ptr = ipfw_nat_del; ipfw_nat_get_cfg_ptr = ipfw_nat_get_cfg; ipfw_nat_get_log_ptr = ipfw_nat_get_log; - IPFW_WUNLOCK(&V_layer3_chain); - V_ifaddr_event_tag = EVENTHANDLER_REGISTER( - ifaddr_event, ifaddr_change, + + ifaddr_event_tag = EVENTHANDLER_REGISTER(ifaddr_event, ifaddr_change, NULL, EVENTHANDLER_PRI_ANY); } static void ipfw_nat_destroy(void) { - struct cfg_nat *ptr, *ptr_temp; - struct ip_fw_chain *chain; - chain = &V_layer3_chain; - IPFW_WLOCK(chain); - LIST_FOREACH_SAFE(ptr, &chain->nat, _next, ptr_temp) { - LIST_REMOVE(ptr, _next); - del_redir_spool_cfg(ptr, &ptr->redir_chain); - LibAliasUninit(ptr->lib); - free(ptr, M_IPFW); - } - EVENTHANDLER_DEREGISTER(ifaddr_event, V_ifaddr_event_tag); - flush_nat_ptrs(chain, -1 /* flush all */); + EVENTHANDLER_DEREGISTER(ifaddr_event, ifaddr_event_tag); /* deregister ipfw_nat */ ipfw_nat_ptr = NULL; lookup_nat_ptr = NULL; @@ -630,7 +646,6 @@ ipfw_nat_destroy(void) ipfw_nat_del_ptr = NULL; ipfw_nat_get_cfg_ptr = NULL; ipfw_nat_get_log_ptr = NULL; - IPFW_WUNLOCK(chain); } static int @@ -640,11 +655,9 @@ ipfw_nat_modevent(module_t mod, int type switch (type) { case MOD_LOAD: - ipfw_nat_init(); break; case MOD_UNLOAD: - ipfw_nat_destroy(); break; default: @@ -660,8 +673,25 @@ static moduledata_t ipfw_nat_mod = { 0 }; -DECLARE_MODULE(ipfw_nat, ipfw_nat_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); +/* Define startup order. */ +#define IPFW_NAT_SI_SUB_FIREWALL SI_SUB_PROTO_IFATTACHDOMAIN +#define IPFW_NAT_MODEVENT_ORDER (SI_ORDER_ANY - 255) +#define IPFW_NAT_MODULE_ORDER (IPFW_NAT_MODEVENT_ORDER + 1) +#define IPFW_NAT_VNET_ORDER (IPFW_NAT_MODEVENT_ORDER + 2) + +DECLARE_MODULE(ipfw_nat, ipfw_nat_mod, IPFW_NAT_SI_SUB_FIREWALL, SI_ORDER_ANY); MODULE_DEPEND(ipfw_nat, libalias, 1, 1, 1); MODULE_DEPEND(ipfw_nat, ipfw, 2, 2, 2); MODULE_VERSION(ipfw_nat, 1); + +SYSINIT(ipfw_nat_init, IPFW_NAT_SI_SUB_FIREWALL, IPFW_NAT_MODULE_ORDER, + ipfw_nat_init, NULL); +VNET_SYSINIT(vnet_ipfw_nat_init, IPFW_NAT_SI_SUB_FIREWALL, IPFW_NAT_VNET_ORDER, + vnet_ipfw_nat_init, NULL); + +SYSUNINIT(ipfw_nat_destroy, IPFW_NAT_SI_SUB_FIREWALL, IPFW_NAT_MODULE_ORDER, + ipfw_nat_destroy, NULL); +VNET_SYSUNINIT(vnet_ipfw_nat_uninit, IPFW_NAT_SI_SUB_FIREWALL, + IPFW_NAT_VNET_ORDER, vnet_ipfw_nat_uninit, NULL); + /* end of file */ Modified: head/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_private.h Sat Aug 24 11:57:02 2013 (r254775) +++ head/sys/netpfil/ipfw/ip_fw_private.h Sat Aug 24 11:59:51 2013 (r254776) @@ -327,9 +327,11 @@ extern struct cfg_nat *(*lookup_nat_ptr) typedef int ipfw_nat_t(struct ip_fw_args *, struct cfg_nat *, struct mbuf *); typedef int ipfw_nat_cfg_t(struct sockopt *); -extern ipfw_nat_t *ipfw_nat_ptr; -#define IPFW_NAT_LOADED (ipfw_nat_ptr != NULL) +VNET_DECLARE(int, ipfw_nat_ready); +#define V_ipfw_nat_ready VNET(ipfw_nat_ready) +#define IPFW_NAT_LOADED (V_ipfw_nat_ready) +extern ipfw_nat_t *ipfw_nat_ptr; extern ipfw_nat_cfg_t *ipfw_nat_cfg_ptr; extern ipfw_nat_cfg_t *ipfw_nat_del_ptr; extern ipfw_nat_cfg_t *ipfw_nat_get_cfg_ptr; From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 12:03: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 ESMTP id 2FA677BF; Sat, 24 Aug 2013 12:03:25 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 1D6492AD4; Sat, 24 Aug 2013 12:03: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 r7OC3OKx056926; Sat, 24 Aug 2013 12:03:24 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OC3OQR056925; Sat, 24 Aug 2013 12:03:24 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241203.r7OC3OQR056925@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 12:03:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254777 - 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.14 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: Sat, 24 Aug 2013 12:03:25 -0000 Author: andre Date: Sat Aug 24 12:03:24 2013 New Revision: 254777 URL: http://svnweb.freebsd.org/changeset/base/254777 Log: Whitespace, style cleanups, and improved comments. Modified: head/sys/net/pfil.h Modified: head/sys/net/pfil.h ============================================================================== --- head/sys/net/pfil.h Sat Aug 24 11:59:51 2013 (r254776) +++ head/sys/net/pfil.h Sat Aug 24 12:03:24 2013 (r254777) @@ -52,9 +52,9 @@ typedef int (*pfil_func_t)(void *, struc * together and after each other in the specified order. */ struct packet_filter_hook { - TAILQ_ENTRY(packet_filter_hook) pfil_chain; - pfil_func_t pfil_func; - void *pfil_arg; + TAILQ_ENTRY(packet_filter_hook) pfil_chain; + pfil_func_t pfil_func; + void *pfil_arg; }; #define PFIL_IN 0x00000001 @@ -74,23 +74,23 @@ typedef TAILQ_HEAD(pfil_chain, packet_fi * For packet is then run through the hook chain for inspection. */ struct pfil_head { - pfil_chain_t ph_in; - pfil_chain_t ph_out; - int ph_type; - int ph_nhooks; + pfil_chain_t ph_in; + pfil_chain_t ph_out; + int ph_type; + int ph_nhooks; #if defined( __linux__ ) || defined( _WIN32 ) - rwlock_t ph_mtx; + rwlock_t ph_mtx; #else struct rmlock *ph_plock; /* Pointer to the used lock */ - struct rmlock ph_lock; /* Private lock storage */ - int flags; + struct rmlock ph_lock; /* Private lock storage */ + int flags; #endif union { - u_long phu_val; - void *phu_ptr; + u_long phu_val; + void *phu_ptr; } ph_un; -#define ph_af ph_un.phu_val -#define ph_ifnet ph_un.phu_ptr +#define ph_af ph_un.phu_val +#define ph_ifnet ph_un.phu_ptr LIST_ENTRY(pfil_head) ph_list; }; @@ -98,6 +98,7 @@ struct pfil_head { struct pfil_head *pfil_head_get(int, u_long); int pfil_add_hook(pfil_func_t, void *, int, struct pfil_head *); int pfil_remove_hook(pfil_func_t, void *, int, struct pfil_head *); +#define PFIL_HOOKED(p) ((p)->ph_nhooks > 0) /* Public functions to run the packet inspection by protocols. */ int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *, @@ -107,16 +108,16 @@ int pfil_run_hooks(struct pfil_head *, s int pfil_head_register(struct pfil_head *); int pfil_head_unregister(struct pfil_head *); -/* Internal pfil locking functions. */ +/* Public pfil locking functions for self managed locks by packet filters. */ struct rm_priotracker; /* Do not require including rmlock header */ -int pfil_try_rlock(struct pfil_head *, struct rm_priotracker *); -void pfil_rlock(struct pfil_head *, struct rm_priotracker *); -void pfil_runlock(struct pfil_head *, struct rm_priotracker *); -void pfil_wlock(struct pfil_head *); -void pfil_wunlock(struct pfil_head *); -int pfil_wowned(struct pfil_head *ph); +int pfil_try_rlock(struct pfil_head *, struct rm_priotracker *); +void pfil_rlock(struct pfil_head *, struct rm_priotracker *); +void pfil_runlock(struct pfil_head *, struct rm_priotracker *); +void pfil_wlock(struct pfil_head *); +void pfil_wunlock(struct pfil_head *); +int pfil_wowned(struct pfil_head *ph); -#define PFIL_HOOKED(p) ((p)->ph_nhooks > 0) +/* Internal pfil locking functions. */ #define PFIL_LOCK_INIT_REAL(l, t) \ rm_init_flags(l, "PFil " t " rmlock", RM_RECURSE) #define PFIL_LOCK_DESTROY_REAL(l) \ @@ -132,6 +133,7 @@ int pfil_wowned(struct pfil_head *ph); if ((p)->flags & PFIL_FLAG_PRIVATE_LOCK) \ PFIL_LOCK_DESTROY_REAL((p)->ph_plock); \ } while (0) + #define PFIL_TRY_RLOCK(p, t) rm_try_rlock((p)->ph_plock, (t)) #define PFIL_RLOCK(p, t) rm_rlock((p)->ph_plock, (t)) #define PFIL_WLOCK(p) rm_wlock((p)->ph_plock) From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 12:24:59 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 ESMTP id 6AADEF9F; Sat, 24 Aug 2013 12:24:59 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 3D64A2BC1; Sat, 24 Aug 2013 12:24:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OCOxaU069851; Sat, 24 Aug 2013 12:24:59 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OCOx9l069850; Sat, 24 Aug 2013 12:24:59 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241224.r7OCOx9l069850@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 12:24:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254779 - 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.14 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: Sat, 24 Aug 2013 12:24:59 -0000 Author: andre Date: Sat Aug 24 12:24:58 2013 New Revision: 254779 URL: http://svnweb.freebsd.org/changeset/base/254779 Log: Avoid code duplication for mbuf initialization and use m_init() instead in mb_ctor_mbuf() and mb_ctor_pack(). Modified: head/sys/kern/kern_mbuf.c Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat Aug 24 12:10:11 2013 (r254778) +++ head/sys/kern/kern_mbuf.c Sat Aug 24 12:24:58 2013 (r254779) @@ -410,18 +410,14 @@ mb_ctor_mbuf(void *mem, int size, void * { struct mbuf *m; struct mb_args *args; -#ifdef MAC int error; -#endif int flags; short type; #ifdef INVARIANTS trash_ctor(mem, size, arg, how); #endif - m = (struct mbuf *)mem; args = (struct mb_args *)arg; - flags = args->flags; type = args->type; /* @@ -431,32 +427,12 @@ mb_ctor_mbuf(void *mem, int size, void * if (type == MT_NOINIT) return (0); - m->m_next = NULL; - m->m_nextpkt = NULL; - m->m_len = 0; - m->m_flags = flags; - m->m_type = type; - if (flags & M_PKTHDR) { - m->m_data = m->m_pktdat; - m->m_pkthdr.rcvif = NULL; - m->m_pkthdr.header = NULL; - m->m_pkthdr.len = 0; - m->m_pkthdr.csum_flags = 0; - m->m_pkthdr.csum_data = 0; - m->m_pkthdr.tso_segsz = 0; - m->m_pkthdr.ether_vtag = 0; - m->m_pkthdr.flowid = 0; - m->m_pkthdr.fibnum = 0; - SLIST_INIT(&m->m_pkthdr.tags); -#ifdef MAC - /* If the label init fails, fail the alloc */ - error = mac_mbuf_init(m, how); - if (error) - return (error); -#endif - } else - m->m_data = m->m_dat; - return (0); + m = (struct mbuf *)mem; + flags = args->flags; + + error = m_init(m, NULL, size, how, type, flags); + + return (error); } /* @@ -656,34 +632,14 @@ mb_ctor_pack(void *mem, int size, void * #ifdef INVARIANTS trash_ctor(m->m_ext.ext_buf, MCLBYTES, arg, how); #endif - m->m_next = NULL; - m->m_nextpkt = NULL; - m->m_data = m->m_ext.ext_buf; - m->m_len = 0; - m->m_flags = (flags | M_EXT); - m->m_type = type; - - if (flags & M_PKTHDR) { - m->m_pkthdr.rcvif = NULL; - m->m_pkthdr.len = 0; - m->m_pkthdr.header = NULL; - m->m_pkthdr.csum_flags = 0; - m->m_pkthdr.csum_data = 0; - m->m_pkthdr.tso_segsz = 0; - m->m_pkthdr.ether_vtag = 0; - m->m_pkthdr.flowid = 0; - m->m_pkthdr.fibnum = 0; - SLIST_INIT(&m->m_pkthdr.tags); -#ifdef MAC - /* If the label init fails, fail the alloc */ - error = mac_mbuf_init(m, how); - if (error) - return (error); -#endif - } + + error = m_init(m, NULL, size, how, type, flags); + /* m_ext is already initialized. */ + m->m_data = m->m_ext.ext_buf; + m->m_flags = (flags | M_EXT); - return (0); + return (error); } int From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 13:15:43 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 ESMTP id 3D6E6D26; Sat, 24 Aug 2013 13:15:43 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 2B4BC2DEB; Sat, 24 Aug 2013 13:15: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 r7ODFhqV003254; Sat, 24 Aug 2013 13:15:43 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7ODFgtK003250; Sat, 24 Aug 2013 13:15:42 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241315.r7ODFgtK003250@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 13:15:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254780 - in head/sys: kern 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.14 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: Sat, 24 Aug 2013 13:15:43 -0000 Author: andre Date: Sat Aug 24 13:15:42 2013 New Revision: 254780 URL: http://svnweb.freebsd.org/changeset/base/254780 Log: dd a 24 bits wide ext_flags field to m_ext by reducing ext_type to 8 bits. ext_type is an enumerator and the number of types we have is a mere dozen. A couple of ext_types are renumbered to fit within 8 bits. EXT_VENDOR[1-4] and EXT_EXP[1-4] types for vendor-internal and experimental local mapping. The ext_flags field is currently unused but has a couple of flags already defined for future use. Again vendor and experimental flags are provided for local mapping. EXT_FLAG_BITS is provided for the printf(9) %b identifier. Initialize and copy ext_flags in the relevant mbuf functions. Improve alignment and packing of struct m_ext on 32 and 64 archs by carefully sorting the fields. Modified: head/sys/kern/kern_mbuf.c head/sys/kern/uipc_mbuf.c head/sys/sys/mbuf.h Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat Aug 24 12:24:58 2013 (r254779) +++ head/sys/kern/kern_mbuf.c Sat Aug 24 13:15:42 2013 (r254780) @@ -547,6 +547,7 @@ mb_ctor_clust(void *mem, int size, void m->m_ext.ext_arg2 = NULL; m->m_ext.ext_size = size; m->m_ext.ext_type = type; + m->m_ext.ext_flags = 0; m->m_ext.ref_cnt = refcnt; } Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Sat Aug 24 12:24:58 2013 (r254779) +++ head/sys/kern/uipc_mbuf.c Sat Aug 24 13:15:42 2013 (r254780) @@ -267,6 +267,7 @@ m_extadd(struct mbuf *mb, caddr_t buf, u mb->m_ext.ext_arg1 = arg1; mb->m_ext.ext_arg2 = arg2; mb->m_ext.ext_type = type; + mb->m_ext.ext_flags = 0; return (0); } @@ -342,6 +343,7 @@ mb_free_ext(struct mbuf *m) m->m_ext.ref_cnt = NULL; m->m_ext.ext_size = 0; m->m_ext.ext_type = 0; + m->m_ext.ext_flags = 0; m->m_flags &= ~M_EXT; uma_zfree(zone_mbuf, m); } @@ -368,6 +370,7 @@ mb_dupcl(struct mbuf *n, struct mbuf *m) n->m_ext.ext_size = m->m_ext.ext_size; n->m_ext.ref_cnt = m->m_ext.ref_cnt; n->m_ext.ext_type = m->m_ext.ext_type; + n->m_ext.ext_flags = m->m_ext.ext_flags; n->m_flags |= M_EXT; n->m_flags |= m->m_flags & M_RDONLY; } Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat Aug 24 12:24:58 2013 (r254779) +++ head/sys/sys/mbuf.h Sat Aug 24 13:15:42 2013 (r254780) @@ -138,16 +138,19 @@ struct pkthdr { /* * Description of external storage mapped into mbuf; valid only if M_EXT is * set. + * Size ILP32: 28 + * LP64: 48 */ struct m_ext { + volatile u_int *ref_cnt; /* pointer to ref count info */ caddr_t ext_buf; /* start of buffer */ + uint32_t ext_size; /* size of buffer, for ext_free */ + uint32_t ext_type:8, /* type of external storage */ + ext_flags:24; /* external storage mbuf flags */ void (*ext_free) /* free routine if not the usual */ (void *, void *); void *ext_arg1; /* optional argument pointer */ void *ext_arg2; /* optional argument pointer */ - u_int ext_size; /* size of buffer, for ext_free */ - volatile u_int *ref_cnt; /* pointer to ref count info */ - int ext_type; /* type of external storage */ }; /* @@ -269,7 +272,7 @@ struct mbuf { M_PROTOFLAGS|M_HASHTYPEBITS) /* - * External buffer types: identify ext_buf type. + * External mbuf storage buffer types. */ #define EXT_CLUSTER 1 /* mbuf cluster */ #define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */ @@ -278,10 +281,48 @@ struct mbuf { #define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */ #define EXT_PACKET 6 /* mbuf+cluster from packet zone */ #define EXT_MBUF 7 /* external mbuf reference (M_IOVEC) */ -#define EXT_NET_DRV 100 /* custom ext_buf provided by net driver(s) */ -#define EXT_MOD_TYPE 200 /* custom module's ext_buf type */ -#define EXT_DISPOSABLE 300 /* can throw this buffer away w/page flipping */ -#define EXT_EXTREF 400 /* has externally maintained ref_cnt ptr */ + +#define EXT_VENDOR1 224 /* for vendor-internal use */ +#define EXT_VENDOR2 225 /* for vendor-internal use */ +#define EXT_VENDOR3 226 /* for vendor-internal use */ +#define EXT_VENDOR4 227 /* for vendor-internal use */ + +#define EXT_EXP1 244 /* for experimental use */ +#define EXT_EXP2 245 /* for experimental use */ +#define EXT_EXP3 246 /* for experimental use */ +#define EXT_EXP4 247 /* for experimental use */ + +#define EXT_NET_DRV 252 /* custom ext_buf provided by net driver(s) */ +#define EXT_MOD_TYPE 253 /* custom module's ext_buf type */ +#define EXT_DISPOSABLE 254 /* can throw this buffer away w/page flipping */ +#define EXT_EXTREF 255 /* has externally maintained ref_cnt ptr */ + +/* + * Flags for external mbuf buffer types. + * NB: limited to the lower 24 bits. + */ +#define EXT_FLAG_EMBREF 0x000001 /* embedded ref_cnt, notyet */ +#define EXT_FLAG_EXTREF 0x000002 /* external ref_cnt, notyet */ +#define EXT_FLAG_NOFREE 0x000010 /* don't free mbuf to pool, notyet */ + +#define EXT_FLAG_VENDOR1 0x010000 /* for vendor-internal use */ +#define EXT_FLAG_VENDOR2 0x020000 /* for vendor-internal use */ +#define EXT_FLAG_VENDOR3 0x040000 /* for vendor-internal use */ +#define EXT_FLAG_VENDOR4 0x080000 /* for vendor-internal use */ + +#define EXT_FLAG_EXP1 0x100000 /* for experimental use */ +#define EXT_FLAG_EXP2 0x200000 /* for experimental use */ +#define EXT_FLAG_EXP3 0x400000 /* for experimental use */ +#define EXT_FLAG_EXP4 0x800000 /* for experimental use */ + +/* + * EXT flag description for use with printf(9) %b identifier. + */ +#define EXT_FLAG_BITS \ + "\20\1EXT_FLAG_EMBREF\2EXT_FLAG_EXTREF\5EXT_FLAG_NOFREE" \ + "\21EXT_FLAG_VENDOR1\22EXT_FLAG_VENDOR2\23EXT_FLAG_VENDOR3" \ + "\24EXT_FLAG_VENDOR4\25EXT_FLAG_EXP1\26EXT_FLAG_EXP2\27EXT_FLAG_EXP3" \ + "\30EXT_FLAG_EXP4" /* * Flags indicating hw checksum support and sw checksum requirements. This @@ -605,6 +646,7 @@ m_cljset(struct mbuf *m, void *cl, int t m->m_ext.ext_free = m->m_ext.ext_arg1 = m->m_ext.ext_arg2 = NULL; m->m_ext.ext_size = size; m->m_ext.ext_type = type; + m->m_ext.ext_flags = 0; m->m_ext.ref_cnt = uma_find_refcnt(zone, cl); m->m_flags |= M_EXT; From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 13:34:37 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 ESMTP id 740A6F4C; Sat, 24 Aug 2013 13:34:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) 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 616BC2E8D; Sat, 24 Aug 2013 13:34: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 r7ODYbDs015526; Sat, 24 Aug 2013 13:34:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7ODYbnT015525; Sat, 24 Aug 2013 13:34:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201308241334.r7ODYbnT015525@svn.freebsd.org> From: Alexander Motin Date: Sat, 24 Aug 2013 13:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254781 - head/sys/netpfil/ipfw 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.14 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: Sat, 24 Aug 2013 13:34:37 -0000 Author: mav Date: Sat Aug 24 13:34:36 2013 New Revision: 254781 URL: http://svnweb.freebsd.org/changeset/base/254781 Log: Make dummynet use new direct callout(9) execution mechanism. Since the only thing done by the dummynet handler is taskqueue_enqueue() call, it doesn't need extra switch to the clock SWI context. On idle system this change in half reduces number of active CPU cycles and wakes up only one CPU from sleep instead of two. I was going to make this change much earlier as part of calloutng project, but waited for better solution with skipping idle ticks to be implemented. Unfortunately with 10.0 release coming it is better get at least this. Modified: head/sys/netpfil/ipfw/ip_dummynet.c Modified: head/sys/netpfil/ipfw/ip_dummynet.c ============================================================================== --- head/sys/netpfil/ipfw/ip_dummynet.c Sat Aug 24 13:15:42 2013 (r254780) +++ head/sys/netpfil/ipfw/ip_dummynet.c Sat Aug 24 13:34:36 2013 (r254781) @@ -82,13 +82,15 @@ dummynet(void *arg) { (void)arg; /* UNUSED */ - taskqueue_enqueue(dn_tq, &dn_task); + taskqueue_enqueue_fast(dn_tq, &dn_task); } void dn_reschedule(void) { - callout_reset(&dn_timeout, 1, dummynet, NULL); + + callout_reset_sbt(&dn_timeout, tick_sbt, 0, dummynet, NULL, + C_HARDCLOCK | C_DIRECT_EXEC); } /*----- end of callout hooks -----*/ @@ -2159,12 +2161,12 @@ ip_dn_init(void) DN_LOCK_INIT(); TASK_INIT(&dn_task, 0, dummynet_task, curvnet); - dn_tq = taskqueue_create("dummynet", M_WAITOK, + dn_tq = taskqueue_create_fast("dummynet", M_WAITOK, taskqueue_thread_enqueue, &dn_tq); taskqueue_start_threads(&dn_tq, 1, PI_NET, "dummynet"); callout_init(&dn_timeout, CALLOUT_MPSAFE); - callout_reset(&dn_timeout, 1, dummynet, NULL); + dn_reschedule(); /* Initialize curr_time adjustment mechanics. */ getmicrouptime(&dn_cfg.prev_t); From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 14:41: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 ESMTP id 18E8E2B0; Sat, 24 Aug 2013 14:41:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) 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 06CC5218B; Sat, 24 Aug 2013 14:41: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 r7OEfnQe060672; Sat, 24 Aug 2013 14:41:49 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OEfnFx060671; Sat, 24 Aug 2013 14:41:49 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201308241441.r7OEfnFx060671@svn.freebsd.org> From: Alexander Motin Date: Sat, 24 Aug 2013 14:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254787 - 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.14 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: Sat, 24 Aug 2013 14:41:50 -0000 Author: mav Date: Sat Aug 24 14:41:49 2013 New Revision: 254787 URL: http://svnweb.freebsd.org/changeset/base/254787 Log: MFprojects/camlock r254460: Remove locking from taskqueue_member(). The list of threads is static during the taskqueue life cycle, so there is no need to protect it, taking quite congested lock several more times for each ZFS I/O. Modified: head/sys/kern/subr_taskqueue.c Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Sat Aug 24 14:33:11 2013 (r254786) +++ head/sys/kern/subr_taskqueue.c Sat Aug 24 14:41:49 2013 (r254787) @@ -620,7 +620,6 @@ taskqueue_member(struct taskqueue *queue { int i, j, ret = 0; - TQ_LOCK(queue); for (i = 0, j = 0; ; i++) { if (queue->tq_threads[i] == NULL) continue; @@ -631,6 +630,5 @@ taskqueue_member(struct taskqueue *queue if (++j >= queue->tq_tcount) break; } - TQ_UNLOCK(queue); return (ret); } From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 15:27:22 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 ESMTP id A7D1EECC; Sat, 24 Aug 2013 15:27:22 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 320472392; Sat, 24 Aug 2013 15:27:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id r7OFRJ8I096603; Sat, 24 Aug 2013 19:27:19 +0400 (MSK) (envelope-from marck@rinet.ru) Date: Sat, 24 Aug 2013 19:27:19 +0400 (MSK) From: Dmitry Morozovsky To: Alexander Motin Subject: Re: svn commit: r254787 - head/sys/kern In-Reply-To: <201308241441.r7OEfnFx060671@svn.freebsd.org> Message-ID: References: <201308241441.r7OEfnFx060671@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (woozle.rinet.ru [0.0.0.0]); Sat, 24 Aug 2013 19:27:19 +0400 (MSK) 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.14 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: Sat, 24 Aug 2013 15:27:22 -0000 On Sat, 24 Aug 2013, Alexander Motin wrote: > MFprojects/camlock r254460: > Remove locking from taskqueue_member(). The list of threads is static > during the taskqueue life cycle, so there is no need to protect it, > taking quite congested lock several more times for each ZFS I/O. Great, thanks! Any chances to MFC this to 9? -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 15:33: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 ESMTP id 9F003ED; Sat, 24 Aug 2013 15:33:09 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-ea0-x232.google.com (mail-ea0-x232.google.com [IPv6:2a00:1450:4013:c01::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D673A23E4; Sat, 24 Aug 2013 15:33:08 +0000 (UTC) Received: by mail-ea0-f178.google.com with SMTP id a15so806861eae.9 for ; Sat, 24 Aug 2013 08:33:07 -0700 (PDT) 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=MAQk8EFM2bx/mXyK3bhXloYvvSWS9ljhXGrDQQQZ88Q=; b=cj71u4NyU7ePTsVLderqLICaxF9WoUIQaVIAnw9kjQxNNCFFv4d+j2tnmNaEWT5mmS kStjYhg9XD6P2lN2It0fsM05IjcLoMk8n55QfyTRJM7Wk6mY8JrthCbxgEarVynzEz3U sU7sazLbsA+1BK/hoo3yjMLGrkQ38KFdhSaqo35mHeoz++ih1C3gnVt8Z7ViZD+YBPSe TIemum+21ByPPh+AxPfECgnil4FtaWAHPmSI4mTZznbPcbhmGRroHNrHfFnU5AfA3DUL fSWw/VB5lAJfJmtZ+iiDrK+IzNFrAFoOXhZU1tgiqw85N6JbUrJylxFQWnqVz3c4yGgQ 6x1w== X-Received: by 10.14.208.194 with SMTP id q42mr8776207eeo.31.1377358387142; Sat, 24 Aug 2013 08:33:07 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([37.229.21.195]) by mx.google.com with ESMTPSA id z12sm7534762eev.6.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 24 Aug 2013 08:33:06 -0700 (PDT) Sender: Alexander Motin Message-ID: <5218D22F.8000009@FreeBSD.org> Date: Sat, 24 Aug 2013 18:33:03 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130616 Thunderbird/17.0.6 MIME-Version: 1.0 To: Dmitry Morozovsky Subject: Re: svn commit: r254787 - head/sys/kern References: <201308241441.r7OEfnFx060671@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.14 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: Sat, 24 Aug 2013 15:33:09 -0000 On 24.08.2013 18:27, Dmitry Morozovsky wrote: > On Sat, 24 Aug 2013, Alexander Motin wrote: > >> MFprojects/camlock r254460: >> Remove locking from taskqueue_member(). The list of threads is static >> during the taskqueue life cycle, so there is no need to protect it, >> taking quite congested lock several more times for each ZFS I/O. > > Great, thanks! > > Any chances to MFC this to 9? I don't see any problem to do it after some time. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 15:33: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 ESMTP id 7D0A11CF; Sat, 24 Aug 2013 15:33:18 +0000 (UTC) (envelope-from emaste@FreeBSD.org) 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 69CD123E5; Sat, 24 Aug 2013 15:33: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 r7OFXIDn088687; Sat, 24 Aug 2013 15:33:18 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OFXHtW088677; Sat, 24 Aug 2013 15:33:17 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201308241533.r7OFXHtW088677@svn.freebsd.org> From: Ed Maste Date: Sat, 24 Aug 2013 15:33:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254790 - in head/contrib/llvm: include/llvm/MC lib/MC lib/Target/X86/InstPrinter 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.14 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: Sat, 24 Aug 2013 15:33:18 -0000 Author: emaste Date: Sat Aug 24 15:33:17 2013 New Revision: 254790 URL: http://svnweb.freebsd.org/changeset/base/254790 Log: Import llvm r187614 (git 44c8e34), for lldb's use: Author: Daniel Malea Date: Thu Aug 1 21:18:16 2013 +0000 Fixed the Intel-syntax X86 disassembler to respect the (existing) option for hexadecimal immediates, to match AT&T syntax. This also brings a new option for C-vs-MASM-style hex. Patch by Richard Mitton Reviewed: http://llvm-reviews.chandlerc.com/D1243 Modified: head/contrib/llvm/include/llvm/MC/MCInstPrinter.h head/contrib/llvm/lib/MC/MCInstPrinter.cpp head/contrib/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp head/contrib/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp Modified: head/contrib/llvm/include/llvm/MC/MCInstPrinter.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCInstPrinter.h Sat Aug 24 15:09:05 2013 (r254789) +++ head/contrib/llvm/include/llvm/MC/MCInstPrinter.h Sat Aug 24 15:33:17 2013 (r254790) @@ -21,6 +21,13 @@ class MCInstrInfo; class MCRegisterInfo; class StringRef; +namespace HexStyle { + enum Style { + C, ///< 0xff + Asm ///< 0ffh + }; +} + /// MCInstPrinter - This is an instance of a target assembly language printer /// that converts an MCInst to valid target assembly syntax. class MCInstPrinter { @@ -42,13 +49,16 @@ protected: /// True if we are printing immediates as hex. bool PrintImmHex; + /// Which style to use for printing hexadecimal values. + HexStyle::Style PrintHexStyle; + /// Utility function for printing annotations. void printAnnotation(raw_ostream &OS, StringRef Annot); public: MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri) : CommentStream(0), MAI(mai), MII(mii), MRI(mri), AvailableFeatures(0), - UseMarkup(0), PrintImmHex(0) {} + UseMarkup(0), PrintImmHex(0), PrintHexStyle(HexStyle::C) {} virtual ~MCInstPrinter(); @@ -80,8 +90,16 @@ public: bool getPrintImmHex() const { return PrintImmHex; } void setPrintImmHex(bool Value) { PrintImmHex = Value; } + HexStyle::Style getPrintHexStyleHex() const { return PrintHexStyle; } + void setPrintImmHex(HexStyle::Style Value) { PrintHexStyle = Value; } + /// Utility function to print immediates in decimal or hex. - format_object1 formatImm(const int64_t Value) const; + format_object1 formatImm(const int64_t Value) const { return PrintImmHex ? formatHex(Value) : formatDec(Value); } + + /// Utility functions to print decimal/hexadecimal values. + format_object1 formatDec(const int64_t Value) const; + format_object1 formatHex(const int64_t Value) const; + format_object1 formatHex(const uint64_t Value) const; }; } // namespace llvm Modified: head/contrib/llvm/lib/MC/MCInstPrinter.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCInstPrinter.cpp Sat Aug 24 15:09:05 2013 (r254789) +++ head/contrib/llvm/lib/MC/MCInstPrinter.cpp Sat Aug 24 15:33:17 2013 (r254790) @@ -52,10 +52,53 @@ StringRef MCInstPrinter::markup(StringRe return b; } -/// Utility function to print immediates in decimal or hex. -format_object1 MCInstPrinter::formatImm(const int64_t Value) const { - if (getPrintImmHex()) - return format("0x%" PRIx64, Value); - else - return format("%" PRId64, Value); +// For asm-style hex (e.g. 0ffh) the first digit always has to be a number. +static bool needsLeadingZero(uint64_t Value) +{ + while(Value) + { + uint64_t digit = (Value >> 60) & 0xf; + if (digit != 0) + return (digit >= 0xa); + Value <<= 4; + } + return false; +} + +format_object1 MCInstPrinter::formatDec(const int64_t Value) const { + return format("%" PRId64, Value); +} + +format_object1 MCInstPrinter::formatHex(const int64_t Value) const { + switch(PrintHexStyle) { + case HexStyle::C: + if (Value < 0) + return format("-0x%" PRIx64, -Value); + else + return format("0x%" PRIx64, Value); + case HexStyle::Asm: + if (Value < 0) { + if (needsLeadingZero((uint64_t)(-Value))) + return format("-0%" PRIx64 "h", -Value); + else + return format("-%" PRIx64 "h", -Value); + } else { + if (needsLeadingZero((uint64_t)(Value))) + return format("0%" PRIx64 "h", Value); + else + return format("%" PRIx64 "h", Value); + } + } +} + +format_object1 MCInstPrinter::formatHex(const uint64_t Value) const { + switch(PrintHexStyle) { + case HexStyle::C: + return format("0x%" PRIx64, Value); + case HexStyle::Asm: + if (needsLeadingZero(Value)) + return format("0%" PRIx64 "h", Value); + else + return format("%" PRIx64 "h", Value); + } } Modified: head/contrib/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp Sat Aug 24 15:09:05 2013 (r254789) +++ head/contrib/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp Sat Aug 24 15:33:17 2013 (r254790) @@ -139,8 +139,7 @@ void X86ATTInstPrinter::printPCRelImm(co const MCConstantExpr *BranchTarget = dyn_cast(Op.getExpr()); int64_t Address; if (BranchTarget && BranchTarget->EvaluateAsAbsolute(Address)) { - O << "0x"; - O.write_hex(Address); + O << formatHex((uint64_t)Address); } else { // Otherwise, just print the expression. Modified: head/contrib/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp Sat Aug 24 15:09:05 2013 (r254789) +++ head/contrib/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp Sat Aug 24 15:33:17 2013 (r254790) @@ -119,7 +119,7 @@ void X86IntelInstPrinter::printPCRelImm( raw_ostream &O) { const MCOperand &Op = MI->getOperand(OpNo); if (Op.isImm()) - O << Op.getImm(); + O << formatImm(Op.getImm()); else { assert(Op.isExpr() && "unknown pcrel immediate operand"); // If a symbolic branch target was added as a constant expression then print @@ -127,8 +127,7 @@ void X86IntelInstPrinter::printPCRelImm( const MCConstantExpr *BranchTarget = dyn_cast(Op.getExpr()); int64_t Address; if (BranchTarget && BranchTarget->EvaluateAsAbsolute(Address)) { - O << "0x"; - O.write_hex(Address); + O << formatHex((uint64_t)Address); } else { // Otherwise, just print the expression. @@ -148,7 +147,7 @@ void X86IntelInstPrinter::printOperand(c if (Op.isReg()) { PrintRegName(O, getRegisterName(Op.getReg())); } else if (Op.isImm()) { - O << Op.getImm(); + O << formatImm((int64_t)Op.getImm()); } else { assert(Op.isExpr() && "unknown operand kind in printOperand"); O << *Op.getExpr(); @@ -200,7 +199,7 @@ void X86IntelInstPrinter::printMemRefere DispVal = -DispVal; } } - O << DispVal; + O << formatImm(DispVal); } } From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 15:41: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 ESMTP id 4357F51E; Sat, 24 Aug 2013 15:41:37 +0000 (UTC) (envelope-from uqs@FreeBSD.org) 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 314C62457; Sat, 24 Aug 2013 15:41: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 r7OFfbu6093418; Sat, 24 Aug 2013 15:41:37 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OFfbes093416; Sat, 24 Aug 2013 15:41:37 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201308241541.r7OFfbes093416@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 24 Aug 2013 15:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254791 - head/sys/modules/vmware/vmxnet3 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.14 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: Sat, 24 Aug 2013 15:41:37 -0000 Author: uqs Date: Sat Aug 24 15:41:36 2013 New Revision: 254791 URL: http://svnweb.freebsd.org/changeset/base/254791 Log: Include bsd.own.mk before trying to check MK_* values. Modified: head/sys/modules/vmware/vmxnet3/Makefile Modified: head/sys/modules/vmware/vmxnet3/Makefile ============================================================================== --- head/sys/modules/vmware/vmxnet3/Makefile Sat Aug 24 15:33:17 2013 (r254790) +++ head/sys/modules/vmware/vmxnet3/Makefile Sat Aug 24 15:41:36 2013 (r254791) @@ -23,6 +23,8 @@ # SUCH DAMAGE. # +.include + .PATH: ${.CURDIR}/../../../dev/vmware/vmxnet3 KMOD= if_vmx From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 15:47: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 ESMTP id 1AC9E90D; Sat, 24 Aug 2013 15:47:16 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) 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 EB93324A5; Sat, 24 Aug 2013 15:47: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 r7OFlFYc095272; Sat, 24 Aug 2013 15:47:15 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OFlFv0095270; Sat, 24 Aug 2013 15:47:15 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201308241547.r7OFlFv0095270@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 24 Aug 2013 15:47:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254792 - head/sys/dev/drm2 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.14 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: Sat, 24 Aug 2013 15:47:16 -0000 Author: dumbbell Date: Sat Aug 24 15:47:15 2013 New Revision: 254792 URL: http://svnweb.freebsd.org/changeset/base/254792 Log: drm: Call drm_global_init() & drm_global_release() at module load/unload Added: head/sys/dev/drm2/drm_core.h (contents, props changed) Modified: head/sys/dev/drm2/drm_drv.c Added: head/sys/dev/drm2/drm_core.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm2/drm_core.h Sat Aug 24 15:47:15 2013 (r254792) @@ -0,0 +1,38 @@ +/* + * Copyright 2004 Jon Smirl + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#define CORE_AUTHOR "Gareth Hughes, Leif Delgass, José Fonseca, Jon Smirl" + +#define CORE_NAME "drm" +#define CORE_DESC "DRM shared core routines" +#define CORE_DATE "20060810" + +#define DRM_IF_MAJOR 1 +#define DRM_IF_MINOR 4 + +#define CORE_MAJOR 1 +#define CORE_MINOR 1 +#define CORE_PATCHLEVEL 0 Modified: head/sys/dev/drm2/drm_drv.c ============================================================================== --- head/sys/dev/drm2/drm_drv.c Sat Aug 24 15:41:36 2013 (r254791) +++ head/sys/dev/drm2/drm_drv.c Sat Aug 24 15:47:15 2013 (r254792) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -78,7 +80,7 @@ static moduledata_t drm_mod = { "drmn", drm_modevent, 0 -}; +}; DECLARE_MODULE(drmn, drm_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(drmn, 1); MODULE_DEPEND(drmn, agp, 1, 1, 1); @@ -210,7 +212,7 @@ static struct drm_msi_blacklist_entry dr static int drm_msi_is_blacklisted(int vendor, int device) { int i = 0; - + for (i = 0; drm_msi_blacklist[i].vendor != 0; i++) { if ((drm_msi_blacklist[i].vendor == vendor) && (drm_msi_blacklist[i].device == device)) { @@ -349,7 +351,7 @@ drm_pci_id_list_t *drm_find_description( drm_pci_id_list_t *idlist) { int i = 0; - + for (i = 0; idlist[i].vendor != 0; i++) { if ((idlist[i].vendor == vendor) && ((idlist[i].device == device) || @@ -746,7 +748,7 @@ void drm_close(void *data) drm_lock_free(&dev->lock, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - + /* FIXME: may require heavy-handed reset of hardware at this point, possibly processed via a callback to the X @@ -809,7 +811,7 @@ extern drm_ioctl_desc_t drm_compat_ioctl /* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */ -int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags, +int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags, DRM_STRUCTPROC *p) { struct drm_device *dev = drm_get_device_from_kdev(kdev); @@ -984,14 +986,9 @@ MODULE_DEPEND(DRIVER_NAME, linux, 1, 1, #define LINUX_IOCTL_DRM_MAX 0x64ff static linux_ioctl_function_t drm_linux_ioctl; -static struct linux_ioctl_handler drm_handler = {drm_linux_ioctl, +static struct linux_ioctl_handler drm_handler = {drm_linux_ioctl, LINUX_IOCTL_DRM_MIN, LINUX_IOCTL_DRM_MAX}; -SYSINIT(drm_register, SI_SUB_KLD, SI_ORDER_MIDDLE, - linux_ioctl_register_handler, &drm_handler); -SYSUNINIT(drm_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE, - linux_ioctl_unregister_handler, &drm_handler); - /* The bits for in/out are switched on Linux */ #define LINUX_IOC_IN IOC_OUT #define LINUX_IOC_OUT IOC_IN @@ -1007,13 +1004,45 @@ drm_linux_ioctl(DRM_STRUCTPROC *p, struc args->cmd |= IOC_IN; if (cmd & LINUX_IOC_OUT) args->cmd |= IOC_OUT; - + error = ioctl(p, (struct ioctl_args *)args); return error; } #endif /* DRM_LINUX */ + +static int +drm_core_init(void *arg) +{ + + drm_global_init(); + +#if DRM_LINUX + linux_ioctl_register_handler(&drm_handler); +#endif /* DRM_LINUX */ + + DRM_INFO("Initialized %s %d.%d.%d %s\n", + CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE); + return 0; +} + +static void +drm_core_exit(void *arg) +{ + +#if DRM_LINUX + linux_ioctl_unregister_handler(&drm_handler); +#endif /* DRM_LINUX */ + + drm_global_release(); +} + +SYSINIT(drm_register, SI_SUB_KLD, SI_ORDER_MIDDLE, + drm_core_init, NULL); +SYSUNINIT(drm_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE, + drm_core_exit, NULL); + bool dmi_check_system(const struct dmi_system_id *sysid) { @@ -1021,4 +1050,3 @@ dmi_check_system(const struct dmi_system /* XXXKIB */ return (false); } - From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 16:09: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 ESMTP id 4769ED52; Sat, 24 Aug 2013 16:09:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) 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 348C025B9; Sat, 24 Aug 2013 16:09:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OG9row007106; Sat, 24 Aug 2013 16:09:53 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OG9rYY007105; Sat, 24 Aug 2013 16:09:53 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201308241609.r7OG9rYY007105@svn.freebsd.org> From: Ed Maste Date: Sat, 24 Aug 2013 16:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254793 - head/contrib/llvm/tools/lldb/source/Expression 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.14 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: Sat, 24 Aug 2013 16:09:53 -0000 Author: emaste Date: Sat Aug 24 16:09:52 2013 New Revision: 254793 URL: http://svnweb.freebsd.org/changeset/base/254793 Log: Revert lldb change for Attribute::NoBuiltin NoBuiltin was introduced after clang/llvm 3.3 and thus does not exist in FreeBSD. Thus special handling for the attribute is not needed in lldb. This reverts lldb r186990 (git eebd175) Sponsored by: DARPA, AFRL Modified: head/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp Modified: head/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp Sat Aug 24 15:47:15 2013 (r254792) +++ head/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp Sat Aug 24 16:09:52 2013 (r254793) @@ -356,20 +356,6 @@ IRForTarget::ResolveFunctionPointers(llv if (value_ptr) *value_ptr = value; - - // If we are replacing a function with the nobuiltin attribute, it may - // be called with the builtin attribute on call sites. Remove any such - // attributes since it's illegal to have a builtin call to something - // other than a nobuiltin function. - if (fun->hasFnAttribute(Attribute::NoBuiltin)) { - Attribute builtin = Attribute::get(fun->getContext(), Attribute::Builtin); - - for (auto u = fun->use_begin(), e = fun->use_end(); u != e; ++u) { - if (auto call = dyn_cast(*u)) { - call->removeAttribute(AttributeSet::FunctionIndex, builtin); - } - } - } fun->replaceAllUsesWith(value); } From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 16:11: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 ESMTP id 84FEAE98; Sat, 24 Aug 2013 16:11:09 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0F7EA25EA; Sat, 24 Aug 2013 16:11:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id r7OGB7fR097080; Sat, 24 Aug 2013 20:11:07 +0400 (MSK) (envelope-from marck@rinet.ru) Date: Sat, 24 Aug 2013 20:11:07 +0400 (MSK) From: Dmitry Morozovsky To: Alexander Motin Subject: Re: svn commit: r254787 - head/sys/kern In-Reply-To: <5218D22F.8000009@FreeBSD.org> Message-ID: References: <201308241441.r7OEfnFx060671@svn.freebsd.org> <5218D22F.8000009@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (woozle.rinet.ru [0.0.0.0]); Sat, 24 Aug 2013 20:11:07 +0400 (MSK) 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.14 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: Sat, 24 Aug 2013 16:11:09 -0000 On Sat, 24 Aug 2013, Alexander Motin wrote: > > > MFprojects/camlock r254460: > > > Remove locking from taskqueue_member(). The list of threads is static > > > during the taskqueue life cycle, so there is no need to protect it, > > > taking quite congested lock several more times for each ZFS I/O. > > > > Great, thanks! > > > > Any chances to MFC this to 9? > > I don't see any problem to do it after some time. Ah, so IIUC, it does not depend on other changes and could be tested on stock stable/9 right now? If so, I'd merge this to our tinderbox/poudriere builder and test. -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 16:14:21 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 ESMTP id 7F5FC2D5; Sat, 24 Aug 2013 16:14:21 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) 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 5D3DF2633; Sat, 24 Aug 2013 16:14:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OGELH1010791; Sat, 24 Aug 2013 16:14:21 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OGEKdD010787; Sat, 24 Aug 2013 16:14:20 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201308241614.r7OGEKdD010787@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 24 Aug 2013 16:14:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254794 - in head/sys: dev/drm2 modules/drm2/drm2 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.14 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: Sat, 24 Aug 2013 16:14:21 -0000 Author: dumbbell Date: Sat Aug 24 16:14:20 2013 New Revision: 254794 URL: http://svnweb.freebsd.org/changeset/base/254794 Log: drm: Import drm_buffer.[ch] from Linux 3.8-rc3 This will be used by the Radeon KMS driver. Added: head/sys/dev/drm2/drm_buffer.c (contents, props changed) head/sys/dev/drm2/drm_buffer.h (contents, props changed) Modified: head/sys/modules/drm2/drm2/Makefile Added: head/sys/dev/drm2/drm_buffer.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm2/drm_buffer.c Sat Aug 24 16:14:20 2013 (r254794) @@ -0,0 +1,183 @@ +/************************************************************************** + * + * Copyright 2010 Pauli Nieminen. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * + **************************************************************************/ +/* + * Multipart buffer for coping data which is larger than the page size. + * + * Authors: + * Pauli Nieminen + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +/** + * Allocate the drm buffer object. + * + * buf: Pointer to a pointer where the object is stored. + * size: The number of bytes to allocate. + */ +int drm_buffer_alloc(struct drm_buffer **buf, int size) +{ + int nr_pages = size / PAGE_SIZE + 1; + int idx; + + /* Allocating pointer table to end of structure makes drm_buffer + * variable sized */ + *buf = malloc(sizeof(struct drm_buffer) + nr_pages*sizeof(char *), + DRM_MEM_DRIVER, M_ZERO | M_WAITOK); + + if (*buf == NULL) { + DRM_ERROR("Failed to allocate drm buffer object to hold" + " %d bytes in %d pages.\n", + size, nr_pages); + return -ENOMEM; + } + + (*buf)->size = size; + + for (idx = 0; idx < nr_pages; ++idx) { + + (*buf)->data[idx] = + malloc(min(PAGE_SIZE, size - idx * PAGE_SIZE), + DRM_MEM_DRIVER, M_WAITOK); + + + if ((*buf)->data[idx] == NULL) { + DRM_ERROR("Failed to allocate %dth page for drm" + " buffer with %d bytes and %d pages.\n", + idx + 1, size, nr_pages); + goto error_out; + } + + } + + return 0; + +error_out: + + /* Only last element can be null pointer so check for it first. */ + if ((*buf)->data[idx]) + free((*buf)->data[idx], DRM_MEM_DRIVER); + + for (--idx; idx >= 0; --idx) + free((*buf)->data[idx], DRM_MEM_DRIVER); + + free(*buf, DRM_MEM_DRIVER); + return -ENOMEM; +} + +/** + * Copy the user data to the begin of the buffer and reset the processing + * iterator. + * + * user_data: A pointer the data that is copied to the buffer. + * size: The Number of bytes to copy. + */ +int drm_buffer_copy_from_user(struct drm_buffer *buf, + void __user *user_data, int size) +{ + int nr_pages = size / PAGE_SIZE + 1; + int idx; + + if (size > buf->size) { + DRM_ERROR("Requesting to copy %d bytes to a drm buffer with" + " %d bytes space\n", + size, buf->size); + return -EFAULT; + } + + for (idx = 0; idx < nr_pages; ++idx) { + + if (DRM_COPY_FROM_USER(buf->data[idx], + (char *)user_data + idx * PAGE_SIZE, + min(PAGE_SIZE, size - idx * PAGE_SIZE))) { + DRM_ERROR("Failed to copy user data (%p) to drm buffer" + " (%p) %dth page.\n", + user_data, buf, idx); + return -EFAULT; + + } + } + buf->iterator = 0; + return 0; +} + +/** + * Free the drm buffer object + */ +void drm_buffer_free(struct drm_buffer *buf) +{ + + if (buf != NULL) { + + int nr_pages = buf->size / PAGE_SIZE + 1; + int idx; + for (idx = 0; idx < nr_pages; ++idx) + free(buf->data[idx], DRM_MEM_DRIVER); + + free(buf, DRM_MEM_DRIVER); + } +} + +/** + * Read an object from buffer that may be split to multiple parts. If object + * is not split function just returns the pointer to object in buffer. But in + * case of split object data is copied to given stack object that is suplied + * by caller. + * + * The processing location of the buffer is also advanced to the next byte + * after the object. + * + * objsize: The size of the objet in bytes. + * stack_obj: A pointer to a memory location where object can be copied. + */ +void *drm_buffer_read_object(struct drm_buffer *buf, + int objsize, void *stack_obj) +{ + int idx = drm_buffer_index(buf); + int page = drm_buffer_page(buf); + void *obj = NULL; + + if (idx + objsize <= PAGE_SIZE) { + obj = &buf->data[page][idx]; + } else { + /* The object is split which forces copy to temporary object.*/ + int beginsz = PAGE_SIZE - idx; + memcpy(stack_obj, &buf->data[page][idx], beginsz); + + memcpy((char *)stack_obj + beginsz, &buf->data[page + 1][0], + objsize - beginsz); + + obj = stack_obj; + } + + drm_buffer_advance(buf, objsize); + return obj; +} Added: head/sys/dev/drm2/drm_buffer.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm2/drm_buffer.h Sat Aug 24 16:14:20 2013 (r254794) @@ -0,0 +1,151 @@ +/************************************************************************** + * + * Copyright 2010 Pauli Nieminen. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * + **************************************************************************/ +/* + * Multipart buffer for coping data which is larger than the page size. + * + * Authors: + * Pauli Nieminen + */ + +#include +__FBSDID("$FreeBSD$"); + +#ifndef _DRM_BUFFER_H_ +#define _DRM_BUFFER_H_ + +#include + +struct drm_buffer { + int iterator; + int size; + char *data[]; +}; + + +/** + * Return the index of page that buffer is currently pointing at. + */ +static inline int drm_buffer_page(struct drm_buffer *buf) +{ + return buf->iterator / PAGE_SIZE; +} +/** + * Return the index of the current byte in the page + */ +static inline int drm_buffer_index(struct drm_buffer *buf) +{ + return buf->iterator & (PAGE_SIZE - 1); +} +/** + * Return number of bytes that is left to process + */ +static inline int drm_buffer_unprocessed(struct drm_buffer *buf) +{ + return buf->size - buf->iterator; +} + +/** + * Advance the buffer iterator number of bytes that is given. + */ +static inline void drm_buffer_advance(struct drm_buffer *buf, int bytes) +{ + buf->iterator += bytes; +} + +/** + * Allocate the drm buffer object. + * + * buf: A pointer to a pointer where the object is stored. + * size: The number of bytes to allocate. + */ +extern int drm_buffer_alloc(struct drm_buffer **buf, int size); + +/** + * Copy the user data to the begin of the buffer and reset the processing + * iterator. + * + * user_data: A pointer the data that is copied to the buffer. + * size: The Number of bytes to copy. + */ +extern int drm_buffer_copy_from_user(struct drm_buffer *buf, + void __user *user_data, int size); + +/** + * Free the drm buffer object + */ +extern void drm_buffer_free(struct drm_buffer *buf); + +/** + * Read an object from buffer that may be split to multiple parts. If object + * is not split function just returns the pointer to object in buffer. But in + * case of split object data is copied to given stack object that is suplied + * by caller. + * + * The processing location of the buffer is also advanced to the next byte + * after the object. + * + * objsize: The size of the objet in bytes. + * stack_obj: A pointer to a memory location where object can be copied. + */ +extern void *drm_buffer_read_object(struct drm_buffer *buf, + int objsize, void *stack_obj); + +/** + * Returns the pointer to the dword which is offset number of elements from the + * current processing location. + * + * Caller must make sure that dword is not split in the buffer. This + * requirement is easily met if all the sizes of objects in buffer are + * multiples of dword and PAGE_SIZE is multiple dword. + * + * Call to this function doesn't change the processing location. + * + * offset: The index of the dword relative to the internat iterator. + */ +static inline void *drm_buffer_pointer_to_dword(struct drm_buffer *buffer, + int offset) +{ + int iter = buffer->iterator + offset * 4; + return &buffer->data[iter / PAGE_SIZE][iter & (PAGE_SIZE - 1)]; +} +/** + * Returns the pointer to the dword which is offset number of elements from + * the current processing location. + * + * Call to this function doesn't change the processing location. + * + * offset: The index of the byte relative to the internat iterator. + */ +static inline void *drm_buffer_pointer_to_byte(struct drm_buffer *buffer, + int offset) +{ + int iter = buffer->iterator + offset; + return &buffer->data[iter / PAGE_SIZE][iter & (PAGE_SIZE - 1)]; +} + +#endif Modified: head/sys/modules/drm2/drm2/Makefile ============================================================================== --- head/sys/modules/drm2/drm2/Makefile Sat Aug 24 16:09:52 2013 (r254793) +++ head/sys/modules/drm2/drm2/Makefile Sat Aug 24 16:14:20 2013 (r254794) @@ -6,6 +6,7 @@ SRCS = \ drm_agpsupport.c \ drm_auth.c \ drm_bufs.c \ + drm_buffer.c \ drm_context.c \ drm_crtc.c \ drm_crtc_helper.c \ From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 16:25:22 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 ESMTP id 754C1759; Sat, 24 Aug 2013 16:25:22 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-ee0-x236.google.com (mail-ee0-x236.google.com [IPv6:2a00:1450:4013:c00::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A74A726BA; Sat, 24 Aug 2013 16:25:21 +0000 (UTC) Received: by mail-ee0-f54.google.com with SMTP id e53so834890eek.27 for ; Sat, 24 Aug 2013 09:25:20 -0700 (PDT) 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=keUAZ7OkC7OOUmCshc7cLZGLf9NFPknDj2Kub8MPt8g=; b=rlWa6GARYzNVOt/sTbEWWgYvCnNhe9acApqft4okOTZ2/HOOEUbt83AwFmXKV4Ufto yAHEvZ/e9B5m+IwPK8RCnAf3A87wXNXL9Q0RVu7QfBW17N/b/JbEzwl2mVObZxe5jSni BZP4hdoPDdpErV+pJM3N8g+upRhzPAuvX1K/v8Vfnx46MgJR/maIv7h57lF1NGxv9Pxr gvLmet4+imK1WTdgXydNBgX4Ik1knbLtCVHrwaQf4lDKteV8HTKmf3XOUxiYmMtYtMsA Q5xGv0JC/Pff/8uLQ5Iymepgwqwr95OavLftRO8v9cAfVh95XOAg+ZSIMZY8EqZ6iYJT XiuA== X-Received: by 10.14.223.1 with SMTP id u1mr9217095eep.10.1377361519898; Sat, 24 Aug 2013 09:25:19 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([37.229.21.195]) by mx.google.com with ESMTPSA id i1sm7831492eeg.0.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 24 Aug 2013 09:25:18 -0700 (PDT) Sender: Alexander Motin Message-ID: <5218DE6C.4060700@FreeBSD.org> Date: Sat, 24 Aug 2013 19:25:16 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130616 Thunderbird/17.0.6 MIME-Version: 1.0 To: Dmitry Morozovsky Subject: Re: svn commit: r254787 - head/sys/kern References: <201308241441.r7OEfnFx060671@svn.freebsd.org> <5218D22F.8000009@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.14 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: Sat, 24 Aug 2013 16:25:22 -0000 On 24.08.2013 19:11, Dmitry Morozovsky wrote: > On Sat, 24 Aug 2013, Alexander Motin wrote: > >>>> MFprojects/camlock r254460: >>>> Remove locking from taskqueue_member(). The list of threads is static >>>> during the taskqueue life cycle, so there is no need to protect it, >>>> taking quite congested lock several more times for each ZFS I/O. >>> >>> Great, thanks! >>> >>> Any chances to MFC this to 9? >> >> I don't see any problem to do it after some time. > > Ah, so IIUC, it does not depend on other changes and could be tested on stock > stable/9 right now? If so, I'd merge this to our tinderbox/poudriere builder > and test. Yes, it is completely independent. Please, welcome. I am just not sure whether you notice much difference unless you have really a lot of IOPS. On my tests doing 90K IOPS over bunch of SSDs I've measured difference of several percents. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 16:41: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 ESMTP id 7A7BD1EC; Sat, 24 Aug 2013 16:41:15 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) 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 5755E27E4; Sat, 24 Aug 2013 16:41: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 r7OGfFBq025670; Sat, 24 Aug 2013 16:41:15 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OGfF4T025668; Sat, 24 Aug 2013 16:41:15 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201308241641.r7OGfF4T025668@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 24 Aug 2013 16:41:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254796 - head/sys/dev/drm2/i915 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.14 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: Sat, 24 Aug 2013 16:41:15 -0000 Author: dumbbell Date: Sat Aug 24 16:41:14 2013 New Revision: 254796 URL: http://svnweb.freebsd.org/changeset/base/254796 Log: drm/i915: Import Linux commit 71244653a8fb0f46bc12ae421f1d5f72af6a75da Author: Daniel Vetter Date: Mon Jun 4 18:39:20 2012 +0200 drm/i915: adjusted_mode->clock in the dp mode_fixup ... instead of changing mode->clock, which we should leave as-is. After the previous patch we only touch that if it's a panel, and then adjusted mode->clock equals adjusted_mode->clock. Outside of intel_dp.c we only use ajusted_mode->clock in the mode_set functions. Within intel_dp.c we only use it to calculate the dp dithering and link bw parameters, so that's the only thing we need to fix up. As a temporary ugliness (until the cleanup in the next patch) we pass the adjusted_mode into dp_dither for both parameters (because that one still looks at mode->clock). Note that we do overwrite adjusted_mode->clock with the selected dp link clock, but that only happens after we've calculated everything we need based on the dotclock of the adjusted output configuration. Outside of intel_dp.c only intel_display.c uses adjusted_mode->clock, and that stays the same after this patch (still equals the selected dp link clock). intel_display.c also needs the actual dotclock (as target_clock), but that has been fixed up in the previous patch. v2: Adjust the debug message to also use adjusted_mode->clock. Reviewed-by: Chris Wilson Reviewed-by: Jesse Barnes Signed-off-by: Daniel Vetter Modified: head/sys/dev/drm2/i915/intel_dp.c Modified: head/sys/dev/drm2/i915/intel_dp.c ============================================================================== --- head/sys/dev/drm2/i915/intel_dp.c Sat Aug 24 16:17:33 2013 (r254795) +++ head/sys/dev/drm2/i915/intel_dp.c Sat Aug 24 16:41:14 2013 (r254796) @@ -691,14 +691,9 @@ intel_dp_mode_fixup(struct drm_encoder * intel_fixed_panel_mode(intel_dp->panel_fixed_mode, adjusted_mode); intel_pch_panel_fitting(dev, DRM_MODE_SCALE_FULLSCREEN, mode, adjusted_mode); - /* - * the mode->clock is used to calculate the Data&Link M/N - * of the pipe. For the eDP the fixed clock should be used. - */ - mode->clock = intel_dp->panel_fixed_mode->clock; } - if (!intel_dp_adjust_dithering(intel_dp, mode, adjusted_mode)) + if (!intel_dp_adjust_dithering(intel_dp, adjusted_mode, adjusted_mode)) return false; bpp = adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24; @@ -707,7 +702,7 @@ intel_dp_mode_fixup(struct drm_encoder * for (clock = 0; clock <= max_clock; clock++) { int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); - if (intel_dp_link_required(mode->clock, bpp) + if (intel_dp_link_required(adjusted_mode->clock, bpp) <= link_avail) { intel_dp->link_bw = bws[clock]; intel_dp->lane_count = lane_count; From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 16:44: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 ESMTP id C409E332; Sat, 24 Aug 2013 16:44:25 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4A37427F1; Sat, 24 Aug 2013 16:44:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id r7OGiNi6097555; Sat, 24 Aug 2013 20:44:23 +0400 (MSK) (envelope-from marck@rinet.ru) Date: Sat, 24 Aug 2013 20:44:23 +0400 (MSK) From: Dmitry Morozovsky To: Alexander Motin Subject: Re: svn commit: r254787 - head/sys/kern In-Reply-To: <5218DE6C.4060700@FreeBSD.org> Message-ID: References: <201308241441.r7OEfnFx060671@svn.freebsd.org> <5218D22F.8000009@FreeBSD.org> <5218DE6C.4060700@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (woozle.rinet.ru [0.0.0.0]); Sat, 24 Aug 2013 20:44:23 +0400 (MSK) 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.14 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: Sat, 24 Aug 2013 16:44:25 -0000 On Sat, 24 Aug 2013, Alexander Motin wrote: > > > > > Remove locking from taskqueue_member(). The list of threads is > > > > Ah, so IIUC, it does not depend on other changes and could be tested on > > stock stable/9 right now? If so, I'd merge this to our tinderbox/poudriere > > builder and test. > > Yes, it is completely independent. Please, welcome. I am just not sure whether > you notice much difference unless you have really a lot of IOPS. On my tests > doing 90K IOPS over bunch of SSDs I've measured difference of several > percents. Yes, this is not a case of a builder, as most of IOSP is done in tmpfs (BTW, doesn't this lock appliy there as well?) OTOH, we have a couple of iSCSI storages where this could be useable too... -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 16:44:50 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 ESMTP id 5B2C7465; Sat, 24 Aug 2013 16:44:50 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mail0.glenbarber.us (mail0.glenbarber.us [208.86.227.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2FB7127F5; Sat, 24 Aug 2013 16:44:49 +0000 (UTC) Received: from glenbarber.us (unknown [IPv6:2001:470:8:1205:99cd:72d:5e87:427e]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gjb) by mail0.glenbarber.us (Postfix) with ESMTPSA id C74902A24; Sat, 24 Aug 2013 16:44:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.8.3 mail0.glenbarber.us C74902A24 Authentication-Results: mail0.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Sat, 24 Aug 2013 12:44:46 -0400 From: Glen Barber To: "Kenneth D. Merry" Subject: Re: svn commit: r254760 - in head: share/man/man4 sys/cam/scsi sys/kern sys/sys Message-ID: <20130824164446.GA41859@glenbarber.us> References: <201308240452.r7O4qMji033904@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CPaaJmjEtnx7DmsZ" Content-Disposition: inline In-Reply-To: <201308240452.r7O4qMji033904@svn.freebsd.org> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Sat, 24 Aug 2013 16:44:50 -0000 --CPaaJmjEtnx7DmsZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 24, 2013 at 04:52:22AM +0000, Kenneth D. Merry wrote: > Author: ken > Date: Sat Aug 24 04:52:22 2013 > New Revision: 254760 > URL: http://svnweb.freebsd.org/changeset/base/254760 >=20 > [...] > @@ -83,6 +113,17 @@ physio(struct cdev *dev, struct uio *uio > */ > iolen =3D ((vm_offset_t) bp->b_data) & PAGE_MASK; > if ((bp->b_bcount + iolen) > bp->b_kvasize) { > + /* > + * This device does not want I/O to be split. > + */ > + if (dev->si_flags & SI_NOSPLIT) { > + printf("%s: request ptr %#jx is not " > + "on a page boundary, cannot split " > + "request\n", devtoname(dev), > + (uintmax_t)bp->b_data); This breaks LINT for at least powerpc. cc1: warnings being treated as errors /src/sys/kern/kern_physio.c: In function 'physio': /src/sys/kern/kern_physio.c:123: warning: cast from pointer to integer of d= ifferent size [-Wpointer-to-int-cast] *** Error code 1 http://tinderbox.freebsd.org/tinderbox-head-build-HEAD-powerpc-powerpc.full Glen --CPaaJmjEtnx7DmsZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBCAAGBQJSGOL+AAoJEFJPDDeguUajy7MIAI1S2l6dQY7IKsoYWwBrVpGx BgdgJMcbNA2vD2ZORtcwe9j9blcXrfZ3AZPWrSky4xA3qFuEA5ryndyge5t3FeQR UHXu7wK+aOM54RqvJajWawBpe3Abfvsa0NibNja8Ir9L7JCqI7QT28ss1d3P012E CZ8p/hGT5ycT4hsSzNDfuYZLxsXpWSXyDg1cK0OCbWdLCVAtDtFBlu2EB5PTIg14 GlnlHj29oPFA2tSWsD9EdYpvuJFUeSWoAkhcP1hLOetAtQYVpvj/FxbyIU9Q4v7q DJnR+1wA9eKnWDA06EM0nSVbsu9Fu253rLXiu2iTTviSFBZB8CNz/xDKoG8hotE= =8VIY -----END PGP SIGNATURE----- --CPaaJmjEtnx7DmsZ-- From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 16:50:50 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 ESMTP id 6C1C36B8; Sat, 24 Aug 2013 16:50:50 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) 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 4A5082842; Sat, 24 Aug 2013 16:50: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 r7OGooKL030877; Sat, 24 Aug 2013 16:50:50 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OGolRX030724; Sat, 24 Aug 2013 16:50:48 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201308241650.r7OGolRX030724@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 24 Aug 2013 16:50:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254797 - in head/sys/dev/drm2: . i915 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.14 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: Sat, 24 Aug 2013 16:50:50 -0000 Author: dumbbell Date: Sat Aug 24 16:50:47 2013 New Revision: 254797 URL: http://svnweb.freebsd.org/changeset/base/254797 Log: drm: Const'ify the 1st "drm_display_mode" passed to "mode_fixup" callbacks This will be needed by the Radeon KMS driver. Modified: head/sys/dev/drm2/drm_crtc.h head/sys/dev/drm2/drm_crtc_helper.h head/sys/dev/drm2/i915/intel_crt.c head/sys/dev/drm2/i915/intel_display.c head/sys/dev/drm2/i915/intel_dp.c head/sys/dev/drm2/i915/intel_drv.h head/sys/dev/drm2/i915/intel_hdmi.c head/sys/dev/drm2/i915/intel_lvds.c head/sys/dev/drm2/i915/intel_panel.c head/sys/dev/drm2/i915/intel_sdvo.c head/sys/dev/drm2/i915/intel_tv.c Modified: head/sys/dev/drm2/drm_crtc.h ============================================================================== --- head/sys/dev/drm2/drm_crtc.h Sat Aug 24 16:41:14 2013 (r254796) +++ head/sys/dev/drm2/drm_crtc.h Sat Aug 24 16:50:47 2013 (r254797) @@ -659,7 +659,7 @@ struct drm_mode_config { int min_width, min_height; int max_width, max_height; - struct drm_mode_config_funcs *funcs; + const struct drm_mode_config_funcs *funcs; resource_size_t fb_base; /* output poll support */ Modified: head/sys/dev/drm2/drm_crtc_helper.h ============================================================================== --- head/sys/dev/drm2/drm_crtc_helper.h Sat Aug 24 16:41:14 2013 (r254796) +++ head/sys/dev/drm2/drm_crtc_helper.h Sat Aug 24 16:50:47 2013 (r254797) @@ -51,7 +51,7 @@ struct drm_crtc_helper_funcs { /* Provider can fixup or change mode timings before modeset occurs */ bool (*mode_fixup)(struct drm_crtc *crtc, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); /* Actually set the mode */ int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode, @@ -78,7 +78,7 @@ struct drm_encoder_helper_funcs { void (*restore)(struct drm_encoder *encoder); bool (*mode_fixup)(struct drm_encoder *encoder, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); void (*prepare)(struct drm_encoder *encoder); void (*commit)(struct drm_encoder *encoder); Modified: head/sys/dev/drm2/i915/intel_crt.c ============================================================================== --- head/sys/dev/drm2/i915/intel_crt.c Sat Aug 24 16:41:14 2013 (r254796) +++ head/sys/dev/drm2/i915/intel_crt.c Sat Aug 24 16:50:47 2013 (r254797) @@ -111,7 +111,7 @@ static int intel_crt_mode_valid(struct d } static bool intel_crt_mode_fixup(struct drm_encoder *encoder, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { return true; Modified: head/sys/dev/drm2/i915/intel_display.c ============================================================================== --- head/sys/dev/drm2/i915/intel_display.c Sat Aug 24 16:41:14 2013 (r254796) +++ head/sys/dev/drm2/i915/intel_display.c Sat Aug 24 16:50:47 2013 (r254797) @@ -3512,7 +3512,7 @@ void intel_encoder_destroy(struct drm_en } static bool intel_crtc_mode_fixup(struct drm_crtc *crtc, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { struct drm_device *dev = crtc->dev; Modified: head/sys/dev/drm2/i915/intel_dp.c ============================================================================== --- head/sys/dev/drm2/i915/intel_dp.c Sat Aug 24 16:41:14 2013 (r254796) +++ head/sys/dev/drm2/i915/intel_dp.c Sat Aug 24 16:50:47 2013 (r254797) @@ -224,7 +224,7 @@ intel_dp_max_data_rate(int max_link_cloc static bool intel_dp_adjust_dithering(struct intel_dp *intel_dp, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); @@ -676,7 +676,7 @@ intel_dp_i2c_init(struct intel_dp *intel } static bool -intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, +intel_dp_mode_fixup(struct drm_encoder *encoder, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { struct drm_device *dev = encoder->dev; Modified: head/sys/dev/drm2/i915/intel_drv.h ============================================================================== --- head/sys/dev/drm2/i915/intel_drv.h Sat Aug 24 16:41:14 2013 (r254796) +++ head/sys/dev/drm2/i915/intel_drv.h Sat Aug 24 16:50:47 2013 (r254797) @@ -320,7 +320,7 @@ extern void intel_fixed_panel_mode(struc struct drm_display_mode *adjusted_mode); extern void intel_pch_panel_fitting(struct drm_device *dev, int fitting_mode, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); extern u32 intel_panel_get_max_backlight(struct drm_device *dev); extern u32 intel_panel_get_backlight(struct drm_device *dev); Modified: head/sys/dev/drm2/i915/intel_hdmi.c ============================================================================== --- head/sys/dev/drm2/i915/intel_hdmi.c Sat Aug 24 16:41:14 2013 (r254796) +++ head/sys/dev/drm2/i915/intel_hdmi.c Sat Aug 24 16:50:47 2013 (r254797) @@ -318,7 +318,7 @@ static int intel_hdmi_mode_valid(struct } static bool intel_hdmi_mode_fixup(struct drm_encoder *encoder, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { return true; Modified: head/sys/dev/drm2/i915/intel_lvds.c ============================================================================== --- head/sys/dev/drm2/i915/intel_lvds.c Sat Aug 24 16:41:14 2013 (r254796) +++ head/sys/dev/drm2/i915/intel_lvds.c Sat Aug 24 16:50:47 2013 (r254797) @@ -230,7 +230,7 @@ static inline u32 panel_fitter_scaling(u } static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { struct drm_device *dev = encoder->dev; Modified: head/sys/dev/drm2/i915/intel_panel.c ============================================================================== --- head/sys/dev/drm2/i915/intel_panel.c Sat Aug 24 16:41:14 2013 (r254796) +++ head/sys/dev/drm2/i915/intel_panel.c Sat Aug 24 16:50:47 2013 (r254797) @@ -59,7 +59,7 @@ intel_fixed_panel_mode(struct drm_displa void intel_pch_panel_fitting(struct drm_device *dev, int fitting_mode, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { struct drm_i915_private *dev_priv = dev->dev_private; Modified: head/sys/dev/drm2/i915/intel_sdvo.c ============================================================================== --- head/sys/dev/drm2/i915/intel_sdvo.c Sat Aug 24 16:41:14 2013 (r254796) +++ head/sys/dev/drm2/i915/intel_sdvo.c Sat Aug 24 16:50:47 2013 (r254797) @@ -924,7 +924,7 @@ static bool intel_sdvo_set_tv_format(str static bool intel_sdvo_set_output_timings_from_mode(struct intel_sdvo *intel_sdvo, - struct drm_display_mode *mode) + const struct drm_display_mode *mode) { struct intel_sdvo_dtd output_dtd; @@ -941,7 +941,7 @@ intel_sdvo_set_output_timings_from_mode( static bool intel_sdvo_set_input_timings_for_mode(struct intel_sdvo *intel_sdvo, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { /* Reset the input timing to the screen. Assume always input 0. */ @@ -964,7 +964,7 @@ intel_sdvo_set_input_timings_for_mode(st } static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, - struct drm_display_mode *mode, + const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder); Modified: head/sys/dev/drm2/i915/intel_tv.c ============================================================================== --- head/sys/dev/drm2/i915/intel_tv.c Sat Aug 24 16:41:14 2013 (r254796) +++ head/sys/dev/drm2/i915/intel_tv.c Sat Aug 24 16:50:47 2013 (r254797) @@ -846,7 +846,7 @@ intel_tv_mode_valid(struct drm_connector static bool -intel_tv_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, +intel_tv_mode_fixup(struct drm_encoder *encoder, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { struct drm_device *dev = encoder->dev; From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 16:55:11 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 ESMTP id 37038924 for ; Sat, 24 Aug 2013 16:55:11 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9CD792865 for ; Sat, 24 Aug 2013 16:55:10 +0000 (UTC) Received: (qmail 93552 invoked from network); 24 Aug 2013 17:37:41 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 24 Aug 2013 17:37:41 -0000 Message-ID: <5218E563.7030308@freebsd.org> Date: Sat, 24 Aug 2013 18:54:59 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r254780 - in head/sys: kern sys References: <201308241315.r7ODFgtK003250@svn.freebsd.org> In-Reply-To: <201308241315.r7ODFgtK003250@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; 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.14 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: Sat, 24 Aug 2013 16:55:11 -0000 On 24.08.2013 15:15, Andre Oppermann wrote: > Author: andre > Date: Sat Aug 24 13:15:42 2013 > New Revision: 254780 > URL: http://svnweb.freebsd.org/changeset/base/254780 > > Log: > dd a 24 bits wide ext_flags field to m_ext by reducing ext_type > to 8 bits. ext_type is an enumerator and the number of types we > have is a mere dozen. > > A couple of ext_types are renumbered to fit within 8 bits. > > EXT_VENDOR[1-4] and EXT_EXP[1-4] types for vendor-internal and > experimental local mapping. > > The ext_flags field is currently unused but has a couple of flags > already defined for future use. Again vendor and experimental > flags are provided for local mapping. > > EXT_FLAG_BITS is provided for the printf(9) %b identifier. > > Initialize and copy ext_flags in the relevant mbuf functions. > > Improve alignment and packing of struct m_ext on 32 and 64 archs > by carefully sorting the fields. Sponsored by: The FreeBSD Foundation -- Andre From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 16:55:53 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 ESMTP id E3DFAA5C; Sat, 24 Aug 2013 16:55:53 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) 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 D1692286D; Sat, 24 Aug 2013 16:55:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OGtrIh032585; Sat, 24 Aug 2013 16:55:53 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OGtree032584; Sat, 24 Aug 2013 16:55:53 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201308241655.r7OGtree032584@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 24 Aug 2013 16:55:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254798 - head/sys/dev/drm2 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.14 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: Sat, 24 Aug 2013 16:55:54 -0000 Author: dumbbell Date: Sat Aug 24 16:55:53 2013 New Revision: 254798 URL: http://svnweb.freebsd.org/changeset/base/254798 Log: drm: Fix leak of connector->edid_blob_ptr Modified: head/sys/dev/drm2/drm_crtc.c Modified: head/sys/dev/drm2/drm_crtc.c ============================================================================== --- head/sys/dev/drm2/drm_crtc.c Sat Aug 24 16:50:47 2013 (r254797) +++ head/sys/dev/drm2/drm_crtc.c Sat Aug 24 16:55:53 2013 (r254798) @@ -170,6 +170,9 @@ static struct drm_prop_enum_list drm_enc { DRM_MODE_ENCODER_TVDAC, "TV" }, }; +static void drm_property_destroy_blob(struct drm_device *dev, + struct drm_property_blob *blob); + char *drm_get_encoder_name(struct drm_encoder *encoder) { static char buf[32]; @@ -520,6 +523,8 @@ void drm_connector_cleanup(struct drm_co drm_mode_remove(connector, mode); sx_xlock(&dev->mode_config.mutex); + if (connector->edid_blob_ptr) + drm_property_destroy_blob(dev, connector->edid_blob_ptr); drm_mode_object_put(dev, &connector->base); list_del(&connector->head); dev->mode_config.num_connector--; From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 16:57: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 ESMTP id 15E2FC93; Sat, 24 Aug 2013 16:57:47 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 019EC2885; Sat, 24 Aug 2013 16:57: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 r7OGvkUm033273; Sat, 24 Aug 2013 16:57:46 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OGvie8033186; Sat, 24 Aug 2013 16:57:44 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241657.r7OGvie8033186@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 16:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254799 - in head/sys: dev/cas dev/hatm dev/iscsi_initiator dev/lge dev/mwl kern 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.14 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: Sat, 24 Aug 2013 16:57:47 -0000 Author: andre Date: Sat Aug 24 16:57:44 2013 New Revision: 254799 URL: http://svnweb.freebsd.org/changeset/base/254799 Log: Add an mbuf pointer parameter to (*ext_free) to give the external free function access to the mbuf the external memory was attached to. Mechanically adjust all users to include the mbuf parameter. This fixes a long standing annoyance for external free functions. Before one had to sacrifice one of the argument pointers for this. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/cas/if_cas.c head/sys/dev/hatm/if_hatm_intr.c head/sys/dev/iscsi_initiator/isc_soc.c head/sys/dev/lge/if_lge.c head/sys/dev/mwl/if_mwl.c head/sys/kern/subr_mbpool.c head/sys/kern/uipc_mbuf.c head/sys/kern/uipc_syscalls.c head/sys/sys/mbpool.h head/sys/sys/mbuf.h head/sys/sys/sf_buf.h Modified: head/sys/dev/cas/if_cas.c ============================================================================== --- head/sys/dev/cas/if_cas.c Sat Aug 24 16:55:53 2013 (r254798) +++ head/sys/dev/cas/if_cas.c Sat Aug 24 16:57:44 2013 (r254799) @@ -132,7 +132,7 @@ static void cas_detach(struct cas_softc static int cas_disable_rx(struct cas_softc *sc); static int cas_disable_tx(struct cas_softc *sc); static void cas_eint(struct cas_softc *sc, u_int status); -static void cas_free(void *arg1, void* arg2); +static void cas_free(struct mbuf *m, void *arg1, void* arg2); static void cas_init(void *xsc); static void cas_init_locked(struct cas_softc *sc); static void cas_init_regs(struct cas_softc *sc); @@ -1888,7 +1888,7 @@ cas_rint(struct cas_softc *sc) } static void -cas_free(void *arg1, void *arg2) +cas_free(struct mbuf *m, void *arg1, void *arg2) { struct cas_rxdsoft *rxds; struct cas_softc *sc; Modified: head/sys/dev/hatm/if_hatm_intr.c ============================================================================== --- head/sys/dev/hatm/if_hatm_intr.c Sat Aug 24 16:55:53 2013 (r254798) +++ head/sys/dev/hatm/if_hatm_intr.c Sat Aug 24 16:57:44 2013 (r254799) @@ -261,7 +261,7 @@ hatm_mbuf_page_alloc(struct hatm_softc * * Free an mbuf and put it onto the free list. */ static void -hatm_mbuf0_free(void *buf, void *args) +hatm_mbuf0_free(struct mbuf *m, void *buf, void *args) { struct hatm_softc *sc = args; struct mbuf0_chunk *c = buf; @@ -272,7 +272,7 @@ hatm_mbuf0_free(void *buf, void *args) hatm_ext_free(&sc->mbuf_list[0], (struct mbufx_free *)c); } static void -hatm_mbuf1_free(void *buf, void *args) +hatm_mbuf1_free(struct mbuf *m, void *buf, void *args) { struct hatm_softc *sc = args; struct mbuf1_chunk *c = buf; @@ -461,7 +461,7 @@ hatm_rx_buffer(struct hatm_softc *sc, u_ hatm_mbuf0_free, c0, sc, M_PKTHDR, EXT_EXTREF); m->m_data += MBUF0_OFFSET; } else - hatm_mbuf0_free(c0, sc); + hatm_mbuf0_free(NULL, c0, sc); } else { struct mbuf1_chunk *c1; @@ -485,7 +485,7 @@ hatm_rx_buffer(struct hatm_softc *sc, u_ hatm_mbuf1_free, c1, sc, M_PKTHDR, EXT_EXTREF); m->m_data += MBUF1_OFFSET; } else - hatm_mbuf1_free(c1, sc); + hatm_mbuf1_free(NULL, c1, sc); } return (m); Modified: head/sys/dev/iscsi_initiator/isc_soc.c ============================================================================== --- head/sys/dev/iscsi_initiator/isc_soc.c Sat Aug 24 16:55:53 2013 (r254798) +++ head/sys/dev/iscsi_initiator/isc_soc.c Sat Aug 24 16:57:44 2013 (r254799) @@ -69,7 +69,7 @@ static int ou_refcnt = 0; | function for freeing external storage for mbuf */ static void -ext_free(void *a, void *b) +ext_free(struct mbuf *m, void *a, void *b) { pduq_t *pq = b; Modified: head/sys/dev/lge/if_lge.c ============================================================================== --- head/sys/dev/lge/if_lge.c Sat Aug 24 16:55:53 2013 (r254798) +++ head/sys/dev/lge/if_lge.c Sat Aug 24 16:57:44 2013 (r254799) @@ -122,7 +122,7 @@ static int lge_detach(device_t); static int lge_alloc_jumbo_mem(struct lge_softc *); static void lge_free_jumbo_mem(struct lge_softc *); static void *lge_jalloc(struct lge_softc *); -static void lge_jfree(void *, void *); +static void lge_jfree(struct mbuf *, void *, void *); static int lge_newbuf(struct lge_softc *, struct lge_rx_desc *, struct mbuf *); static int lge_encap(struct lge_softc *, struct mbuf *, u_int32_t *); @@ -847,9 +847,7 @@ lge_jalloc(sc) * Release a jumbo buffer. */ static void -lge_jfree(buf, args) - void *buf; - void *args; +lge_jfree(struct mbuf *m, void *buf, void *args) { struct lge_softc *sc; int i; Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Sat Aug 24 16:55:53 2013 (r254798) +++ head/sys/dev/mwl/if_mwl.c Sat Aug 24 16:57:44 2013 (r254799) @@ -2622,7 +2622,7 @@ mwl_rxbuf_init(struct mwl_softc *sc, str } static void -mwl_ext_free(void *data, void *arg) +mwl_ext_free(struct mbuf *m, void *data, void *arg) { struct mwl_softc *sc = arg; Modified: head/sys/kern/subr_mbpool.c ============================================================================== --- head/sys/kern/subr_mbpool.c Sat Aug 24 16:55:53 2013 (r254798) +++ head/sys/kern/subr_mbpool.c Sat Aug 24 16:57:44 2013 (r254799) @@ -283,7 +283,7 @@ mbp_free(struct mbpool *p, void *ptr) * Mbuf system external mbuf free routine */ void -mbp_ext_free(void *buf, void *arg) +mbp_ext_free(struct mbuf *m, void *buf, void *arg) { mbp_free(arg, buf); } Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Sat Aug 24 16:55:53 2013 (r254798) +++ head/sys/kern/uipc_mbuf.c Sat Aug 24 16:57:44 2013 (r254799) @@ -247,8 +247,8 @@ m_freem(struct mbuf *mb) */ int m_extadd(struct mbuf *mb, caddr_t buf, u_int size, - void (*freef)(void *, void *), void *arg1, void *arg2, int flags, int type, - int wait) + void (*freef)(struct mbuf *, void *, void *), void *arg1, void *arg2, + int flags, int type, int wait) { KASSERT(type != EXT_CLUSTER, ("%s: EXT_CLUSTER not allowed", __func__)); @@ -321,7 +321,7 @@ mb_free_ext(struct mbuf *m) case EXT_EXTREF: KASSERT(m->m_ext.ext_free != NULL, ("%s: ext_free not set", __func__)); - (*(m->m_ext.ext_free))(m->m_ext.ext_arg1, + (*(m->m_ext.ext_free))(m, m->m_ext.ext_arg1, m->m_ext.ext_arg2); break; default: Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Sat Aug 24 16:55:53 2013 (r254798) +++ head/sys/kern/uipc_syscalls.c Sat Aug 24 16:57:44 2013 (r254799) @@ -1855,7 +1855,7 @@ struct sendfile_sync { * Detach mapped page and release resources back to the system. */ void -sf_buf_mext(void *addr, void *args) +sf_buf_mext(struct mbuf *mb, void *addr, void *args) { vm_page_t m; struct sendfile_sync *sfs; @@ -2315,14 +2315,14 @@ retry_space: m0 = m_get((mnw ? M_NOWAIT : M_WAITOK), MT_DATA); if (m0 == NULL) { error = (mnw ? EAGAIN : ENOBUFS); - sf_buf_mext(NULL, sf); + sf_buf_mext(NULL, NULL, sf); break; } if (m_extadd(m0, (caddr_t )sf_buf_kva(sf), PAGE_SIZE, sf_buf_mext, sfs, sf, M_RDONLY, EXT_SFBUF, (mnw ? M_NOWAIT : M_WAITOK)) != 0) { error = (mnw ? EAGAIN : ENOBUFS); - sf_buf_mext(NULL, sf); + sf_buf_mext(NULL, NULL, sf); m_freem(m0); break; } Modified: head/sys/sys/mbpool.h ============================================================================== --- head/sys/sys/mbpool.h Sat Aug 24 16:55:53 2013 (r254798) +++ head/sys/sys/mbpool.h Sat Aug 24 16:57:44 2013 (r254799) @@ -69,7 +69,7 @@ void *mbp_alloc(struct mbpool *, bus_add void mbp_free(struct mbpool *, void *); /* free a chunk that is an external mbuf */ -void mbp_ext_free(void *, void *); +void mbp_ext_free(struct mbuf *, void *, void *); /* free all buffers that are marked to be on the card */ void mbp_card_free(struct mbpool *); Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat Aug 24 16:55:53 2013 (r254798) +++ head/sys/sys/mbuf.h Sat Aug 24 16:57:44 2013 (r254799) @@ -148,7 +148,7 @@ struct m_ext { uint32_t ext_type:8, /* type of external storage */ ext_flags:24; /* external storage mbuf flags */ void (*ext_free) /* free routine if not the usual */ - (void *, void *); + (struct mbuf *, void *, void *); void *ext_arg1; /* optional argument pointer */ void *ext_arg2; /* optional argument pointer */ }; @@ -822,7 +822,8 @@ int m_apply(struct mbuf *, int, int, int m_append(struct mbuf *, int, c_caddr_t); void m_cat(struct mbuf *, struct mbuf *); int m_extadd(struct mbuf *, caddr_t, u_int, - void (*)(void *, void *), void *, void *, int, int, int); + void (*)(struct mbuf *, void *, void *), void *, void *, + int, int, int); struct mbuf *m_collapse(struct mbuf *, int, int); void m_copyback(struct mbuf *, int, int, c_caddr_t); void m_copydata(const struct mbuf *, int, int, caddr_t); Modified: head/sys/sys/sf_buf.h ============================================================================== --- head/sys/sys/sf_buf.h Sat Aug 24 16:55:53 2013 (r254798) +++ head/sys/sys/sf_buf.h Sat Aug 24 16:57:44 2013 (r254799) @@ -55,6 +55,7 @@ struct sfstat { /* sendfile statistic #ifdef _KERNEL #include #include +struct mbuf; /* for sf_buf_mext() */ extern counter_u64_t sfstat[sizeof(struct sfstat) / sizeof(uint64_t)]; #define SFSTAT_ADD(name, val) \ @@ -66,6 +67,6 @@ extern counter_u64_t sfstat[sizeof(struc struct sf_buf * sf_buf_alloc(struct vm_page *m, int flags); void sf_buf_free(struct sf_buf *sf); -void sf_buf_mext(void *addr, void *args); +void sf_buf_mext(struct mbuf *mb, void *addr, void *args); #endif /* !_SYS_SF_BUF_H_ */ From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 17:14: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 ESMTP id 7AB2648F; Sat, 24 Aug 2013 17:14:15 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 681F82974; Sat, 24 Aug 2013 17:14: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 r7OHEF9g043388; Sat, 24 Aug 2013 17:14:15 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OHEFGi043385; Sat, 24 Aug 2013 17:14:15 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241714.r7OHEFGi043385@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 17:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254800 - in head/sys/dev: cxgb sfxge 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.14 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: Sat, 24 Aug 2013 17:14:15 -0000 Author: andre Date: Sat Aug 24 17:14:14 2013 New Revision: 254800 URL: http://svnweb.freebsd.org/changeset/base/254800 Log: Remove unnecessary setup of the m->pkthdr.header pointer. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/cxgb/cxgb_sge.c head/sys/dev/sfxge/sfxge_rx.c Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Sat Aug 24 16:57:44 2013 (r254799) +++ head/sys/dev/cxgb/cxgb_sge.c Sat Aug 24 17:14:14 2013 (r254800) @@ -2634,7 +2634,6 @@ t3_rx_eth(struct adapter *adap, struct m } m->m_pkthdr.rcvif = ifp; - m->m_pkthdr.header = mtod(m, uint8_t *) + sizeof(*cpl) + ethpad; /* * adjust after conversion to mbuf chain */ Modified: head/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_rx.c Sat Aug 24 16:57:44 2013 (r254799) +++ head/sys/dev/sfxge/sfxge_rx.c Sat Aug 24 17:14:14 2013 (r254800) @@ -282,7 +282,6 @@ static void __sfxge_rx_deliver(struct sf struct ifnet *ifp = sc->ifnet; m->m_pkthdr.rcvif = ifp; - m->m_pkthdr.header = m->m_data; m->m_pkthdr.csum_data = 0xffff; ifp->if_input(ifp, m); } From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 19:02: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 ESMTP id 9FE22AA0; Sat, 24 Aug 2013 19:02:36 +0000 (UTC) (envelope-from ken@FreeBSD.org) 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 8A9D12DF7; Sat, 24 Aug 2013 19:02: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 r7OJ2aNa001975; Sat, 24 Aug 2013 19:02:36 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OJ2a0I001974; Sat, 24 Aug 2013 19:02:36 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201308241902.r7OJ2a0I001974@svn.freebsd.org> From: "Kenneth D. Merry" Date: Sat, 24 Aug 2013 19:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254802 - 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.14 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: Sat, 24 Aug 2013 19:02:36 -0000 Author: ken Date: Sat Aug 24 19:02:36 2013 New Revision: 254802 URL: http://svnweb.freebsd.org/changeset/base/254802 Log: Fix a printf format warning on 32-bit mips and powerpc. Reported by: bde, gjb Pointy hat to: ken Modified: head/sys/kern/kern_physio.c Modified: head/sys/kern/kern_physio.c ============================================================================== --- head/sys/kern/kern_physio.c Sat Aug 24 17:45:42 2013 (r254801) +++ head/sys/kern/kern_physio.c Sat Aug 24 19:02:36 2013 (r254802) @@ -117,10 +117,10 @@ physio(struct cdev *dev, struct uio *uio * This device does not want I/O to be split. */ if (dev->si_flags & SI_NOSPLIT) { - printf("%s: request ptr %#jx is not " + printf("%s: request ptr %p is not " "on a page boundary, cannot split " "request\n", devtoname(dev), - (uintmax_t)bp->b_data); + bp->b_data); error = EFBIG; goto doerror; } From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 19:03: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 ESMTP id 27493BD8; Sat, 24 Aug 2013 19:03:18 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DF8C22DFD; Sat, 24 Aug 2013 19:03:17 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id r7OJ3AqJ062806; Sat, 24 Aug 2013 13:03:10 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id r7OJ3AaL062805; Sat, 24 Aug 2013 13:03:10 -0600 (MDT) (envelope-from ken) Date: Sat, 24 Aug 2013 13:03:10 -0600 From: "Kenneth D. Merry" To: Glen Barber Subject: Re: svn commit: r254760 - in head: share/man/man4 sys/cam/scsi sys/kern sys/sys Message-ID: <20130824190310.GA62787@nargothrond.kdm.org> References: <201308240452.r7O4qMji033904@svn.freebsd.org> <20130824164446.GA41859@glenbarber.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130824164446.GA41859@glenbarber.us> User-Agent: Mutt/1.4.2i 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.14 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: Sat, 24 Aug 2013 19:03:18 -0000 On Sat, Aug 24, 2013 at 12:44:46 -0400, Glen Barber wrote: > On Sat, Aug 24, 2013 at 04:52:22AM +0000, Kenneth D. Merry wrote: > > Author: ken > > Date: Sat Aug 24 04:52:22 2013 > > New Revision: 254760 > > URL: http://svnweb.freebsd.org/changeset/base/254760 > > > > > [...] > > > @@ -83,6 +113,17 @@ physio(struct cdev *dev, struct uio *uio > > */ > > iolen = ((vm_offset_t) bp->b_data) & PAGE_MASK; > > if ((bp->b_bcount + iolen) > bp->b_kvasize) { > > + /* > > + * This device does not want I/O to be split. > > + */ > > + if (dev->si_flags & SI_NOSPLIT) { > > + printf("%s: request ptr %#jx is not " > > + "on a page boundary, cannot split " > > + "request\n", devtoname(dev), > > + (uintmax_t)bp->b_data); > > This breaks LINT for at least powerpc. > > cc1: warnings being treated as errors > /src/sys/kern/kern_physio.c: In function 'physio': > /src/sys/kern/kern_physio.c:123: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] > *** Error code 1 > > > http://tinderbox.freebsd.org/tinderbox-head-build-HEAD-powerpc-powerpc.full Oops, sorry about that! Fixed. Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 19:38:37 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 ESMTP id 842D03B9; Sat, 24 Aug 2013 19:38:37 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 717322F57; Sat, 24 Aug 2013 19:38: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 r7OJcbbt020509; Sat, 24 Aug 2013 19:38:37 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OJcbEe020507; Sat, 24 Aug 2013 19:38:37 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241938.r7OJcbEe020507@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 19:38:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254803 - in head/sys/dev: jme nfe 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.14 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: Sat, 24 Aug 2013 19:38:37 -0000 Author: andre Date: Sat Aug 24 19:38:36 2013 New Revision: 254803 URL: http://svnweb.freebsd.org/changeset/base/254803 Log: Change local variable tso_segsz to tsosegsz to avoid mbuf.h macro conflicts. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/jme/if_jme.c head/sys/dev/nfe/if_nfe.c Modified: head/sys/dev/jme/if_jme.c ============================================================================== --- head/sys/dev/jme/if_jme.c Sat Aug 24 19:02:36 2013 (r254802) +++ head/sys/dev/jme/if_jme.c Sat Aug 24 19:38:36 2013 (r254803) @@ -1690,7 +1690,7 @@ jme_encap(struct jme_softc *sc, struct m struct mbuf *m; bus_dma_segment_t txsegs[JME_MAXTXSEGS]; int error, i, nsegs, prod; - uint32_t cflags, tso_segsz; + uint32_t cflags, tsosegsz; JME_LOCK_ASSERT(sc); @@ -1808,10 +1808,10 @@ jme_encap(struct jme_softc *sc, struct m m = *m_head; cflags = 0; - tso_segsz = 0; + tsosegsz = 0; /* Configure checksum offload and TSO. */ if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { - tso_segsz = (uint32_t)m->m_pkthdr.tso_segsz << + tsosegsz = (uint32_t)m->m_pkthdr.tso_segsz << JME_TD_MSS_SHIFT; cflags |= JME_TD_TSO; } else { @@ -1830,7 +1830,7 @@ jme_encap(struct jme_softc *sc, struct m desc = &sc->jme_rdata.jme_tx_ring[prod]; desc->flags = htole32(cflags); - desc->buflen = htole32(tso_segsz); + desc->buflen = htole32(tsosegsz); desc->addr_hi = htole32(m->m_pkthdr.len); desc->addr_lo = 0; sc->jme_cdata.jme_tx_cnt++; Modified: head/sys/dev/nfe/if_nfe.c ============================================================================== --- head/sys/dev/nfe/if_nfe.c Sat Aug 24 19:02:36 2013 (r254802) +++ head/sys/dev/nfe/if_nfe.c Sat Aug 24 19:38:36 2013 (r254803) @@ -2390,7 +2390,7 @@ nfe_encap(struct nfe_softc *sc, struct m bus_dmamap_t map; bus_dma_segment_t segs[NFE_MAX_SCATTER]; int error, i, nsegs, prod, si; - uint32_t tso_segsz; + uint32_t tsosegsz; uint16_t cflags, flags; struct mbuf *m; @@ -2429,9 +2429,9 @@ nfe_encap(struct nfe_softc *sc, struct m m = *m_head; cflags = flags = 0; - tso_segsz = 0; + tsosegsz = 0; if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { - tso_segsz = (uint32_t)m->m_pkthdr.tso_segsz << + tsosegsz = (uint32_t)m->m_pkthdr.tso_segsz << NFE_TX_TSO_SHIFT; cflags &= ~(NFE_TX_IP_CSUM | NFE_TX_TCP_UDP_CSUM); cflags |= NFE_TX_TSO; @@ -2482,14 +2482,14 @@ nfe_encap(struct nfe_softc *sc, struct m if ((m->m_flags & M_VLANTAG) != 0) desc64->vtag = htole32(NFE_TX_VTAG | m->m_pkthdr.ether_vtag); - if (tso_segsz != 0) { + if (tsosegsz != 0) { /* * XXX * The following indicates the descriptor element * is a 32bit quantity. */ - desc64->length |= htole16((uint16_t)tso_segsz); - desc64->flags |= htole16(tso_segsz >> 16); + desc64->length |= htole16((uint16_t)tsosegsz); + desc64->flags |= htole16(tsosegsz >> 16); } /* * finally, set the valid/checksum/TSO bit in the first @@ -2502,14 +2502,14 @@ nfe_encap(struct nfe_softc *sc, struct m else desc32->flags |= htole16(NFE_TX_LASTFRAG_V1); desc32 = &sc->txq.desc32[si]; - if (tso_segsz != 0) { + if (tsosegsz != 0) { /* * XXX * The following indicates the descriptor element * is a 32bit quantity. */ - desc32->length |= htole16((uint16_t)tso_segsz); - desc32->flags |= htole16(tso_segsz >> 16); + desc32->length |= htole16((uint16_t)tsosegsz); + desc32->flags |= htole16(tsosegsz >> 16); } /* * finally, set the valid/checksum/TSO bit in the first From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 19:51:22 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 ESMTP id 35FAE6E7; Sat, 24 Aug 2013 19:51:22 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 20DB12FFC; Sat, 24 Aug 2013 19:51:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OJpM13028993; Sat, 24 Aug 2013 19:51:22 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OJpJxa028966; Sat, 24 Aug 2013 19:51:19 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241951.r7OJpJxa028966@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 19:51:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254804 - in head/sys: dev/cxgb dev/e1000 dev/ixgbe dev/patm dev/qlxgb kern net netinet netinet6 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.14 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: Sat, 24 Aug 2013 19:51:22 -0000 Author: andre Date: Sat Aug 24 19:51:18 2013 New Revision: 254804 URL: http://svnweb.freebsd.org/changeset/base/254804 Log: Restructure the mbuf pkthdr to make it fit for upcoming capabilities and features. The changes in particular are: o Remove rarely used "header" pointer and replace it with a 64bit protocol/ layer specific union PH_loc for local use. Protocols can flexibly overlay their own 8 to 64 bit fields to store information while the packet is worked on. o Mechanically convert IP reassembly, IGMP/MLD and ATM to use pkthdr.PH_loc instead of pkthdr.header. o Extend csum_flags to 64bits to allow for additional future offload information to be carried (e.g. iSCSI, IPsec offload, and others). o Move the RSS hash type enumerator from abusing m_flags to its own 8bit rsstype field. Adjust accessor macros. o Add cosqos field to store Class of Service / Quality of Service information with the packet. It is not yet supported in any drivers but allows us to get on par with Cisco/Juniper in routing applications (plus MPLS QoS) with a modernized ALTQ. o Add four 8 bit fields l[2-5]hlen to store the relative header offsets from the start of the packet. This is important for various offload capabilities and to relieve the drivers from having to parse the packet and protocol headers to find out location of checksums and other information. Header parsing in drivers is a lot of copy-paste and unhandled corner cases which we want to avoid. o Add another flexible 64bit union to map various additional persistent packet information, like ether_vtag, tso_segsz and csum fields. Depending on the csum_flags settings some fields may have different usage making it very flexible and adaptable to future capabilities. o Restructure the CSUM flags to better signify their outbound (down the stack) and inbound (up the stack) use. The CSUM flags used to be a bit chaotic and rather poorly documented leading to incorrect use in many places. Bring clarity into their use through better naming. Compatibility mappings are provided to preserve the API. The drivers can be corrected one by one and MFC'd without issue. o The size of pkthdr stays the same at 48/56bytes (32/64bit architectures). Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/cxgb/cxgb_sge.c head/sys/dev/e1000/if_igb.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixv.c head/sys/dev/patm/if_patm.c head/sys/dev/patm/if_patm_tx.c head/sys/dev/qlxgb/qla_hw.c head/sys/kern/kern_mbuf.c head/sys/kern/uipc_mbuf.c head/sys/net/if.h head/sys/netinet/igmp.c head/sys/netinet/ip_input.c head/sys/netinet6/ip6_output.c head/sys/netinet6/mld6.c head/sys/sys/mbuf.h Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/dev/cxgb/cxgb_sge.c Sat Aug 24 19:51:18 2013 (r254804) @@ -1470,9 +1470,9 @@ t3_encap(struct sge_qset *qs, struct mbu hdr->len = htonl(mlen | 0x80000000); if (__predict_false(mlen < TCPPKTHDRSIZE)) { - printf("mbuf=%p,len=%d,tso_segsz=%d,csum_flags=%#x,flags=%#x", + printf("mbuf=%p,len=%d,tso_segsz=%d,csum_flags=%b,flags=%#x", m0, mlen, m0->m_pkthdr.tso_segsz, - m0->m_pkthdr.csum_flags, m0->m_flags); + (int)m0->m_pkthdr.csum_flags, CSUM_BITS, m0->m_flags); panic("tx tso packet too small"); } Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/dev/e1000/if_igb.c Sat Aug 24 19:51:18 2013 (r254804) @@ -4981,7 +4981,7 @@ igb_rx_checksum(u32 staterr, struct mbuf } if (status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS)) { - u16 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); + u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); #if __FreeBSD_version >= 800000 if (sctp) /* reassign */ type = CSUM_SCTP_VALID; Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/dev/ixgbe/ixgbe.c Sat Aug 24 19:51:18 2013 (r254804) @@ -4625,7 +4625,7 @@ ixgbe_rx_checksum(u32 staterr, struct mb mp->m_pkthdr.csum_flags = 0; } if (status & IXGBE_RXD_STAT_L4CS) { - u16 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); + u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); #if __FreeBSD_version >= 800000 if (sctp) type = CSUM_SCTP_VALID; Modified: head/sys/dev/ixgbe/ixv.c ============================================================================== --- head/sys/dev/ixgbe/ixv.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/dev/ixgbe/ixv.c Sat Aug 24 19:51:18 2013 (r254804) @@ -3544,7 +3544,7 @@ ixv_rx_checksum(u32 staterr, struct mbuf mp->m_pkthdr.csum_flags = 0; } if (status & IXGBE_RXD_STAT_L4CS) { - u16 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); + u64 type = (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); #if __FreeBSD_version >= 800000 if (sctp) type = CSUM_SCTP_VALID; Modified: head/sys/dev/patm/if_patm.c ============================================================================== --- head/sys/dev/patm/if_patm.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/dev/patm/if_patm.c Sat Aug 24 19:51:18 2013 (r254804) @@ -319,7 +319,7 @@ patm_stop(struct patm_softc *sc) for (i = 0; i < IDT_TSQE_TAG_SPACE; i++) { if ((m = scd->on_card[i]) != NULL) { scd->on_card[i] = 0; - map = m->m_pkthdr.header; + map = m->m_pkthdr.PH_loc.ptr; bus_dmamap_unload(sc->tx_tag, map->map); SLIST_INSERT_HEAD(&sc->tx_maps_free, map, link); Modified: head/sys/dev/patm/if_patm_tx.c ============================================================================== --- head/sys/dev/patm/if_patm_tx.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/dev/patm/if_patm_tx.c Sat Aug 24 19:51:18 2013 (r254804) @@ -373,7 +373,7 @@ patm_start(struct ifnet *ifp) } /* save data */ - m->m_pkthdr.header = vcc; + m->m_pkthdr.PH_loc.ptr = vcc; /* try to put it on the channels queue */ if (_IF_QFULL(&vcc->scd->q)) { @@ -473,7 +473,7 @@ patm_launch(struct patm_softc *sc, struc if (m == NULL) break; - a.vcc = m->m_pkthdr.header; + a.vcc = m->m_pkthdr.PH_loc.ptr; /* we must know the number of segments beforehand - count * this may actually give a wrong number of segments for @@ -499,7 +499,7 @@ patm_launch(struct patm_softc *sc, struc } /* load the map */ - m->m_pkthdr.header = map; + m->m_pkthdr.PH_loc.ptr = map; a.mbuf = m; /* handle AAL_RAW */ @@ -690,7 +690,7 @@ patm_tx(struct patm_softc *sc, u_int sta scd->on_card[last] = NULL; patm_debug(sc, TX, "ok tag=%x", last); - map = m->m_pkthdr.header; + map = m->m_pkthdr.PH_loc.ptr; scd->space += m->m_pkthdr.csum_data; bus_dmamap_sync(sc->tx_tag, map->map, Modified: head/sys/dev/qlxgb/qla_hw.c ============================================================================== --- head/sys/dev/qlxgb/qla_hw.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/dev/qlxgb/qla_hw.c Sat Aug 24 19:51:18 2013 (r254804) @@ -1000,9 +1000,9 @@ qla_hw_send(qla_host_t *ha, bus_dma_segm (mp->m_pkthdr.len > ha->max_frame_size)){ /* TBD: copy into private buffer and send it */ device_printf(dev, - "%s: (nsegs[%d, %d, 0x%x] > Q8_TX_MAX_SEGMENTS)\n", + "%s: (nsegs[%d, %d, 0x%b] > Q8_TX_MAX_SEGMENTS)\n", __func__, nsegs, mp->m_pkthdr.len, - mp->m_pkthdr.csum_flags); + (int)mp->m_pkthdr.csum_flags, CSUM_BITS); qla_dump_buf8(ha, "qla_hw_send: wrong pkt", mtod(mp, char *), mp->m_len); return (EINVAL); Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/kern/kern_mbuf.c Sat Aug 24 19:51:18 2013 (r254804) @@ -650,16 +650,20 @@ m_pkthdr_init(struct mbuf *m, int how) int error; #endif m->m_data = m->m_pktdat; - SLIST_INIT(&m->m_pkthdr.tags); m->m_pkthdr.rcvif = NULL; - m->m_pkthdr.header = NULL; + SLIST_INIT(&m->m_pkthdr.tags); m->m_pkthdr.len = 0; m->m_pkthdr.flowid = 0; - m->m_pkthdr.fibnum = 0; m->m_pkthdr.csum_flags = 0; - m->m_pkthdr.csum_data = 0; - m->m_pkthdr.tso_segsz = 0; - m->m_pkthdr.ether_vtag = 0; + m->m_pkthdr.fibnum = 0; + m->m_pkthdr.cosqos = 0; + m->m_pkthdr.rsstype = 0; + m->m_pkthdr.l2hlen = 0; + m->m_pkthdr.l3hlen = 0; + m->m_pkthdr.l4hlen = 0; + m->m_pkthdr.l5hlen = 0; + m->m_pkthdr.PH_per.sixtyfour[0] = 0; + m->m_pkthdr.PH_loc.sixtyfour[0] = 0; #ifdef MAC /* If the label init fails, fail the alloc */ error = mac_mbuf_init(m, how); Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/kern/uipc_mbuf.c Sat Aug 24 19:51:18 2013 (r254804) @@ -438,11 +438,6 @@ m_sanity(struct mbuf *m0, int sanitize) M_SANITY_ACTION("m_data outside mbuf data range right"); if ((caddr_t)m->m_data + m->m_len > b) M_SANITY_ACTION("m_data + m_len exeeds mbuf space"); - if ((m->m_flags & M_PKTHDR) && m->m_pkthdr.header) { - if ((caddr_t)m->m_pkthdr.header < a || - (caddr_t)m->m_pkthdr.header > b) - M_SANITY_ACTION("m_pkthdr.header outside mbuf data range"); - } /* m->m_nextpkt may only be set on first mbuf in chain. */ if (m != m0 && m->m_nextpkt != NULL) { @@ -746,7 +741,6 @@ m_copymdata(struct mbuf *m, struct mbuf return NULL; bcopy(&buf, mm->m_ext.ext_buf, mm->m_len); mm->m_data = mm->m_ext.ext_buf; - mm->m_pkthdr.header = NULL; } if (prep && !(mm->m_flags & M_EXT) && len > M_LEADINGSPACE(mm)) { bcopy(mm->m_data, &buf, mm->m_len); @@ -757,7 +751,6 @@ m_copymdata(struct mbuf *m, struct mbuf mm->m_ext.ext_size - mm->m_len, mm->m_len); mm->m_data = (caddr_t)mm->m_ext.ext_buf + mm->m_ext.ext_size - mm->m_len; - mm->m_pkthdr.header = NULL; } /* Append/prepend as many mbuf (clusters) as necessary to fit len. */ Modified: head/sys/net/if.h ============================================================================== --- head/sys/net/if.h Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/net/if.h Sat Aug 24 19:51:18 2013 (r254804) @@ -103,7 +103,7 @@ struct if_data { u_long ifi_omcasts; /* packets sent via multicast */ u_long ifi_iqdrops; /* dropped on input, this interface */ u_long ifi_noproto; /* destined for unsupported protocol */ - u_long ifi_hwassist; /* HW offload capabilities, see IFCAP */ + uint64_t ifi_hwassist; /* HW offload capabilities, see IFCAP */ time_t ifi_epoch; /* uptime at attach or stat reset */ struct timeval ifi_lastchange; /* time of last administrative change */ }; Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/netinet/igmp.c Sat Aug 24 19:51:18 2013 (r254804) @@ -289,7 +289,7 @@ igmp_save_context(struct mbuf *m, struct { #ifdef VIMAGE - m->m_pkthdr.header = ifp->if_vnet; + m->m_pkthdr.PH_loc.ptr = ifp->if_vnet; #endif /* VIMAGE */ m->m_pkthdr.flowid = ifp->if_index; } @@ -298,7 +298,7 @@ static __inline void igmp_scrub_context(struct mbuf *m) { - m->m_pkthdr.header = NULL; + m->m_pkthdr.PH_loc.ptr = NULL; m->m_pkthdr.flowid = 0; } @@ -326,7 +326,7 @@ igmp_restore_context(struct mbuf *m) #ifdef notyet #if defined(VIMAGE) && defined(INVARIANTS) - KASSERT(curvnet == (m->m_pkthdr.header), + KASSERT(curvnet == (m->m_pkthdr.PH_loc.ptr), ("%s: called when curvnet was not restored", __func__)); #endif #endif @@ -3403,7 +3403,7 @@ igmp_intr(struct mbuf *m) * indexes to guard against interface detach, they are * unique to each VIMAGE and must be retrieved. */ - CURVNET_SET((struct vnet *)(m->m_pkthdr.header)); + CURVNET_SET((struct vnet *)(m->m_pkthdr.PH_loc.ptr)); ifindex = igmp_restore_context(m); /* Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/netinet/ip_input.c Sat Aug 24 19:51:18 2013 (r254804) @@ -921,7 +921,7 @@ found: * ip_reass() will return a different mbuf. */ IPSTAT_INC(ips_fragments); - m->m_pkthdr.header = ip; + m->m_pkthdr.PH_loc.ptr = ip; /* Previous ip_reass() started here. */ /* @@ -964,7 +964,7 @@ found: #endif } -#define GETIP(m) ((struct ip*)((m)->m_pkthdr.header)) +#define GETIP(m) ((struct ip*)((m)->m_pkthdr.PH_loc.ptr)) /* * Handle ECN by comparing this segment with the first one; Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/netinet6/ip6_output.c Sat Aug 24 19:51:18 2013 (r254804) @@ -196,8 +196,8 @@ in6_delayed_cksum(struct mbuf *m, uint32 if (offset + sizeof(u_short) > m->m_len) { printf("%s: delayed m_pullup, m->len: %d plen %u off %u " - "csum_flags=0x%04x\n", __func__, m->m_len, plen, offset, - m->m_pkthdr.csum_flags); + "csum_flags=%b\n", __func__, m->m_len, plen, offset, + (int)m->m_pkthdr.csum_flags, CSUM_BITS); /* * XXX this should not happen, but if it does, the correct * behavior may be to insert the checksum in the appropriate Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/netinet6/mld6.c Sat Aug 24 19:51:18 2013 (r254804) @@ -275,7 +275,7 @@ mld_save_context(struct mbuf *m, struct { #ifdef VIMAGE - m->m_pkthdr.header = ifp->if_vnet; + m->m_pkthdr.PH_loc.ptr = ifp->if_vnet; #endif /* VIMAGE */ m->m_pkthdr.flowid = ifp->if_index; } @@ -284,7 +284,7 @@ static __inline void mld_scrub_context(struct mbuf *m) { - m->m_pkthdr.header = NULL; + m->m_pkthdr.PH_loc.ptr = NULL; m->m_pkthdr.flowid = 0; } @@ -300,7 +300,7 @@ mld_restore_context(struct mbuf *m) { #if defined(VIMAGE) && defined(INVARIANTS) - KASSERT(curvnet == m->m_pkthdr.header, + KASSERT(curvnet == m->m_pkthdr.PH_loc.ptr, ("%s: called when curvnet was not restored", __func__)); #endif return (m->m_pkthdr.flowid); Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat Aug 24 19:38:36 2013 (r254803) +++ head/sys/sys/mbuf.h Sat Aug 24 19:51:18 2013 (r254804) @@ -112,28 +112,49 @@ struct m_tag { /* * Record/packet header in first mbuf of chain; valid only if M_PKTHDR is set. + * Size ILP32: 48 + * LP64: 56 */ struct pkthdr { struct ifnet *rcvif; /* rcv interface */ - /* variables for ip and tcp reassembly */ - void *header; /* pointer to packet header */ - int len; /* total packet length */ - uint32_t flowid; /* packet's 4-tuple system - * flow identifier - */ - /* variables for hardware checksum */ - int csum_flags; /* flags regarding checksum */ - int csum_data; /* data field used by csum routines */ - u_int16_t tso_segsz; /* TSO segment size */ - union { - u_int16_t vt_vtag; /* Ethernet 802.1p+q vlan tag */ - u_int16_t vt_nrecs; /* # of IGMPv3 records in this chain */ - } PH_vt; - u_int16_t fibnum; /* this packet should use this fib */ - u_int16_t pad2; /* align to 32 bits */ SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */ + int32_t len; /* total packet length */ + + /* Layer crossing persistent information. */ + uint32_t flowid; /* packet's 4-tuple system */ + uint64_t csum_flags; /* checksum and offload features */ + uint16_t fibnum; /* this packet should use this fib */ + uint8_t cosqos; /* class/quality of service */ + uint8_t rsstype; /* hash type */ + uint8_t l2hlen; /* layer 2 header length */ + uint8_t l3hlen; /* layer 3 header length */ + uint8_t l4hlen; /* layer 4 header length */ + uint8_t l5hlen; /* layer 5 header length */ + union { + uint8_t eigth[8]; + uint16_t sixteen[4]; + uint32_t thirtytwo[2]; + uint64_t sixtyfour[1]; + uintptr_t unintptr[1]; + void *ptr; + } PH_per; + + /* Layer specific non-persistent local storage for reassembly, etc. */ + union { + uint8_t eigth[8]; + uint16_t sixteen[4]; + uint32_t thirtytwo[2]; + uint64_t sixtyfour[1]; + uintptr_t unintptr[1]; + void *ptr; + } PH_loc; }; -#define ether_vtag PH_vt.vt_vtag +#define ether_vtag PH_per.sixteen[0] +#define PH_vt PH_per +#define vt_nrecs sixteen[0] +#define tso_segsz PH_per.sixteen[1] +#define csum_phsum PH_per.sixteen[2] +#define csum_data PH_per.thirtytwo[1] /* * Description of external storage mapped into mbuf; valid only if M_EXT is @@ -209,8 +230,6 @@ struct mbuf { #define M_PROTO11 0x00400000 /* protocol-specific */ #define M_PROTO12 0x00800000 /* protocol-specific */ -#define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid hash type */ - /* * Flags to purge when crossing layers. */ @@ -219,6 +238,13 @@ struct mbuf { M_PROTO9|M_PROTO10|M_PROTO11|M_PROTO12) /* + * Flags preserved when copying m_pkthdr. + */ +#define M_COPYFLAGS \ + (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_VLANTAG|M_PROMISC| \ + M_PROTOFLAGS) + +/* * Mbuf flag description for use with printf(9) %b identifier. */ #define M_FLAG_BITS \ @@ -245,31 +271,46 @@ struct mbuf { * that provide an opaque flow identifier, allowing for ordering and * distribution without explicit affinity. */ -#define M_HASHTYPE_SHIFT 24 -#define M_HASHTYPE_NONE 0x0 -#define M_HASHTYPE_RSS_IPV4 0x1 /* IPv4 2-tuple */ -#define M_HASHTYPE_RSS_TCP_IPV4 0x2 /* TCPv4 4-tuple */ -#define M_HASHTYPE_RSS_IPV6 0x3 /* IPv6 2-tuple */ -#define M_HASHTYPE_RSS_TCP_IPV6 0x4 /* TCPv6 4-tuple */ -#define M_HASHTYPE_RSS_IPV6_EX 0x5 /* IPv6 2-tuple + ext hdrs */ -#define M_HASHTYPE_RSS_TCP_IPV6_EX 0x6 /* TCPv6 4-tiple + ext hdrs */ -#define M_HASHTYPE_OPAQUE 0xf /* ordering, not affinity */ - -#define M_HASHTYPE_CLEAR(m) (m)->m_flags &= ~(M_HASHTYPEBITS) -#define M_HASHTYPE_GET(m) (((m)->m_flags & M_HASHTYPEBITS) >> \ - M_HASHTYPE_SHIFT) -#define M_HASHTYPE_SET(m, v) do { \ - (m)->m_flags &= ~M_HASHTYPEBITS; \ - (m)->m_flags |= ((v) << M_HASHTYPE_SHIFT); \ -} while (0) +#define M_HASHTYPE_NONE 0 +#define M_HASHTYPE_RSS_IPV4 1 /* IPv4 2-tuple */ +#define M_HASHTYPE_RSS_TCP_IPV4 2 /* TCPv4 4-tuple */ +#define M_HASHTYPE_RSS_IPV6 3 /* IPv6 2-tuple */ +#define M_HASHTYPE_RSS_TCP_IPV6 4 /* TCPv6 4-tuple */ +#define M_HASHTYPE_RSS_IPV6_EX 5 /* IPv6 2-tuple + ext hdrs */ +#define M_HASHTYPE_RSS_TCP_IPV6_EX 6 /* TCPv6 4-tiple + ext hdrs */ +#define M_HASHTYPE_OPAQUE 255 /* ordering, not affinity */ + +#define M_HASHTYPE_CLEAR(m) ((m)->m_pkthdr.rsstype = 0) +#define M_HASHTYPE_GET(m) ((m)->m_pkthdr.rsstype) +#define M_HASHTYPE_SET(m, v) ((m)->m_pkthdr.rsstype = (v)) #define M_HASHTYPE_TEST(m, v) (M_HASHTYPE_GET(m) == (v)) /* - * Flags preserved when copying m_pkthdr. + * COS/QOS class and quality of service tags. + * It uses DSCP code points as base. */ -#define M_COPYFLAGS \ - (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_VLANTAG|M_PROMISC| \ - M_PROTOFLAGS|M_HASHTYPEBITS) +#define QOS_DSCP_CS0 0x00 +#define QOS_DSCP_DEF QOS_DSCP_CS0 +#define QOS_DSCP_CS1 0x20 +#define QOS_DSCP_AF11 0x28 +#define QOS_DSCP_AF12 0x30 +#define QOS_DSCP_AF13 0x38 +#define QOS_DSCP_CS2 0x40 +#define QOS_DSCP_AF21 0x48 +#define QOS_DSCP_AF22 0x50 +#define QOS_DSCP_AF23 0x58 +#define QOS_DSCP_CS3 0x60 +#define QOS_DSCP_AF31 0x68 +#define QOS_DSCP_AF32 0x70 +#define QOS_DSCP_AF33 0x78 +#define QOS_DSCP_CS4 0x80 +#define QOS_DSCP_AF41 0x88 +#define QOS_DSCP_AF42 0x90 +#define QOS_DSCP_AF43 0x98 +#define QOS_DSCP_CS5 0xa0 +#define QOS_DSCP_EF 0xb8 +#define QOS_DSCP_CS6 0xc0 +#define QOS_DSCP_CS7 0xe0 /* * External mbuf storage buffer types. @@ -325,33 +366,66 @@ struct mbuf { "\30EXT_FLAG_EXP4" /* - * Flags indicating hw checksum support and sw checksum requirements. This - * field can be directly tested against if_data.ifi_hwassist. - */ -#define CSUM_IP 0x0001 /* will csum IP */ -#define CSUM_TCP 0x0002 /* will csum TCP */ -#define CSUM_UDP 0x0004 /* will csum UDP */ -#define CSUM_FRAGMENT 0x0010 /* will do IP fragmentation */ -#define CSUM_TSO 0x0020 /* will do TSO */ -#define CSUM_SCTP 0x0040 /* will csum SCTP */ -#define CSUM_SCTP_IPV6 0x0080 /* will csum IPv6/SCTP */ - -#define CSUM_IP_CHECKED 0x0100 /* did csum IP */ -#define CSUM_IP_VALID 0x0200 /* ... the csum is valid */ -#define CSUM_DATA_VALID 0x0400 /* csum_data field is valid */ -#define CSUM_PSEUDO_HDR 0x0800 /* csum_data has pseudo hdr */ -#define CSUM_SCTP_VALID 0x1000 /* SCTP checksum is valid */ -#define CSUM_UDP_IPV6 0x2000 /* will csum IPv6/UDP */ -#define CSUM_TCP_IPV6 0x4000 /* will csum IPv6/TCP */ -/* CSUM_TSO_IPV6 0x8000 will do IPv6/TSO */ - -/* CSUM_FRAGMENT_IPV6 0x10000 will do IPv6 fragementation */ - -#define CSUM_DELAY_DATA_IPV6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6) + * Flags indicating checksum, segmentation and other offload work to be + * done, or already done, by hardware or lower layers. It is split into + * separate inbound and outbound flags. + * + * Outbound flags that are set by upper protocol layers requesting lower + * layers, or ideally the hardware, to perform these offloading tasks. + * For outbound packets this field and its flags can be directly tested + * against if_data.ifi_hwassist. + */ +#define CSUM_IP 0x00000001 /* IP header checksum offload */ +#define CSUM_IP_UDP 0x00000002 /* UDP checksum offload */ +#define CSUM_IP_TCP 0x00000004 /* TCP checksum offload */ +#define CSUM_IP_SCTP 0x00000008 /* SCTP checksum offload */ +#define CSUM_IP_TSO 0x00000010 /* TCP segmentation offload */ +#define CSUM_IP_ISCSI 0x00000020 /* iSCSI checksum offload */ + +#define CSUM_IP6_UDP 0x00000200 /* UDP checksum offload */ +#define CSUM_IP6_TCP 0x00000400 /* TCP checksum offload */ +#define CSUM_IP6_SCTP 0x00000800 /* SCTP checksum offload */ +#define CSUM_IP6_TSO 0x00001000 /* TCP segmentation offload */ +#define CSUM_IP6_ISCSI 0x00002000 /* iSCSI checksum offload */ + +/* Inbound checksum support where the checksum was verified by hardware. */ +#define CSUM_L3_CALC 0x01000000 /* calculated layer 3 csum */ +#define CSUM_L3_VALID 0x02000000 /* checksum is correct */ +#define CSUM_L4_CALC 0x04000000 /* calculated layer 4 csum */ +#define CSUM_L4_VALID 0x08000000 /* checksum is correct */ +#define CSUM_L5_CALC 0x10000000 /* calculated layer 5 csum */ +#define CSUM_L5_VALID 0x20000000 /* checksum is correct */ +#define CSUM_COALESED 0x40000000 /* contains merged segments */ + +/* + * CSUM flag description for use with printf(9) %b identifier. + */ +#define CSUM_BITS \ + "\20\1CSUM_IP\2CSUM_IP_UDP\3CSUM_IP_TCP\4CSUM_IP_SCTP\5CSUM_IP_TSO" \ + "\6CSUM_IP_ISCSI" \ + "\12CSUM_IP6_UDP\13CSUM_IP6_TCP\14CSUM_IP6_SCTP\15CSUM_IP6_TSO" \ + "\16CSUM_IP6_ISCSI" \ + "\31CSUM_L3_CALC\32CSUM_L3_VALID\33CSUM_L4_CALC\34CSUM_L4_VALID" \ + "\35CSUM_L5_CALC\36CSUM_L5_VALID\37CSUM_COALESED" + +/* CSUM flags compatibility mappings. */ +#define CSUM_IP_CHECKED CSUM_L3_CALC +#define CSUM_IP_VALID CSUM_L3_VALID +#define CSUM_DATA_VALID CSUM_L4_VALID +#define CSUM_PSEUDO_HDR CSUM_L4_CALC +#define CSUM_SCTP_VALID CSUM_L3_VALID +#define CSUM_DELAY_DATA (CSUM_TCP|CSUM_UDP) +#define CSUM_DELAY_IP CSUM_IP /* Only v4, no v6 IP hdr csum */ +#define CSUM_DELAY_DATA_IPV6 (CSUM_TCP_IPV6|CSUM_UDP_IPV6) #define CSUM_DATA_VALID_IPV6 CSUM_DATA_VALID - -#define CSUM_DELAY_DATA (CSUM_TCP | CSUM_UDP) -#define CSUM_DELAY_IP (CSUM_IP) /* Only v4, no v6 IP hdr csum */ +#define CSUM_TCP CSUM_IP_TCP +#define CSUM_UDP CSUM_IP_UDP +#define CSUM_SCTP CSUM_IP_SCTP +#define CSUM_TSO (CSUM_IP_TSO|CSUM_IP6_TSO) +#define CSUM_UDP_IPV6 CSUM_IP6_UDP +#define CSUM_TCP_IPV6 CSUM_IP6_TCP +#define CSUM_SCTP_IPV6 CSUM_IP6_SCTP +#define CSUM_FRAGMENT 0x0 /* Unused */ /* * mbuf types. From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 19:58: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 ESMTP id AAAA6A1D; Sat, 24 Aug 2013 19:58:36 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 96483202B; Sat, 24 Aug 2013 19:58: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 r7OJwa9f031369; Sat, 24 Aug 2013 19:58:36 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OJwaxV031368; Sat, 24 Aug 2013 19:58:36 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308241958.r7OJwaxV031368@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 19:58:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254805 - 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.14 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: Sat, 24 Aug 2013 19:58:36 -0000 Author: andre Date: Sat Aug 24 19:58:36 2013 New Revision: 254805 URL: http://svnweb.freebsd.org/changeset/base/254805 Log: Add mtodo(m, o) macro taking an additional offset into the mbuf data section. Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat Aug 24 19:51:18 2013 (r254804) +++ head/sys/sys/mbuf.h Sat Aug 24 19:58:36 2013 (r254805) @@ -67,8 +67,10 @@ * type: * * mtod(m, t) -- Convert mbuf pointer to data pointer of correct type. + * mtodo(m, o) -- Same as above but with offset 'o' into data. */ #define mtod(m, t) ((t)((m)->m_data)) +#define mtodo(m, o) ((void *)(((m)->m_data) + (o))) /* * Argument structure passed to UMA routines during mbuf and packet From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 20:06:00 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 ESMTP id DA9D2DD5; Sat, 24 Aug 2013 20:06:00 +0000 (UTC) (envelope-from jilles@FreeBSD.org) 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 C733C20B8; Sat, 24 Aug 2013 20:06: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 r7OK60l9036250; Sat, 24 Aug 2013 20:06:00 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OK60e0036247; Sat, 24 Aug 2013 20:06:00 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201308242006.r7OK60e0036247@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 24 Aug 2013 20:06:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254806 - in head: bin/sh tools/regression/bin/sh/expansion 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.14 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: Sat, 24 Aug 2013 20:06:00 -0000 Author: jilles Date: Sat Aug 24 20:06:00 2013 New Revision: 254806 URL: http://svnweb.freebsd.org/changeset/base/254806 Log: sh: Reject ++ and -- in arithmetic. POSIX does not require ++ and -- in arithmetic. It is probably more useful to reject them than to treat ++x and --x as x silently. Note that the behaviour of increment and decrement can be obtained via (x+=1), ((x+=1)-1), (x-=1) and ((x-=1)+1). PR: bin/176444 Added: head/tools/regression/bin/sh/expansion/arith13.0 (contents, props changed) Modified: head/bin/sh/arith_yylex.c Modified: head/bin/sh/arith_yylex.c ============================================================================== --- head/bin/sh/arith_yylex.c Sat Aug 24 19:58:36 2013 (r254805) +++ head/bin/sh/arith_yylex.c Sat Aug 24 20:06:00 2013 (r254806) @@ -218,9 +218,13 @@ checkeqcur: value += ARITH_REM - '%'; goto checkeq; case '+': + if (buf[1] == '+') + return ARITH_BAD; value += ARITH_ADD - '+'; goto checkeq; case '-': + if (buf[1] == '-') + return ARITH_BAD; value += ARITH_SUB - '-'; goto checkeq; case '~': Added: head/tools/regression/bin/sh/expansion/arith13.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/arith13.0 Sat Aug 24 20:06:00 2013 (r254806) @@ -0,0 +1,6 @@ +# $FreeBSD$ +# Pre-increment and pre-decrement in arithmetic expansion are not in POSIX. +# Require either an error or a correct implementation. + +! (eval 'x=4; [ $((++x)) != 5 ] || [ $x != 5 ]') 2>/dev/null && +! (eval 'x=2; [ $((--x)) != 1 ] || [ $x != 1 ]') 2>/dev/null From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 20:26:42 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 ESMTP id 0EB38251; Sat, 24 Aug 2013 20:26:42 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 DF365217D; Sat, 24 Aug 2013 20:26: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 r7OKQf2Y047548; Sat, 24 Aug 2013 20:26:41 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OKQfWa047547; Sat, 24 Aug 2013 20:26:41 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308242026.r7OKQfWa047547@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 20:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254807 - 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.14 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: Sat, 24 Aug 2013 20:26:42 -0000 Author: andre Date: Sat Aug 24 20:26:41 2013 New Revision: 254807 URL: http://svnweb.freebsd.org/changeset/base/254807 Log: Compact m_hdr by packing the type and flags fields into one uint32_t. The mbuf type is an enumerator with only a handful of types in use and thus reduced from int to 8bits allowing for 255 types to be specified. Only 5 types have been in use for a long time. The flags field gets the remaining 24 bits with 12 bits for global persistent flags and 12 bits for protocol/layer specific overlays. Some of the global flags/functionality can be moved to the csum_flags or ext_flags bits in the future. MT_VENDOR[1-4] and MT_EXP[1-4] types for vendor-internal and experimental local mapping are added. The size of m_hdr shrinks from 24/40 to 20/32bytes (32/64bit architectures). Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat Aug 24 20:06:00 2013 (r254806) +++ head/sys/sys/mbuf.h Sat Aug 24 20:26:41 2013 (r254807) @@ -82,23 +82,18 @@ struct mb_args { }; #endif /* _KERNEL */ -#if defined(__LP64__) -#define M_HDR_PAD 6 -#else -#define M_HDR_PAD 2 -#endif - /* * Header present at the beginning of every mbuf. + * Size ILP32: 20 + * LP64: 32 */ struct m_hdr { struct mbuf *mh_next; /* next buffer in chain */ struct mbuf *mh_nextpkt; /* next chain in queue/record */ caddr_t mh_data; /* location of data */ - int mh_len; /* amount of data in this mbuf */ - int mh_flags; /* flags; see below */ - short mh_type; /* type of data in this mbuf */ - uint8_t pad[M_HDR_PAD];/* word align */ + int32_t mh_len; /* amount of data in this mbuf */ + uint32_t mh_type:8, /* type of data in this mbuf */ + mh_flags:24; /* flags; see below */ }; /* @@ -206,7 +201,10 @@ struct mbuf { #define m_dat M_dat.M_databuf /* - * mbuf flags. + * mbuf flags of global significance and layer crossing. + * Those of only protocol/layer specific significance are to be mapped + * to M_PROTO[1-12] and cleared at layer handoff boundaries. + * NB: Limited to the lower 24 bits. */ #define M_EXT 0x00000001 /* has associated external storage */ #define M_PKTHDR 0x00000002 /* start of record */ @@ -430,12 +428,24 @@ struct mbuf { #define CSUM_FRAGMENT 0x0 /* Unused */ /* - * mbuf types. + * mbuf types describing the content of the mbuf (including external storage). */ #define MT_NOTMBUF 0 /* USED INTERNALLY ONLY! Object is not mbuf */ #define MT_DATA 1 /* dynamic (data) allocation */ #define MT_HEADER MT_DATA /* packet header, use M_PKTHDR instead */ + +#define MT_VENDOR1 4 /* for vendor-internal use */ +#define MT_VENDOR2 5 /* for vendor-internal use */ +#define MT_VENDOR3 6 /* for vendor-internal use */ +#define MT_VENDOR4 7 /* for vendor-internal use */ + #define MT_SONAME 8 /* socket name */ + +#define MT_EXP1 9 /* for experimental use */ +#define MT_EXP2 10 /* for experimental use */ +#define MT_EXP3 11 /* for experimental use */ +#define MT_EXP4 12 /* for experimental use */ + #define MT_CONTROL 14 /* extra-data protocol message */ #define MT_OOBDATA 15 /* expedited data */ #define MT_NTYPES 16 /* number of mbuf types for mbtypes[] */ From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:00:40 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 ESMTP id 6FFB3B64; Sat, 24 Aug 2013 21:00:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) 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 5CD682322; Sat, 24 Aug 2013 21:00:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OL0eNf065721; Sat, 24 Aug 2013 21:00:40 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OL0eNG065720; Sat, 24 Aug 2013 21:00:40 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201308242100.r7OL0eNG065720@svn.freebsd.org> From: Mark Johnston Date: Sat, 24 Aug 2013 21:00:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254808 - 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.14 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: Sat, 24 Aug 2013 21:00:40 -0000 Author: markj Date: Sat Aug 24 21:00:39 2013 New Revision: 254808 URL: http://svnweb.freebsd.org/changeset/base/254808 Log: Remove some code that has been commented out since it was added in 2000. Modified: head/sys/kern/link_elf.c Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Sat Aug 24 20:26:41 2013 (r254807) +++ head/sys/kern/link_elf.c Sat Aug 24 21:00:39 2013 (r254808) @@ -702,16 +702,6 @@ link_elf_link_preload_finish(linker_file int error; ef = (elf_file_t) lf; -#if 0 /* this will be more trouble than it's worth for now */ - for (dp = ef->dynamic; dp->d_tag != DT_NULL; dp++) { - if (dp->d_tag != DT_NEEDED) - continue; - modname = ef->strtab + dp->d_un.d_val; - error = linker_load_module(modname, lf); - if (error != 0) - goto out; - } -#endif error = relocate_file(ef); if (error != 0) return (error); @@ -973,16 +963,6 @@ link_elf_load_file(linker_class_t cls, c vn_lock(nd.ni_vp, LK_EXCLUSIVE | LK_RETRY); if (error != 0) goto out; -#if 0 /* this will be more trouble than it's worth for now */ - for (dp = ef->dynamic; dp->d_tag != DT_NULL; dp++) { - if (dp->d_tag != DT_NEEDED) - continue; - modname = ef->strtab + dp->d_un.d_val; - error = linker_load_module(modname, lf); - if (error != 0) - goto out; - } -#endif error = relocate_file(ef); if (error != 0) goto out; From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:04:55 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 ESMTP id 612B8E0B; Sat, 24 Aug 2013 21:04:55 +0000 (UTC) (envelope-from joerg@FreeBSD.org) 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 4DE362347; Sat, 24 Aug 2013 21:04: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 r7OL4t1X068824; Sat, 24 Aug 2013 21:04:55 GMT (envelope-from joerg@svn.freebsd.org) Received: (from joerg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OL4tUf068823; Sat, 24 Aug 2013 21:04:55 GMT (envelope-from joerg@svn.freebsd.org) Message-Id: <201308242104.r7OL4tUf068823@svn.freebsd.org> From: Joerg Wunsch Date: Sat, 24 Aug 2013 21:04:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254809 - head/sys/dev/fdc 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.14 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: Sat, 24 Aug 2013 21:04:55 -0000 Author: joerg Date: Sat Aug 24 21:04:54 2013 New Revision: 254809 URL: http://svnweb.freebsd.org/changeset/base/254809 Log: Do not use "Enable Implied Seek" on enhanced floppy controllers. This breaks the "2step" feature of the driver, e.g. in order to read 360 KiB media on a 1200 KiB drive. As the only potential advantage of implied (vs. explicit) seeks is to minimize the software effort, yet our driver always contained the logic needed for explicit seeks, simply dropping implied seeks is the best solution without introducing risks for new bugs. There is no performance penalty, reading a 1440 KiB medium takes exactly the same time with both, implied or explicit seeks. MFC after: 1 week Modified: head/sys/dev/fdc/fdc.c Modified: head/sys/dev/fdc/fdc.c ============================================================================== --- head/sys/dev/fdc/fdc.c Sat Aug 24 21:00:39 2013 (r254808) +++ head/sys/dev/fdc/fdc.c Sat Aug 24 21:04:54 2013 (r254809) @@ -528,7 +528,8 @@ fdc_reset(struct fdc_data *fdc) if (fdc_cmd(fdc, 4, I8207X_CONFIG, 0, - 0x40 | /* Enable Implied Seek */ + /* 0x40 | */ /* Enable Implied Seek - + * breaks 2step! */ 0x10 | /* Polling disabled */ (fifo_threshold - 1), /* Fifo threshold */ 0x00, /* Precomp track */ @@ -922,14 +923,8 @@ fdc_worker(struct fdc_data *fdc) /* * SEEK to where we want to be - * - * Enhanced controllers do implied seeks for read&write as long as - * we do not need multiple steps per track. */ - if (cylinder != fd->track && ( - fdc->fdct != FDC_ENHANCED || - descyl != cylinder || - (bp->bio_cmd & (BIO_RDID|BIO_FMT)))) { + if (cylinder != fd->track) { retry_line = __LINE__; if (fdc_cmd(fdc, 3, NE7CMD_SEEK, fd->fdsu, descyl, 0)) return (1); From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:07:04 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 ESMTP id C6C05F5; Sat, 24 Aug 2013 21:07:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) 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 B315A2364; Sat, 24 Aug 2013 21:07:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OL74vs069441; Sat, 24 Aug 2013 21:07:04 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OL74v2069440; Sat, 24 Aug 2013 21:07:04 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201308242107.r7OL74v2069440@svn.freebsd.org> From: Mark Johnston Date: Sat, 24 Aug 2013 21:07:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254810 - 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.14 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: Sat, 24 Aug 2013 21:07:04 -0000 Author: markj Date: Sat Aug 24 21:07:04 2013 New Revision: 254810 URL: http://svnweb.freebsd.org/changeset/base/254810 Log: Remove the kld lock macros and just use the sx(9) API. Add locking in linker_init_kernel_modules() and linker_preload() in order to remove most of the checks for !cold before asserting that the kld lock is held. These routines are invoked by SYSINIT(9), so there's no harm in them taking the kld lock. Modified: head/sys/kern/kern_linker.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Sat Aug 24 21:04:54 2013 (r254809) +++ head/sys/kern/kern_linker.c Sat Aug 24 21:07:04 2013 (r254810) @@ -71,17 +71,6 @@ SYSCTL_INT(_debug, OID_AUTO, kld_debug, TUNABLE_INT("debug.kld_debug", &kld_debug); #endif -#define KLD_LOCK() sx_xlock(&kld_sx) -#define KLD_UNLOCK() sx_xunlock(&kld_sx) -#define KLD_DOWNGRADE() sx_downgrade(&kld_sx) -#define KLD_LOCK_READ() sx_slock(&kld_sx) -#define KLD_UNLOCK_READ() sx_sunlock(&kld_sx) -#define KLD_LOCKED() sx_xlocked(&kld_sx) -#define KLD_LOCK_ASSERT() do { \ - if (!cold) \ - sx_assert(&kld_sx, SX_XLOCKED); \ -} while (0) - /* * static char *linker_search_path(const char *name, struct mod_depend * *verinfo); @@ -121,7 +110,8 @@ static int linker_no_more_classes = 0; #define LINKER_GET_NEXT_FILE_ID(a) do { \ linker_file_t lftmp; \ \ - KLD_LOCK_ASSERT(); \ + if (!cold) \ + sx_assert(&kld_sx, SA_XLOCKED); \ retry: \ TAILQ_FOREACH(lftmp, &linker_files, link) { \ if (next_file_id == lftmp->id) { \ @@ -360,7 +350,9 @@ static void linker_init_kernel_modules(void) { + sx_xlock(&kld_sx); linker_file_register_modules(linker_kernel_file); + sx_xunlock(&kld_sx); } SYSINIT(linker_kernel, SI_SUB_KLD, SI_ORDER_ANY, linker_init_kernel_modules, @@ -377,7 +369,7 @@ linker_load_file(const char *filename, l if (prison0.pr_securelevel > 0) return (EPERM); - KLD_LOCK_ASSERT(); + sx_assert(&kld_sx, SA_XLOCKED); lf = linker_find_file_by_name(filename); if (lf) { KLD_DPF(FILE, ("linker_load_file: file %s is already loaded," @@ -411,10 +403,10 @@ linker_load_file(const char *filename, l return (error); } modules = !TAILQ_EMPTY(&lf->modules); - KLD_UNLOCK(); + sx_xunlock(&kld_sx); linker_file_register_sysctls(lf); linker_file_sysinit(lf); - KLD_LOCK(); + sx_xlock(&kld_sx); lf->flags |= LINKER_FILE_LINKED; /* @@ -465,16 +457,16 @@ linker_reference_module(const char *modn modlist_t mod; int error; - KLD_LOCK(); + sx_xlock(&kld_sx); if ((mod = modlist_lookup2(modname, verinfo)) != NULL) { *result = mod->container; (*result)->refs++; - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (0); } error = linker_load_module(NULL, modname, NULL, verinfo, result); - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (error); } @@ -485,13 +477,13 @@ linker_release_module(const char *modnam modlist_t mod; int error; - KLD_LOCK(); + sx_xlock(&kld_sx); if (lf == NULL) { KASSERT(modname != NULL, ("linker_release_module: no file or name")); mod = modlist_lookup2(modname, verinfo); if (mod == NULL) { - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (ESRCH); } lf = mod->container; @@ -499,7 +491,7 @@ linker_release_module(const char *modnam KASSERT(modname == NULL && verinfo == NULL, ("linker_release_module: both file and name")); error = linker_file_unload(lf, LINKER_UNLOAD_NORMAL); - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (error); } @@ -512,7 +504,7 @@ linker_find_file_by_name(const char *fil koname = malloc(strlen(filename) + 4, M_LINKER, M_WAITOK); sprintf(koname, "%s.ko", filename); - KLD_LOCK_ASSERT(); + sx_assert(&kld_sx, SA_XLOCKED); TAILQ_FOREACH(lf, &linker_files, link) { if (strcmp(lf->filename, koname) == 0) break; @@ -528,7 +520,7 @@ linker_find_file_by_id(int fileid) { linker_file_t lf; - KLD_LOCK_ASSERT(); + sx_assert(&kld_sx, SA_XLOCKED); TAILQ_FOREACH(lf, &linker_files, link) if (lf->id == fileid && lf->flags & LINKER_FILE_LINKED) break; @@ -541,13 +533,13 @@ linker_file_foreach(linker_predicate_t * linker_file_t lf; int retval = 0; - KLD_LOCK(); + sx_xlock(&kld_sx); TAILQ_FOREACH(lf, &linker_files, link) { retval = predicate(lf, context); if (retval != 0) break; } - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (retval); } @@ -557,7 +549,8 @@ linker_make_file(const char *pathname, l linker_file_t lf; const char *filename; - KLD_LOCK_ASSERT(); + if (!cold) + sx_assert(&kld_sx, SA_XLOCKED); filename = linker_basename(pathname); KLD_DPF(FILE, ("linker_make_file: new file, filename='%s' for pathname='%s'\n", filename, pathname)); @@ -591,7 +584,7 @@ linker_file_unload(linker_file_t file, i if (prison0.pr_securelevel > 0) return (EPERM); - KLD_LOCK_ASSERT(); + sx_assert(&kld_sx, SA_XLOCKED); KLD_DPF(FILE, ("linker_file_unload: lf->refs=%d\n", file->refs)); /* Easy case of just dropping a reference. */ @@ -664,10 +657,10 @@ linker_file_unload(linker_file_t file, i */ if (file->flags & LINKER_FILE_LINKED) { file->flags &= ~LINKER_FILE_LINKED; - KLD_UNLOCK(); + sx_xunlock(&kld_sx); linker_file_sysuninit(file); linker_file_unregister_sysctls(file); - KLD_LOCK(); + sx_xlock(&kld_sx); } TAILQ_REMOVE(&linker_files, file, link); @@ -706,7 +699,7 @@ linker_file_add_dependency(linker_file_t { linker_file_t *newdeps; - KLD_LOCK_ASSERT(); + sx_assert(&kld_sx, SA_XLOCKED); newdeps = malloc((file->ndeps + 1) * sizeof(linker_file_t *), M_LINKER, M_WAITOK | M_ZERO); if (newdeps == NULL) @@ -738,12 +731,12 @@ linker_file_lookup_set(linker_file_t fil { int error, locked; - locked = KLD_LOCKED(); + locked = sx_xlocked(&kld_sx); if (!locked) - KLD_LOCK(); + sx_xlock(&kld_sx); error = LINKER_LOOKUP_SET(file, name, firstp, lastp, countp); if (!locked) - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (error); } @@ -763,12 +756,12 @@ linker_file_lookup_symbol(linker_file_t caddr_t sym; int locked; - locked = KLD_LOCKED(); + locked = sx_xlocked(&kld_sx); if (!locked) - KLD_LOCK(); + sx_xlock(&kld_sx); sym = linker_file_lookup_symbol_internal(file, name, deps); if (!locked) - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (sym); } @@ -782,7 +775,7 @@ linker_file_lookup_symbol_internal(linke size_t common_size = 0; int i; - KLD_LOCK_ASSERT(); + sx_assert(&kld_sx, SA_XLOCKED); KLD_DPF(SYM, ("linker_file_lookup_symbol: file=%p, name=%s, deps=%d\n", file, name, deps)); @@ -982,9 +975,9 @@ linker_search_symbol_name(caddr_t value, { int error; - KLD_LOCK(); + sx_xlock(&kld_sx); error = linker_debug_search_symbol_name(value, buf, buflen, offset); - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (error); } @@ -1026,10 +1019,10 @@ kern_kldload(struct thread *td, const ch modname = file; } - KLD_LOCK(); + sx_xlock(&kld_sx); error = linker_load_module(kldname, modname, NULL, NULL, &lf); if (error) { - KLD_UNLOCK(); + sx_xunlock(&kld_sx); goto done; } lf->userrefs++; @@ -1039,13 +1032,13 @@ kern_kldload(struct thread *td, const ch EVENTHANDLER_INVOKE(kld_load, lf); #ifdef HWPMC_HOOKS - KLD_DOWNGRADE(); + sx_downgrade(&kld_sx); pkm.pm_file = lf->filename; pkm.pm_address = (uintptr_t) lf->address; PMC_CALL_HOOK(td, PMC_FN_KLD_LOAD, (void *) &pkm); - KLD_UNLOCK_READ(); + sx_sunlock(&kld_sx); #else - KLD_UNLOCK(); + sx_xunlock(&kld_sx); #endif done: @@ -1088,7 +1081,7 @@ kern_kldunload(struct thread *td, int fi return (error); CURVNET_SET(TD_TO_VNET(td)); - KLD_LOCK(); + sx_xlock(&kld_sx); lf = linker_find_file_by_id(fileid); if (lf) { KLD_DPF(FILE, ("kldunload: lf->userrefs=%d\n", lf->userrefs)); @@ -1119,13 +1112,13 @@ kern_kldunload(struct thread *td, int fi #ifdef HWPMC_HOOKS if (error == 0) { - KLD_DOWNGRADE(); + sx_downgrade(&kld_sx); PMC_CALL_HOOK(td, PMC_FN_KLD_UNLOAD, (void *) &pkm); - KLD_UNLOCK_READ(); + sx_sunlock(&kld_sx); } else - KLD_UNLOCK(); + sx_xunlock(&kld_sx); #else - KLD_UNLOCK(); + sx_xunlock(&kld_sx); #endif CURVNET_RESTORE(); return (error); @@ -1169,13 +1162,13 @@ sys_kldfind(struct thread *td, struct kl goto out; filename = linker_basename(pathname); - KLD_LOCK(); + sx_xlock(&kld_sx); lf = linker_find_file_by_name(filename); if (lf) td->td_retval[0] = lf->id; else error = ENOENT; - KLD_UNLOCK(); + sx_xunlock(&kld_sx); out: free(pathname, M_TEMP); return (error); @@ -1193,7 +1186,7 @@ sys_kldnext(struct thread *td, struct kl return (error); #endif - KLD_LOCK(); + sx_xlock(&kld_sx); if (uap->fileid == 0) lf = TAILQ_FIRST(&linker_files); else { @@ -1214,7 +1207,7 @@ sys_kldnext(struct thread *td, struct kl else td->td_retval[0] = 0; out: - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (error); } @@ -1253,10 +1246,10 @@ kern_kldstat(struct thread *td, int file return (error); #endif - KLD_LOCK(); + sx_xlock(&kld_sx); lf = linker_find_file_by_id(fileid); if (lf == NULL) { - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (ENOENT); } @@ -1274,7 +1267,7 @@ kern_kldstat(struct thread *td, int file if (namelen > MAXPATHLEN) namelen = MAXPATHLEN; bcopy(lf->pathname, &stat->pathname[0], namelen); - KLD_UNLOCK(); + sx_xunlock(&kld_sx); td->td_retval[0] = 0; return (0); @@ -1293,7 +1286,7 @@ sys_kldfirstmod(struct thread *td, struc return (error); #endif - KLD_LOCK(); + sx_xlock(&kld_sx); lf = linker_find_file_by_id(uap->fileid); if (lf) { MOD_SLOCK; @@ -1305,7 +1298,7 @@ sys_kldfirstmod(struct thread *td, struc MOD_SUNLOCK; } else error = ENOENT; - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (error); } @@ -1333,7 +1326,7 @@ sys_kldsym(struct thread *td, struct kld symstr = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); if ((error = copyinstr(lookup.symname, symstr, MAXPATHLEN, NULL)) != 0) goto out; - KLD_LOCK(); + sx_xlock(&kld_sx); if (uap->fileid != 0) { lf = linker_find_file_by_id(uap->fileid); if (lf == NULL) @@ -1359,7 +1352,7 @@ sys_kldsym(struct thread *td, struct kld if (lf == NULL) error = ENOENT; } - KLD_UNLOCK(); + sx_xunlock(&kld_sx); out: free(symstr, M_TEMP); return (error); @@ -1468,6 +1461,7 @@ linker_preload(void *arg) error = 0; modptr = NULL; + sx_xlock(&kld_sx); while ((modptr = preload_search_next_name(modptr)) != NULL) { modname = (char *)preload_search_info(modptr, MODINFO_NAME); modtype = (char *)preload_search_info(modptr, MODINFO_TYPE); @@ -1649,6 +1643,7 @@ fail: TAILQ_REMOVE(&depended_files, lf, loaded); linker_file_unload(lf, LINKER_UNLOAD_FORCE); } + sx_xunlock(&kld_sx); /* woohoo! we made it! */ } @@ -1948,7 +1943,7 @@ linker_hwpmc_list_objects(void) int i, nmappings; nmappings = 0; - KLD_LOCK_READ(); + sx_slock(&kld_sx); TAILQ_FOREACH(lf, &linker_files, link) nmappings++; @@ -1963,7 +1958,7 @@ linker_hwpmc_list_objects(void) kobase[i].pm_address = (uintptr_t)lf->address; i++; } - KLD_UNLOCK_READ(); + sx_sunlock(&kld_sx); KASSERT(i > 0, ("linker_hpwmc_list_objects: no kernel objects?")); @@ -1989,7 +1984,7 @@ linker_load_module(const char *kldname, char *pathname; int error; - KLD_LOCK_ASSERT(); + sx_assert(&kld_sx, SA_XLOCKED); if (modname == NULL) { /* * We have to load KLD @@ -2063,7 +2058,7 @@ linker_load_dependencies(linker_file_t l /* * All files are dependant on /kernel. */ - KLD_LOCK_ASSERT(); + sx_assert(&kld_sx, SA_XLOCKED); if (linker_kernel_file) { linker_kernel_file->refs++; error = linker_file_add_dependency(lf, linker_kernel_file); @@ -2155,16 +2150,16 @@ sysctl_kern_function_list(SYSCTL_HANDLER error = sysctl_wire_old_buffer(req, 0); if (error != 0) return (error); - KLD_LOCK(); + sx_xlock(&kld_sx); TAILQ_FOREACH(lf, &linker_files, link) { error = LINKER_EACH_FUNCTION_NAME(lf, sysctl_kern_function_list_iterate, req); if (error) { - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (error); } } - KLD_UNLOCK(); + sx_xunlock(&kld_sx); return (SYSCTL_OUT(req, "", 1)); } From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:08:55 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 ESMTP id B2CBC24B; Sat, 24 Aug 2013 21:08:55 +0000 (UTC) (envelope-from markj@FreeBSD.org) 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 9F19B2375; Sat, 24 Aug 2013 21:08: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 r7OL8tfR070092; Sat, 24 Aug 2013 21:08:55 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OL8tcG070091; Sat, 24 Aug 2013 21:08:55 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201308242108.r7OL8tcG070091@svn.freebsd.org> From: Mark Johnston Date: Sat, 24 Aug 2013 21:08:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254811 - 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.14 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: Sat, 24 Aug 2013 21:08:55 -0000 Author: markj Date: Sat Aug 24 21:08:55 2013 New Revision: 254811 URL: http://svnweb.freebsd.org/changeset/base/254811 Log: Set things up so that linker_file_lookup_set() is always called with the linker lock held. This makes it possible to call it from a kld event handler with the shared lock held. Reviewed by: jhb Modified: head/sys/kern/kern_linker.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Sat Aug 24 21:07:04 2013 (r254810) +++ head/sys/kern/kern_linker.c Sat Aug 24 21:08:55 2013 (r254811) @@ -188,6 +188,8 @@ linker_file_sysinit(linker_file_t lf) KLD_DPF(FILE, ("linker_file_sysinit: calling SYSINITs for %s\n", lf->filename)); + sx_assert(&kld_sx, SA_XLOCKED); + if (linker_file_lookup_set(lf, "sysinit_set", &start, &stop, NULL) != 0) return; /* @@ -213,6 +215,7 @@ linker_file_sysinit(linker_file_t lf) * Traverse the (now) ordered list of system initialization tasks. * Perform each task, and continue on to the next task. */ + sx_xunlock(&kld_sx); mtx_lock(&Giant); for (sipp = start; sipp < stop; sipp++) { if ((*sipp)->subsystem == SI_SUB_DUMMY) @@ -222,6 +225,7 @@ linker_file_sysinit(linker_file_t lf) (*((*sipp)->func)) ((*sipp)->udata); } mtx_unlock(&Giant); + sx_xlock(&kld_sx); } static void @@ -232,6 +236,8 @@ linker_file_sysuninit(linker_file_t lf) KLD_DPF(FILE, ("linker_file_sysuninit: calling SYSUNINITs for %s\n", lf->filename)); + sx_assert(&kld_sx, SA_XLOCKED); + if (linker_file_lookup_set(lf, "sysuninit_set", &start, &stop, NULL) != 0) return; @@ -259,6 +265,7 @@ linker_file_sysuninit(linker_file_t lf) * Traverse the (now) ordered list of system initialization tasks. * Perform each task, and continue on to the next task. */ + sx_xunlock(&kld_sx); mtx_lock(&Giant); for (sipp = start; sipp < stop; sipp++) { if ((*sipp)->subsystem == SI_SUB_DUMMY) @@ -268,6 +275,7 @@ linker_file_sysuninit(linker_file_t lf) (*((*sipp)->func)) ((*sipp)->udata); } mtx_unlock(&Giant); + sx_xlock(&kld_sx); } static void @@ -279,13 +287,17 @@ linker_file_register_sysctls(linker_file ("linker_file_register_sysctls: registering SYSCTLs for %s\n", lf->filename)); + sx_assert(&kld_sx, SA_XLOCKED); + if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0) return; + sx_xunlock(&kld_sx); sysctl_lock(); for (oidp = start; oidp < stop; oidp++) sysctl_register_oid(*oidp); sysctl_unlock(); + sx_xlock(&kld_sx); } static void @@ -296,13 +308,17 @@ linker_file_unregister_sysctls(linker_fi KLD_DPF(FILE, ("linker_file_unregister_sysctls: unregistering SYSCTLs" " for %s\n", lf->filename)); + sx_assert(&kld_sx, SA_XLOCKED); + if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0) return; + sx_xunlock(&kld_sx); sysctl_lock(); for (oidp = start; oidp < stop; oidp++) sysctl_unregister_oid(*oidp); sysctl_unlock(); + sx_xlock(&kld_sx); } static int @@ -315,6 +331,8 @@ linker_file_register_modules(linker_file KLD_DPF(FILE, ("linker_file_register_modules: registering modules" " in %s\n", lf->filename)); + sx_assert(&kld_sx, SA_XLOCKED); + if (linker_file_lookup_set(lf, "modmetadata_set", &start, &stop, NULL) != 0) { /* @@ -403,10 +421,8 @@ linker_load_file(const char *filename, l return (error); } modules = !TAILQ_EMPTY(&lf->modules); - sx_xunlock(&kld_sx); linker_file_register_sysctls(lf); linker_file_sysinit(lf); - sx_xlock(&kld_sx); lf->flags |= LINKER_FILE_LINKED; /* @@ -657,10 +673,8 @@ linker_file_unload(linker_file_t file, i */ if (file->flags & LINKER_FILE_LINKED) { file->flags &= ~LINKER_FILE_LINKED; - sx_xunlock(&kld_sx); linker_file_sysuninit(file); linker_file_unregister_sysctls(file); - sx_xlock(&kld_sx); } TAILQ_REMOVE(&linker_files, file, link); @@ -729,15 +743,9 @@ int linker_file_lookup_set(linker_file_t file, const char *name, void *firstp, void *lastp, int *countp) { - int error, locked; - locked = sx_xlocked(&kld_sx); - if (!locked) - sx_xlock(&kld_sx); - error = LINKER_LOOKUP_SET(file, name, firstp, lastp, countp); - if (!locked) - sx_xunlock(&kld_sx); - return (error); + sx_assert(&kld_sx, SA_LOCKED); + return (LINKER_LOOKUP_SET(file, name, firstp, lastp, countp)); } /* From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:09: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 ESMTP id B7366390; Sat, 24 Aug 2013 21:09:58 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 890F82383; Sat, 24 Aug 2013 21:09: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 r7OL9wR3070548; Sat, 24 Aug 2013 21:09:58 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OL9wu0070546; Sat, 24 Aug 2013 21:09:58 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308242109.r7OL9wu0070546@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 21:09:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254812 - in head/sys: kern 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.14 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: Sat, 24 Aug 2013 21:09:58 -0000 Author: andre Date: Sat Aug 24 21:09:57 2013 New Revision: 254812 URL: http://svnweb.freebsd.org/changeset/base/254812 Log: Remove unused m_free_fast(). The difference to m_free() is only 2 predictable branches nowadays. However as a pre-condition the caller had to ensure that the mbuf pkthdr did not have any mtags attached to it, costing some potential branches again. Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_mbuf.c head/sys/sys/mbuf.h Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat Aug 24 21:08:55 2013 (r254811) +++ head/sys/kern/kern_mbuf.c Sat Aug 24 21:09:57 2013 (r254812) @@ -447,7 +447,7 @@ mb_dtor_mbuf(void *mem, int size, void * m = (struct mbuf *)mem; flags = (unsigned long)arg; - if ((flags & MB_NOTAGS) == 0 && (m->m_flags & M_PKTHDR) != 0) + if ((m->m_flags & M_PKTHDR) && !SLIST_EMPTY(&m->m_pkthdr.tags)) m_tag_delete_chain(m, NULL); KASSERT((m->m_flags & M_EXT) == 0, ("%s: M_EXT set", __func__)); KASSERT((m->m_flags & M_NOFREE) == 0, ("%s: M_NOFREE set", __func__)); Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat Aug 24 21:08:55 2013 (r254811) +++ head/sys/sys/mbuf.h Sat Aug 24 21:09:57 2013 (r254812) @@ -453,8 +453,6 @@ struct mbuf { #define MT_NOINIT 255 /* Not a type but a flag to allocate a non-initialized mbuf */ -#define MB_NOTAGS 0x1UL /* no tags attached to mbuf */ - /* * Compatibility with historic mbuf allocator. */ @@ -636,17 +634,6 @@ m_getcl(int how, short type, int flags) return (uma_zalloc_arg(zone_pack, &args, how)); } -static __inline void -m_free_fast(struct mbuf *m) -{ -#ifdef INVARIANTS - if (m->m_flags & M_PKTHDR) - KASSERT(SLIST_EMPTY(&m->m_pkthdr.tags), ("doing fast free of mbuf with tags")); -#endif - - uma_zfree_arg(zone_mbuf, m, (void *)MB_NOTAGS); -} - static __inline struct mbuf * m_free(struct mbuf *m) { From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:13:29 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 ESMTP id 898014F8; Sat, 24 Aug 2013 21:13:29 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mail0.glenbarber.us (mail0.glenbarber.us [208.86.227.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5C08D23C2; Sat, 24 Aug 2013 21:13:29 +0000 (UTC) Received: from glenbarber.us (unknown [IPv6:2001:470:8:1205:99cd:72d:5e87:427e]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gjb) by mail0.glenbarber.us (Postfix) with ESMTPSA id A09B526AD; Sat, 24 Aug 2013 21:13:27 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.8.3 mail0.glenbarber.us A09B526AD Authentication-Results: mail0.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Sat, 24 Aug 2013 17:13:25 -0400 From: Glen Barber To: Andre Oppermann Subject: Re: svn commit: r254779 - head/sys/kern Message-ID: <20130824211325.GA33782@glenbarber.us> References: <201308241224.r7OCOx9l069850@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Qxx1br4bt0+wmkIi" Content-Disposition: inline In-Reply-To: <201308241224.r7OCOx9l069850@svn.freebsd.org> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Sat, 24 Aug 2013 21:13:29 -0000 --Qxx1br4bt0+wmkIi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 24, 2013 at 12:24:59PM +0000, Andre Oppermann wrote: > Author: andre > Date: Sat Aug 24 12:24:58 2013 > New Revision: 254779 > URL: http://svnweb.freebsd.org/changeset/base/254779 >=20 > Log: > Avoid code duplication for mbuf initialization and use m_init() instead > in mb_ctor_mbuf() and mb_ctor_pack(). >=20 > Modified: > head/sys/kern/kern_mbuf.c >=20 > [...] > -#ifdef MAC > - /* If the label init fails, fail the alloc */ > - error =3D mac_mbuf_init(m, how); > - if (error) > - return (error); > -#endif > - } else > - m->m_data =3D m->m_dat; > - return (0); > + m =3D (struct mbuf *)mem; > + flags =3D args->flags; > + > + error =3D m_init(m, NULL, size, how, type, flags); > + > + return (error); > } > =20 This breaks head/. cc -c -O -pipe -std=3Dc99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -nostdinc -I. -I/src/sys -I/src/sys/contrib/altq -I/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -funwind-tables -mllvm -arm-enable-ehabi -ffreestanding -Werror /src/sys/kern/kern_mbuf.c /src/sys/kern/kern_mbuf.c:637:2: error: use of undeclared identifier 'error' error =3D m_init(m, NULL, size, how, type, flags); ^ /src/sys/kern/kern_mbuf.c:643:10: error: use of undeclared identifier 'erro= r' return (error); ^=20 http://tinderbox.freebsd.org/tinderbox-head-build-HEAD-armv6-arm.full Glen --Qxx1br4bt0+wmkIi Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBCAAGBQJSGSH1AAoJEFJPDDeguUaj1dwH/25PG6K7KQ1aIyEpYDbjKt+W 1z8fHkawnLFoOYhRe5Zs1ffmA/+HS6XfqWkS+cOrWfdKeMBunxgc973tx+jkMmWO slKMYqMPLQHcN4TeTSbMsYQ1fofCcweL5ZTB4O0GS4G6F18KQzCtopBn/XCLfxs0 AgnWvdg7ipD/r3aeTGoeGKOzPRv7E+WDsDfMIWAmzqLFi4Ci23IE4bqDR3OnFP86 2eOcOjd1gj1oe58BIUmeDsLW0zL2bFgCfcHa7rzMn5Y1kDk/KioUgQHTTAuxhhI+ FZBLJayMy8gxy1YI+T/WqRenVmNb1P6Skh20Ni+TOF2qrcxsV9sbxZ8lbNjgWbQ= =z9RW -----END PGP SIGNATURE----- --Qxx1br4bt0+wmkIi-- From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:13: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 ESMTP id 6559F70C; Sat, 24 Aug 2013 21:13:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) 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 509E023CE; Sat, 24 Aug 2013 21:13: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 r7OLDf9k073791; Sat, 24 Aug 2013 21:13:41 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OLDdTw073778; Sat, 24 Aug 2013 21:13:39 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201308242113.r7OLDdTw073778@svn.freebsd.org> From: Mark Johnston Date: Sat, 24 Aug 2013 21:13:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254813 - in head: share/man/man9 sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/dev/dtrace sys/cddl/dev/sdt sys/dev/hwpmc sys/kern 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.14 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: Sat, 24 Aug 2013 21:13:41 -0000 Author: markj Date: Sat Aug 24 21:13:38 2013 New Revision: 254813 URL: http://svnweb.freebsd.org/changeset/base/254813 Log: Rename the kld_unload event handler to kld_unload_try, and add a new kld_unload event handler which gets invoked after a linker file has been successfully unloaded. The kld_unload and kld_load event handlers are now invoked with the shared linker lock held, while kld_unload_try is invoked with the lock exclusively held. Convert hwpmc(4) to use these event handlers instead of having kern_kldload() and kern_kldunload() invoke hwpmc(4) hooks whenever files are loaded or unloaded. This has no functional effect, but simplifes the linker code somewhat. Reviewed by: jhb Modified: head/share/man/man9/EVENTHANDLER.9 head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/dev/dtrace/dtrace_load.c head/sys/cddl/dev/dtrace/dtrace_unload.c head/sys/cddl/dev/sdt/sdt.c head/sys/dev/hwpmc/hwpmc_mod.c head/sys/kern/kern_linker.c head/sys/sys/eventhandler.h head/sys/sys/pmckern.h Modified: head/share/man/man9/EVENTHANDLER.9 ============================================================================== --- head/share/man/man9/EVENTHANDLER.9 Sat Aug 24 21:09:57 2013 (r254812) +++ head/share/man/man9/EVENTHANDLER.9 Sat Aug 24 21:13:38 2013 (r254813) @@ -202,6 +202,8 @@ Callbacks invoked when a BPF listener at .It Vt kld_load Callbacks invoked after a linker file has been loaded. .It Vt kld_unload +Callbacks invoked after a linker file has been successfully unloaded. +.It Vt kld_unload_try Callbacks invoked before a linker file is about to be unloaded. These callbacks may be used to return an error and prevent the unload from proceeding. Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sat Aug 24 21:09:57 2013 (r254812) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Sat Aug 24 21:13:38 2013 (r254813) @@ -242,7 +242,7 @@ int dtrace_in_probe; /* non-zero if exe uintptr_t dtrace_in_probe_addr; /* Address of invop when already in probe */ #endif static eventhandler_tag dtrace_kld_load_tag; -static eventhandler_tag dtrace_kld_unload_tag; +static eventhandler_tag dtrace_kld_unload_try_tag; #endif /* @@ -15351,7 +15351,7 @@ dtrace_kld_load(void *arg __unused, link } static void -dtrace_kld_unload(void *arg __unused, linker_file_t lf, int *error) +dtrace_kld_unload_try(void *arg __unused, linker_file_t lf, int *error) { if (*error != 0) Modified: head/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_load.c Sat Aug 24 21:09:57 2013 (r254812) +++ head/sys/cddl/dev/dtrace/dtrace_load.c Sat Aug 24 21:13:38 2013 (r254813) @@ -59,8 +59,8 @@ dtrace_load(void *dummy) /* Register callbacks for linker file load and unload events. */ dtrace_kld_load_tag = EVENTHANDLER_REGISTER(kld_load, dtrace_kld_load, NULL, EVENTHANDLER_PRI_ANY); - dtrace_kld_unload_tag = EVENTHANDLER_REGISTER(kld_unload, - dtrace_kld_unload, NULL, EVENTHANDLER_PRI_ANY); + dtrace_kld_unload_try_tag = EVENTHANDLER_REGISTER(kld_unload_try, + dtrace_kld_unload_try, NULL, EVENTHANDLER_PRI_ANY); /* * Initialise the mutexes without 'witness' because the dtrace Modified: head/sys/cddl/dev/dtrace/dtrace_unload.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_unload.c Sat Aug 24 21:09:57 2013 (r254812) +++ head/sys/cddl/dev/dtrace/dtrace_unload.c Sat Aug 24 21:13:38 2013 (r254813) @@ -68,7 +68,7 @@ dtrace_unload() dtrace_provider = NULL; EVENTHANDLER_DEREGISTER(kld_load, dtrace_kld_load_tag); - EVENTHANDLER_DEREGISTER(kld_unload, dtrace_kld_unload_tag); + EVENTHANDLER_DEREGISTER(kld_unload_try, dtrace_kld_unload_try_tag); if ((state = dtrace_anon_grab()) != NULL) { /* Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Sat Aug 24 21:09:57 2013 (r254812) +++ head/sys/cddl/dev/sdt/sdt.c Sat Aug 24 21:13:38 2013 (r254813) @@ -59,7 +59,7 @@ static int sdt_unload(void *); static void sdt_create_provider(struct sdt_provider *); static void sdt_create_probe(struct sdt_probe *); static void sdt_kld_load(void *, struct linker_file *); -static void sdt_kld_unload(void *, struct linker_file *, int *); +static void sdt_kld_unload_try(void *, struct linker_file *, int *); static MALLOC_DEFINE(M_SDT, "SDT", "DTrace SDT providers"); @@ -95,7 +95,7 @@ static struct cdev *sdt_cdev; static TAILQ_HEAD(, sdt_provider) sdt_prov_list; eventhandler_tag sdt_kld_load_tag; -eventhandler_tag sdt_kld_unload_tag; +eventhandler_tag sdt_kld_unload_try_tag; static void sdt_create_provider(struct sdt_provider *prov) @@ -264,7 +264,7 @@ sdt_kld_load(void *arg __unused, struct } static void -sdt_kld_unload(void *arg __unused, struct linker_file *lf, int *error __unused) +sdt_kld_unload_try(void *arg __unused, struct linker_file *lf, int *error __unused) { struct sdt_provider *prov, **curr, **begin, **end, *tmp; @@ -319,8 +319,8 @@ sdt_load(void *arg __unused) sdt_kld_load_tag = EVENTHANDLER_REGISTER(kld_load, sdt_kld_load, NULL, EVENTHANDLER_PRI_ANY); - sdt_kld_unload_tag = EVENTHANDLER_REGISTER(kld_unload, sdt_kld_unload, - NULL, EVENTHANDLER_PRI_ANY); + sdt_kld_unload_try_tag = EVENTHANDLER_REGISTER(kld_unload_try, + sdt_kld_unload_try, NULL, EVENTHANDLER_PRI_ANY); /* Pick up probes from the kernel and already-loaded linker files. */ linker_file_foreach(sdt_linker_file_cb, NULL); @@ -332,7 +332,7 @@ sdt_unload(void *arg __unused) struct sdt_provider *prov, *tmp; EVENTHANDLER_DEREGISTER(kld_load, sdt_kld_load_tag); - EVENTHANDLER_DEREGISTER(kld_unload, sdt_kld_unload_tag); + EVENTHANDLER_DEREGISTER(kld_unload_try, sdt_kld_unload_try_tag); sdt_probe_func = sdt_probe_stub; Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Sat Aug 24 21:09:57 2013 (r254812) +++ head/sys/dev/hwpmc/hwpmc_mod.c Sat Aug 24 21:13:38 2013 (r254813) @@ -132,7 +132,8 @@ static int *pmc_pmcdisp; /* PMC row di /* various event handlers */ -static eventhandler_tag pmc_exit_tag, pmc_fork_tag; +static eventhandler_tag pmc_exit_tag, pmc_fork_tag, pmc_kld_load_tag, + pmc_kld_unload_tag; /* Module statistics */ struct pmc_op_getdriverstats pmc_stats; @@ -1476,50 +1477,6 @@ pmc_process_csw_out(struct thread *td) } /* - * Log a KLD operation. - */ - -static void -pmc_process_kld_load(struct pmckern_map_in *pkm) -{ - struct pmc_owner *po; - - sx_assert(&pmc_sx, SX_LOCKED); - - /* - * Notify owners of system sampling PMCs about KLD operations. - */ - - LIST_FOREACH(po, &pmc_ss_owners, po_ssnext) - if (po->po_flags & PMC_PO_OWNS_LOGFILE) - pmclog_process_map_in(po, (pid_t) -1, pkm->pm_address, - (char *) pkm->pm_file); - - /* - * TODO: Notify owners of (all) process-sampling PMCs too. - */ - - return; -} - -static void -pmc_process_kld_unload(struct pmckern_map_out *pkm) -{ - struct pmc_owner *po; - - sx_assert(&pmc_sx, SX_LOCKED); - - LIST_FOREACH(po, &pmc_ss_owners, po_ssnext) - if (po->po_flags & PMC_PO_OWNS_LOGFILE) - pmclog_process_map_out(po, (pid_t) -1, - pkm->pm_address, pkm->pm_address + pkm->pm_size); - - /* - * TODO: Notify owners of process-sampling PMCs. - */ -} - -/* * A mapping change for a process. */ @@ -1833,8 +1790,8 @@ const char *pmc_hooknames[] = { "CSW-IN", "CSW-OUT", "SAMPLE", - "KLDLOAD", - "KLDUNLOAD", + "UNUSED1", + "UNUSED2", "MMAP", "MUNMAP", "CALLCHAIN-NMI", @@ -2002,17 +1959,6 @@ pmc_hook_handler(struct thread *td, int pmc_process_samples(PCPU_GET(cpuid), PMC_SR); break; - - case PMC_FN_KLD_LOAD: - sx_assert(&pmc_sx, SX_LOCKED); - pmc_process_kld_load((struct pmckern_map_in *) arg); - break; - - case PMC_FN_KLD_UNLOAD: - sx_assert(&pmc_sx, SX_LOCKED); - pmc_process_kld_unload((struct pmckern_map_out *) arg); - break; - case PMC_FN_MMAP: sx_assert(&pmc_sx, SX_LOCKED); pmc_process_mmap(td, (struct pmckern_map_in *) arg); @@ -4644,6 +4590,47 @@ pmc_process_fork(void *arg __unused, str sx_xunlock(&pmc_sx); } +static void +pmc_kld_load(void *arg __unused, linker_file_t lf) +{ + struct pmc_owner *po; + + sx_slock(&pmc_sx); + + /* + * Notify owners of system sampling PMCs about KLD operations. + */ + LIST_FOREACH(po, &pmc_ss_owners, po_ssnext) + if (po->po_flags & PMC_PO_OWNS_LOGFILE) + pmclog_process_map_in(po, (pid_t) -1, + (uintfptr_t) lf->address, lf->filename); + + /* + * TODO: Notify owners of (all) process-sampling PMCs too. + */ + + sx_sunlock(&pmc_sx); +} + +static void +pmc_kld_unload(void *arg __unused, const char *filename __unused, + caddr_t address, size_t size) +{ + struct pmc_owner *po; + + sx_slock(&pmc_sx); + + LIST_FOREACH(po, &pmc_ss_owners, po_ssnext) + if (po->po_flags & PMC_PO_OWNS_LOGFILE) + pmclog_process_map_out(po, (pid_t) -1, + (uintfptr_t) address, (uintfptr_t) address + size); + + /* + * TODO: Notify owners of process-sampling PMCs. + */ + + sx_sunlock(&pmc_sx); +} /* * initialization @@ -4913,6 +4900,12 @@ pmc_initialize(void) pmc_fork_tag = EVENTHANDLER_REGISTER(process_fork, pmc_process_fork, NULL, EVENTHANDLER_PRI_ANY); + /* register kld event handlers */ + pmc_kld_load_tag = EVENTHANDLER_REGISTER(kld_load, pmc_kld_load, + NULL, EVENTHANDLER_PRI_ANY); + pmc_kld_unload_tag = EVENTHANDLER_REGISTER(kld_unload, pmc_kld_unload, + NULL, EVENTHANDLER_PRI_ANY); + /* initialize logging */ pmclog_initialize(); @@ -4970,6 +4963,8 @@ pmc_cleanup(void) /* deregister event handlers */ EVENTHANDLER_DEREGISTER(process_fork, pmc_fork_tag); EVENTHANDLER_DEREGISTER(process_exit, pmc_exit_tag); + EVENTHANDLER_DEREGISTER(kld_load, pmc_kld_load_tag); + EVENTHANDLER_DEREGISTER(kld_unload, pmc_kld_unload_tag); /* send SIGBUS to all owner threads, free up allocations */ if (pmc_ownerhash) Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Sat Aug 24 21:09:57 2013 (r254812) +++ head/sys/kern/kern_linker.c Sat Aug 24 21:13:38 2013 (r254813) @@ -995,9 +995,6 @@ linker_search_symbol_name(caddr_t value, int kern_kldload(struct thread *td, const char *file, int *fileid) { -#ifdef HWPMC_HOOKS - struct pmckern_map_in pkm; -#endif const char *kldname, *modname; linker_file_t lf; int error; @@ -1037,17 +1034,9 @@ kern_kldload(struct thread *td, const ch if (fileid != NULL) *fileid = lf->id; - EVENTHANDLER_INVOKE(kld_load, lf); - -#ifdef HWPMC_HOOKS sx_downgrade(&kld_sx); - pkm.pm_file = lf->filename; - pkm.pm_address = (uintptr_t) lf->address; - PMC_CALL_HOOK(td, PMC_FN_KLD_LOAD, (void *) &pkm); + EVENTHANDLER_INVOKE(kld_load, lf); sx_sunlock(&kld_sx); -#else - sx_xunlock(&kld_sx); -#endif done: CURVNET_RESTORE(); @@ -1076,10 +1065,10 @@ sys_kldload(struct thread *td, struct kl int kern_kldunload(struct thread *td, int fileid, int flags) { -#ifdef HWPMC_HOOKS - struct pmckern_map_out pkm; -#endif linker_file_t lf; + char *filename = NULL; + caddr_t address; + size_t size; int error = 0; if ((error = securelevel_gt(td->td_ucred, 0)) != 0) @@ -1094,7 +1083,7 @@ kern_kldunload(struct thread *td, int fi if (lf) { KLD_DPF(FILE, ("kldunload: lf->userrefs=%d\n", lf->userrefs)); - EVENTHANDLER_INVOKE(kld_unload, lf, &error); + EVENTHANDLER_INVOKE(kld_unload_try, lf, &error); if (error != 0) error = EBUSY; else if (lf->userrefs == 0) { @@ -1105,11 +1094,11 @@ kern_kldunload(struct thread *td, int fi " loaded by the kernel\n"); error = EBUSY; } else { -#ifdef HWPMC_HOOKS - /* Save data needed by hwpmc(4) before unloading. */ - pkm.pm_address = (uintptr_t) lf->address; - pkm.pm_size = lf->size; -#endif + /* Save data needed for the kld_unload callbacks. */ + filename = strdup(lf->filename, M_TEMP); + address = lf->address; + size = lf->size; + lf->userrefs--; error = linker_file_unload(lf, flags); if (error) @@ -1118,16 +1107,14 @@ kern_kldunload(struct thread *td, int fi } else error = ENOENT; -#ifdef HWPMC_HOOKS if (error == 0) { sx_downgrade(&kld_sx); - PMC_CALL_HOOK(td, PMC_FN_KLD_UNLOAD, (void *) &pkm); + EVENTHANDLER_INVOKE(kld_unload, filename, address, size); sx_sunlock(&kld_sx); } else sx_xunlock(&kld_sx); -#else - sx_xunlock(&kld_sx); -#endif + free(filename, M_TEMP); + CURVNET_RESTORE(); return (error); } Modified: head/sys/sys/eventhandler.h ============================================================================== --- head/sys/sys/eventhandler.h Sat Aug 24 21:09:57 2013 (r254812) +++ head/sys/sys/eventhandler.h Sat Aug 24 21:13:38 2013 (r254813) @@ -269,8 +269,10 @@ EVENTHANDLER_DECLARE(maxsockets_change, /* Kernel linker file load and unload events */ struct linker_file; typedef void (*kld_load_fn)(void *, struct linker_file *); -typedef void (*kld_unload_fn)(void *, struct linker_file *, int *); +typedef void (*kld_unload_fn)(void *, const char *, caddr_t, size_t); +typedef void (*kld_unload_try_fn)(void *, struct linker_file *, int *); EVENTHANDLER_DECLARE(kld_load, kld_load_fn); EVENTHANDLER_DECLARE(kld_unload, kld_unload_fn); +EVENTHANDLER_DECLARE(kld_unload_try, kld_unload_try_fn); #endif /* SYS_EVENTHANDLER_H */ Modified: head/sys/sys/pmckern.h ============================================================================== --- head/sys/sys/pmckern.h Sat Aug 24 21:09:57 2013 (r254812) +++ head/sys/sys/pmckern.h Sat Aug 24 21:13:38 2013 (r254813) @@ -51,8 +51,8 @@ #define PMC_FN_CSW_IN 2 #define PMC_FN_CSW_OUT 3 #define PMC_FN_DO_SAMPLES 4 -#define PMC_FN_KLD_LOAD 5 -#define PMC_FN_KLD_UNLOAD 6 +#define PMC_FN_UNUSED1 5 +#define PMC_FN_UNUSED2 6 #define PMC_FN_MMAP 7 #define PMC_FN_MUNMAP 8 #define PMC_FN_USER_CALLCHAIN 9 From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:25: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 ESMTP id 70CD4B46; Sat, 24 Aug 2013 21:25:05 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-qc0-x22d.google.com (mail-qc0-x22d.google.com [IPv6:2607:f8b0:400d:c01::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F1557247D; Sat, 24 Aug 2013 21:25:04 +0000 (UTC) Received: by mail-qc0-f173.google.com with SMTP id z10so1032295qcx.4 for ; Sat, 24 Aug 2013 14:25:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=uYl3s5NNMgZOW0JKaEvaa8J/jpSoyRh2yN5KLrOSZeE=; b=YKfPCakvHgocfhneyXbgaJpKmAvRpUcdKD4RcJW7njKwSVr4ABtOws5FY+3GHtd4ix tT3V6dGSxNSGzqhSSOLuBq6GrZiUSbTyvY5Pnv5sfv69zUYuTMgA1tOw17oCeOcVTCWH 5f2oSGO06WKM11IB0MoZv5plYqqqfnv8QVlZXGv+7fOLn5yO61BmYINZVMohzhpvQ2dj sCTWIaFmAyhFEOVtszoJ5IYqYeKnd8NmzptgLrNJ4D4Zlogwm1/O2FqN7zbI1t1360c6 sxg2FGhNJcNGvzCtPYZk7HD29qG+aSmdwRoUt8GN5g/ywA3a5WAVMNc0a7LVB9Qu8OjL FMeQ== MIME-Version: 1.0 X-Received: by 10.224.7.67 with SMTP id c3mr6914935qac.6.1377379502964; Sat, 24 Aug 2013 14:25:02 -0700 (PDT) Received: by 10.49.30.233 with HTTP; Sat, 24 Aug 2013 14:25:02 -0700 (PDT) In-Reply-To: <201308241038.r7OAc2hY011437@svn.freebsd.org> References: <201308241038.r7OAc2hY011437@svn.freebsd.org> Date: Sat, 24 Aug 2013 17:25:02 -0400 Message-ID: Subject: Re: svn commit: r254772 - head/share/man/man9 From: Benjamin Kaduk To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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.14 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: Sat, 24 Aug 2013 21:25:05 -0000 On Sat, Aug 24, 2013 at 6:38 AM, Andre Oppermann wrote: > Author: andre > Date: Sat Aug 24 10:38:02 2013 > New Revision: 254772 > URL: http://svnweb.freebsd.org/changeset/base/254772 > > Log: > pfil_hook_get() has been internalized in r254771 and is no longer > part of the API. It wasn't safe for external use in any case. > > Modified: head/share/man/man9/pfil.9 > > ============================================================================== > --- head/share/man/man9/pfil.9 Sat Aug 24 10:36:33 2013 (r254771) > +++ head/share/man/man9/pfil.9 Sat Aug 24 10:38:02 2013 (r254772) > @@ -245,11 +242,7 @@ lock export was added in > .Fx 10.0 . > .Sh BUGS > The > -.Fn pfil_hook_get > -function > -is only safe for internal use. > -.Pp > -When a > +.Fn When a > This hunk looks pretty bogus. -Ben > .Vt pfil_head > is being modified, no traffic is diverted > (to avoid deadlock). > From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:25:54 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 ESMTP id 05EC2C8E; Sat, 24 Aug 2013 21:25:54 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 E767A248A; Sat, 24 Aug 2013 21:25:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OLPrPK079512; Sat, 24 Aug 2013 21:25:53 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OLPrfC079511; Sat, 24 Aug 2013 21:25:53 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308242125.r7OLPrfC079511@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 21:25:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254814 - 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.14 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: Sat, 24 Aug 2013 21:25:54 -0000 Author: andre Date: Sat Aug 24 21:25:53 2013 New Revision: 254814 URL: http://svnweb.freebsd.org/changeset/base/254814 Log: After r254779 "error" must always be present in mb_ctor_pack(), not only when MAC is defined. Reported by: gjb / tinderbox Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_mbuf.c Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat Aug 24 21:13:38 2013 (r254813) +++ head/sys/kern/kern_mbuf.c Sat Aug 24 21:25:53 2013 (r254814) @@ -619,10 +619,7 @@ mb_ctor_pack(void *mem, int size, void * { struct mbuf *m; struct mb_args *args; -#ifdef MAC - int error; -#endif - int flags; + int error, flags; short type; m = (struct mbuf *)mem; From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:26: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 ESMTP id 4858FE3A for ; Sat, 24 Aug 2013 21:26:54 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ADAC2249A for ; Sat, 24 Aug 2013 21:26:53 +0000 (UTC) Received: (qmail 97161 invoked from network); 24 Aug 2013 22:09:22 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 24 Aug 2013 22:09:22 -0000 Message-ID: <52192512.50206@freebsd.org> Date: Sat, 24 Aug 2013 23:26:42 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Glen Barber Subject: Re: svn commit: r254779 - head/sys/kern References: <201308241224.r7OCOx9l069850@svn.freebsd.org> <20130824211325.GA33782@glenbarber.us> In-Reply-To: <20130824211325.GA33782@glenbarber.us> 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.14 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: Sat, 24 Aug 2013 21:26:54 -0000 On 24.08.2013 23:13, Glen Barber wrote: > On Sat, Aug 24, 2013 at 12:24:59PM +0000, Andre Oppermann wrote: >> Author: andre >> Date: Sat Aug 24 12:24:58 2013 >> New Revision: 254779 >> URL: http://svnweb.freebsd.org/changeset/base/254779 >> >> Log: >> Avoid code duplication for mbuf initialization and use m_init() instead >> in mb_ctor_mbuf() and mb_ctor_pack(). >> >> Modified: >> head/sys/kern/kern_mbuf.c >> > >> [...] > >> -#ifdef MAC >> - /* If the label init fails, fail the alloc */ >> - error = mac_mbuf_init(m, how); >> - if (error) >> - return (error); >> -#endif >> - } else >> - m->m_data = m->m_dat; >> - return (0); >> + m = (struct mbuf *)mem; >> + flags = args->flags; >> + >> + error = m_init(m, NULL, size, how, type, flags); >> + >> + return (error); >> } >> > > > This breaks head/. > > cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs > -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith > -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions > -Wmissing-include-dirs -fdiagnostics-show-option > -Wno-error-tautological-compare -Wno-error-empty-body > -Wno-error-parentheses-equality -nostdinc -I. -I/src/sys > -I/src/sys/contrib/altq -I/src/sys/contrib/libfdt -D_KERNEL > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -funwind-tables -mllvm > -arm-enable-ehabi -ffreestanding -Werror /src/sys/kern/kern_mbuf.c > /src/sys/kern/kern_mbuf.c:637:2: error: use of undeclared identifier 'error' > error = m_init(m, NULL, size, how, type, flags); > ^ > /src/sys/kern/kern_mbuf.c:643:10: error: use of undeclared identifier 'error' > return (error); > ^ > > http://tinderbox.freebsd.org/tinderbox-head-build-HEAD-armv6-arm.full Sorry, and thanks for the report. Fixed in r254814. -- Andre From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:30: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 ESMTP id 9C0C7E7; Sat, 24 Aug 2013 21:30:35 +0000 (UTC) (envelope-from andre@FreeBSD.org) 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 88F1924E0; Sat, 24 Aug 2013 21:30:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OLUZXG081149; Sat, 24 Aug 2013 21:30:35 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OLUZfG081148; Sat, 24 Aug 2013 21:30:35 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308242130.r7OLUZfG081148@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 21:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254815 - head/share/man/man9 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.14 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: Sat, 24 Aug 2013 21:30:35 -0000 Author: andre Date: Sat Aug 24 21:30:35 2013 New Revision: 254815 URL: http://svnweb.freebsd.org/changeset/base/254815 Log: Fix BUGS section after botched modify in r254772. Reported by: bjk Modified: head/share/man/man9/pfil.9 Modified: head/share/man/man9/pfil.9 ============================================================================== --- head/share/man/man9/pfil.9 Sat Aug 24 21:25:53 2013 (r254814) +++ head/share/man/man9/pfil.9 Sat Aug 24 21:30:35 2013 (r254815) @@ -241,8 +241,7 @@ Fine-grained locking was added in lock export was added in .Fx 10.0 . .Sh BUGS -The -.Fn When a +.Pp When a .Vt pfil_head is being modified, no traffic is diverted (to avoid deadlock). From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 21:31:37 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 ESMTP id D501334D for ; Sat, 24 Aug 2013 21:31:37 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4533824F6 for ; Sat, 24 Aug 2013 21:31:36 +0000 (UTC) Received: (qmail 97195 invoked from network); 24 Aug 2013 22:14:06 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 24 Aug 2013 22:14:06 -0000 Message-ID: <5219262D.2040804@freebsd.org> Date: Sat, 24 Aug 2013 23:31:25 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Benjamin Kaduk Subject: Re: svn commit: r254772 - head/share/man/man9 References: <201308241038.r7OAc2hY011437@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.14 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: Sat, 24 Aug 2013 21:31:37 -0000 On 24.08.2013 23:25, Benjamin Kaduk wrote: > On Sat, Aug 24, 2013 at 6:38 AM, Andre Oppermann > wrote: > > Author: andre > Date: Sat Aug 24 10:38:02 2013 > New Revision: 254772 > URL: http://svnweb.freebsd.org/changeset/base/254772 > > Log: > pfil_hook_get() has been internalized in r254771 and is no longer > part of the API. It wasn't safe for external use in any case. > > Modified: head/share/man/man9/pfil.9 > ============================================================================== > --- head/share/man/man9/pfil.9 Sat Aug 24 10:36:33 2013 (r254771) > +++ head/share/man/man9/pfil.9 Sat Aug 24 10:38:02 2013 (r254772) > @@ -245,11 +242,7 @@ lock export was added in > .Fx 10.0 . > .Sh BUGS > The > -.Fn pfil_hook_get > -function > -is only safe for internal use. > -.Pp > -When a > +.Fn When a > > > This hunk looks pretty bogus. Thanks for the report. I'm a total mdoc noob. (Hopefully) fixed in r254815. -- Andre > -Ben > > .Vt pfil_head > is being modified, no traffic is diverted > (to avoid deadlock). > From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 23:38:58 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 ESMTP id 6D650DE; Sat, 24 Aug 2013 23:38:58 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) 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 594622AE1; Sat, 24 Aug 2013 23:38: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 r7ONcwhC051131; Sat, 24 Aug 2013 23:38:58 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7ONcvCZ051127; Sat, 24 Aug 2013 23:38:57 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201308242338.r7ONcvCZ051127@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 24 Aug 2013 23:38:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254817 - in head/sys: dev/drm2 modules/drm2/drm2 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.14 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: Sat, 24 Aug 2013 23:38:58 -0000 Author: dumbbell Date: Sat Aug 24 23:38:57 2013 New Revision: 254817 URL: http://svnweb.freebsd.org/changeset/base/254817 Log: drm: Import drm_dp_helper.c from Linux 3.8-rc3 While here, update drm_dp_helper.h to better match Linux one. Added: head/sys/dev/drm2/drm_dp_helper.c (contents, props changed) Modified: head/sys/dev/drm2/drmP.h head/sys/dev/drm2/drm_dp_helper.h head/sys/modules/drm2/drm2/Makefile Modified: head/sys/dev/drm2/drmP.h ============================================================================== --- head/sys/dev/drm2/drmP.h Sat Aug 24 22:42:19 2013 (r254816) +++ head/sys/dev/drm2/drmP.h Sat Aug 24 23:38:57 2013 (r254817) @@ -317,6 +317,9 @@ typedef int8_t s8; #define DRM_HZ hz #define DRM_UDELAY(udelay) DELAY(udelay) +#define DRM_MDELAY(msecs) do { int loops = (msecs); \ + while (loops--) DELAY(1000); \ + } while (0) #define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */ #define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \ Added: head/sys/dev/drm2/drm_dp_helper.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm2/drm_dp_helper.c Sat Aug 24 23:38:57 2013 (r254817) @@ -0,0 +1,147 @@ +/* + * Copyright © 2009 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +/** + * DOC: dp helpers + * + * These functions contain some common logic and helpers at various abstraction + * levels to deal with Display Port sink devices and related things like DP aux + * channel transfers, EDID reading over DP aux channels, decoding certain DPCD + * blocks, ... + */ + +static u8 dp_link_status(u8 link_status[DP_LINK_STATUS_SIZE], int r) +{ + return link_status[r - DP_LANE0_1_STATUS]; +} + +static u8 dp_get_lane_status(u8 link_status[DP_LINK_STATUS_SIZE], + int lane) +{ + int i = DP_LANE0_1_STATUS + (lane >> 1); + int s = (lane & 1) * 4; + u8 l = dp_link_status(link_status, i); + return (l >> s) & 0xf; +} + +bool drm_dp_channel_eq_ok(u8 link_status[DP_LINK_STATUS_SIZE], + int lane_count) +{ + u8 lane_align; + u8 lane_status; + int lane; + + lane_align = dp_link_status(link_status, + DP_LANE_ALIGN_STATUS_UPDATED); + if ((lane_align & DP_INTERLANE_ALIGN_DONE) == 0) + return false; + for (lane = 0; lane < lane_count; lane++) { + lane_status = dp_get_lane_status(link_status, lane); + if ((lane_status & DP_CHANNEL_EQ_BITS) != DP_CHANNEL_EQ_BITS) + return false; + } + return true; +} + +bool drm_dp_clock_recovery_ok(u8 link_status[DP_LINK_STATUS_SIZE], + int lane_count) +{ + int lane; + u8 lane_status; + + for (lane = 0; lane < lane_count; lane++) { + lane_status = dp_get_lane_status(link_status, lane); + if ((lane_status & DP_LANE_CR_DONE) == 0) + return false; + } + return true; +} + +u8 drm_dp_get_adjust_request_voltage(u8 link_status[DP_LINK_STATUS_SIZE], + int lane) +{ + int i = DP_ADJUST_REQUEST_LANE0_1 + (lane >> 1); + int s = ((lane & 1) ? + DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT : + DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT); + u8 l = dp_link_status(link_status, i); + + return ((l >> s) & 0x3) << DP_TRAIN_VOLTAGE_SWING_SHIFT; +} + +u8 drm_dp_get_adjust_request_pre_emphasis(u8 link_status[DP_LINK_STATUS_SIZE], + int lane) +{ + int i = DP_ADJUST_REQUEST_LANE0_1 + (lane >> 1); + int s = ((lane & 1) ? + DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT : + DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT); + u8 l = dp_link_status(link_status, i); + + return ((l >> s) & 0x3) << DP_TRAIN_PRE_EMPHASIS_SHIFT; +} + +void drm_dp_link_train_clock_recovery_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]) { + if (dpcd[DP_TRAINING_AUX_RD_INTERVAL] == 0) + DRM_UDELAY(100); + else + DRM_MDELAY(dpcd[DP_TRAINING_AUX_RD_INTERVAL] * 4); +} + +void drm_dp_link_train_channel_eq_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]) { + if (dpcd[DP_TRAINING_AUX_RD_INTERVAL] == 0) + DRM_UDELAY(400); + else + DRM_MDELAY(dpcd[DP_TRAINING_AUX_RD_INTERVAL] * 4); +} + +u8 drm_dp_link_rate_to_bw_code(int link_rate) +{ + switch (link_rate) { + case 162000: + default: + return DP_LINK_BW_1_62; + case 270000: + return DP_LINK_BW_2_7; + case 540000: + return DP_LINK_BW_5_4; + } +} + +int drm_dp_bw_code_to_link_rate(u8 link_bw) +{ + switch (link_bw) { + case DP_LINK_BW_1_62: + default: + return 162000; + case DP_LINK_BW_2_7: + return 270000; + case DP_LINK_BW_5_4: + return 540000; + } +} Modified: head/sys/dev/drm2/drm_dp_helper.h ============================================================================== --- head/sys/dev/drm2/drm_dp_helper.h Sat Aug 24 22:42:19 2013 (r254816) +++ head/sys/dev/drm2/drm_dp_helper.h Sat Aug 24 23:38:57 2013 (r254817) @@ -25,7 +25,19 @@ #ifndef _DRM_DP_HELPER_H_ #define _DRM_DP_HELPER_H_ -/* From the VESA DisplayPort spec */ +/* + * Unless otherwise noted, all values are from the DP 1.1a spec. Note that + * DP and DPCD versions are independent. Differences from 1.0 are not noted, + * 1.0 devices basically don't exist in the wild. + * + * Abbreviations, in chronological order: + * + * eDP: Embedded DisplayPort version 1 + * DPI: DisplayPort Interoperability Guideline v1.1a + * 1.2: DisplayPort 1.2 + * + * 1.2 formally includes both eDP and DPI definitions. + */ #define AUX_NATIVE_WRITE 0x8 #define AUX_NATIVE_READ 0x9 @@ -52,7 +64,7 @@ #define DP_MAX_LANE_COUNT 0x002 # define DP_MAX_LANE_COUNT_MASK 0x1f -# define DP_TPS3_SUPPORTED (1 << 6) +# define DP_TPS3_SUPPORTED (1 << 6) /* 1.2 */ # define DP_ENHANCED_FRAME_CAP (1 << 7) #define DP_MAX_DOWNSPREAD 0x003 @@ -68,14 +80,33 @@ /* 10b = TMDS or HDMI */ /* 11b = Other */ # define DP_FORMAT_CONVERSION (1 << 3) +# define DP_DETAILED_CAP_INFO_AVAILABLE (1 << 4) /* DPI */ #define DP_MAIN_LINK_CHANNEL_CODING 0x006 -#define DP_TRAINING_AUX_RD_INTERVAL 0x00e +#define DP_DOWN_STREAM_PORT_COUNT 0x007 +# define DP_PORT_COUNT_MASK 0x0f +# define DP_MSA_TIMING_PAR_IGNORED (1 << 6) /* eDP */ +# define DP_OUI_SUPPORT (1 << 7) + +#define DP_I2C_SPEED_CAP 0x00c /* DPI */ +# define DP_I2C_SPEED_1K 0x01 +# define DP_I2C_SPEED_5K 0x02 +# define DP_I2C_SPEED_10K 0x04 +# define DP_I2C_SPEED_100K 0x08 +# define DP_I2C_SPEED_400K 0x10 +# define DP_I2C_SPEED_1M 0x20 + +#define DP_EDP_CONFIGURATION_CAP 0x00d /* XXX 1.2? */ +#define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */ + +/* Multiple stream transport */ +#define DP_MSTM_CAP 0x021 /* 1.2 */ +# define DP_MST_CAP (1 << 0) -#define DP_PSR_SUPPORT 0x070 +#define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */ # define DP_PSR_IS_SUPPORTED 1 -#define DP_PSR_CAPS 0x071 +#define DP_PSR_CAPS 0x071 /* XXX 1.2? */ # define DP_PSR_NO_TRAIN_ON_EXIT 1 # define DP_PSR_SETUP_TIME_330 (0 << 1) # define DP_PSR_SETUP_TIME_275 (1 << 1) @@ -87,11 +118,36 @@ # define DP_PSR_SETUP_TIME_MASK (7 << 1) # define DP_PSR_SETUP_TIME_SHIFT 1 +/* + * 0x80-0x8f describe downstream port capabilities, but there are two layouts + * based on whether DP_DETAILED_CAP_INFO_AVAILABLE was set. If it was not, + * each port's descriptor is one byte wide. If it was set, each port's is + * four bytes wide, starting with the one byte from the base info. As of + * DP interop v1.1a only VGA defines additional detail. + */ + +/* offset 0 */ +#define DP_DOWNSTREAM_PORT_0 0x80 +# define DP_DS_PORT_TYPE_MASK (7 << 0) +# define DP_DS_PORT_TYPE_DP 0 +# define DP_DS_PORT_TYPE_VGA 1 +# define DP_DS_PORT_TYPE_DVI 2 +# define DP_DS_PORT_TYPE_HDMI 3 +# define DP_DS_PORT_TYPE_NON_EDID 4 +# define DP_DS_PORT_HPD (1 << 3) +/* offset 1 for VGA is maximum megapixels per second / 8 */ +/* offset 2 */ +# define DP_DS_VGA_MAX_BPC_MASK (3 << 0) +# define DP_DS_VGA_8BPC 0 +# define DP_DS_VGA_10BPC 1 +# define DP_DS_VGA_12BPC 2 +# define DP_DS_VGA_16BPC 3 + /* link configuration */ #define DP_LINK_BW_SET 0x100 # define DP_LINK_BW_1_62 0x06 # define DP_LINK_BW_2_7 0x0a -# define DP_LINK_BW_5_4 0x14 +# define DP_LINK_BW_5_4 0x14 /* 1.2 */ #define DP_LANE_COUNT_SET 0x101 # define DP_LANE_COUNT_MASK 0x0f @@ -101,7 +157,7 @@ # define DP_TRAINING_PATTERN_DISABLE 0 # define DP_TRAINING_PATTERN_1 1 # define DP_TRAINING_PATTERN_2 2 -# define DP_TRAINING_PATTERN_3 3 +# define DP_TRAINING_PATTERN_3 3 /* 1.2 */ # define DP_TRAINING_PATTERN_MASK 0x3 # define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2) @@ -142,16 +198,32 @@ #define DP_DOWNSPREAD_CTRL 0x107 # define DP_SPREAD_AMP_0_5 (1 << 4) +# define DP_MSA_TIMING_PAR_IGNORE_EN (1 << 7) /* eDP */ #define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108 # define DP_SET_ANSI_8B10B (1 << 0) -#define DP_PSR_EN_CFG 0x170 +#define DP_I2C_SPEED_CONTROL_STATUS 0x109 /* DPI */ +/* bitmask as for DP_I2C_SPEED_CAP */ + +#define DP_EDP_CONFIGURATION_SET 0x10a /* XXX 1.2? */ + +#define DP_MSTM_CTRL 0x111 /* 1.2 */ +# define DP_MST_EN (1 << 0) +# define DP_UP_REQ_EN (1 << 1) +# define DP_UPSTREAM_IS_SRC (1 << 2) + +#define DP_PSR_EN_CFG 0x170 /* XXX 1.2? */ # define DP_PSR_ENABLE (1 << 0) # define DP_PSR_MAIN_LINK_ACTIVE (1 << 1) # define DP_PSR_CRC_VERIFICATION (1 << 2) # define DP_PSR_FRAME_CAPTURE (1 << 3) +#define DP_SINK_COUNT 0x200 +/* prior to 1.2 bit 7 was reserved mbz */ +# define DP_GET_SINK_COUNT(x) ((((x) & 0x80) >> 1) | ((x) & 0x3f)) +# define DP_SINK_CP_READY (1 << 6) + #define DP_DEVICE_SERVICE_IRQ_VECTOR 0x201 # define DP_REMOTE_CONTROL_COMMAND_PENDING (1 << 0) # define DP_AUTOMATED_TEST_REQUEST (1 << 1) @@ -209,18 +281,22 @@ # define DP_TEST_NAK (1 << 1) # define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2) +#define DP_SOURCE_OUI 0x300 +#define DP_SINK_OUI 0x400 +#define DP_BRANCH_OUI 0x500 + #define DP_SET_POWER 0x600 # define DP_SET_POWER_D0 0x1 # define DP_SET_POWER_D3 0x2 -#define DP_PSR_ERROR_STATUS 0x2006 +#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */ # define DP_PSR_LINK_CRC_ERROR (1 << 0) # define DP_PSR_RFB_STORAGE_ERROR (1 << 1) -#define DP_PSR_ESI 0x2007 +#define DP_PSR_ESI 0x2007 /* XXX 1.2? */ # define DP_PSR_CAPS_CHANGE (1 << 0) -#define DP_PSR_STATUS 0x2008 +#define DP_PSR_STATUS 0x2008 /* XXX 1.2? */ # define DP_PSR_SINK_INACTIVE 0 # define DP_PSR_SINK_ACTIVE_SRC_SYNCED 1 # define DP_PSR_SINK_ACTIVE_RFB 2 @@ -247,4 +323,34 @@ int iic_dp_aux_add_bus(device_t dev, con int (*ch)(device_t idev, int mode, uint8_t write_byte, uint8_t *read_byte), void *priv, device_t *bus, device_t *adapter); + +#define DP_LINK_STATUS_SIZE 6 +bool drm_dp_channel_eq_ok(u8 link_status[DP_LINK_STATUS_SIZE], + int lane_count); +bool drm_dp_clock_recovery_ok(u8 link_status[DP_LINK_STATUS_SIZE], + int lane_count); +u8 drm_dp_get_adjust_request_voltage(u8 link_status[DP_LINK_STATUS_SIZE], + int lane); +u8 drm_dp_get_adjust_request_pre_emphasis(u8 link_status[DP_LINK_STATUS_SIZE], + int lane); + +#define DP_RECEIVER_CAP_SIZE 0xf +void drm_dp_link_train_clock_recovery_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]); +void drm_dp_link_train_channel_eq_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]); + +u8 drm_dp_link_rate_to_bw_code(int link_rate); +int drm_dp_bw_code_to_link_rate(u8 link_bw); + +static inline int +drm_dp_max_link_rate(u8 dpcd[DP_RECEIVER_CAP_SIZE]) +{ + return drm_dp_bw_code_to_link_rate(dpcd[DP_MAX_LINK_RATE]); +} + +static inline u8 +drm_dp_max_lane_count(u8 dpcd[DP_RECEIVER_CAP_SIZE]) +{ + return dpcd[DP_MAX_LANE_COUNT] & DP_MAX_LANE_COUNT_MASK; +} + #endif /* _DRM_DP_HELPER_H_ */ Modified: head/sys/modules/drm2/drm2/Makefile ============================================================================== --- head/sys/modules/drm2/drm2/Makefile Sat Aug 24 22:42:19 2013 (r254816) +++ head/sys/modules/drm2/drm2/Makefile Sat Aug 24 23:38:57 2013 (r254817) @@ -11,6 +11,7 @@ SRCS = \ drm_crtc.c \ drm_crtc_helper.c \ drm_dma.c \ + drm_dp_helper.c \ drm_dp_iic_helper.c \ drm_drawable.c \ drm_drv.c \ From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 23:47:32 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 ESMTP id 5B28F33D; Sat, 24 Aug 2013 23:47:32 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) 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 4877B2B34; Sat, 24 Aug 2013 23:47: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 r7ONlWhD055924; Sat, 24 Aug 2013 23:47:32 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7ONlVF1055922; Sat, 24 Aug 2013 23:47:31 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201308242347.r7ONlVF1055922@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 24 Aug 2013 23:47:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254818 - in head/sys/dev/drm2: . i915 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.14 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: Sat, 24 Aug 2013 23:47:32 -0000 Author: dumbbell Date: Sat Aug 24 23:47:31 2013 New Revision: 254818 URL: http://svnweb.freebsd.org/changeset/base/254818 Log: drm: Move definition of EREMOTEIO to drmP.h It will be used by both i915 and radeon drivers. Add ERESTARTSYS definition at the same time. Modified: head/sys/dev/drm2/drmP.h head/sys/dev/drm2/i915/intel_dp.c Modified: head/sys/dev/drm2/drmP.h ============================================================================== --- head/sys/dev/drm2/drmP.h Sat Aug 24 23:38:57 2013 (r254817) +++ head/sys/dev/drm2/drmP.h Sat Aug 24 23:47:31 2013 (r254818) @@ -1411,5 +1411,10 @@ do { \ #define KTR_DRM KTR_DEV #define KTR_DRM_REG KTR_SPARE3 +/* Error codes conversion from Linux to FreeBSD. */ +/* XXXKIB what is the right code for EREMOTEIO on FreeBSD? */ +#define EREMOTEIO ENXIO +#define ERESTARTSYS ERESTART + #endif /* __KERNEL__ */ #endif /* _DRM_P_H_ */ Modified: head/sys/dev/drm2/i915/intel_dp.c ============================================================================== --- head/sys/dev/drm2/i915/intel_dp.c Sat Aug 24 23:38:57 2013 (r254817) +++ head/sys/dev/drm2/i915/intel_dp.c Sat Aug 24 23:47:31 2013 (r254818) @@ -43,9 +43,6 @@ __FBSDID("$FreeBSD$"); #define DP_LINK_CONFIGURATION_SIZE 9 -/* XXXKIB what is the right code for the FreeBSD ? */ -#define EREMOTEIO ENXIO - struct intel_dp { struct intel_encoder base; uint32_t output_reg; From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 23:54:07 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 ESMTP id 1CD695B4; Sat, 24 Aug 2013 23:54:07 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) 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 0A9B32B8D; Sat, 24 Aug 2013 23:54: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 r7ONs6kD060148; Sat, 24 Aug 2013 23:54:06 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7ONs6D7060147; Sat, 24 Aug 2013 23:54:06 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201308242354.r7ONs6D7060147@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 24 Aug 2013 23:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254819 - head/sys/dev/drm2 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.14 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: Sat, 24 Aug 2013 23:54:07 -0000 Author: dumbbell Date: Sat Aug 24 23:54:06 2013 New Revision: 254819 URL: http://svnweb.freebsd.org/changeset/base/254819 Log: drm: Don't delete already deleted iicbus child from drm_iic_dp_aux The iic_dp_aux_detach callback is therefore useless: it's replaced by bus_generic_detach. This fixes a "General protection fault" panic during second (incorrect) deletion of the child. Tested by: kwm@ Reviewed by: ray@ Modified: head/sys/dev/drm2/drm_dp_iic_helper.c Modified: head/sys/dev/drm2/drm_dp_iic_helper.c ============================================================================== --- head/sys/dev/drm2/drm_dp_iic_helper.c Sat Aug 24 23:47:31 2013 (r254818) +++ head/sys/dev/drm2/drm_dp_iic_helper.c Sat Aug 24 23:54:06 2013 (r254819) @@ -216,22 +216,6 @@ iic_dp_aux_attach(device_t idev) return (0); } -static int -iic_dp_aux_detach(device_t idev) -{ - struct iic_dp_aux_data *aux_data; - device_t port; - - aux_data = device_get_softc(idev); - - port = aux_data->port; - bus_generic_detach(idev); - if (port != NULL) - device_delete_child(idev, port); - - return (0); -} - int iic_dp_aux_add_bus(device_t dev, const char *name, int (*ch)(device_t idev, int mode, uint8_t write_byte, uint8_t *read_byte), @@ -277,7 +261,7 @@ iic_dp_aux_add_bus(device_t dev, const c static device_method_t drm_iic_dp_aux_methods[] = { DEVMETHOD(device_probe, iic_dp_aux_probe), DEVMETHOD(device_attach, iic_dp_aux_attach), - DEVMETHOD(device_detach, iic_dp_aux_detach), + DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD(iicbus_reset, iic_dp_aux_reset), DEVMETHOD(iicbus_transfer, iic_dp_aux_xfer), DEVMETHOD_END