From owner-svn-src-head@freebsd.org Sun Oct 23 01:01:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51089C13862; Sun, 23 Oct 2016 01:01:09 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22A8E36A; Sun, 23 Oct 2016 01:01:09 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9N118eA006601; Sun, 23 Oct 2016 01:01:08 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9N118m7006600; Sun, 23 Oct 2016 01:01:08 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610230101.u9N118m7006600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 23 Oct 2016 01:01:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307813 - head/sys/powerpc/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.23 Precedence: list List-Id: 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, 23 Oct 2016 01:01:09 -0000 Author: jhibbits Date: Sun Oct 23 01:01:08 2016 New Revision: 307813 URL: https://svnweb.freebsd.org/changeset/base/307813 Log: Use the right thread pointer for SPE alignment exceptions. Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Sun Oct 23 00:46:53 2016 (r307812) +++ head/sys/powerpc/powerpc/trap.c Sun Oct 23 01:01:08 2016 (r307813) @@ -765,13 +765,13 @@ fix_unaligned(struct thread *td, struct fpr = (double *)td->td_pcb->pcb_vec.vr[reg]; fputhread = PCPU_GET(vecthread); - /* Juggle the FPU to ensure that we've initialized - * the FPRs, and that their current state is in + /* Juggle the SPE to ensure that we've initialized + * the registers, and that their current state is in * the PCB. */ - if (fputhread != td) { - if (fputhread) - save_vec(fputhread); + if (vecthread != td) { + if (vecthread) + save_vec(vecthread); enable_vec(td); } save_vec(td); From owner-svn-src-head@freebsd.org Sun Oct 23 01:03:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E856AC138E0; Sun, 23 Oct 2016 01:03:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4A0989A; Sun, 23 Oct 2016 01:03:18 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9N13Hgs009402; Sun, 23 Oct 2016 01:03:17 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9N13Hsd009401; Sun, 23 Oct 2016 01:03:17 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610230103.u9N13Hsd009401@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 23 Oct 2016 01:03:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307814 - head/sys/powerpc/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.23 Precedence: list List-Id: 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, 23 Oct 2016 01:03:19 -0000 Author: jhibbits Date: Sun Oct 23 01:03:17 2016 New Revision: 307814 URL: https://svnweb.freebsd.org/changeset/base/307814 Log: Revert r307813. I misread the code, and it shouldn't have compiled (fputhread is just a variable name). Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Sun Oct 23 01:01:08 2016 (r307813) +++ head/sys/powerpc/powerpc/trap.c Sun Oct 23 01:03:17 2016 (r307814) @@ -769,9 +769,9 @@ fix_unaligned(struct thread *td, struct * the registers, and that their current state is in * the PCB. */ - if (vecthread != td) { - if (vecthread) - save_vec(vecthread); + if (fputhread != td) { + if (fputhread) + save_vec(fputhread); enable_vec(td); } save_vec(td); From owner-svn-src-head@freebsd.org Sun Oct 23 08:19:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C0BBC1E8A4; Sun, 23 Oct 2016 08:19:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DE7A7BC; Sun, 23 Oct 2016 08:19:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9N8JhbB071886; Sun, 23 Oct 2016 08:19:43 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9N8JhOa071885; Sun, 23 Oct 2016 08:19:43 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201610230819.u9N8JhOa071885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 23 Oct 2016 08:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307818 - 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.23 Precedence: list List-Id: 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, 23 Oct 2016 08:19:44 -0000 Author: adrian Date: Sun Oct 23 08:19:43 2016 New Revision: 307818 URL: https://svnweb.freebsd.org/changeset/base/307818 Log: [net80211] Add a macro to see if a frame is a management frame or not. Modified: head/sys/net80211/ieee80211.h Modified: head/sys/net80211/ieee80211.h ============================================================================== --- head/sys/net80211/ieee80211.h Sun Oct 23 02:25:06 2016 (r307817) +++ head/sys/net80211/ieee80211.h Sun Oct 23 08:19:43 2016 (r307818) @@ -162,6 +162,10 @@ struct ieee80211_qosframe_addr4 { #define IEEE80211_FC0_SUBTYPE_QOS_CFACKPOLL 0xb0 #define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 +#define IEEE80211_IS_MGMT(wh) \ + (!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) \ + == IEEE80211_FC0_TYPE_MGT)) + #define IEEE80211_FC0_QOSDATA \ (IEEE80211_FC0_TYPE_DATA|IEEE80211_FC0_SUBTYPE_QOS|IEEE80211_FC0_VERSION_0) From owner-svn-src-head@freebsd.org Sun Oct 23 08:21:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14534C1E90F; Sun, 23 Oct 2016 08:21:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D80A4AE0; Sun, 23 Oct 2016 08:21:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9N8LZU6073283; Sun, 23 Oct 2016 08:21:35 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9N8LZe1073281; Sun, 23 Oct 2016 08:21:35 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201610230821.u9N8LZe1073281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 23 Oct 2016 08:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307819 - 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.23 Precedence: list List-Id: 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, 23 Oct 2016 08:21:37 -0000 Author: adrian Date: Sun Oct 23 08:21:35 2016 New Revision: 307819 URL: https://svnweb.freebsd.org/changeset/base/307819 Log: [net80211] Add a variant on ieee80211_get_rx_params() that returns a pointer. Be careful when calling this, as the underlying mbuf may change afterwards - common in the RX path. Modified: head/sys/net80211/ieee80211_freebsd.c head/sys/net80211/ieee80211_freebsd.h Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Sun Oct 23 08:19:43 2016 (r307818) +++ head/sys/net80211/ieee80211_freebsd.c Sun Oct 23 08:21:35 2016 (r307819) @@ -529,6 +529,21 @@ ieee80211_get_rx_params(struct mbuf *m, return (0); } +const struct ieee80211_rx_stats * +ieee80211_get_rx_params_ptr(struct mbuf *m) +{ + struct m_tag *mtag; + struct ieee80211_rx_params *rx; + + mtag = m_tag_locate(m, MTAG_ABI_NET80211, NET80211_TAG_RECV_PARAMS, + NULL); + if (mtag == NULL) + return (NULL); + rx = (struct ieee80211_rx_params *)(mtag + 1); + return (&rx->params); +} + + /* * Add TOA parameters to the given mbuf. */ Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Sun Oct 23 08:19:43 2016 (r307818) +++ head/sys/net80211/ieee80211_freebsd.h Sun Oct 23 08:21:35 2016 (r307819) @@ -713,6 +713,7 @@ int ieee80211_add_rx_params(struct mbuf const struct ieee80211_rx_stats *rxs); int ieee80211_get_rx_params(struct mbuf *m, struct ieee80211_rx_stats *rxs); +const struct ieee80211_rx_stats * ieee80211_get_rx_params_ptr(struct mbuf *m); struct ieee80211_toa_params { int request_id; From owner-svn-src-head@freebsd.org Sun Oct 23 11:23:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2A95C1E3F2; Sun, 23 Oct 2016 11:23:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4A5866D; Sun, 23 Oct 2016 11:23:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9NBNHhs044912; Sun, 23 Oct 2016 11:23:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9NBNH2u044911; Sun, 23 Oct 2016 11:23:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610231123.u9NBNH2u044911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 23 Oct 2016 11:23:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307821 - 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.23 Precedence: list List-Id: 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, 23 Oct 2016 11:23:19 -0000 Author: kib Date: Sun Oct 23 11:23:17 2016 New Revision: 307821 URL: https://svnweb.freebsd.org/changeset/base/307821 Log: In the fueword64(9) wrapper for architectures which do not implemented native fueword64(9) still, use proper type for local where fuword64() result is stored. Note that fueword64() is unused in the tree. Submitted by: Chunhui He PR: 212520 MFC after: 1 week Modified: head/sys/kern/subr_uio.c Modified: head/sys/kern/subr_uio.c ============================================================================== --- head/sys/kern/subr_uio.c Sun Oct 23 10:59:42 2016 (r307820) +++ head/sys/kern/subr_uio.c Sun Oct 23 11:23:17 2016 (r307821) @@ -532,7 +532,7 @@ fueword32(volatile const void *base, int int fueword64(volatile const void *base, int64_t *val) { - int32_t res; + int64_t res; res = fuword64(base); if (res == -1) From owner-svn-src-head@freebsd.org Sun Oct 23 11:36:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7331EC1E7AA; Sun, 23 Oct 2016 11:36:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B961FC5; Sun, 23 Oct 2016 11:36:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u9NBaO02019867 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 23 Oct 2016 14:36:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u9NBaO02019867 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u9NBaONr019866; Sun, 23 Oct 2016 14:36:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 23 Oct 2016 14:36:24 +0300 From: Konstantin Belousov To: Justin Hibbits Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307799 - in head/lib/libc: powerpc/gen powerpcspe powerpcspe/gen powerpcspe/sys Message-ID: <20161023113624.GB54029@kib.kiev.ua> References: <201610222151.u9MLpwuv036530@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201610222151.u9MLpwuv036530@repo.freebsd.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 23 Oct 2016 11:36:34 -0000 On Sat, Oct 22, 2016 at 09:51:58PM +0000, Justin Hibbits wrote: > Author: jhibbits > Date: Sat Oct 22 21:51:58 2016 > New Revision: 307799 > URL: https://svnweb.freebsd.org/changeset/base/307799 > > Log: > Reduce code duplication between powerpc and powerpcspe > > They're nearly identical except for a few files. Thank you. BTW, SYM_MAPS are specified with the explicit path, so it costs nothing to use libc/powerpc/Symbol.map instead of the identical copy. I doubt that the variation would need MD symbols not present in the powerpc libc, and hope that it will not. From owner-svn-src-head@freebsd.org Sun Oct 23 12:14:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B70CC1C84D; Sun, 23 Oct 2016 12:14:34 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ua0-x230.google.com (mail-ua0-x230.google.com [IPv6:2607:f8b0:400c:c08::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D5B739BC; Sun, 23 Oct 2016 12:14:33 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-ua0-x230.google.com with SMTP id m11so23522479uab.3; Sun, 23 Oct 2016 05:14:33 -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:from:date:message-id :subject:to:cc; bh=b6IuH8Sxyw8ee4vmWCr8c1Sm51cXmMsGnELq0RLlwn4=; b=lN+5TvlEtLC4uF3sZNWCOBlgjUsvjD1IuF2aAk+DqnealvZEAaYv+ECeDcXKn8uNPl HiTeCUjZp5iezn0m769pO3CoNndc8OFLvdkEda9GZKzsgJGbF2jodQzwYPbsoCZjFUbf BsOpMnJsD/VD4V0CfXVsyMXH5jEr3rp/tws5G5r4eU2Q3GnDoh8DbTAAkGngy88pFp6P NadbSf+xxERqKQGPS/iVRMzY1sa19ecxNCJQRDxEv9p09d7SNJ1LwHwACP0ul2fL3QTi GnoTZ14d4No8KdN4s/Yb+l7bHvV+THkEKuoKVTz4D5DNVBFS7fOAZqtf8Tlb5cccFZxg OaOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=b6IuH8Sxyw8ee4vmWCr8c1Sm51cXmMsGnELq0RLlwn4=; b=m/PLQZzmDyFhRrd0mUZT+s4tXTTjBnDyElc9oONt0yOuUTdRvRuP1wcRzt9tB6vEUN ttgE5g3W+k8CdjdAyewFIlBm8uixFjkggtviXhACJqTJ3J6+Cpt04Q/i+Gho4ozeZAQt P7yEaKfm544g1xpeQuvqkEVOa4EXWGOPJBeDDvsaWDwEesP6o84ZCPJqDEJv5B+dWFNV 3IFc8Q0Nxkf8UFZu7ZvS9G8h2wn4TOQdLPOD7C+ylDUKzw8qumUA16+f8xvZbIZqTH/Q bgUbd6Wh9bqeUArLG23NU7tgwaY2cK3xYCVQKlH5CLJulWDVNOnUNVTDKyak1u46viQO 4hFw== X-Gm-Message-State: ABUngvche2SKIVgZNwbYEdvDTOq9k0V4e+dtLlPUQkIwsQqBSkKtaChMgolTqcZ5Fpohu02gZnx7p7k3EpR6og== X-Received: by 10.176.80.71 with SMTP id z7mr5001146uaz.140.1477224872935; Sun, 23 Oct 2016 05:14:32 -0700 (PDT) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 10.103.88.209 with HTTP; Sun, 23 Oct 2016 05:14:31 -0700 (PDT) Received: by 10.103.88.209 with HTTP; Sun, 23 Oct 2016 05:14:31 -0700 (PDT) In-Reply-To: References: <201610222151.u9MLpwuv036530@repo.freebsd.org> <20161023113624.GB54029@kib.kiev.ua> From: Justin Hibbits Date: Sun, 23 Oct 2016 07:14:31 -0500 X-Google-Sender-Auth: 3GSDdohc2iliyZkJjw8Lu95GV78 Message-ID: Subject: Re: svn commit: r307799 - in head/lib/libc: powerpc/gen powerpcspe powerpcspe/gen powerpcspe/sys To: Konstantin Belousov Cc: src-committers , svn-src-head@freebsd.org, svn-src-all@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 23 Oct 2016 12:14:34 -0000 On Oct 23, 2016 06:36, "Konstantin Belousov" wrote: > > On Sat, Oct 22, 2016 at 09:51:58PM +0000, Justin Hibbits wrote: > > Author: jhibbits > > Date: Sat Oct 22 21:51:58 2016 > > New Revision: 307799 > > URL: https://svnweb.freebsd.org/changeset/base/307799 > > > > Log: > > Reduce code duplication between powerpc and powerpcspe > > > > They're nearly identical except for a few files. > > Thank you. > > BTW, SYM_MAPS are specified with the explicit path, so it costs nothing > to use libc/powerpc/Symbol.map instead of the identical copy. I doubt > that the variation would need MD symbols not present in the powerpc libc, > and hope that it will not. Okay I'll fix that today as well. - Justin From owner-svn-src-head@freebsd.org Sun Oct 23 12:48:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 579E4C1D312; Sun, 23 Oct 2016 12:48:11 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F9FDB78; Sun, 23 Oct 2016 12:48:11 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9NCmA5a075754; Sun, 23 Oct 2016 12:48:10 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9NCm91E075749; Sun, 23 Oct 2016 12:48:09 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201610231248.u9NCm91E075749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sun, 23 Oct 2016 12:48:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307822 - in head/sys/arm: allwinner 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.23 Precedence: list List-Id: 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, 23 Oct 2016 12:48:11 -0000 Author: manu Date: Sun Oct 23 12:48:09 2016 New Revision: 307822 URL: https://svnweb.freebsd.org/changeset/base/307822 Log: allwinner: Add support for P2WI bus P2WI (Push-Pull Two Wire Interface) is an I2C-like bus used in sun6i SoC for talking to power management unit IC. Added: head/sys/arm/allwinner/aw_p2wi.c (contents, props changed) head/sys/arm/allwinner/aw_p2wi.h (contents, props changed) Modified: head/sys/arm/allwinner/files.allwinner head/sys/arm/conf/GENERIC Added: head/sys/arm/allwinner/aw_p2wi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/aw_p2wi.c Sun Oct 23 12:48:09 2016 (r307822) @@ -0,0 +1,277 @@ +/*- + * Copyright (c) 2016 Emmanuel Vadot + * 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$ + */ + +/* + * Allwinner P2WI (Push-Pull Two Wire Interface) + * P2WI is a iic-like interface used on sun6i hardware + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include + +#include "iicbus_if.h" + +static struct ofw_compat_data compat_data[] = { + { "allwinner,sun6i-a31-p2wi", 1 }, + { NULL, 0 } +}; + +static struct resource_spec p2wi_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +struct p2wi_softc { + struct resource *res; + struct mtx mtx; + clk_t clk; + hwreset_t rst; + device_t iicbus; +}; + +#define P2WI_LOCK(sc) mtx_lock(&(sc)->mtx) +#define P2WI_UNLOCK(sc) mtx_unlock(&(sc)->mtx) +#define P2WI_READ(sc, reg) bus_read_4((sc)->res, (reg)) +#define P2WI_WRITE(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) + +#define P2WI_RETRY 1000 + +static phandle_t +p2wi_get_node(device_t bus, device_t dev) +{ + return (ofw_bus_get_node(bus)); +} + +static int +p2wi_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) +{ + struct p2wi_softc *sc; + int retry; + + sc = device_get_softc(dev); + + P2WI_LOCK(sc); + + P2WI_WRITE(sc, P2WI_CTRL, P2WI_CTRL_SOFT_RESET); + for (retry = P2WI_RETRY; retry > 0; retry--) + if ((P2WI_READ(sc, P2WI_CTRL) & P2WI_CTRL_SOFT_RESET) == 0) + break; + + P2WI_UNLOCK(sc); + + if (retry == 0) { + device_printf(dev, "soft reset timeout\n"); + return (ETIMEDOUT); + } + + return (IIC_ENOADDR); +} + +static int +p2wi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) +{ + struct p2wi_softc *sc; + int retry, error; + uint8_t data_len; + + sc = device_get_softc(dev); + + /* + * Since P2WI is only used for AXP22x PMIC we only support + * two messages of one byte length + */ + if (nmsgs != 2 || (msgs[0].flags & IIC_M_RD) == IIC_M_RD || + msgs[0].len != 1 || msgs[1].len != 1) + return (EINVAL); + + P2WI_LOCK(sc); + + /* Write address */ + P2WI_WRITE(sc, P2WI_DADDR0, msgs[0].buf[0]); + + /* Write Data length/Direction */ + data_len = P2WI_DLEN_LEN(msgs[1].len); + if ((msgs[1].flags & IIC_M_RD) == 0) + P2WI_WRITE(sc, P2WI_DATA0, msgs[1].buf[0]); + else + data_len |= P2WI_DLEN_READ; + P2WI_WRITE(sc, P2WI_DLEN, data_len); + + /* Start transfer */ + P2WI_WRITE(sc, P2WI_CTRL, P2WI_CTRL_START_TRANS); + + /* Wait for transfer to complete */ + for (retry = P2WI_RETRY; retry > 0; retry--) + if ((P2WI_READ(sc, P2WI_CTRL) & P2WI_CTRL_START_TRANS) == 0) + break; + + if (retry == 0) { + error = ETIMEDOUT; + goto done; + } + + /* Read data if needed */ + if ((msgs[1].flags & IIC_M_RD) == IIC_M_RD) { + msgs[1].buf[0] = P2WI_READ(sc, P2WI_DATA0) & 0xff; + msgs[1].len = 1; + } + + error = 0; + +done: + P2WI_UNLOCK(sc); + + return (error); +} + +static int +p2wi_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Allwinner P2WI"); + return (BUS_PROBE_DEFAULT); +} + +static int +p2wi_attach(device_t dev) +{ + struct p2wi_softc *sc; + int error; + + sc = device_get_softc(dev); + mtx_init(&sc->mtx, device_get_nameunit(dev), "p2wi", MTX_DEF); + + if (clk_get_by_ofw_index(dev, 0, 0, &sc->clk) == 0) { + error = clk_enable(sc->clk); + if (error != 0) { + device_printf(dev, "cannot enable clock\n"); + goto fail; + } + } + if (hwreset_get_by_ofw_idx(dev, 0, 0, &sc->rst) == 0) { + error = hwreset_deassert(sc->rst); + if (error != 0) { + device_printf(dev, "cannot de-assert reset\n"); + goto fail; + } + } + + if (bus_alloc_resources(dev, p2wi_spec, &sc->res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + error = ENXIO; + goto fail; + } + + sc->iicbus = device_add_child(dev, "iicbus", -1); + if (sc->iicbus == NULL) { + device_printf(dev, "cannot add iicbus child device\n"); + error = ENXIO; + goto fail; + } + + /* Disable interrupts */ + P2WI_WRITE(sc, P2WI_INTE, 0x0); + + bus_generic_attach(dev); + + return (0); + +fail: + bus_release_resources(dev, p2wi_spec, &sc->res); + if (sc->rst != NULL) + hwreset_release(sc->rst); + if (sc->clk != NULL) + clk_release(sc->clk); + mtx_destroy(&sc->mtx); + return (error); +} + +static device_method_t p2wi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, p2wi_probe), + DEVMETHOD(device_attach, p2wi_attach), + + /* Bus interface */ + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), + DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), + DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + + /* OFW methods */ + DEVMETHOD(ofw_bus_get_node, p2wi_get_node), + + /* iicbus interface */ + DEVMETHOD(iicbus_callback, iicbus_null_callback), + DEVMETHOD(iicbus_reset, p2wi_reset), + DEVMETHOD(iicbus_transfer, p2wi_transfer), + + DEVMETHOD_END +}; + +static driver_t p2wi_driver = { + "iichb", + p2wi_methods, + sizeof(struct p2wi_softc), +}; + +static devclass_t p2wi_devclass; + +EARLY_DRIVER_MODULE(iicbus, p2wi, iicbus_driver, iicbus_devclass, 0, 0, + BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); +EARLY_DRIVER_MODULE(p2wi, simplebus, p2wi_driver, p2wi_devclass, 0, 0, + BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); +MODULE_VERSION(p2wi, 1); Added: head/sys/arm/allwinner/aw_p2wi.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/aw_p2wi.h Sun Oct 23 12:48:09 2016 (r307822) @@ -0,0 +1,79 @@ +/*- + * Copyright (c) 2016 Emmanuel Vadot + * 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 __AW_P2WI_H__ +#define __AW_P2WI_H__ + +#define P2WI_CTRL 0x00 +#define P2WI_CTRL_SOFT_RESET (1 << 0) +#define P2WI_CTRL_GLOBAL_INT_ENB (1 << 1) +#define P2WI_CTRL_ABORT_TRANS (1 << 6) +#define P2WI_CTRL_START_TRANS (1 << 7) + +#define P2WI_CCR 0x04 +#define P2WI_CCR_CLK_DIV_SHIFT 0 +#define P2WI_CCR_CLK_DIV_MASK 0xFF +#define P2WI_CCR_SDA_ODLY_SHIFT 7 +#define P2WI_CCR_SDA_ODLY_MASK 0x700 + +#define P2WI_INTE 0x08 +#define P2WI_INTE_TRANS_OVER_ENB +#define P2WI_INTE_TRANS_ERR_ENB +#define P2WI_INTE_LOAD_BSY_ENB + +#define P2WI_STAT 0x0C +#define P2WI_STAT_TRANS_OVER (1 << 0) +#define P2WI_STAT_TRANS_ERR (1 << 1) +#define P2WI_STAT_LOAD_BSY (1 << 2) +#define P2WI_STAT_TRANS_ERR_ID_SHIFT 7 +#define P2WI_STAT_TRANS_ERR_ID_MASK 0xFF00 + +#define P2WI_DADDR0 0x10 + +#define P2WI_DADDR1 0x14 + +#define P2WI_DLEN 0x18 +#define P2WI_DLEN_LEN(x) ((x - 1) & 0x7) +#define P2WI_DLEN_READ (1 << 4) + +#define P2WI_DATA0 0x1C + +#define P2WI_DATA1 0x20 + +#define P2WI_LCR 0x24 +#define P2WI_LCR_SDA_CTL_EN (1 << 0) +#define P2WI_LCR_SDA_CTL (1 << 1) +#define P2WI_LCR_SCL_CTL_EN (1 << 2) +#define P2WI_LCR_SCL_CTL (1 << 3) +#define P2WI_LCR_SDA_STATE (1 << 4) +#define P2WI_LCR_SCL_STATE (1 << 5) + + +#define P2WI_PMCR 0x28 + +#endif /* __AW_P2WI_H__ */ Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Sun Oct 23 11:23:17 2016 (r307821) +++ head/sys/arm/allwinner/files.allwinner Sun Oct 23 12:48:09 2016 (r307822) @@ -12,6 +12,7 @@ arm/allwinner/a10_mmc.c optional mmc arm/allwinner/a10_sramc.c standard arm/allwinner/aw_nmi.c optional intrng arm/allwinner/aw_if_dwc.c optional dwc +arm/allwinner/aw_p2wi.c optional p2wi arm/allwinner/aw_rsb.c optional rsb arm/allwinner/aw_rtc.c standard arm/allwinner/aw_ts.c standard Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Sun Oct 23 11:23:17 2016 (r307821) +++ head/sys/arm/conf/GENERIC Sun Oct 23 12:48:09 2016 (r307822) @@ -104,6 +104,7 @@ device iicbus device iic device twsi device rsb +device p2wi # Allwinner Push-Pull Two Wire interface device axp209 # AXP209 Power Management Unit device axp81x # AXP813/818 Power Management Unit device bcm2835_bsc From owner-svn-src-head@freebsd.org Sun Oct 23 14:28:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A537C1EFA6; Sun, 23 Oct 2016 14:28:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F13D7135; Sun, 23 Oct 2016 14:28:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9NESUDd013425; Sun, 23 Oct 2016 14:28:30 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9NESTLB013423; Sun, 23 Oct 2016 14:28:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201610231428.u9NESTLB013423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 23 Oct 2016 14:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307823 - 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.23 Precedence: list List-Id: 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, 23 Oct 2016 14:28:31 -0000 Author: dim Date: Sun Oct 23 14:28:29 2016 New Revision: 307823 URL: https://svnweb.freebsd.org/changeset/base/307823 Log: Use upstream suffixes for LLVM IR In r307676, several make rules were added for LLVM IR files, both in text and binary format. Unfortunately these use different suffixes from what upstream uses: * Text IR has upstream suffix ".ll", while r307676 uses ".llo" * Binary IR has upstream suffix ".bc", while r307676 uses ".bco" Change these to what upstream uses instead. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D8326 Modified: head/share/mk/bsd.suffixes.mk head/share/mk/sys.mk Modified: head/share/mk/bsd.suffixes.mk ============================================================================== --- head/share/mk/bsd.suffixes.mk Sun Oct 23 12:48:09 2016 (r307822) +++ head/share/mk/bsd.suffixes.mk Sun Oct 23 14:28:29 2016 (r307823) @@ -20,10 +20,10 @@ ${CC} ${STATIC_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} -.c.bco: +.c.bc: ${CC} -emit-llvm ${IR_CFLAGS} -c ${.IMPSRC} -o ${.TARGET} -.c.llo: +.c.ll: ${CC} -emit-llvm ${IR_CFLAGS} -S ${.IMPSRC} -o ${.TARGET} .cc .cpp .cxx .C: @@ -32,10 +32,10 @@ .cc.o .cpp.o .cxx.o .C.o: ${CXX} ${STATIC_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} -.cc.bco .cpp.bco .cxx.bco .C.bco: +.cc.bc .cpp.bc .cxx.bc .C.bc: ${CXX} -emit-llvm ${IR_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} -.cc.llo .cpp.llo .cxx.llo .C.llo: +.cc.ll .cpp.ll .cxx.ll .C.ll: ${CXX} -emit-llvm ${IR_CXXFLAGS} -S ${.IMPSRC} -o ${.TARGET} .m.o: Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Sun Oct 23 12:48:09 2016 (r307822) +++ head/share/mk/sys.mk Sun Oct 23 14:28:29 2016 (r307823) @@ -121,7 +121,7 @@ META_MODE?= normal .if defined(%POSIX) .SUFFIXES: .o .c .y .l .a .sh .f .else -.SUFFIXES: .out .a .ln .o .bco .llo .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .asm .s .cl .p .h .sh +.SUFFIXES: .out .a .ln .o .bc .ll .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .asm .s .cl .p .h .sh .endif AR ?= ar From owner-svn-src-head@freebsd.org Sun Oct 23 17:48:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82CE3C1E065; Sun, 23 Oct 2016 17:48:35 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52386BCC; Sun, 23 Oct 2016 17:48:35 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9NHmYba089216; Sun, 23 Oct 2016 17:48:34 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9NHmYMZ089215; Sun, 23 Oct 2016 17:48:34 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201610231748.u9NHmYMZ089215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sun, 23 Oct 2016 17:48:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307824 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 23 Oct 2016 17:48:35 -0000 Author: jmcneill Date: Sun Oct 23 17:48:34 2016 New Revision: 307824 URL: https://svnweb.freebsd.org/changeset/base/307824 Log: Throttle CPU frequency when hot temperature threshold has been reached to prevent overheating. When sensor 0's alarm interrupt is fired, set a throttle flag. Further requests to set CPU frequency will be rejected until sensor 0's temperature returns to a level below the hot temperature threshold. Relnotes: yes Modified: head/sys/arm/allwinner/aw_thermal.c Modified: head/sys/arm/allwinner/aw_thermal.c ============================================================================== --- head/sys/arm/allwinner/aw_thermal.c Sun Oct 23 14:28:29 2016 (r307823) +++ head/sys/arm/allwinner/aw_thermal.c Sun Oct 23 17:48:34 2016 (r307824) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -51,6 +52,8 @@ __FBSDID("$FreeBSD$"); #include +#include "cpufreq_if.h" + #define THS_CTRL0 0x00 #define THS_CTRL1 0x04 #define ADC_CALI_EN (1 << 17) @@ -70,6 +73,14 @@ __FBSDID("$FreeBSD$"); #define ALARM_INT2_STS (1 << 2) #define ALARM_INT1_STS (1 << 1) #define ALARM_INT0_STS (1 << 0) +#define THS_ALARM0_CTRL 0x50 +#define ALARM_T_HOT_MASK 0xfff +#define ALARM_T_HOT_SHIFT 16 +#define ALARM_T_HYST_MASK 0xfff +#define ALARM_T_HYST_SHIFT 0 +#define THS_SHUTDOWN0_CTRL 0x60 +#define SHUT_T_HOT_MASK 0xfff +#define SHUT_T_HOT_SHIFT 16 #define THS_FILTER 0x70 #define THS_CALIB0 0x74 #define THS_CALIB1 0x78 @@ -97,16 +108,24 @@ __FBSDID("$FreeBSD$"); #define H3_ADC_ACQUIRE_TIME 0x3f #define H3_FILTER 0x6 #define H3_INTC 0x191000 -#define H3_TEMP_BASE 217000000 -#define H3_TEMP_MUL 121168 -#define H3_TEMP_DIV 1000000 +#define H3_TEMP_BASE 2794000 +#define H3_TEMP_MUL 1000 +#define H3_TEMP_DIV -14882 #define H3_CLK_RATE 4000000 #define TEMP_C_TO_K 273 #define SENSOR_ENABLE_ALL (SENSOR0_EN|SENSOR1_EN|SENSOR2_EN) #define SHUT_INT_ALL (SHUT_INT0_STS|SHUT_INT1_STS|SHUT_INT2_STS) +#define ALARM_INT_ALL (ALARM_INT0_STS) #define MAX_SENSORS 3 +#define MAX_CF_LEVELS 64 + +#define THROTTLE_ENABLE_DEFAULT 1 + +/* Enable thermal throttling */ +static int aw_thermal_throttle_enable = THROTTLE_ENABLE_DEFAULT; +TUNABLE_INT("hw.aw_thermal.throttle_enable", &aw_thermal_throttle_enable); struct aw_thermal_sensor { const char *name; @@ -118,14 +137,23 @@ struct aw_thermal_config { int nsensors; uint64_t clk_rate; uint32_t adc_acquire_time; + int adc_cali_en; uint32_t filter; uint32_t intc; + int (*to_temp)(uint32_t); int temp_base; int temp_mul; int temp_div; - int calib; + int calib0, calib1; + uint32_t calib0_mask, calib1_mask; }; +static int +a83t_to_temp(uint32_t val) +{ + return ((A83T_TEMP_BASE - (val * A83T_TEMP_MUL)) / A83T_TEMP_DIV); +} + static const struct aw_thermal_config a83t_config = { .nsensors = 3, .sensors = { @@ -144,14 +172,22 @@ static const struct aw_thermal_config a8 }, .clk_rate = A83T_CLK_RATE, .adc_acquire_time = A83T_ADC_ACQUIRE_TIME, + .adc_cali_en = 1, .filter = A83T_FILTER, .intc = A83T_INTC, - .temp_base = A83T_TEMP_BASE, - .temp_mul = A83T_TEMP_MUL, - .temp_div = A83T_TEMP_DIV, - .calib = 1, + .to_temp = a83t_to_temp, + .calib0 = 1, + .calib0_mask = 0xffffffff, + .calib1 = 1, + .calib1_mask = 0xffffffff, }; +static int +a64_to_temp(uint32_t val) +{ + return ((A64_TEMP_BASE - (val * A64_TEMP_MUL)) / A64_TEMP_DIV); +} + static const struct aw_thermal_config a64_config = { .nsensors = 3, .sensors = { @@ -172,11 +208,15 @@ static const struct aw_thermal_config a6 .adc_acquire_time = A64_ADC_ACQUIRE_TIME, .filter = A64_FILTER, .intc = A64_INTC, - .temp_base = A64_TEMP_BASE, - .temp_mul = A64_TEMP_MUL, - .temp_div = A64_TEMP_DIV, + .to_temp = a64_to_temp, }; +static int +h3_to_temp(uint32_t val) +{ + return (((int)(val * H3_TEMP_MUL) - H3_TEMP_BASE) / H3_TEMP_DIV); +} + static const struct aw_thermal_config h3_config = { .nsensors = 1, .sensors = { @@ -189,9 +229,9 @@ static const struct aw_thermal_config h3 .adc_acquire_time = H3_ADC_ACQUIRE_TIME, .filter = H3_FILTER, .intc = H3_INTC, - .temp_base = H3_TEMP_BASE, - .temp_mul = H3_TEMP_MUL, - .temp_div = H3_TEMP_DIV, + .to_temp = h3_to_temp, + .calib0 = 1, + .calib0_mask = 0xfff, }; static struct ofw_compat_data compat_data[] = { @@ -205,8 +245,14 @@ static struct ofw_compat_data compat_dat (void *)ofw_bus_search_compatible((d), compat_data)->ocd_data struct aw_thermal_softc { + device_t dev; struct resource *res[2]; struct aw_thermal_config *conf; + + int throttle; + int min_freq; + struct cf_level levels[MAX_CF_LEVELS]; + eventhandler_tag cf_pre_tag; }; static struct resource_spec aw_thermal_spec[] = { @@ -224,15 +270,20 @@ aw_thermal_init(struct aw_thermal_softc uint32_t calib0, calib1; int error; - if (sc->conf->calib) { + if (sc->conf->calib0 != 0 || sc->conf->calib1 != 0) { /* Read calibration settings from SRAM */ error = aw_sid_read_tscalib(&calib0, &calib1); if (error != 0) return (error); + calib0 &= sc->conf->calib0_mask; + calib1 &= sc->conf->calib1_mask; + /* Write calibration settings to thermal controller */ - WR4(sc, THS_CALIB0, calib0); - WR4(sc, THS_CALIB1, calib1); + if (sc->conf->calib0 != 0 && calib0 != 0) + WR4(sc, THS_CALIB0, calib0); + if (sc->conf->calib1 != 0 && calib1 != 0) + WR4(sc, THS_CALIB1, calib1); } /* Configure ADC acquire time (CLK_IN/(N+1)) and enable sensors */ @@ -245,7 +296,7 @@ aw_thermal_init(struct aw_thermal_softc /* Enable interrupts */ WR4(sc, THS_INTS, RD4(sc, THS_INTS)); - WR4(sc, THS_INTC, sc->conf->intc | SHUT_INT_ALL); + WR4(sc, THS_INTC, sc->conf->intc | SHUT_INT_ALL | ALARM_INT_ALL); /* Enable sensors */ WR4(sc, THS_CTRL2, RD4(sc, THS_CTRL2) | SENSOR_ENABLE_ALL); @@ -254,20 +305,46 @@ aw_thermal_init(struct aw_thermal_softc } static int -aw_thermal_reg_to_temp(struct aw_thermal_softc *sc, uint32_t val) +aw_thermal_gettemp(struct aw_thermal_softc *sc, int sensor) { - return ((sc->conf->temp_base - (val * sc->conf->temp_mul)) / - sc->conf->temp_div); + uint32_t val; + + val = RD4(sc, THS_DATA0 + (sensor * 4)); + + return (sc->conf->to_temp(val) + TEMP_C_TO_K); } static int -aw_thermal_gettemp(struct aw_thermal_softc *sc, int sensor) +aw_thermal_getshut(struct aw_thermal_softc *sc, int sensor) { uint32_t val; - val = RD4(sc, THS_DATA0 + (sensor * 4)); + val = RD4(sc, THS_SHUTDOWN0_CTRL + (sensor * 4)); + val = (val >> SHUT_T_HOT_SHIFT) & SHUT_T_HOT_MASK; + + return (sc->conf->to_temp(val) + TEMP_C_TO_K); +} + +static int +aw_thermal_gethyst(struct aw_thermal_softc *sc, int sensor) +{ + uint32_t val; - return (aw_thermal_reg_to_temp(sc, val) + TEMP_C_TO_K); + val = RD4(sc, THS_ALARM0_CTRL + (sensor * 4)); + val = (val >> ALARM_T_HYST_SHIFT) & ALARM_T_HYST_MASK; + + return (sc->conf->to_temp(val) + TEMP_C_TO_K); +} + +static int +aw_thermal_getalarm(struct aw_thermal_softc *sc, int sensor) +{ + uint32_t val; + + val = RD4(sc, THS_ALARM0_CTRL + (sensor * 4)); + val = (val >> ALARM_T_HOT_SHIFT) & ALARM_T_HOT_MASK; + + return (sc->conf->to_temp(val) + TEMP_C_TO_K); } static int @@ -285,6 +362,55 @@ aw_thermal_sysctl(SYSCTL_HANDLER_ARGS) } static void +aw_thermal_throttle(struct aw_thermal_softc *sc, int enable) +{ + device_t cf_dev; + int count, error; + + if (enable == sc->throttle) + return; + + if (enable != 0) { + /* Set the lowest available frequency */ + cf_dev = devclass_get_device(devclass_find("cpufreq"), 0); + if (cf_dev == NULL) + return; + count = MAX_CF_LEVELS; + error = CPUFREQ_LEVELS(cf_dev, sc->levels, &count); + if (error != 0 || count == 0) + return; + sc->min_freq = sc->levels[count - 1].total_set.freq; + error = CPUFREQ_SET(cf_dev, &sc->levels[count - 1], + CPUFREQ_PRIO_USER); + if (error != 0) + return; + } + + sc->throttle = enable; +} + +static void +aw_thermal_cf_pre_change(void *arg, const struct cf_level *level, int *status) +{ + struct aw_thermal_softc *sc; + int temp_cur, temp_alarm; + + sc = arg; + + if (aw_thermal_throttle_enable == 0 || sc->throttle == 0 || + level->total_set.freq == sc->min_freq) + return; + + temp_cur = aw_thermal_gettemp(sc, 0); + temp_alarm = aw_thermal_getalarm(sc, 0); + + if (temp_cur < temp_alarm) + aw_thermal_throttle(sc, 0); + else + *status = ENXIO; +} + +static void aw_thermal_intr(void *arg) { struct aw_thermal_softc *sc; @@ -299,9 +425,12 @@ aw_thermal_intr(void *arg) if ((ints & SHUT_INT_ALL) != 0) { device_printf(dev, - "WARNING - current temperature exceeds safe limits\n"); + "WARNING - current temperature exceeds safe limits\n"); shutdown_nice(RB_POWEROFF); } + + if ((ints & ALARM_INT_ALL) != 0) + aw_thermal_throttle(sc, 1); } static int @@ -383,6 +512,18 @@ aw_thermal_attach(device_t dev) sc, i, aw_thermal_sysctl, "IK0", sc->conf->sensors[i].desc); + if (bootverbose) + for (i = 0; i < sc->conf->nsensors; i++) { + device_printf(dev, + "#%d: alarm %dC hyst %dC shut %dC\n", i, + aw_thermal_getalarm(sc, i) - TEMP_C_TO_K, + aw_thermal_gethyst(sc, i) - TEMP_C_TO_K, + aw_thermal_getshut(sc, i) - TEMP_C_TO_K); + } + + sc->cf_pre_tag = EVENTHANDLER_REGISTER(cpufreq_pre_change, + aw_thermal_cf_pre_change, sc, EVENTHANDLER_PRI_FIRST); + return (0); fail: From owner-svn-src-head@freebsd.org Sun Oct 23 18:00:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4260C1E63F; Sun, 23 Oct 2016 18:00:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75642753; Sun, 23 Oct 2016 18:00:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9NI08Ll093290; Sun, 23 Oct 2016 18:00:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9NI08hH093288; Sun, 23 Oct 2016 18:00:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610231800.u9NI08hH093288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 23 Oct 2016 18:00:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307825 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 23 Oct 2016 18:00:09 -0000 Author: imp Date: Sun Oct 23 18:00:08 2016 New Revision: 307825 URL: https://svnweb.freebsd.org/changeset/base/307825 Log: Tweak the UPDATING message a bit about the upgrade path. Add some automation into Makefile.inc1 to to enforce known good upgrade from source paths. Modified: head/Makefile.inc1 head/UPDATING Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sun Oct 23 17:48:34 2016 (r307824) +++ head/Makefile.inc1 Sun Oct 23 18:00:08 2016 (r307825) @@ -453,7 +453,7 @@ PACKAGE= kernel # BOOTSTRAPPING?= 0 -# Keep these in sync +# Keep these in sync -- see below for special case exception MINIMUM_SUPPORTED_OSREL?= 900044 MINIMUM_SUPPORTED_REL?= 9.1 @@ -1557,10 +1557,23 @@ _elftoolchain_libs= lib/libelf lib/libdw .endif legacy: .PHONY +# Temporary special case for automatically detecting the clang compiler issue +# Note: 9.x didn't have FreeBSD_version bumps often enough, so you may need to +# set BOOTSTRAPPING to 0 if you're stable/9 tree post-dates r286035 but is before +# the version bump in r296219 (from July 29, 2015 -> Feb 29, 2016). +.if ${BOOTSTRAPPING} != 0 && \ + ${WANT_COMPILER_TYPE} == "clang" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 30601 +.if ${BOOTSTRAPPING} > 10000000 && ${BOOTSTRAPPING} < 1002501 + @echo "ERROR: Source upgrades from stable/10 prior to r286033 are not supported."; false +.elif ${BOOTSTRAPPING} > 9000000 && ${BOOTSTRAPPING} < 903509 + @echo "ERROR: Source upgrades from stable/9 prior to r286035 are not supported."; false +.endif +.endif .if ${BOOTSTRAPPING} < ${MINIMUM_SUPPORTED_OSREL} && ${BOOTSTRAPPING} != 0 @echo "ERROR: Source upgrades from versions prior to ${MINIMUM_SUPPORTED_REL} are not supported."; \ false .endif + .for _tool in tools/build ${_elftoolchain_libs} ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \ cd ${.CURDIR}/${_tool}; \ Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Oct 23 17:48:34 2016 (r307824) +++ head/UPDATING Sun Oct 23 18:00:08 2016 (r307825) @@ -41,10 +41,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 11.0-RELEASE). These revisions post-date the 10.2 and 9.3 releases, so you'll need to take the unusual step of upgrading to the tip of the stable branch before moving to 11 or -current via a source upgrade. - stable/11 and 11.0-RELEASE post-date the fix so you can move from them - to -current. This differs from the historical situation where one could - upgrade from anywhere on the last couple of stable branches, so be - careful. + stable/11 and 11.0-RELEASE have working newer compiler. This differs + from the historical situation where one could upgrade from anywhere on + the last couple of stable branches, so be careful. + + If you're running a hybrid system on 9.x or 10.x with an updated clang + compiler or are using an supported external toolchain, the build system + will allow the upgrade. Otherwise it will print a reminder. ****************************** SPECIAL WARNING: ****************************** From owner-svn-src-head@freebsd.org Sun Oct 23 18:00:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42A07C1E646; Sun, 23 Oct 2016 18:00:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1075A754; Sun, 23 Oct 2016 18:00:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9NI0AtF093333; Sun, 23 Oct 2016 18:00:10 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9NI0ATu093332; Sun, 23 Oct 2016 18:00:10 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610231800.u9NI0ATu093332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 23 Oct 2016 18:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307826 - 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.23 Precedence: list List-Id: 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, 23 Oct 2016 18:00:11 -0000 Author: imp Date: Sun Oct 23 18:00:09 2016 New Revision: 307826 URL: https://svnweb.freebsd.org/changeset/base/307826 Log: Use checkyesno instead of rolling my own.. Modified: head/etc/rc Modified: head/etc/rc ============================================================================== --- head/etc/rc Sun Oct 23 18:00:08 2016 (r307825) +++ head/etc/rc Sun Oct 23 18:00:09 2016 (r307826) @@ -135,16 +135,16 @@ done # Note: this assumes firstboot_sentinel is on / when we have # a read-only /, or that it is on media that's writable. if [ -e ${firstboot_sentinel} ]; then - [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -uw / + checkyesno root_rw_mount && mount -uw / chflags -R 0 ${firstboot_sentinel} rm -rf ${firstboot_sentinel} if [ -e ${firstboot_sentinel}-reboot ]; then chflags -R 0 ${firstboot_sentinel}-reboot rm -rf ${firstboot_sentinel}-reboot - [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -ur / + checkyesno root_rw_mount && mount -ur / kill -INT 1 fi - [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -ur / + checkyesno root_rw_mount && mount -ur / fi echo '' From owner-svn-src-head@freebsd.org Sun Oct 23 18:08:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D82B4C1E91E; Sun, 23 Oct 2016 18:08:35 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A75AAE22; Sun, 23 Oct 2016 18:08:35 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9NI8YrA096912; Sun, 23 Oct 2016 18:08:34 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9NI8YXF096911; Sun, 23 Oct 2016 18:08:34 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610231808.u9NI8YXF096911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 23 Oct 2016 18:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307827 - head/lib/libc/powerpcspe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 23 Oct 2016 18:08:35 -0000 Author: jhibbits Date: Sun Oct 23 18:08:34 2016 New Revision: 307827 URL: https://svnweb.freebsd.org/changeset/base/307827 Log: Remove the powerpcspe Symbol.map, it's identical to powerpc's. Reported by: kib Deleted: head/lib/libc/powerpcspe/Symbol.map Modified: head/lib/libc/powerpcspe/Makefile.inc Modified: head/lib/libc/powerpcspe/Makefile.inc ============================================================================== --- head/lib/libc/powerpcspe/Makefile.inc Sun Oct 23 18:00:09 2016 (r307826) +++ head/lib/libc/powerpcspe/Makefile.inc Sun Oct 23 18:08:34 2016 (r307827) @@ -5,4 +5,4 @@ SRCS+= trivial-vdso_tc.c # Long double is 64-bits MDSRCS+=machdep_ldisd.c -SYM_MAPS+=${LIBC_SRCTOP}/powerpcspe/Symbol.map +SYM_MAPS+=${LIBC_SRCTOP}/powerpc/Symbol.map From owner-svn-src-head@freebsd.org Sun Oct 23 19:02:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4510C1E6E2; Sun, 23 Oct 2016 19:02:20 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94856B12; Sun, 23 Oct 2016 19:02:20 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9NJ2JSr019138; Sun, 23 Oct 2016 19:02:19 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9NJ2JpX019137; Sun, 23 Oct 2016 19:02:19 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201610231902.u9NJ2JpX019137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sun, 23 Oct 2016 19:02:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307828 - 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.23 Precedence: list List-Id: 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, 23 Oct 2016 19:02:20 -0000 Author: jmcneill Date: Sun Oct 23 19:02:19 2016 New Revision: 307828 URL: https://svnweb.freebsd.org/changeset/base/307828 Log: Add device cpufreq. Modified: head/sys/arm/conf/GENERIC Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Sun Oct 23 18:08:34 2016 (r307827) +++ head/sys/arm/conf/GENERIC Sun Oct 23 19:02:19 2016 (r307828) @@ -59,6 +59,9 @@ device phy device hwreset device regulator +# CPU frequency control +device cpufreq + # Interrupt controller options INTRNG device gic From owner-svn-src-head@freebsd.org Sun Oct 23 19:59:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE951C1B335; Sun, 23 Oct 2016 19:59:57 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C04EF751; Sun, 23 Oct 2016 19:59:57 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9NJxuDl038379; Sun, 23 Oct 2016 19:59:56 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9NJxuFo038378; Sun, 23 Oct 2016 19:59:56 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610231959.u9NJxuFo038378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 23 Oct 2016 19:59:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307830 - head/sys/dev/dpaa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 23 Oct 2016 19:59:58 -0000 Author: jhibbits Date: Sun Oct 23 19:59:56 2016 New Revision: 307830 URL: https://svnweb.freebsd.org/changeset/base/307830 Log: Use the correct name for the qm_portals class. This file was copy&pasted from bman_fdt, and it still shows. Modified: head/sys/dev/dpaa/qman_fdt.c Modified: head/sys/dev/dpaa/qman_fdt.c ============================================================================== --- head/sys/dev/dpaa/qman_fdt.c Sun Oct 23 19:57:26 2016 (r307829) +++ head/sys/dev/dpaa/qman_fdt.c Sun Oct 23 19:59:56 2016 (r307830) @@ -91,7 +91,7 @@ qman_fdt_probe(device_t dev) static device_probe_t qman_portals_fdt_probe; static device_attach_t qman_portals_fdt_attach; -static device_method_t bm_portals_methods[] = { +static device_method_t qm_portals_methods[] = { /* Device interface */ DEVMETHOD(device_probe, qman_portals_fdt_probe), DEVMETHOD(device_attach, qman_portals_fdt_attach), @@ -100,14 +100,14 @@ static device_method_t bm_portals_method { 0, 0 } }; -static driver_t bm_portals_driver = { +static driver_t qm_portals_driver = { "qman-portals", - bm_portals_methods, + qm_portals_methods, sizeof(struct dpaa_portals_softc), }; -static devclass_t bm_portals_devclass; -DRIVER_MODULE(qman_portals, ofwbus, bm_portals_driver, bm_portals_devclass, 0, 0); +static devclass_t qm_portals_devclass; +DRIVER_MODULE(qman_portals, ofwbus, qm_portals_driver, qm_portals_devclass, 0, 0); static void get_addr_props(phandle_t node, uint32_t *addrp, uint32_t *sizep) From owner-svn-src-head@freebsd.org Sun Oct 23 20:41:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BACAEC1BEB2; Sun, 23 Oct 2016 20:41:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 841ECA2E; Sun, 23 Oct 2016 20:41:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9NKfPFs056857; Sun, 23 Oct 2016 20:41:25 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9NKfPIO056856; Sun, 23 Oct 2016 20:41:25 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201610232041.u9NKfPIO056856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 23 Oct 2016 20:41:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307831 - head/lib/librss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 23 Oct 2016 20:41:26 -0000 Author: adrian Date: Sun Oct 23 20:41:25 2016 New Revision: 307831 URL: https://svnweb.freebsd.org/changeset/base/307831 Log: [rss] install the header file. Submitted by: gallatin Modified: head/lib/librss/Makefile Modified: head/lib/librss/Makefile ============================================================================== --- head/lib/librss/Makefile Sun Oct 23 19:59:56 2016 (r307830) +++ head/lib/librss/Makefile Sun Oct 23 20:41:25 2016 (r307831) @@ -5,6 +5,7 @@ SHLIBDIR?= /lib .include +INCS= librss.h LIB= rss SHLIB_MAJOR= 1 From owner-svn-src-head@freebsd.org Sun Oct 23 20:42:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D11D9C1BF18; Sun, 23 Oct 2016 20:42:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A161ED30; Sun, 23 Oct 2016 20:42:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9NKgWZQ056939; Sun, 23 Oct 2016 20:42:32 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9NKgWRr056938; Sun, 23 Oct 2016 20:42:32 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201610232042.u9NKgWRr056938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 23 Oct 2016 20:42:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307832 - head/lib/librss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 23 Oct 2016 20:42:33 -0000 Author: adrian Date: Sun Oct 23 20:42:32 2016 New Revision: 307832 URL: https://svnweb.freebsd.org/changeset/base/307832 Log: [rss] manpage improvements. Submitted by: gallatin Modified: head/lib/librss/librss.3 Modified: head/lib/librss/librss.3 ============================================================================== --- head/lib/librss/librss.3 Sun Oct 23 20:41:25 2016 (r307831) +++ head/lib/librss/librss.3 Sun Oct 23 20:42:32 2016 (r307832) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd September 29, 2016 +.Dd October 23, 2016 .Dt LIBRSS 3 .Os .Sh NAME @@ -9,6 +9,8 @@ .Sh LIBRARY .Lb librss .Sh SYNOPSIS +.In sys/param.h +.In sys/cpuset.h .In librss.h .Ft struct rss_config * .Fn rss_config_get "void" @@ -17,6 +19,8 @@ .Ft int .Fn rss_config_get_bucket_count "struct rss_config *cfg" .Ft int +.Fn rss_get_bucket_cpuset "struct rss_config *rc" "rss_bucket_type_t btype" "int bucket" "cpuset_t *cs" +.Ft int .Fn rss_set_bucket_rebalance_cb "rss_bucket_rebalance_cb_t *cb" "void *cbdata" .Ft int .Fn rss_sock_set_bindmulti "int fd" "int af" "int val" From owner-svn-src-head@freebsd.org Mon Oct 24 03:26:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65F26C1F38A; Mon, 24 Oct 2016 03:26:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 28E29ABC; Mon, 24 Oct 2016 03:26:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9O3QZXK007618; Mon, 24 Oct 2016 03:26:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9O3QYch007612; Mon, 24 Oct 2016 03:26:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610240326.u9O3QYch007612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Oct 2016 03:26:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307838 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 03:26:36 -0000 Author: sephe Date: Mon Oct 24 03:26:34 2016 New Revision: 307838 URL: https://svnweb.freebsd.org/changeset/base/307838 Log: hyperv/hn: Move chimney buffer index and size to txdesc. All RNDIS control messages have used SG list for a while. This makes the send context suitable for further refactoring. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8308 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 24 01:29:46 2016 (r307837) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 24 03:26:34 2016 (r307838) @@ -117,7 +117,7 @@ hn_nvs_xact_execute(struct hn_softc *sc, /* * Execute the xact setup by the caller. */ - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); + hn_send_ctx_init(&sndc, hn_nvs_sent_xact, xact); vmbus_xact_activate(xact); error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, @@ -669,34 +669,6 @@ hn_chim_free(struct hn_softc *sc, uint32 atomic_clear_long(&sc->hn_chim_bmap[idx], mask); } -/* - * Net VSC on send - * Sends a packet on the specified Hyper-V device. - * Returns 0 on success, non-zero on failure. - */ -int -hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, - struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) -{ - struct hn_nvs_rndis rndis; - int ret; - - rndis.nvs_type = HN_NVS_TYPE_RNDIS; - rndis.nvs_rndis_mtype = rndis_mtype; - rndis.nvs_chim_idx = sndc->hn_chim_idx; - rndis.nvs_chim_sz = sndc->hn_chim_sz; - - if (gpa_cnt) { - ret = hn_nvs_send_sglist(chan, gpa, gpa_cnt, - &rndis, sizeof(rndis), sndc); - } else { - ret = hn_nvs_send(chan, VMBUS_CHANPKT_FLAG_RC, - &rndis, sizeof(rndis), sndc); - } - - return (ret); -} - int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch0) { Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 24 01:29:46 2016 (r307837) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 24 03:26:34 2016 (r307838) @@ -104,8 +104,8 @@ struct vmbus_channel; #define HN_XACT_REQ_SIZE (HN_XACT_REQ_PGCNT * PAGE_SIZE) #define HN_XACT_RESP_SIZE (HN_XACT_RESP_PGCNT * PAGE_SIZE) -#ifndef HN_USE_TXDESC_BUFRING struct hn_txdesc; +#ifndef HN_USE_TXDESC_BUFRING SLIST_HEAD(hn_txdesc_list, hn_txdesc); #else struct buf_ring; @@ -179,6 +179,7 @@ struct hn_tx_ring { bus_dma_tag_t hn_tx_data_dtag; uint64_t hn_csum_assist; + int (*hn_sendpkt)(struct hn_tx_ring *, struct hn_txdesc *); int hn_suspended; int hn_gpa_cnt; struct vmbus_gpa hn_gpa[NETVSC_PACKET_MAXPAGE]; @@ -276,13 +277,5 @@ struct hn_softc { #define HN_LINK_FLAG_LINKUP 0x0001 #define HN_LINK_FLAG_NETCHG 0x0002 -/* - * Externs - */ -struct hn_send_ctx; - -int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, - struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); - #endif /* __HV_NET_VSC_H__ */ Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 24 01:29:46 2016 (r307837) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 24 03:26:34 2016 (r307838) @@ -169,6 +169,8 @@ struct hn_txdesc { int refs; uint32_t flags; /* HN_TXD_FLAG_ */ struct hn_send_ctx send_ctx; + uint32_t chim_index; + int chim_size; bus_dmamap_t data_dmap; @@ -363,6 +365,8 @@ static void hn_tx_resume(struct hn_softc static void hn_tx_ring_qflush(struct hn_tx_ring *); static int netvsc_detach(device_t dev); static void hn_link_status(struct hn_softc *); +static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *, struct hn_txdesc *); +static int hn_sendpkt_rndis_chim(struct hn_tx_ring *, struct hn_txdesc *); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -399,6 +403,57 @@ hn_set_lro_lenlim(struct hn_softc *sc, i } #endif +static __inline int +hn_nvs_send_rndis_sglist1(struct vmbus_channel *chan, uint32_t rndis_mtype, + struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + struct hn_nvs_rndis rndis; + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = rndis_mtype; + rndis.nvs_chim_idx = HN_NVS_CHIM_IDX_INVALID; + rndis.nvs_chim_sz = 0; + + return (hn_nvs_send_sglist(chan, gpa, gpa_cnt, + &rndis, sizeof(rndis), sndc)); +} + +int +hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + + return hn_nvs_send_rndis_sglist1(chan, HN_NVS_RNDIS_MTYPE_CTRL, + sndc, gpa, gpa_cnt); +} + +static int +hn_sendpkt_rndis_sglist(struct hn_tx_ring *txr, struct hn_txdesc *txd) +{ + + KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID && + txd->chim_size == 0, ("invalid rndis sglist txd")); + return (hn_nvs_send_rndis_sglist1(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, + &txd->send_ctx, txr->hn_gpa, txr->hn_gpa_cnt)); +} + +static int +hn_sendpkt_rndis_chim(struct hn_tx_ring *txr, struct hn_txdesc *txd) +{ + struct hn_nvs_rndis rndis; + + KASSERT(txd->chim_index != HN_NVS_CHIM_IDX_INVALID && + txd->chim_size > 0, ("invalid rndis chim txd")); + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = HN_NVS_RNDIS_MTYPE_DATA; + rndis.nvs_chim_idx = txd->chim_index; + rndis.nvs_chim_sz = txd->chim_size; + + return (hn_nvs_send(txr->hn_chan, VMBUS_CHANPKT_FLAG_RC, + &rndis, sizeof(rndis), &txd->send_ctx)); +} + static int hn_get_txswq_depth(const struct hn_tx_ring *txr) { @@ -1038,8 +1093,8 @@ hn_tx_done(struct hn_send_ctx *sndc, str struct hn_txdesc *txd = sndc->hn_cbarg; struct hn_tx_ring *txr; - if (sndc->hn_chim_idx != HN_NVS_CHIM_IDX_INVALID) - hn_chim_free(sc, sndc->hn_chim_idx); + if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) + hn_chim_free(sc, txd->chim_index); txr = txd->txr; KASSERT(txr->hn_chan == chan, @@ -1096,9 +1151,8 @@ hn_encap(struct hn_tx_ring *txr, struct int error, nsegs, i; struct mbuf *m_head = *m_head0; struct rndis_packet_msg *pkt; - uint32_t send_buf_section_idx; - int send_buf_section_size, pktlen; uint32_t *pi_data; + int pktlen; /* * extension points to the area reserved for the @@ -1211,18 +1265,19 @@ hn_encap(struct hn_tx_ring *txr, struct */ if (pkt->rm_len < txr->hn_chim_size) { txr->hn_tx_chimney_tried++; - send_buf_section_idx = hn_chim_alloc(txr->hn_sc); - if (send_buf_section_idx != HN_NVS_CHIM_IDX_INVALID) { + txd->chim_index = hn_chim_alloc(txr->hn_sc); + if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) { uint8_t *dest = txr->hn_sc->hn_chim + - (send_buf_section_idx * txr->hn_sc->hn_chim_szmax); + (txd->chim_index * txr->hn_sc->hn_chim_szmax); memcpy(dest, pkt, pktlen); dest += pktlen; m_copydata(m_head, 0, m_head->m_pkthdr.len, dest); - send_buf_section_size = pkt->rm_len; + txd->chim_size = pkt->rm_len; txr->hn_gpa_cnt = 0; txr->hn_tx_chimney++; + txr->hn_sendpkt = hn_sendpkt_rndis_chim; goto done; } } @@ -1267,14 +1322,14 @@ hn_encap(struct hn_tx_ring *txr, struct gpa->gpa_len = segs[i].ds_len; } - send_buf_section_idx = HN_NVS_CHIM_IDX_INVALID; - send_buf_section_size = 0; + txd->chim_index = HN_NVS_CHIM_IDX_INVALID; + txd->chim_size = 0; + txr->hn_sendpkt = hn_sendpkt_rndis_sglist; done: txd->m = m_head; /* Set the completion routine */ - hn_send_ctx_init(&txd->send_ctx, hn_tx_done, txd, - send_buf_section_idx, send_buf_section_size); + hn_send_ctx_init(&txd->send_ctx, hn_tx_done, txd); return 0; } @@ -1294,8 +1349,7 @@ again: * Make sure that txd is not freed before ETHER_BPF_MTAP. */ hn_txdesc_hold(txd); - error = hv_nv_on_send(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, - &txd->send_ctx, txr->hn_gpa, txr->hn_gpa_cnt); + error = txr->hn_sendpkt(txr, txd); if (!error) { ETHER_BPF_MTAP(ifp, txd->m); if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 24 01:29:46 2016 (r307837) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 24 03:26:34 2016 (r307838) @@ -585,8 +585,7 @@ hn_rndis_xact_exec1(struct hn_softc *sc, * message. */ vmbus_xact_activate(xact); - error = hv_nv_on_send(sc->hn_prichan, HN_NVS_RNDIS_MTYPE_CTRL, sndc, - gpa, gpa_cnt); + error = hn_nvs_send_rndis_ctrl(sc->hn_prichan, sndc, gpa, gpa_cnt); if (error) { vmbus_xact_deactivate(xact); if_printf(sc->hn_ifp, "RNDIS ctrl send failed: %d\n", error); @@ -1165,7 +1164,7 @@ hn_rndis_halt(struct hn_softc *sc) halt->rm_rid = hn_rndis_rid(sc); /* No RNDIS completion; rely on NVS message send completion */ - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); + hn_send_ctx_init(&sndc, hn_nvs_sent_xact, xact); hn_rndis_xact_exec1(sc, xact, sizeof(*halt), &sndc, &comp_len); vmbus_xact_put(xact); Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 24 01:29:46 2016 (r307837) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 24 03:26:34 2016 (r307838) @@ -46,8 +46,6 @@ typedef void (*hn_sent_callback_t) struct hn_send_ctx { hn_sent_callback_t hn_cb; void *hn_cbarg; - uint32_t hn_chim_idx; - int hn_chim_sz; }; struct rndis_hash_info; @@ -66,31 +64,18 @@ struct hn_recvinfo { uint32_t hash_value; }; -#define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ -{ \ - .hn_cb = cb, \ - .hn_cbarg = cbarg, \ - .hn_chim_idx = HN_NVS_CHIM_IDX_INVALID, \ - .hn_chim_sz = 0 \ +#define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ +{ \ + .hn_cb = cb, \ + .hn_cbarg = cbarg \ } static __inline void -hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, - void *cbarg, uint32_t chim_idx, int chim_sz) +hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, void *cbarg) { sndc->hn_cb = cb; sndc->hn_cbarg = cbarg; - sndc->hn_chim_idx = chim_idx; - sndc->hn_chim_sz = chim_sz; -} - -static __inline void -hn_send_ctx_init_simple(struct hn_send_ctx *sndc, hn_sent_callback_t cb, - void *cbarg) -{ - - hn_send_ctx_init(sndc, cb, cbarg, HN_NVS_CHIM_IDX_INVALID, 0); } static __inline int @@ -134,6 +119,9 @@ void hn_nvs_detach(struct hn_softc *sc) int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch); void hn_nvs_sent_xact(struct hn_send_ctx *sndc, struct hn_softc *sc, struct vmbus_channel *chan, const void *data, int dlen); +int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, + int gpa_cnt); int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_recvinfo *info); From owner-svn-src-head@freebsd.org Mon Oct 24 03:34:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A138DC1F536; Mon, 24 Oct 2016 03:34:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75DB8F9A; Mon, 24 Oct 2016 03:34:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9O3YJ81011371; Mon, 24 Oct 2016 03:34:19 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9O3YJk2011370; Mon, 24 Oct 2016 03:34:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610240334.u9O3YJk2011370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Oct 2016 03:34:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307839 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 03:34:20 -0000 Author: sephe Date: Mon Oct 24 03:34:19 2016 New Revision: 307839 URL: https://svnweb.freebsd.org/changeset/base/307839 Log: hyperv/hn: Fix chimney sending buffer leakage upon NVS sending failure. This will not happen in real world, since TX consumption of the vmbus TX bufring is limitted. Better safe than sorry. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8309 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 24 03:26:34 2016 (r307838) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 24 03:34:19 2016 (r307839) @@ -951,6 +951,8 @@ hn_txdesc_dmamap_load(struct hn_tx_ring struct mbuf *m = *m_head; int error; + KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID, ("txd uses chim")); + error = bus_dmamap_load_mbuf_sg(txr->hn_tx_data_dtag, txd->data_dmap, m, segs, nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { @@ -974,19 +976,6 @@ hn_txdesc_dmamap_load(struct hn_tx_ring return error; } -static __inline void -hn_txdesc_dmamap_unload(struct hn_tx_ring *txr, struct hn_txdesc *txd) -{ - - if (txd->flags & HN_TXD_FLAG_DMAMAP) { - bus_dmamap_sync(txr->hn_tx_data_dtag, - txd->data_dmap, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(txr->hn_tx_data_dtag, - txd->data_dmap); - txd->flags &= ~HN_TXD_FLAG_DMAMAP; - } -} - static __inline int hn_txdesc_put(struct hn_tx_ring *txr, struct hn_txdesc *txd) { @@ -998,14 +987,25 @@ hn_txdesc_put(struct hn_tx_ring *txr, st if (atomic_fetchadd_int(&txd->refs, -1) != 1) return 0; - hn_txdesc_dmamap_unload(txr, txd); + if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) { + KASSERT((txd->flags & HN_TXD_FLAG_DMAMAP) == 0, + ("chim txd uses dmamap")); + hn_chim_free(txr->hn_sc, txd->chim_index); + txd->chim_index = HN_NVS_CHIM_IDX_INVALID; + } else if (txd->flags & HN_TXD_FLAG_DMAMAP) { + bus_dmamap_sync(txr->hn_tx_data_dtag, + txd->data_dmap, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(txr->hn_tx_data_dtag, + txd->data_dmap); + txd->flags &= ~HN_TXD_FLAG_DMAMAP; + } + if (txd->m != NULL) { m_freem(txd->m); txd->m = NULL; } txd->flags |= HN_TXD_FLAG_ONLIST; - #ifndef HN_USE_TXDESC_BUFRING mtx_lock_spin(&txr->hn_txlist_spin); KASSERT(txr->hn_txdesc_avail >= 0 && @@ -1046,7 +1046,9 @@ hn_txdesc_get(struct hn_tx_ring *txr) atomic_subtract_int(&txr->hn_txdesc_avail, 1); #endif KASSERT(txd->m == NULL && txd->refs == 0 && - (txd->flags & HN_TXD_FLAG_ONLIST), ("invalid txd")); + txd->chim_index == HN_NVS_CHIM_IDX_INVALID && + (txd->flags & HN_TXD_FLAG_ONLIST) && + (txd->flags & HN_TXD_FLAG_DMAMAP) == 0, ("invalid txd")); txd->flags &= ~HN_TXD_FLAG_ONLIST; txd->refs = 1; } @@ -1093,9 +1095,6 @@ hn_tx_done(struct hn_send_ctx *sndc, str struct hn_txdesc *txd = sndc->hn_cbarg; struct hn_tx_ring *txr; - if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) - hn_chim_free(sc, txd->chim_index); - txr = txd->txr; KASSERT(txr->hn_chan == chan, ("channel mismatch, on chan%u, should be chan%u", @@ -2820,6 +2819,7 @@ hn_create_tx_ring(struct hn_softc *sc, i struct hn_txdesc *txd = &txr->hn_txdesc[i]; txd->txr = txr; + txd->chim_index = HN_NVS_CHIM_IDX_INVALID; /* * Allocate and load RNDIS packet message. From owner-svn-src-head@freebsd.org Mon Oct 24 03:42:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C16FCC1F73D; Mon, 24 Oct 2016 03:42:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E3196CC; Mon, 24 Oct 2016 03:42:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9O3gYWF015115; Mon, 24 Oct 2016 03:42:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9O3gYw3015114; Mon, 24 Oct 2016 03:42:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610240342.u9O3gYw3015114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Oct 2016 03:42:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307840 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 03:42:35 -0000 Author: sephe Date: Mon Oct 24 03:42:34 2016 New Revision: 307840 URL: https://svnweb.freebsd.org/changeset/base/307840 Log: hyperv/hn: Properly handle synthetic parts reattach failure. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8310 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 24 03:34:19 2016 (r307839) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 24 03:42:34 2016 (r307840) @@ -1783,19 +1783,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, break; } - /* Obtain and record requested MTU */ - ifp->if_mtu = ifr->ifr_mtu; - -#if __FreeBSD_version >= 1100099 - /* - * Make sure that LRO aggregation length limit is still - * valid, after the MTU change. - */ - if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < - HN_LRO_LENLIM_MIN(ifp)) - hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); -#endif - /* * Suspend this interface before the synthetic parts * are ripped. @@ -1810,13 +1797,31 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, /* * Reattach the synthetic parts, i.e. NVS and RNDIS, * with the new MTU setting. - * XXX check error. */ - hn_synth_attach(sc, ifr->ifr_mtu); + error = hn_synth_attach(sc, ifr->ifr_mtu); + if (error) { + HN_UNLOCK(sc); + break; + } + + /* + * Commit the requested MTU, after the synthetic parts + * have been successfully attached. + */ + ifp->if_mtu = ifr->ifr_mtu; + /* + * Make sure that various parameters based on MTU are + * still valid, after the MTU change. + */ if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) hn_set_chim_size(sc, sc->hn_chim_szmax); - hn_set_tso_maxsize(sc, hn_tso_maxlen, ifr->ifr_mtu); + hn_set_tso_maxsize(sc, hn_tso_maxlen, ifp->if_mtu); +#if __FreeBSD_version >= 1100099 + if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < + HN_LRO_LENLIM_MIN(ifp)) + hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); +#endif /* * All done! Resume the interface now. From owner-svn-src-head@freebsd.org Mon Oct 24 04:21:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AF73C1FC66; Mon, 24 Oct 2016 04:21:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0122D392; Mon, 24 Oct 2016 04:21:07 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9O4L7mX028601; Mon, 24 Oct 2016 04:21:07 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9O4L7WW028599; Mon, 24 Oct 2016 04:21:07 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610240421.u9O4L7WW028599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 24 Oct 2016 04:21:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307841 - 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.23 Precedence: list List-Id: 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, 24 Oct 2016 04:21:08 -0000 Author: jhibbits Date: Mon Oct 24 04:21:06 2016 New Revision: 307841 URL: https://svnweb.freebsd.org/changeset/base/307841 Log: Add a bunch of new default options to MPC85XX* configs These were tested at various points but never merged into the configs at the time. Modified: head/sys/powerpc/conf/MPC85XX head/sys/powerpc/conf/MPC85XXSPE Modified: head/sys/powerpc/conf/MPC85XX ============================================================================== --- head/sys/powerpc/conf/MPC85XX Mon Oct 24 03:42:34 2016 (r307840) +++ head/sys/powerpc/conf/MPC85XX Mon Oct 24 04:21:06 2016 (r307841) @@ -58,6 +58,10 @@ options SYSVSEM options SYSVSHM options WITNESS options WITNESS_SKIPSPIN +options COMPAT_FREEBSD10 +options HWPMC_HOOKS +options KDTRACE_HOOKS # Kernel DTrace hooks +options DDB_CTF # Kernel ELF linker loads CTF data device ata device bpf @@ -86,6 +90,7 @@ device scbus device scc device sec device tsec +device dpaa device tun device uart options USB_DEBUG # enable debug msgs @@ -98,3 +103,5 @@ device vlan # P1022 DIU device diu device videomode +device vt +device fbd Modified: head/sys/powerpc/conf/MPC85XXSPE ============================================================================== --- head/sys/powerpc/conf/MPC85XXSPE Mon Oct 24 03:42:34 2016 (r307840) +++ head/sys/powerpc/conf/MPC85XXSPE Mon Oct 24 04:21:06 2016 (r307841) @@ -58,6 +58,10 @@ options SYSVSEM options SYSVSHM options WITNESS options WITNESS_SKIPSPIN +options COMPAT_FREEBSD10 +options HWPMC_HOOKS +options KDTRACE_HOOKS # Kernel DTrace hooks +options DDB_CTF # Kernel ELF linker loads CTF data device ata device bpf @@ -86,6 +90,7 @@ device scbus device scc device sec device tsec +device dpaa device tun device uart options USB_DEBUG # enable debug msgs @@ -98,3 +103,5 @@ device vlan # P1022 DIU device diu device videomode +device vt +device fbd From owner-svn-src-head@freebsd.org Mon Oct 24 05:01:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ED06C1F1E1; Mon, 24 Oct 2016 05:01:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED78B358; Mon, 24 Oct 2016 05:01:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9O51ZIR043026; Mon, 24 Oct 2016 05:01:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9O51ZPn043025; Mon, 24 Oct 2016 05:01:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610240501.u9O51ZPn043025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Oct 2016 05:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307842 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 05:01:36 -0000 Author: sephe Date: Mon Oct 24 05:01:34 2016 New Revision: 307842 URL: https://svnweb.freebsd.org/changeset/base/307842 Log: hyperv/hn: Start link status check, if no network changes were pending. Link status check is much more lightweight than network change detection. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8311 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 24 04:21:06 2016 (r307841) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 24 05:01:34 2016 (r307842) @@ -3908,12 +3908,18 @@ static void hn_resume_mgmt(struct hn_softc *sc) { + sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; + /* - * Kick off network change detection, which will - * do link status check too. + * Kick off network change detection, if it was pending. + * If no network change was pending, start link status + * checks, which is more lightweight than network change + * detection. */ - sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; - hn_network_change(sc); + if (sc->hn_link_flags & HN_LINK_FLAG_NETCHG) + hn_network_change(sc); + else + hn_link_status_update(sc); } static void From owner-svn-src-head@freebsd.org Mon Oct 24 05:10:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEAD6C1F4DB; Mon, 24 Oct 2016 05:10:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FA889BB; Mon, 24 Oct 2016 05:10:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9O5AZZN045436; Mon, 24 Oct 2016 05:10:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9O5AZkX045433; Mon, 24 Oct 2016 05:10:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610240510.u9O5AZkX045433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Oct 2016 05:10:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307843 - in head/sys: dev/hyperv/netvsc 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.23 Precedence: list List-Id: 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, 24 Oct 2016 05:10:36 -0000 Author: sephe Date: Mon Oct 24 05:10:35 2016 New Revision: 307843 URL: https://svnweb.freebsd.org/changeset/base/307843 Log: hyperv/hn: Fix RX filter settings. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8313 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/net/rndis.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 24 05:01:34 2016 (r307842) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 24 05:10:35 2016 (r307843) @@ -232,6 +232,7 @@ struct hn_softc { struct sysctl_oid *hn_rx_sysctl_tree; struct vmbus_xact_ctx *hn_xact; uint32_t hn_nvs_ver; + uint32_t hn_rx_filter; struct taskqueue *hn_mgmt_taskq; struct taskqueue *hn_mgmt_taskq0; Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 24 05:01:34 2016 (r307842) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 24 05:10:35 2016 (r307843) @@ -326,6 +326,7 @@ static int hn_tx_conf_int_sysctl(SYSCTL_ static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS); static int hn_caps_sysctl(SYSCTL_HANDLER_ARGS); static int hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); static int hn_check_iplen(const struct mbuf *, int); @@ -367,6 +368,7 @@ static int netvsc_detach(device_t dev); static void hn_link_status(struct hn_softc *); static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *, struct hn_txdesc *); static int hn_sendpkt_rndis_chim(struct hn_tx_ring *, struct hn_txdesc *); +static int hn_set_rxfilter(struct hn_softc *); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -455,6 +457,43 @@ hn_sendpkt_rndis_chim(struct hn_tx_ring } static int +hn_set_rxfilter(struct hn_softc *sc) +{ + struct ifnet *ifp = sc->hn_ifp; + uint32_t filter; + int error = 0; + + HN_LOCK_ASSERT(sc); + + if (ifp->if_flags & IFF_PROMISC) { + filter = NDIS_PACKET_TYPE_PROMISCUOUS; + } else { + filter = NDIS_PACKET_TYPE_DIRECTED; + if (ifp->if_flags & IFF_BROADCAST) + filter |= NDIS_PACKET_TYPE_BROADCAST; +#ifdef notyet + /* + * See the comment in SIOCADDMULTI/SIOCDELMULTI. + */ + /* TODO: support multicast list */ + if ((ifp->if_flags & IFF_ALLMULTI) || + !TAILQ_EMPTY(&ifp->if_multiaddrs)) + filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; +#else + /* Always enable ALLMULTI */ + filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; +#endif + } + + if (sc->hn_rx_filter != filter) { + error = hn_rndis_set_rxfilter(sc, filter); + if (!error) + sc->hn_rx_filter = filter; + } + return (error); +} + +static int hn_get_txswq_depth(const struct hn_tx_ring *txr) { @@ -728,6 +767,9 @@ netvsc_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "hwassist", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_hwassist_sysctl, "A", "hwassist"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rxfilter_sysctl, "A", "rxfilter"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key", CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_rss_key_sysctl, "IU", "RSS key"); @@ -1840,31 +1882,13 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } if (ifp->if_flags & IFF_UP) { - /* - * If only the state of the PROMISC flag changed, - * then just use the 'set promisc mode' command - * instead of reinitializing the entire NIC. Doing - * a full re-init means reloading the firmware and - * waiting for it to start up, which may take a - * second or two. - */ -#ifdef notyet - /* Fixme: Promiscuous mode? */ - if (ifp->if_drv_flags & IFF_DRV_RUNNING && - ifp->if_flags & IFF_PROMISC && - !(sc->hn_if_flags & IFF_PROMISC)) { - /* do something here for Hyper-V */ - } else if (ifp->if_drv_flags & IFF_DRV_RUNNING && - !(ifp->if_flags & IFF_PROMISC) && - sc->hn_if_flags & IFF_PROMISC) { - /* do something here for Hyper-V */ - } else -#endif + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_set_rxfilter(sc); + else hn_init_locked(sc); } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) hn_stop(sc); - } } sc->hn_if_flags = ifp->if_flags; @@ -1922,12 +1946,27 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, case SIOCADDMULTI: case SIOCDELMULTI: - /* Always all-multi */ +#ifdef notyet /* - * TODO: - * Enable/disable all-multi according to the emptiness of - * the mcast address list. + * XXX + * Multicast uses mutex, while RNDIS RX filter setting + * sleeps. We workaround this by always enabling + * ALLMULTI. ALLMULTI would actually always be on, even + * if we supported the SIOCADDMULTI/SIOCDELMULTI, since + * we don't support multicast address list configuration + * for this driver. */ + HN_LOCK(sc); + + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) { + HN_UNLOCK(sc); + break; + } + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_set_rxfilter(sc); + + HN_UNLOCK(sc); +#endif break; case SIOCSIFMEDIA: @@ -2035,8 +2074,8 @@ hn_init_locked(struct hn_softc *sc) if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; - /* TODO: add hn_rx_filter */ - hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS); + /* Configure RX filter */ + hn_set_rxfilter(sc); /* Clear OACTIVE bit. */ atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); @@ -2363,6 +2402,21 @@ hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char filter_str[128]; + uint32_t filter; + + HN_LOCK(sc); + filter = sc->hn_rx_filter; + HN_UNLOCK(sc); + snprintf(filter_str, sizeof(filter_str), "%b", filter, + NDIS_PACKET_TYPES); + return sysctl_handle_string(oidp, filter_str, sizeof(filter_str), req); +} + +static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; @@ -3783,6 +3837,7 @@ hn_suspend_data(struct hn_softc *sc) * Disable RX by clearing RX filter. */ hn_rndis_set_rxfilter(sc, 0); + sc->hn_rx_filter = 0; /* * Give RNDIS enough time to flush all pending data packets. @@ -3870,9 +3925,8 @@ hn_resume_data(struct hn_softc *sc) /* * Re-enable RX. - * TODO: add hn_rx_filter. */ - hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS); + hn_set_rxfilter(sc); /* * Make sure to clear suspend status on "all" TX rings, Modified: head/sys/net/rndis.h ============================================================================== --- head/sys/net/rndis.h Mon Oct 24 05:01:34 2016 (r307842) +++ head/sys/net/rndis.h Mon Oct 24 05:10:35 2016 (r307843) @@ -351,7 +351,7 @@ struct rndis_keepalive_comp { uint32_t rm_status; }; -/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ +/* Packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ #define NDIS_PACKET_TYPE_DIRECTED 0x00000001 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 @@ -365,6 +365,14 @@ struct rndis_keepalive_comp { #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000 #define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000 +/* + * Packet filter description for use with printf(9) %b identifier. + */ +#define NDIS_PACKET_TYPES \ + "\20\1DIRECT\2MULTICAST\3ALLMULTI\4BROADCAST" \ + "\5SRCROUTE\6PROMISC\7SMT\10ALLLOCAL" \ + "\11GROUP\12ALLFUNC\13FUNC\14MACFRAME" + /* RNDIS offsets */ #define RNDIS_HEADER_OFFSET ((uint32_t)sizeof(struct rndis_msghdr)) #define RNDIS_DATA_OFFSET \ From owner-svn-src-head@freebsd.org Mon Oct 24 05:20:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C83AC1F784; Mon, 24 Oct 2016 05:20:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0E13F6C; Mon, 24 Oct 2016 05:20:03 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9O5K264049309; Mon, 24 Oct 2016 05:20:02 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9O5K23i049308; Mon, 24 Oct 2016 05:20:02 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610240520.u9O5K23i049308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Oct 2016 05:20:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307844 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 05:20:04 -0000 Author: sephe Date: Mon Oct 24 05:20:02 2016 New Revision: 307844 URL: https://svnweb.freebsd.org/changeset/base/307844 Log: hyperv/hn: Nuke unused forward declaration. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8314 Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 24 05:10:35 2016 (r307843) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 24 05:20:02 2016 (r307844) @@ -48,11 +48,6 @@ struct hn_send_ctx { void *hn_cbarg; }; -struct rndis_hash_info; -struct rndix_hash_value; -struct ndis_8021q_info_; -struct rndis_tcp_ip_csum_info_; - #define HN_NDIS_VLAN_INFO_INVALID 0xffffffff #define HN_NDIS_RXCSUM_INFO_INVALID 0 #define HN_NDIS_HASH_INFO_INVALID 0 From owner-svn-src-head@freebsd.org Mon Oct 24 05:36:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 257ABC1FBE9; Mon, 24 Oct 2016 05:36:22 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E52C5BBF; Mon, 24 Oct 2016 05:36:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9O5aLiD056481; Mon, 24 Oct 2016 05:36:21 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9O5aKQS056472; Mon, 24 Oct 2016 05:36:20 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610240536.u9O5aKQS056472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Oct 2016 05:36:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307845 - head/sys/dev/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 05:36:22 -0000 Author: sephe Date: Mon Oct 24 05:36:19 2016 New Revision: 307845 URL: https://svnweb.freebsd.org/changeset/base/307845 Log: hyperv/ic: Rework framework/message version negotiation. Submitted by: Hongjiang Zhang Modified by: sephe MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8280 Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_kvp.h head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/utilities/hv_util.c head/sys/dev/hyperv/utilities/hv_util.h head/sys/dev/hyperv/utilities/hv_utilreg.h head/sys/dev/hyperv/utilities/vmbus_icreg.h Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 24 05:20:02 2016 (r307844) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 24 05:36:19 2016 (r307845) @@ -40,6 +40,14 @@ __FBSDID("$FreeBSD$"); #include "vmbus_if.h" +#define VMBUS_HEARTBEAT_FWVER_MAJOR 3 +#define VMBUS_HEARTBEAT_FWVER \ + VMBUS_IC_VERSION(VMBUS_HEARTBEAT_FWVER_MAJOR, 0) + +#define VMBUS_HEARTBEAT_MSGVER_MAJOR 3 +#define VMBUS_HEARTBEAT_MSGVER \ + VMBUS_IC_VERSION(VMBUS_HEARTBEAT_MSGVER_MAJOR, 0) + static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = { { .ic_guid = { .hv_guid = { @@ -80,7 +88,8 @@ vmbus_heartbeat_cb(struct vmbus_channel */ switch (hdr->ic_type) { case VMBUS_ICMSG_TYPE_NEGOTIATE: - error = vmbus_ic_negomsg(sc, data, &dlen); + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_HEARTBEAT_FWVER, VMBUS_HEARTBEAT_MSGVER); if (error) return; break; Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 24 05:20:02 2016 (r307844) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 24 05:36:19 2016 (r307845) @@ -61,7 +61,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include "hv_util.h" #include "unicode.h" @@ -74,6 +76,12 @@ __FBSDID("$FreeBSD$"); #define KVP_ERROR 1 #define kvp_hdr hdr.kvp_hdr +#define KVP_FWVER_MAJOR 3 +#define KVP_FWVER VMBUS_IC_VERSION(KVP_FWVER_MAJOR, 0) + +#define KVP_MSGVER_MAJOR 4 +#define KVP_MSGVER VMBUS_IC_VERSION(KVP_MSGVER_MAJOR, 0) + /* hv_kvp debug control */ static int hv_kvp_log = 0; @@ -208,52 +216,10 @@ hv_kvp_transaction_init(hv_kvp_sc *sc, u sc->host_msg_id = request_id; sc->rcv_buf = rcv_buf; sc->host_kvp_msg = (struct hv_kvp_msg *)&rcv_buf[ - sizeof(struct hv_vmbus_pipe_hdr) + - sizeof(struct hv_vmbus_icmsg_hdr)]; + sizeof(struct hv_vmbus_pipe_hdr) + + sizeof(struct hv_vmbus_icmsg_hdr)]; } - -/* - * hv_kvp - version neogtiation function - */ -static void -hv_kvp_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf) -{ - struct hv_vmbus_icmsg_negotiate *negop; - int icframe_vercnt; - int icmsg_vercnt; - - icmsghdrp->icmsgsize = 0x10; - - negop = (struct hv_vmbus_icmsg_negotiate *)&buf[ - sizeof(struct hv_vmbus_pipe_hdr) + - sizeof(struct hv_vmbus_icmsg_hdr)]; - icframe_vercnt = negop->icframe_vercnt; - icmsg_vercnt = negop->icmsg_vercnt; - - /* - * Select the framework version number we will support - */ - if ((icframe_vercnt >= 2) && (negop->icversion_data[1].major == 3)) { - icframe_vercnt = 3; - if (icmsg_vercnt > 2) - icmsg_vercnt = 4; - else - icmsg_vercnt = 3; - } else { - icframe_vercnt = 1; - icmsg_vercnt = 1; - } - - negop->icframe_vercnt = 1; - negop->icmsg_vercnt = 1; - negop->icversion_data[0].major = icframe_vercnt; - negop->icversion_data[0].minor = 0; - negop->icversion_data[1].major = icmsg_vercnt; - negop->icversion_data[1].minor = 0; -} - - /* * Convert ip related info in umsg from utf8 to utf16 and store in hmsg */ @@ -578,7 +544,8 @@ hv_kvp_respond_host(hv_kvp_sc *sc, int e error = HV_KVP_E_FAIL; hv_icmsg_hdrp->status = error; - hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; + hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | + HV_ICMSGHDRFLAG_RESPONSE; error = vmbus_chan_send(vmbus_get_channel(sc->dev), VMBUS_CHANPKT_TYPE_INBAND, 0, sc->rcv_buf, sc->host_msg_len, @@ -622,8 +589,8 @@ hv_kvp_process_request(void *context, in uint32_t recvlen = 0; uint64_t requestid; struct hv_vmbus_icmsg_hdr *icmsghdrp; - int ret = 0; - hv_kvp_sc *sc; + int ret = 0, error; + hv_kvp_sc *sc; hv_kvp_log_info("%s: entering hv_kvp_process_request\n", __func__); @@ -637,14 +604,15 @@ hv_kvp_process_request(void *context, in /* XXX check recvlen to make sure that it contains enough data */ while ((ret == 0) && (recvlen > 0)) { - icmsghdrp = (struct hv_vmbus_icmsg_hdr *) - &kvp_buf[sizeof(struct hv_vmbus_pipe_hdr)]; + &kvp_buf[sizeof(struct hv_vmbus_pipe_hdr)]; hv_kvp_transaction_init(sc, recvlen, requestid, kvp_buf); if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - hv_kvp_negotiate_version(icmsghdrp, kvp_buf); - hv_kvp_respond_host(sc, ret); + error = vmbus_ic_negomsg(&sc->util_sc, + kvp_buf, &recvlen, KVP_FWVER, KVP_MSGVER); + /* XXX handle vmbus_ic_negomsg failure. */ + hv_kvp_respond_host(sc, error); /* * It is ok to not acquire the mutex before setting Modified: head/sys/dev/hyperv/utilities/hv_kvp.h ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.h Mon Oct 24 05:20:02 2016 (r307844) +++ head/sys/dev/hyperv/utilities/hv_kvp.h Mon Oct 24 05:36:19 2016 (r307845) @@ -28,7 +28,6 @@ #ifndef _KVP_H #define _KVP_H - /* * An implementation of HyperV key value pair (KVP) functionality for FreeBSD * @@ -178,9 +177,9 @@ struct hv_kvp_ipaddr_value { }__attribute__((packed)); struct hv_kvp_hdr { - uint8_t operation; - uint8_t pool; - uint16_t pad; + uint8_t operation; + uint8_t pool; + uint16_t pad; } __attribute__((packed)); struct hv_kvp_exchg_msg_value { Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 24 05:20:02 2016 (r307844) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 24 05:36:19 2016 (r307845) @@ -41,6 +41,14 @@ __FBSDID("$FreeBSD$"); #include "vmbus_if.h" +#define VMBUS_SHUTDOWN_FWVER_MAJOR 3 +#define VMBUS_SHUTDOWN_FWVER \ + VMBUS_IC_VERSION(VMBUS_SHUTDOWN_FWVER_MAJOR, 0) + +#define VMBUS_SHUTDOWN_MSGVER_MAJOR 3 +#define VMBUS_SHUTDOWN_MSGVER \ + VMBUS_IC_VERSION(VMBUS_SHUTDOWN_MSGVER_MAJOR, 0) + static const struct vmbus_ic_desc vmbus_shutdown_descs[] = { { .ic_guid = { .hv_guid = { @@ -82,7 +90,8 @@ vmbus_shutdown_cb(struct vmbus_channel * */ switch (hdr->ic_type) { case VMBUS_ICMSG_TYPE_NEGOTIATE: - error = vmbus_ic_negomsg(sc, data, &dlen); + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_SHUTDOWN_FWVER, VMBUS_SHUTDOWN_MSGVER); if (error) return; break; Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 24 05:20:02 2016 (r307844) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 24 05:36:19 2016 (r307845) @@ -42,6 +42,14 @@ __FBSDID("$FreeBSD$"); #include "vmbus_if.h" +#define VMBUS_TIMESYNC_FWVER_MAJOR 3 +#define VMBUS_TIMESYNC_FWVER \ + VMBUS_IC_VERSION(VMBUS_TIMESYNC_FWVER_MAJOR, 0) + +#define VMBUS_TIMESYNC_MSGVER_MAJOR 3 +#define VMBUS_TIMESYNC_MSGVER \ + VMBUS_IC_VERSION(VMBUS_TIMESYNC_MSGVER_MAJOR, 0) + static const struct vmbus_ic_desc vmbus_timesync_descs[] = { { .ic_guid = { .hv_guid = { @@ -162,7 +170,8 @@ vmbus_timesync_cb(struct vmbus_channel * */ switch (hdr->ic_type) { case VMBUS_ICMSG_TYPE_NEGOTIATE: - error = vmbus_ic_negomsg(sc, data, &dlen); + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_TIMESYNC_FWVER, VMBUS_TIMESYNC_MSGVER); if (error) return; break; Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Mon Oct 24 05:20:02 2016 (r307844) +++ head/sys/dev/hyperv/utilities/hv_util.c Mon Oct 24 05:36:19 2016 (r307845) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -53,52 +54,145 @@ __offsetof(struct vmbus_icmsg_negotiate, ic_ver[VMBUS_IC_VERCNT]) CTASSERT(VMBUS_IC_NEGOSZ < VMBUS_IC_BRSIZE); +static int vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS); +static int vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS); + int -vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen0) +vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen0, + uint32_t fw_ver, uint32_t msg_ver) { struct vmbus_icmsg_negotiate *nego; - int cnt, major, dlen = *dlen0; + int i, cnt, dlen = *dlen0, error; + uint32_t sel_fw_ver, sel_msg_ver; + bool has_fw_ver, has_msg_ver; /* - * Preliminary message size verification + * Preliminary message verification. */ if (dlen < sizeof(*nego)) { device_printf(sc->ic_dev, "truncated ic negotiate, len %d\n", dlen); - return EINVAL; + return (EINVAL); } nego = data; + if (nego->ic_fwver_cnt == 0) { + device_printf(sc->ic_dev, "ic negotiate does not contain " + "framework version %u\n", nego->ic_fwver_cnt); + return (EINVAL); + } + if (nego->ic_msgver_cnt == 0) { + device_printf(sc->ic_dev, "ic negotiate does not contain " + "message version %u\n", nego->ic_msgver_cnt); + return (EINVAL); + } + cnt = nego->ic_fwver_cnt + nego->ic_msgver_cnt; if (dlen < __offsetof(struct vmbus_icmsg_negotiate, ic_ver[cnt])) { device_printf(sc->ic_dev, "ic negotiate does not contain " "versions %d\n", dlen); - return EINVAL; + return (EINVAL); + } + + error = EOPNOTSUPP; + + /* + * Find the best match framework version. + */ + has_fw_ver = false; + for (i = 0; i < nego->ic_fwver_cnt; ++i) { + if (VMBUS_ICVER_LE(nego->ic_ver[i], fw_ver)) { + if (!has_fw_ver) { + sel_fw_ver = nego->ic_ver[i]; + has_fw_ver = true; + } else if (VMBUS_ICVER_GT(nego->ic_ver[i], + sel_fw_ver)) { + sel_fw_ver = nego->ic_ver[i]; + } + } + } + if (!has_fw_ver) { + device_printf(sc->ic_dev, "failed to select framework " + "version\n"); + goto done; + } + + /* + * Fine the best match message version. + */ + has_msg_ver = false; + for (i = nego->ic_fwver_cnt; + i < nego->ic_fwver_cnt + nego->ic_msgver_cnt; ++i) { + if (VMBUS_ICVER_LE(nego->ic_ver[i], msg_ver)) { + if (!has_msg_ver) { + sel_msg_ver = nego->ic_ver[i]; + has_msg_ver = true; + } else if (VMBUS_ICVER_GT(nego->ic_ver[i], + sel_msg_ver)) { + sel_msg_ver = nego->ic_ver[i]; + } + } + } + if (!has_msg_ver) { + device_printf(sc->ic_dev, "failed to select message " + "version\n"); + goto done; } - /* Select major version; XXX looks wrong. */ - if (nego->ic_fwver_cnt >= 2 && VMBUS_ICVER_MAJOR(nego->ic_ver[1]) == 3) - major = 3; - else - major = 1; + error = 0; +done: + if (bootverbose || !has_fw_ver || !has_msg_ver) { + if (has_fw_ver) { + device_printf(sc->ic_dev, "sel framework version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(sel_fw_ver), + VMBUS_ICVER_MINOR(sel_fw_ver)); + } + for (i = 0; i < nego->ic_fwver_cnt; i++) { + device_printf(sc->ic_dev, "supp framework version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(nego->ic_ver[i]), + VMBUS_ICVER_MINOR(nego->ic_ver[i])); + } + + if (has_msg_ver) { + device_printf(sc->ic_dev, "sel message version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(sel_msg_ver), + VMBUS_ICVER_MINOR(sel_msg_ver)); + } + for (i = nego->ic_fwver_cnt; + i < nego->ic_fwver_cnt + nego->ic_msgver_cnt; i++) { + device_printf(sc->ic_dev, "supp message version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(nego->ic_ver[i]), + VMBUS_ICVER_MINOR(nego->ic_ver[i])); + } + } + if (error) + return (error); + + /* Record the selected versions. */ + sc->ic_fwver = sel_fw_ver; + sc->ic_msgver = sel_msg_ver; - /* One framework version */ + /* One framework version. */ nego->ic_fwver_cnt = 1; - nego->ic_ver[0] = VMBUS_IC_VERSION(major, 0); + nego->ic_ver[0] = sel_fw_ver; - /* One message version */ + /* One message version. */ nego->ic_msgver_cnt = 1; - nego->ic_ver[1] = VMBUS_IC_VERSION(major, 0); + nego->ic_ver[1] = sel_msg_ver; - /* Update data size */ + /* Update data size. */ nego->ic_hdr.ic_dsize = VMBUS_IC_NEGOSZ - sizeof(struct vmbus_icmsg_hdr); - /* Update total size, if necessary */ + /* Update total size, if necessary. */ if (dlen < VMBUS_IC_NEGOSZ) *dlen0 = VMBUS_IC_NEGOSZ; - return 0; + return (0); } int @@ -124,6 +218,8 @@ hv_util_attach(device_t dev, vmbus_chan_ { struct hv_util_sc *sc = device_get_softc(dev); struct vmbus_channel *chan = vmbus_get_channel(dev); + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; int error; sc->ic_dev = dev; @@ -146,9 +242,41 @@ hv_util_attach(device_t dev, vmbus_chan_ free(sc->receive_buffer, M_DEVBUF); return (error); } + + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "fw_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + vmbus_ic_fwver_sysctl, "A", "framework version"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "msg_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + vmbus_ic_msgver_sysctl, "A", "message version"); + return (0); } +static int +vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hv_util_sc *sc = arg1; + char verstr[16]; + + snprintf(verstr, sizeof(verstr), "%u.%u", + VMBUS_ICVER_MAJOR(sc->ic_fwver), VMBUS_ICVER_MINOR(sc->ic_fwver)); + return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); +} + +static int +vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hv_util_sc *sc = arg1; + char verstr[16]; + + snprintf(verstr, sizeof(verstr), "%u.%u", + VMBUS_ICVER_MAJOR(sc->ic_msgver), VMBUS_ICVER_MINOR(sc->ic_msgver)); + return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); +} + int hv_util_detach(device_t dev) { Modified: head/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.h Mon Oct 24 05:20:02 2016 (r307844) +++ head/sys/dev/hyperv/utilities/hv_util.h Mon Oct 24 05:36:19 2016 (r307845) @@ -42,6 +42,8 @@ typedef struct hv_util_sc { device_t ic_dev; uint8_t *receive_buffer; int ic_buflen; + uint32_t ic_fwver; /* framework version */ + uint32_t ic_msgver; /* message version */ } hv_util_sc; struct vmbus_ic_desc { @@ -54,6 +56,7 @@ struct vmbus_ic_desc { int hv_util_attach(device_t dev, vmbus_chan_callback_t cb); int hv_util_detach(device_t dev); int vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]); -int vmbus_ic_negomsg(struct hv_util_sc *, void *data, int *dlen); +int vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen, + uint32_t fw_ver, uint32_t msg_ver); #endif Modified: head/sys/dev/hyperv/utilities/hv_utilreg.h ============================================================================== --- head/sys/dev/hyperv/utilities/hv_utilreg.h Mon Oct 24 05:20:02 2016 (r307844) +++ head/sys/dev/hyperv/utilities/hv_utilreg.h Mon Oct 24 05:36:19 2016 (r307845) @@ -76,16 +76,4 @@ typedef struct hv_vmbus_icmsg_negotiate hv_vmbus_ic_version icversion_data[1]; /* any size array */ } __packed hv_vmbus_icmsg_negotiate; -typedef struct hv_vmbus_shutdown_msg_data { - uint32_t reason_code; - uint32_t timeout_seconds; - uint32_t flags; - uint8_t display_message[2048]; -} __packed hv_vmbus_shutdown_msg_data; - -typedef struct hv_vmbus_heartbeat_msg_data { - uint64_t seq_num; - uint32_t reserved[8]; -} __packed hv_vmbus_heartbeat_msg_data; - #endif /* !_HV_UTILREG_H_ */ Modified: head/sys/dev/hyperv/utilities/vmbus_icreg.h ============================================================================== --- head/sys/dev/hyperv/utilities/vmbus_icreg.h Mon Oct 24 05:20:02 2016 (r307844) +++ head/sys/dev/hyperv/utilities/vmbus_icreg.h Mon Oct 24 05:36:19 2016 (r307845) @@ -42,6 +42,12 @@ #define VMBUS_IC_VERSION(major, minor) ((major) | (((uint32_t)(minor)) << 16)) #define VMBUS_ICVER_MAJOR(ver) ((ver) & 0xffff) #define VMBUS_ICVER_MINOR(ver) (((ver) & 0xffff0000) >> 16) +#define VMBUS_ICVER_SWAP(ver) \ + ((VMBUS_ICVER_MAJOR((ver)) << 16) | VMBUS_ICVER_MINOR((ver))) +#define VMBUS_ICVER_LE(v1, v2) \ + (VMBUS_ICVER_SWAP((v1)) <= VMBUS_ICVER_SWAP((v2))) +#define VMBUS_ICVER_GT(v1, v2) \ + (VMBUS_ICVER_SWAP((v1)) > VMBUS_ICVER_SWAP((v2))) struct vmbus_pipe_hdr { uint32_t ph_flags; From owner-svn-src-head@freebsd.org Mon Oct 24 12:24:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53220C1E298; Mon, 24 Oct 2016 12:24:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2202A2E5; Mon, 24 Oct 2016 12:24:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OCOOPn012189; Mon, 24 Oct 2016 12:24:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OCOO3Q012188; Mon, 24 Oct 2016 12:24:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610241224.u9OCOO3Q012188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Oct 2016 12:24:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307857 - 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.23 Precedence: list List-Id: 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, 24 Oct 2016 12:24:25 -0000 Author: mav Date: Mon Oct 24 12:24:24 2016 New Revision: 307857 URL: https://svnweb.freebsd.org/changeset/base/307857 Log: Fix panic after ZVOL renamed to name invalid for DEVFS. MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Oct 24 11:47:27 2016 (r307856) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Oct 24 12:24:24 2016 (r307857) @@ -782,8 +782,10 @@ zvol_remove_zv(zvol_state_t *zv) g_topology_lock(); zvol_geom_destroy(zv); g_topology_unlock(); - } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) - destroy_dev(zv->zv_dev); + } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) { + if (zv->zv_dev != NULL) + destroy_dev(zv->zv_dev); + } #endif avl_destroy(&zv->zv_znode.z_range_avl); @@ -2973,14 +2975,14 @@ zvol_rename_minor(zvol_state_t *zv, cons } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) { struct make_dev_args args; - dev = zv->zv_dev; - ASSERT(dev != NULL); - zv->zv_dev = NULL; - destroy_dev(dev); - if (zv->zv_total_opens > 0) { - zv->zv_flags &= ~ZVOL_EXCL; - zv->zv_total_opens = 0; - zvol_last_close(zv); + if ((dev = zv->zv_dev) != NULL) { + zv->zv_dev = NULL; + destroy_dev(dev); + if (zv->zv_total_opens > 0) { + zv->zv_flags &= ~ZVOL_EXCL; + zv->zv_total_opens = 0; + zvol_last_close(zv); + } } make_dev_args_init(&args); From owner-svn-src-head@freebsd.org Mon Oct 24 13:44:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC26BC1F707; Mon, 24 Oct 2016 13:44:25 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B54DEFB; Mon, 24 Oct 2016 13:44:25 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ODiOL8042875; Mon, 24 Oct 2016 13:44:24 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ODiOSW042874; Mon, 24 Oct 2016 13:44:24 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610241344.u9ODiOSW042874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 24 Oct 2016 13:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307858 - head/sys/arm64/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.23 Precedence: list List-Id: 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, 24 Oct 2016 13:44:25 -0000 Author: andrew Date: Mon Oct 24 13:44:24 2016 New Revision: 307858 URL: https://svnweb.freebsd.org/changeset/base/307858 Log: Increase CACHE_LINE_SHIFT to 7 as cache lines are 128 bytes on ThunderX. MFC after: 1 week Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/include/param.h Modified: head/sys/arm64/include/param.h ============================================================================== --- head/sys/arm64/include/param.h Mon Oct 24 12:24:24 2016 (r307857) +++ head/sys/arm64/include/param.h Mon Oct 24 13:44:24 2016 (r307858) @@ -77,7 +77,7 @@ * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ -#define CACHE_LINE_SHIFT 6 +#define CACHE_LINE_SHIFT 7 #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #define PAGE_SHIFT 12 From owner-svn-src-head@freebsd.org Mon Oct 24 14:08:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42CD0C1FBC0; Mon, 24 Oct 2016 14:08:09 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D34C7E2B; Mon, 24 Oct 2016 14:08:08 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OE88cx050979; Mon, 24 Oct 2016 14:08:08 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OE86Rn050959; Mon, 24 Oct 2016 14:08:06 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201610241408.u9OE86Rn050959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Mon, 24 Oct 2016 14:08:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307861 - in head: contrib/libarchive contrib/libarchive/cat/test contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/te... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 14:08:09 -0000 Author: mm Date: Mon Oct 24 14:08:05 2016 New Revision: 307861 URL: https://svnweb.freebsd.org/changeset/base/307861 Log: MFV r307859: Update libarchive to 3.2.2 Modified: head/contrib/libarchive/NEWS head/contrib/libarchive/cat/test/main.c head/contrib/libarchive/cat/test/test.h head/contrib/libarchive/cpio/test/main.c head/contrib/libarchive/cpio/test/test.h head/contrib/libarchive/libarchive/archive.h head/contrib/libarchive/libarchive/archive_entry.h head/contrib/libarchive/libarchive/test/main.c head/contrib/libarchive/libarchive/test/test.h head/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c head/contrib/libarchive/libarchive/test/test_read_format_zip_high_compression.c head/contrib/libarchive/libarchive/test/test_read_set_format.c head/contrib/libarchive/libarchive/test/test_write_format_iso9660.c head/contrib/libarchive/tar/test/main.c head/contrib/libarchive/tar/test/test.h head/contrib/libarchive/tar/test/test_option_b.c head/contrib/libarchive/tar/test/test_symlink_dir.c head/usr.bin/bsdcat/Makefile head/usr.bin/cpio/Makefile head/usr.bin/tar/Makefile Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/NEWS ============================================================================== --- head/contrib/libarchive/NEWS Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/NEWS Mon Oct 24 14:08:05 2016 (r307861) @@ -1,3 +1,6 @@ +Oct 23, 2016: libarchive 3.2.2 released + Security release + Jun 20, 2016: libarchive 3.2.1 released This fixes a handful of security and other critical issues with 3.2.0 Modified: head/contrib/libarchive/cat/test/main.c ============================================================================== --- head/contrib/libarchive/cat/test/main.c Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/cat/test/main.c Mon Oct 24 14:08:05 2016 (r307861) @@ -129,6 +129,13 @@ # include #endif +mode_t umasked(mode_t expected_mode) +{ + mode_t mode = umask(0); + umask(mode); + return expected_mode & ~mode; +} + /* Path to working directory for current test */ const char *testworkdir; #ifdef PROGRAM @@ -1156,6 +1163,35 @@ assertion_file_contains_lines_any_order( return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1293,6 +1329,11 @@ assertion_file_time(const char *file, in switch (type) { case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; case 'b': filet = st.st_birthtime; + /* FreeBSD filesystems that don't support birthtime + * (e.g., UFS1) always return -1 here. */ + if (filet == -1) { + return (1); + } filet_nsec = st.st_birthtimespec.tv_nsec; break; case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); @@ -1370,6 +1411,8 @@ assertion_file_mode(const char *file, in assertion_count(file, line); #if defined(_WIN32) && !defined(__CYGWIN__) failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ #else { struct stat st; @@ -1424,7 +1467,7 @@ assertion_file_nlinks(const char *file, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1660,6 +1703,7 @@ assertion_make_file(const char *file, in if (0 != chmod(path, mode)) { failure_start(file, line, "Could not chmod %s", path); failure_finish(NULL); + close(fd); return (0); } if (contents != NULL) { @@ -1674,6 +1718,7 @@ assertion_make_file(const char *file, in failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } Modified: head/contrib/libarchive/cat/test/test.h ============================================================================== --- head/contrib/libarchive/cat/test/test.h Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/cat/test/test.h Mon Oct 24 14:08:05 2016 (r307861) @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -182,6 +185,8 @@ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) #define assertFileSize(pathname, size) \ assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertFileMode(pathname, mode) \ + assertion_file_mode(__FILE__, __LINE__, pathname, mode) #define assertTextFileContents(text, pathname) \ assertion_text_file_contents(__FILE__, __LINE__, text, pathname) #define assertFileContainsLinesAnyOrder(pathname, lines) \ @@ -239,6 +244,7 @@ int assertion_file_atime_recent(const ch int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); int assertion_file_mode(const char *, int, const char *, int); @@ -327,6 +333,9 @@ void copy_reference_file(const char *); */ void extract_reference_files(const char **); +/* Subtract umask from mode */ +mode_t umasked(mode_t expected_mode); + /* Path to working directory for current test */ extern const char *testworkdir; Modified: head/contrib/libarchive/cpio/test/main.c ============================================================================== --- head/contrib/libarchive/cpio/test/main.c Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/cpio/test/main.c Mon Oct 24 14:08:05 2016 (r307861) @@ -1164,6 +1164,35 @@ assertion_file_contains_lines_any_order( return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1383,6 +1412,8 @@ assertion_file_mode(const char *file, in assertion_count(file, line); #if defined(_WIN32) && !defined(__CYGWIN__) failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ #else { struct stat st; Modified: head/contrib/libarchive/cpio/test/test.h ============================================================================== --- head/contrib/libarchive/cpio/test/test.h Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/cpio/test/test.h Mon Oct 24 14:08:05 2016 (r307861) @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -241,6 +244,7 @@ int assertion_file_atime_recent(const ch int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); int assertion_file_mode(const char *, int, const char *, int); Modified: head/contrib/libarchive/libarchive/archive.h ============================================================================== --- head/contrib/libarchive/libarchive/archive.h Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/libarchive/archive.h Mon Oct 24 14:08:05 2016 (r307861) @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3002001 +#define ARCHIVE_VERSION_NUMBER 3002002 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(vo /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.2.1" +#define ARCHIVE_VERSION_ONLY_STRING "3.2.2" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); Modified: head/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.h Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/libarchive/archive_entry.h Mon Oct 24 14:08:05 2016 (r307861) @@ -29,7 +29,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3002001 +#define ARCHIVE_VERSION_NUMBER 3002002 /* * Note: archive_entry.h is for use outside of libarchive; the Modified: head/contrib/libarchive/libarchive/test/main.c ============================================================================== --- head/contrib/libarchive/libarchive/test/main.c Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/libarchive/test/main.c Mon Oct 24 14:08:05 2016 (r307861) @@ -1162,6 +1162,35 @@ assertion_file_contains_lines_any_order( return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1381,6 +1410,8 @@ assertion_file_mode(const char *file, in assertion_count(file, line); #if defined(_WIN32) && !defined(__CYGWIN__) failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ #else { struct stat st; Modified: head/contrib/libarchive/libarchive/test/test.h ============================================================================== --- head/contrib/libarchive/libarchive/test/test.h Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/libarchive/test/test.h Mon Oct 24 14:08:05 2016 (r307861) @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -241,6 +244,7 @@ int assertion_file_atime_recent(const ch int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); int assertion_file_mode(const char *, int, const char *, int); Modified: head/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c Mon Oct 24 14:08:05 2016 (r307861) @@ -33,6 +33,11 @@ DEFINE_TEST(test_read_format_mtree_crash const char *reffile = "test_read_format_mtree_crash747.mtree.bz2"; struct archive *a; + if (archive_bzlib_version() == NULL) { + skipping("This test requires bzlib"); + return; + } + extract_reference_file(reffile); assert((a = archive_read_new()) != NULL); Modified: head/contrib/libarchive/libarchive/test/test_read_format_zip_high_compression.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_read_format_zip_high_compression.c Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/libarchive/test/test_read_format_zip_high_compression.c Mon Oct 24 14:08:05 2016 (r307861) @@ -50,6 +50,11 @@ DEFINE_TEST(test_read_format_zip_high_co size_t s; int64_t o; + if (archive_zlib_version() == NULL) { + skipping("Zip compression test requires zlib"); + return; + } + extract_reference_file(refname); p = slurpfile(&archive_size, refname); @@ -82,6 +87,11 @@ DEFINE_TEST(test_read_format_zip_high_co char *body, *body_read, *buff; int n; + if (archive_zlib_version() == NULL) { + skipping("Zip compression test requires zlib"); + return; + } + assert((body = malloc(body_size)) != NULL); assert((body_read = malloc(body_size)) != NULL); assert((buff = malloc(buff_size)) != NULL); Modified: head/contrib/libarchive/libarchive/test/test_read_set_format.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_read_set_format.c Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/libarchive/test/test_read_set_format.c Mon Oct 24 14:08:05 2016 (r307861) @@ -133,11 +133,12 @@ DEFINE_TEST(test_read_append_filter) assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR)); r = archive_read_append_filter(a, ARCHIVE_FILTER_GZIP); - if (r == ARCHIVE_WARN && !canGzip()) { - skipping("gzip reading not fully supported on this platform"); + if (r != ARCHIVE_OK && archive_zlib_version() == NULL && !canGzip()) { + skipping("gzip tests require zlib or working gzip command"); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); return; } + assertEqualIntA(a, ARCHIVE_OK, r); assertEqualInt(ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -200,8 +201,11 @@ DEFINE_TEST(test_read_append_filter_wron { struct archive_entry *ae; struct archive *a; +#if !defined(_WIN32) || defined(__CYGWIN__) + FILE * fp; int fd; fpos_t pos; +#endif /* * If we have "bunzip2 -q", try using that. @@ -211,11 +215,13 @@ DEFINE_TEST(test_read_append_filter_wron return; } +#if !defined(_WIN32) || defined(__CYGWIN__) /* bunzip2 will write to stderr, redirect it to a file */ fflush(stderr); fgetpos(stderr, &pos); fd = dup(fileno(stderr)); - freopen("stderr1", "w", stderr); + fp = freopen("stderr1", "w", stderr); +#endif assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR)); @@ -227,12 +233,15 @@ DEFINE_TEST(test_read_append_filter_wron assertEqualIntA(a, ARCHIVE_WARN, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); - /* restore stderr */ - fflush(stderr); - dup2(fd, fileno(stderr)); - close(fd); - clearerr(stderr); - fsetpos(stderr, &pos); - +#if !defined(_WIN32) || defined(__CYGWIN__) + /* restore stderr and verify results */ + if (fp != NULL) { + fflush(stderr); + dup2(fd, fileno(stderr)); + close(fd); + clearerr(stderr); + fsetpos(stderr, &pos); + } assertTextFileContents("bunzip2: (stdin) is not a bzip2 file.\n", "stderr1"); +#endif } Modified: head/contrib/libarchive/libarchive/test/test_write_format_iso9660.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_write_format_iso9660.c Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/libarchive/test/test_write_format_iso9660.c Mon Oct 24 14:08:05 2016 (r307861) @@ -117,8 +117,8 @@ DEFINE_TEST(test_write_format_iso9660) */ dirname[0] = '\0'; strcpy(dir, "/dir0"); - for (i = 0; i < 10; i++) { - dir[4] = '0' + i; + for (i = 0; i < 13; i++) { + dir[4] = "0123456789ABCDEF"[i]; if (i == 0) strcat(dirname, dir+1); else @@ -134,6 +134,19 @@ DEFINE_TEST(test_write_format_iso9660) archive_entry_free(ae); } + strcat(dirname, "/file"); + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_atime(ae, 2, 20); + archive_entry_set_birthtime(ae, 3, 30); + archive_entry_set_ctime(ae, 4, 40); + archive_entry_set_mtime(ae, 5, 50); + archive_entry_copy_pathname(ae, dirname); + archive_entry_set_mode(ae, S_IFREG | 0755); + archive_entry_set_size(ae, 8); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, 8, archive_write_data(a, "12345678", 9)); + /* * "dir0/dir1/file1" has 8 bytes of data. */ @@ -333,6 +346,45 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0555) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0555) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0555) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* * Read "hardlnk" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -386,6 +438,21 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualMem(buff2, "12345678", 8); /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file", archive_entry_pathname(ae)); + assert((AE_IFREG | 0555) == archive_entry_mode(ae)); + assertEqualInt(1, archive_entry_nlink(ae)); + assertEqualInt(8, archive_entry_size(ae)); + assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); + assertEqualMem(buff2, "12345678", 8); + + /* * Read "dir0/dir1/file1" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -580,29 +647,65 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* - * Read "hardlnk" + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("hardlnk", archive_entry_pathname(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("file", archive_entry_pathname(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); - assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(8, archive_entry_size(ae)); assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); assertEqualMem(buff2, "12345678", 8); /* - * Read "file" + * Read "hardlnk" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("file", archive_entry_pathname(ae)); - assertEqualString("hardlnk", archive_entry_hardlink(ae)); + assertEqualString("hardlnk", archive_entry_pathname(ae)); + assertEqualString("file", archive_entry_hardlink(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(0, archive_entry_size(ae)); assertEqualIntA(a, 0, archive_read_data(a, buff2, 10)); @@ -625,6 +728,22 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualMem(buff2, "12345678", 8); /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString( + "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file", + archive_entry_pathname(ae)); + assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(1, archive_entry_nlink(ae)); + assertEqualInt(8, archive_entry_size(ae)); + assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); + assertEqualMem(buff2, "12345678", 8); + + /* * Read "dir0/dir1/file1" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -746,6 +865,42 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* + * Read "rr_moved/dir7/dir8/dir9/dira" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "rr_moved/dir7/dir8/dir9/dira/dirB" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "rr_moved/dir7/dir8/dir9/dirA/dirB/dirC" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB/DIRC", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* * Read "dir0" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -827,33 +982,35 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* - * Read "file" + * Read "hardlink" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); - assertEqualInt(0, archive_entry_birthtime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("FILE", archive_entry_pathname(ae)); + assertEqualString("HARDLNK", archive_entry_pathname(ae)); + assertEqualString(NULL, archive_entry_hardlink(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); - assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(8, archive_entry_size(ae)); assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); assertEqualMem(buff2, "12345678", 8); /* - * Read "hardlink" + * Read "file" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_birthtime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("HARDLNK", archive_entry_pathname(ae)); - assertEqualString("FILE", archive_entry_hardlink(ae)); + assertEqualString("FILE", archive_entry_pathname(ae)); + assertEqualString("HARDLNK", archive_entry_hardlink(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(0, archive_entry_size(ae)); assertEqualIntA(a, 0, archive_read_data(a, buff2, 10)); + /* * Read longname */ @@ -871,6 +1028,22 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualMem(buff2, "12345678", 8); /* + * Read "rr_moved/dir7/dir8/dir9/dirA/dirB/dirC/file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString( + "RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB/DIRC/FILE", + archive_entry_pathname(ae)); + assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(1, archive_entry_nlink(ae)); + assertEqualInt(8, archive_entry_size(ae)); + assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); + assertEqualMem(buff2, "12345678", 8); + + /* * Read "dir0/dir1/file1" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); Modified: head/contrib/libarchive/tar/test/main.c ============================================================================== --- head/contrib/libarchive/tar/test/main.c Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/tar/test/main.c Mon Oct 24 14:08:05 2016 (r307861) @@ -1188,7 +1188,7 @@ assertion_file_contains_no_invalid_strin return(0); } } - + free(buff); return (0); } @@ -1412,6 +1412,8 @@ assertion_file_mode(const char *file, in assertion_count(file, line); #if defined(_WIN32) && !defined(__CYGWIN__) failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ #else { struct stat st; Modified: head/contrib/libarchive/tar/test/test.h ============================================================================== --- head/contrib/libarchive/tar/test/test.h Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/tar/test/test.h Mon Oct 24 14:08:05 2016 (r307861) @@ -244,7 +244,7 @@ int assertion_file_atime_recent(const ch int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); -int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); int assertion_file_mode(const char *, int, const char *, int); Modified: head/contrib/libarchive/tar/test/test_option_b.c ============================================================================== --- head/contrib/libarchive/tar/test/test_option_b.c Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/tar/test/test_option_b.c Mon Oct 24 14:08:05 2016 (r307861) @@ -33,7 +33,7 @@ DEFINE_TEST(test_option_b) assertMakeFile("file1", 0644, "file1"); if (systemf("cat file1 > test_cat.out 2> test_cat.err") != 0) { - skipping("Platform doesn't have cat"); + skipping("This test requires a `cat` program"); return; } testprog_ustar = malloc(strlen(testprog) + sizeof(USTAR_OPT) + 1); Modified: head/contrib/libarchive/tar/test/test_symlink_dir.c ============================================================================== --- head/contrib/libarchive/tar/test/test_symlink_dir.c Mon Oct 24 13:52:53 2016 (r307860) +++ head/contrib/libarchive/tar/test/test_symlink_dir.c Mon Oct 24 14:08:05 2016 (r307861) @@ -63,7 +63,7 @@ DEFINE_TEST(test_symlink_dir) /* "dir2" is a symlink to a non-existing "real_dir2" */ assertMakeSymlink("dest1/dir2", "real_dir2"); } else { - skipping("some symlink checks"); + skipping("Symlinks are not supported on this platform"); } /* "dir3" is a symlink to an existing "non_dir3" */ assertMakeFile("dest1/non_dir3", 0755, "abcdef"); Modified: head/usr.bin/bsdcat/Makefile ============================================================================== --- head/usr.bin/bsdcat/Makefile Mon Oct 24 13:52:53 2016 (r307860) +++ head/usr.bin/bsdcat/Makefile Mon Oct 24 14:08:05 2016 (r307861) @@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${.CURDIR}/../../contrib _LIBARCHIVECONFDIR= ${.CURDIR}/../../lib/libarchive PROG= bsdcat -BSDCAT_VERSION_STRING= 3.2.1 +BSDCAT_VERSION_STRING= 3.2.2 .PATH: ${_LIBARCHIVEDIR}/cat SRCS= bsdcat.c cmdline.c Modified: head/usr.bin/cpio/Makefile ============================================================================== --- head/usr.bin/cpio/Makefile Mon Oct 24 13:52:53 2016 (r307860) +++ head/usr.bin/cpio/Makefile Mon Oct 24 14:08:05 2016 (r307861) @@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${.CURDIR}/../../contrib _LIBARCHIVECONFDIR= ${.CURDIR}/../../lib/libarchive PROG= bsdcpio -BSDCPIO_VERSION_STRING= 3.2.1 +BSDCPIO_VERSION_STRING= 3.2.2 .PATH: ${_LIBARCHIVEDIR}/cpio SRCS= cpio.c cmdline.c Modified: head/usr.bin/tar/Makefile ============================================================================== --- head/usr.bin/tar/Makefile Mon Oct 24 13:52:53 2016 (r307860) +++ head/usr.bin/tar/Makefile Mon Oct 24 14:08:05 2016 (r307861) @@ -4,7 +4,7 @@ _LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive PROG= bsdtar -BSDTAR_VERSION_STRING= 3.2.1 +BSDTAR_VERSION_STRING= 3.2.2 .PATH: ${_LIBARCHIVEDIR}/tar SRCS= bsdtar.c \ From owner-svn-src-head@freebsd.org Mon Oct 24 14:24:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B5AAC1E05C; Mon, 24 Oct 2016 14:24:14 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17C73BD9; Mon, 24 Oct 2016 14:24:14 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OEODKn058573; Mon, 24 Oct 2016 14:24:13 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OEODwS058571; Mon, 24 Oct 2016 14:24:13 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201610241424.u9OEODwS058571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 24 Oct 2016 14:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307862 - in head/sys/arm: allwinner 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.23 Precedence: list List-Id: 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, 24 Oct 2016 14:24:14 -0000 Author: manu Date: Mon Oct 24 14:24:12 2016 New Revision: 307862 URL: https://svnweb.freebsd.org/changeset/base/307862 Log: Revert 307822 P2WI is almost compatible with RSB which we already support. I'll add support for P2WI in aw_rsb instead. Discussed with: jmcneill Deleted: head/sys/arm/allwinner/aw_p2wi.c head/sys/arm/allwinner/aw_p2wi.h Modified: head/sys/arm/allwinner/files.allwinner head/sys/arm/conf/GENERIC Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Mon Oct 24 14:08:05 2016 (r307861) +++ head/sys/arm/allwinner/files.allwinner Mon Oct 24 14:24:12 2016 (r307862) @@ -12,7 +12,6 @@ arm/allwinner/a10_mmc.c optional mmc arm/allwinner/a10_sramc.c standard arm/allwinner/aw_nmi.c optional intrng arm/allwinner/aw_if_dwc.c optional dwc -arm/allwinner/aw_p2wi.c optional p2wi arm/allwinner/aw_rsb.c optional rsb arm/allwinner/aw_rtc.c standard arm/allwinner/aw_ts.c standard Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Mon Oct 24 14:08:05 2016 (r307861) +++ head/sys/arm/conf/GENERIC Mon Oct 24 14:24:12 2016 (r307862) @@ -107,7 +107,6 @@ device iicbus device iic device twsi device rsb -device p2wi # Allwinner Push-Pull Two Wire interface device axp209 # AXP209 Power Management Unit device axp81x # AXP813/818 Power Management Unit device bcm2835_bsc From owner-svn-src-head@freebsd.org Mon Oct 24 14:37:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE438C1E2F7; Mon, 24 Oct 2016 14:37:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AAB2240; Mon, 24 Oct 2016 14:37:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OEbIiu062731; Mon, 24 Oct 2016 14:37:18 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OEbIuC062727; Mon, 24 Oct 2016 14:37:18 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610241437.u9OEbIuC062727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 24 Oct 2016 14:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307863 - in head/lib/libcasper/services: cap_dns cap_grp cap_pwd cap_sysctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 14:37:19 -0000 Author: emaste Date: Mon Oct 24 14:37:18 2016 New Revision: 307863 URL: https://svnweb.freebsd.org/changeset/base/307863 Log: Set SHLIBDIR before .including src.opts.mk in libcapser services bsd.own.mk (included from src.opts.mk) sets SHLIBDIR?=${LIBDIR}, so SHLIBDIR must be set before including either one of them. MFC with: 305626 Sponsored by: The FreeBSD Foundation Modified: head/lib/libcasper/services/cap_dns/Makefile head/lib/libcasper/services/cap_grp/Makefile head/lib/libcasper/services/cap_pwd/Makefile head/lib/libcasper/services/cap_sysctl/Makefile Modified: head/lib/libcasper/services/cap_dns/Makefile ============================================================================== --- head/lib/libcasper/services/cap_dns/Makefile Mon Oct 24 14:24:12 2016 (r307862) +++ head/lib/libcasper/services/cap_dns/Makefile Mon Oct 24 14:37:18 2016 (r307863) @@ -1,12 +1,13 @@ # $FreeBSD$ +SHLIBDIR?= /lib/casper + .include PACKAGE=libcasper LIB= cap_dns SHLIB_MAJOR= 0 -SHLIBDIR?= /lib/casper INCSDIR?= ${INCLUDEDIR}/casper SRCS= cap_dns.c Modified: head/lib/libcasper/services/cap_grp/Makefile ============================================================================== --- head/lib/libcasper/services/cap_grp/Makefile Mon Oct 24 14:24:12 2016 (r307862) +++ head/lib/libcasper/services/cap_grp/Makefile Mon Oct 24 14:37:18 2016 (r307863) @@ -1,12 +1,13 @@ # $FreeBSD$ +SHLIBDIR?= /lib/casper + .include PACKAGE=libcasper LIB= cap_grp SHLIB_MAJOR= 0 -SHLIBDIR?= /lib/casper INCSDIR?= ${INCLUDEDIR}/casper SRCS= cap_grp.c Modified: head/lib/libcasper/services/cap_pwd/Makefile ============================================================================== --- head/lib/libcasper/services/cap_pwd/Makefile Mon Oct 24 14:24:12 2016 (r307862) +++ head/lib/libcasper/services/cap_pwd/Makefile Mon Oct 24 14:37:18 2016 (r307863) @@ -1,12 +1,13 @@ # $FreeBSD$ +SHLIBDIR?= /lib/casper + .include PACKAGE=libcasper LIB= cap_pwd SHLIB_MAJOR= 0 -SHLIBDIR?= /lib/casper INCSDIR?= ${INCLUDEDIR}/casper SRCS= cap_pwd.c Modified: head/lib/libcasper/services/cap_sysctl/Makefile ============================================================================== --- head/lib/libcasper/services/cap_sysctl/Makefile Mon Oct 24 14:24:12 2016 (r307862) +++ head/lib/libcasper/services/cap_sysctl/Makefile Mon Oct 24 14:37:18 2016 (r307863) @@ -1,12 +1,13 @@ # $FreeBSD$ +SHLIBDIR?= /lib/casper + .include PACKAGE=libcasper LIB= cap_sysctl SHLIB_MAJOR= 0 -SHLIBDIR?= /lib/casper INCSDIR?= ${INCLUDEDIR}/casper SRCS= cap_sysctl.c From owner-svn-src-head@freebsd.org Mon Oct 24 14:56:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4106C1EA32; Mon, 24 Oct 2016 14:56:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72B0024D; Mon, 24 Oct 2016 14:56:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OEuD1T070800; Mon, 24 Oct 2016 14:56:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OEuD2B070799; Mon, 24 Oct 2016 14:56:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610241456.u9OEuD2B070799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 24 Oct 2016 14:56:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307864 - head/lib/libgcc_s X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 14:56:14 -0000 Author: emaste Date: Mon Oct 24 14:56:13 2016 New Revision: 307864 URL: https://svnweb.freebsd.org/changeset/base/307864 Log: Move the LLVM-based libgcc_s to /lib When enabled, it should install in the same location as the existing library. Reported by: antoine Modified: head/lib/libgcc_s/Makefile Modified: head/lib/libgcc_s/Makefile ============================================================================== --- head/lib/libgcc_s/Makefile Mon Oct 24 14:37:18 2016 (r307863) +++ head/lib/libgcc_s/Makefile Mon Oct 24 14:56:13 2016 (r307864) @@ -2,6 +2,7 @@ PKG= clibs SHLIB_NAME= libgcc_s.so.1 +SHLIBDIR?= /lib WARNS?= 2 From owner-svn-src-head@freebsd.org Mon Oct 24 16:28:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5050DC1FEEF; Mon, 24 Oct 2016 16:28:55 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F85DFAB; Mon, 24 Oct 2016 16:28:55 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OGSsLe005533; Mon, 24 Oct 2016 16:28:54 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OGSs52005532; Mon, 24 Oct 2016 16:28:54 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201610241628.u9OGSs52005532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 24 Oct 2016 16:28:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307865 - head/sys/boot/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.23 Precedence: list List-Id: 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, 24 Oct 2016 16:28:55 -0000 Author: tsoome Date: Mon Oct 24 16:28:54 2016 New Revision: 307865 URL: https://svnweb.freebsd.org/changeset/base/307865 Log: loader should boot pre-feature flags pools. The feature flags chek is missing the corner case where we have valid pool version, but feature flags are not enabled - as for example plain v28 pool. This update does fix the boot support for such pools. Reviewed by: avg, allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D8331 Modified: head/sys/boot/zfs/zfsimpl.c Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Mon Oct 24 14:56:13 2016 (r307864) +++ head/sys/boot/zfs/zfsimpl.c Mon Oct 24 16:28:54 2016 (r307865) @@ -2122,8 +2122,13 @@ check_mos_features(const spa_t *spa) &dir)) != 0) return (rc); if ((rc = zap_lookup(spa, &dir, DMU_POOL_FEATURES_FOR_READ, - sizeof (objnum), 1, &objnum)) != 0) - return (rc); + sizeof (objnum), 1, &objnum)) != 0) { + /* + * It is older pool without features. As we have already + * tested the label, just return without raising the error. + */ + return (0); + } if ((rc = objset_get_dnode(spa, &spa->spa_mos, objnum, &dir)) != 0) return (rc); From owner-svn-src-head@freebsd.org Mon Oct 24 16:40:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93C33C1F1CE; Mon, 24 Oct 2016 16:40:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FCCB83C; Mon, 24 Oct 2016 16:40:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OGeSkn009501; Mon, 24 Oct 2016 16:40:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OGeRFB009494; Mon, 24 Oct 2016 16:40:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610241640.u9OGeRFB009494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 24 Oct 2016 16:40:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307866 - in head/sys: amd64/amd64 i386/i386 kern x86/include x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 16:40:29 -0000 Author: kib Date: Mon Oct 24 16:40:27 2016 New Revision: 307866 URL: https://svnweb.freebsd.org/changeset/base/307866 Log: Handle broadcast NMIs. On several Intel chipsets, diagnostic NMIs sent from BMC or NMIs reporting hardware errors are broadcasted to all CPUs. When kernel is configured to enter kdb on NMI, the outcome is problematic, because each CPU tries to enter kdb. All CPUs are executing NMI handlers, which set the latches disabling the nested NMI delivery; this means that stop_cpus_hard(), used by kdb_enter() to stop other cpus by broadcasting IPI_STOP_HARD NMI, cannot work. One indication of this is the harmless but annoying diagnostic "timeout stopping cpus". Much more harming behaviour is that because all CPUs try to enter kdb, and if ddb is used as debugger, all CPUs issue prompt on console and race for the input, not to mention the simultaneous use of the ddb shared state. Try to fix this by introducing a pseudo-lock for simultaneous attempts to handle NMIs. If one core happens to enter NMI trap handler, other cores see it and simulate reception of the IPI_STOP_HARD. More, generic_stop_cpus() avoids sending IPI_STOP_HARD and avoids waiting for the acknowledgement, relying on the nmi handler on other cores suspending and then restarting the CPU. Since it is impossible to detect at runtime whether some stray NMI is broadcast or unicast, add a knob for administrator (really developer) to configure debugging NMI handling mode. The updated patch was debugged with the help from Andrey Gapon (avg) and discussed with him. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D8249 Modified: head/sys/amd64/amd64/trap.c head/sys/i386/i386/trap.c head/sys/kern/subr_smp.c head/sys/x86/include/x86_smp.h head/sys/x86/include/x86_var.h head/sys/x86/x86/cpu_machdep.c head/sys/x86/x86/mp_x86.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Mon Oct 24 16:28:54 2016 (r307865) +++ head/sys/amd64/amd64/trap.c Mon Oct 24 16:40:27 2016 (r307866) @@ -144,11 +144,6 @@ static char *trap_msg[] = { "DTrace pid return trap", /* 32 T_DTRACE_RET */ }; -#ifdef KDB -static int kdb_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN, - &kdb_on_nmi, 0, "Go to KDB on NMI"); -#endif static int panic_on_nmi = 1; SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN, &panic_on_nmi, 0, "Panic on NMI"); @@ -377,21 +372,7 @@ trap(struct trapframe *frame) #ifdef DEV_ISA case T_NMI: - /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(frame->tf_err) == 0) { -#ifdef KDB - /* - * NMI can be hooked up to a pushbutton - * for debugging. - */ - if (kdb_on_nmi) { - printf ("NMI ... going to debugger\n"); - kdb_trap(type, 0, frame); - } -#endif /* KDB */ - goto userout; - } else if (panic_on_nmi) - panic("NMI indicates hardware failure"); + nmi_handle_intr(type, frame, true); break; #endif /* DEV_ISA */ @@ -563,20 +544,8 @@ trap(struct trapframe *frame) #ifdef DEV_ISA case T_NMI: - /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(frame->tf_err) == 0) { -#ifdef KDB - /* - * NMI can be hooked up to a pushbutton - * for debugging. - */ - if (kdb_on_nmi) { - printf ("NMI ... going to debugger\n"); - kdb_trap(type, 0, frame); - } -#endif /* KDB */ - goto out; - } else if (panic_on_nmi == 0) + if (nmi_handle_intr(type, frame, false) || + !panic_on_nmi) goto out; /* FALLTHROUGH */ #endif /* DEV_ISA */ Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Mon Oct 24 16:28:54 2016 (r307865) +++ head/sys/i386/i386/trap.c Mon Oct 24 16:40:27 2016 (r307866) @@ -467,21 +467,7 @@ user_trctrap_out: } goto userout; #else /* !POWERFAIL_NMI */ - /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(frame->tf_err) == 0) { -#ifdef KDB - /* - * NMI can be hooked up to a pushbutton - * for debugging. - */ - if (kdb_on_nmi) { - printf ("NMI ... going to debugger\n"); - kdb_trap(type, 0, frame); - } -#endif /* KDB */ - goto userout; - } else if (panic_on_nmi) - panic("NMI indicates hardware failure"); + nmi_handle_intr(type, frame, true); break; #endif /* POWERFAIL_NMI */ #endif /* DEV_ISA */ @@ -730,20 +716,8 @@ kernel_trctrap: } goto out; #else /* !POWERFAIL_NMI */ - /* machine/parity/power fail/"kitchen sink" faults */ - if (isa_nmi(frame->tf_err) == 0) { -#ifdef KDB - /* - * NMI can be hooked up to a pushbutton - * for debugging. - */ - if (kdb_on_nmi) { - printf ("NMI ... going to debugger\n"); - kdb_trap(type, 0, frame); - } -#endif /* KDB */ - goto out; - } else if (panic_on_nmi == 0) + if (nmi_handle_intr(type, frame, false) || + !panic_on_nmi) goto out; /* FALLTHROUGH */ #endif /* POWERFAIL_NMI */ Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Mon Oct 24 16:28:54 2016 (r307865) +++ head/sys/kern/subr_smp.c Mon Oct 24 16:40:27 2016 (r307866) @@ -209,6 +209,11 @@ forward_signal(struct thread *td) * 1: ok * */ +#if defined(__amd64__) || defined(__i386__) +#define X86 1 +#else +#define X86 0 +#endif static int generic_stop_cpus(cpuset_t map, u_int type) { @@ -220,12 +225,11 @@ generic_stop_cpus(cpuset_t map, u_int ty volatile cpuset_t *cpus; KASSERT( -#if defined(__amd64__) || defined(__i386__) - type == IPI_STOP || type == IPI_STOP_HARD || type == IPI_SUSPEND, -#else - type == IPI_STOP || type == IPI_STOP_HARD, + type == IPI_STOP || type == IPI_STOP_HARD +#if X86 + || type == IPI_SUSPEND #endif - ("%s: invalid stop type", __func__)); + , ("%s: invalid stop type", __func__)); if (!smp_started) return (0); @@ -233,7 +237,7 @@ generic_stop_cpus(cpuset_t map, u_int ty CTR2(KTR_SMP, "stop_cpus(%s) with %u type", cpusetobj_strprint(cpusetbuf, &map), type); -#if defined(__amd64__) || defined(__i386__) +#if X86 /* * When suspending, ensure there are are no IPIs in progress. * IPIs that have been issued, but not yet delivered (e.g. @@ -245,6 +249,9 @@ generic_stop_cpus(cpuset_t map, u_int ty mtx_lock_spin(&smp_ipi_mtx); #endif +#if X86 + if (!nmi_is_broadcast || nmi_kdb_lock == 0) { +#endif if (stopping_cpu != PCPU_GET(cpuid)) while (atomic_cmpset_int(&stopping_cpu, NOCPU, PCPU_GET(cpuid)) == 0) @@ -253,8 +260,11 @@ generic_stop_cpus(cpuset_t map, u_int ty /* send the stop IPI to all CPUs in map */ ipi_selected(map, type); +#if X86 + } +#endif -#if defined(__amd64__) || defined(__i386__) +#if X86 if (type == IPI_SUSPEND) cpus = &suspended_cpus; else @@ -272,7 +282,7 @@ generic_stop_cpus(cpuset_t map, u_int ty } } -#if defined(__amd64__) || defined(__i386__) +#if X86 if (type == IPI_SUSPEND) mtx_unlock_spin(&smp_ipi_mtx); #endif @@ -295,7 +305,7 @@ stop_cpus_hard(cpuset_t map) return (generic_stop_cpus(map, IPI_STOP_HARD)); } -#if defined(__amd64__) || defined(__i386__) +#if X86 int suspend_cpus(cpuset_t map) { @@ -325,20 +335,18 @@ generic_restart_cpus(cpuset_t map, u_int #endif volatile cpuset_t *cpus; - KASSERT( -#if defined(__amd64__) || defined(__i386__) - type == IPI_STOP || type == IPI_STOP_HARD || type == IPI_SUSPEND, -#else - type == IPI_STOP || type == IPI_STOP_HARD, + KASSERT(type == IPI_STOP || type == IPI_STOP_HARD +#if X86 + || type == IPI_SUSPEND #endif - ("%s: invalid stop type", __func__)); + , ("%s: invalid stop type", __func__)); if (!smp_started) - return 0; + return (0); CTR1(KTR_SMP, "restart_cpus(%s)", cpusetobj_strprint(cpusetbuf, &map)); -#if defined(__amd64__) || defined(__i386__) +#if X86 if (type == IPI_SUSPEND) cpus = &suspended_cpus; else @@ -348,11 +356,17 @@ generic_restart_cpus(cpuset_t map, u_int /* signal other cpus to restart */ CPU_COPY_STORE_REL(&map, &started_cpus); +#if X86 + if (!nmi_is_broadcast || nmi_kdb_lock == 0) { +#endif /* wait for each to clear its bit */ while (CPU_OVERLAP(cpus, &map)) cpu_spinwait(); +#if X86 + } +#endif - return 1; + return (1); } int @@ -362,7 +376,7 @@ restart_cpus(cpuset_t map) return (generic_restart_cpus(map, IPI_STOP)); } -#if defined(__amd64__) || defined(__i386__) +#if X86 int resume_cpus(cpuset_t map) { @@ -370,6 +384,7 @@ resume_cpus(cpuset_t map) return (generic_restart_cpus(map, IPI_SUSPEND)); } #endif +#undef X86 /* * All-CPU rendezvous. CPUs are signalled, all execute the setup function Modified: head/sys/x86/include/x86_smp.h ============================================================================== --- head/sys/x86/include/x86_smp.h Mon Oct 24 16:28:54 2016 (r307865) +++ head/sys/x86/include/x86_smp.h Mon Oct 24 16:40:27 2016 (r307866) @@ -45,6 +45,9 @@ extern u_int ipi_page; extern u_int ipi_range; extern u_int ipi_range_size; +extern int nmi_kdb_lock; +extern int nmi_is_broadcast; + struct cpu_info { int cpu_present:1; int cpu_bsp:1; Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Mon Oct 24 16:28:54 2016 (r307865) +++ head/sys/x86/include/x86_var.h Mon Oct 24 16:40:27 2016 (r307866) @@ -85,6 +85,7 @@ struct reg; struct fpreg; struct dbreg; struct dumperinfo; +struct trapframe; /* * The interface type of the interrupt handler entry point cannot be @@ -107,6 +108,10 @@ bool fix_cpuid(void); void fillw(int /*u_short*/ pat, void *base, size_t cnt); int is_physical_memory(vm_paddr_t addr); int isa_nmi(int cd); +bool nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame, + bool panic); +bool nmi_call_kdb_smp(u_int type, struct trapframe *frame, bool panic); +int nmi_handle_intr(u_int type, struct trapframe *frame, bool panic); void pagecopy(void *from, void *to); void printcpuinfo(void); int user_dbreg_trap(void); Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Mon Oct 24 16:28:54 2016 (r307865) +++ head/sys/x86/x86/cpu_machdep.c Mon Oct 24 16:40:27 2016 (r307866) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_inet.h" #include "opt_isa.h" +#include "opt_kdb.h" #include "opt_kstack_pages.h" #include "opt_maxmem.h" #include "opt_mp_watchdog.h" @@ -522,3 +523,52 @@ idle_sysctl(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, idle_sysctl, "A", "currently selected idle function"); + +int nmi_is_broadcast = 1; +SYSCTL_INT(_machdep, OID_AUTO, nmi_is_broadcast, CTLFLAG_RWTUN, + &nmi_is_broadcast, 0, + "Chipset NMI is broadcast"); +#ifdef KDB +int kdb_on_nmi = 1; +SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN, + &kdb_on_nmi, 0, + "Go to KDB on NMI"); +#endif + +#ifdef DEV_ISA +bool +nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame, bool do_panic) +{ + + /* machine/parity/power fail/"kitchen sink" faults */ + if (isa_nmi(frame->tf_err) == 0) { +#ifdef KDB + /* + * NMI can be hooked up to a pushbutton for debugging. + */ + if (kdb_on_nmi) { + printf ("NMI/cpu%d ... going to debugger\n", cpu); + kdb_trap(type, 0, frame); + return (true); + } + } else +#endif /* KDB */ + if (do_panic) + panic("NMI indicates hardware failure"); + return (false); +} +#endif + +int +nmi_handle_intr(u_int type, struct trapframe *frame, bool panic) +{ + +#ifdef DEV_ISA +#ifdef SMP + if (nmi_is_broadcast) + return (nmi_call_kdb_smp(type, frame, panic)); + else +#endif + return (nmi_call_kdb(0, type, frame, panic)); +#endif +} Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Mon Oct 24 16:28:54 2016 (r307865) +++ head/sys/x86/x86/mp_x86.c Mon Oct 24 16:40:27 2016 (r307866) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include "opt_apic.h" #endif #include "opt_cpu.h" +#include "opt_isa.h" #include "opt_kstack_pages.h" #include "opt_pmap.h" #include "opt_sched.h" @@ -140,6 +141,7 @@ int cpu_apic_ids[MAXCPU]; volatile u_int cpu_ipi_pending[MAXCPU]; static void release_aps(void *dummy); +static void cpustop_handler_post(u_int cpu); static int hyperthreading_allowed = 1; SYSCTL_INT(_machdep, OID_AUTO, hyperthreading_allowed, CTLFLAG_RDTUN, @@ -1211,6 +1213,34 @@ ipi_nmi_handler(void) return (0); } +#ifdef DEV_ISA +int nmi_kdb_lock; + +bool +nmi_call_kdb_smp(u_int type, struct trapframe *frame, bool do_panic) +{ + int cpu; + bool call_post, ret; + + cpu = PCPU_GET(cpuid); + if (atomic_cmpset_acq_int(&nmi_kdb_lock, 0, 1)) { + ret = nmi_call_kdb(cpu, type, frame, do_panic); + call_post = false; + } else { + ret = true; + savectx(&stoppcbs[cpu]); + CPU_SET_ATOMIC(cpu, &stopped_cpus); + while (!atomic_cmpset_acq_int(&nmi_kdb_lock, 0, 1)) + ia32_pause(); + call_post = true; + } + atomic_store_rel_int(&nmi_kdb_lock, 0); + if (call_post) + cpustop_handler_post(cpu); + return (ret); +} +#endif + /* * Handle an IPI_STOP by saving our current context and spinning until we * are resumed. @@ -1231,6 +1261,13 @@ cpustop_handler(void) while (!CPU_ISSET(cpu, &started_cpus)) ia32_pause(); + cpustop_handler_post(cpu); +} + +static void +cpustop_handler_post(u_int cpu) +{ + CPU_CLR_ATOMIC(cpu, &started_cpus); CPU_CLR_ATOMIC(cpu, &stopped_cpus); From owner-svn-src-head@freebsd.org Mon Oct 24 17:07:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3AC3C1FF21; Mon, 24 Oct 2016 17:07:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAB75124B; Mon, 24 Oct 2016 17:07:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 99B9510AF7C; Mon, 24 Oct 2016 13:07:02 -0400 (EDT) From: John Baldwin To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307756 - in head: include sys/sys Date: Mon, 24 Oct 2016 09:10:33 -0700 Message-ID: <5535792.BsRA60PV1C@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <20161022000056.GC95989@spindle.one-eyed-alien.net> References: <201610212350.u9LNo2PT031675@repo.freebsd.org> <20161022000056.GC95989@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 24 Oct 2016 13:07:02 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 17:07:03 -0000 On Saturday, October 22, 2016 12:00:56 AM Brooks Davis wrote: > On Fri, Oct 21, 2016 at 11:50:02PM +0000, John Baldwin wrote: > > Author: jhb > > Date: Fri Oct 21 23:50:02 2016 > > New Revision: 307756 > > URL: https://svnweb.freebsd.org/changeset/base/307756 > > > > Log: > > Define max_align_t for C11. > > > > libc++'s stddef.h includes an existing definition of max_align_t for > > C++11, but it is only defined for C++, not for C. In addition, GCC and > > clang both define an alternate version of max_align_t that uses a > > union of multiple types rather than a plain long double as in libc++. > > This adds a __max_align_t to that matches the GCC and > > clang definition that is mapped to max_align_t in . > > > > PR: 210890 > > Reviewed by: dim > > MFC after: 1 month > > Differential Revision: https://reviews.freebsd.org/D8194 > > > > Modified: > > head/include/stddef.h > > head/sys/sys/_types.h > > > > Modified: head/include/stddef.h > > ============================================================================== > > --- head/include/stddef.h Fri Oct 21 21:55:50 2016 (r307755) > > +++ head/include/stddef.h Fri Oct 21 23:50:02 2016 (r307756) > > @@ -62,6 +62,14 @@ typedef ___wchar_t wchar_t; > > #endif > > #endif > > > > +#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L > > +#ifndef __CLANG_MAX_ALIGN_T_DEFINED > > +typedef __max_align_t max_align_t; > > +#define __CLANG_MAX_ALIGN_T_DEFINED > > +#define __GCC_MAX_ALIGN_T > > +#endif > > +#endif > > + > > #define offsetof(type, member) __offsetof(type, member) > > > > #endif /* _STDDEF_H_ */ > > > > Modified: head/sys/sys/_types.h > > ============================================================================== > > --- head/sys/sys/_types.h Fri Oct 21 21:55:50 2016 (r307755) > > +++ head/sys/sys/_types.h Fri Oct 21 23:50:02 2016 (r307756) > > @@ -100,6 +100,11 @@ typedef __uint_least32_t __char32_t; > > #define _CHAR32_T_DECLARED > > #endif > > > > +typedef struct { > > Should this be union per the commit message? Dimitry's response is correct of course. I think my brain had "fixed" this when I read it to be a union instead of a struct since a struct seems so obviously wrong. -- John Baldwin From owner-svn-src-head@freebsd.org Mon Oct 24 17:37:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9587FC1EE0B; Mon, 24 Oct 2016 17:37:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67195E3F; Mon, 24 Oct 2016 17:37:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OHbLbs032717; Mon, 24 Oct 2016 17:37:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OHbL5b032716; Mon, 24 Oct 2016 17:37:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610241737.u9OHbL5b032716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 24 Oct 2016 17:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307869 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 17:37:22 -0000 Author: kib Date: Mon Oct 24 17:37:21 2016 New Revision: 307869 URL: https://svnweb.freebsd.org/changeset/base/307869 Log: Fix typo. Submitted by: alc MFC after: 3 days Modified: head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Mon Oct 24 17:08:12 2016 (r307868) +++ head/sys/x86/x86/mp_x86.c Mon Oct 24 17:37:21 2016 (r307869) @@ -1351,7 +1351,7 @@ invlcache_handler(void) * Reading the generation here allows greater parallelism * since wbinvd is a serializing instruction. Without the * temporary, we'd wait for wbinvd to complete, then the read - * would execute, then the dependent write, whuch must then + * would execute, then the dependent write, which must then * complete before return from interrupt. */ generation = smp_tlb_generation; From owner-svn-src-head@freebsd.org Mon Oct 24 17:56:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5058C1F4C9; Mon, 24 Oct 2016 17:56:09 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A411BDDD; Mon, 24 Oct 2016 17:56:09 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OHu8Ts040441; Mon, 24 Oct 2016 17:56:08 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OHu8eM040440; Mon, 24 Oct 2016 17:56:08 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610241756.u9OHu8eM040440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Mon, 24 Oct 2016 17:56:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307870 - head/lib/libnetbsd/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.23 Precedence: list List-Id: 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, 24 Oct 2016 17:56:09 -0000 Author: marcel Date: Mon Oct 24 17:56:08 2016 New Revision: 307870 URL: https://svnweb.freebsd.org/changeset/base/307870 Log: When compiling on macOS or Linux, __dead can be defined already. Conditionally define __dead. Modified: head/lib/libnetbsd/sys/cdefs.h Modified: head/lib/libnetbsd/sys/cdefs.h ============================================================================== --- head/lib/libnetbsd/sys/cdefs.h Mon Oct 24 17:37:21 2016 (r307869) +++ head/lib/libnetbsd/sys/cdefs.h Mon Oct 24 17:56:08 2016 (r307870) @@ -35,11 +35,13 @@ #include_next +#ifndef __dead #ifdef __dead2 #define __dead __dead2 #else #define __dead #endif +#endif /* !__dead */ /* * The __CONCAT macro is used to concatenate parts of symbol names, e.g. From owner-svn-src-head@freebsd.org Mon Oct 24 17:57:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 525F2C1F599; Mon, 24 Oct 2016 17:57:47 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22AB5FDB; Mon, 24 Oct 2016 17:57:47 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OHvkvC040587; Mon, 24 Oct 2016 17:57:46 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OHvk1t040586; Mon, 24 Oct 2016 17:57:46 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610241757.u9OHvk1t040586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Mon, 24 Oct 2016 17:57:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307871 - head/lib/libnetbsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 17:57:47 -0000 Author: marcel Date: Mon Oct 24 17:57:46 2016 New Revision: 307871 URL: https://svnweb.freebsd.org/changeset/base/307871 Log: Include "util.h", not . The header is in the same directory as the C file. There may be a on the host when compiling on macOS or Linux, causing conflicts. Modified: head/lib/libnetbsd/util.c Modified: head/lib/libnetbsd/util.c ============================================================================== --- head/lib/libnetbsd/util.c Mon Oct 24 17:56:08 2016 (r307870) +++ head/lib/libnetbsd/util.c Mon Oct 24 17:57:46 2016 (r307871) @@ -36,7 +36,8 @@ #include #include #include -#include + +#include "util.h" char * flags_to_string(u_long flags, const char *def) From owner-svn-src-head@freebsd.org Mon Oct 24 17:59:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8340DC1F833; Mon, 24 Oct 2016 17:59:26 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FC9B69A; Mon, 24 Oct 2016 17:59:26 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OHxP0j040820; Mon, 24 Oct 2016 17:59:25 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OHxPGf040819; Mon, 24 Oct 2016 17:59:25 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610241759.u9OHxPGf040819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Mon, 24 Oct 2016 17:59:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307872 - 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.23 Precedence: list List-Id: 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, 24 Oct 2016 17:59:26 -0000 Author: marcel Date: Mon Oct 24 17:59:25 2016 New Revision: 307872 URL: https://svnweb.freebsd.org/changeset/base/307872 Log: Detect clang on macOS. The version string is slightly different. Modified: head/share/mk/bsd.compiler.mk Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Mon Oct 24 17:57:46 2016 (r307871) +++ head/share/mk/bsd.compiler.mk Mon Oct 24 17:59:25 2016 (r307872) @@ -147,7 +147,7 @@ ${X_}COMPILER_TYPE:= clang ${X_}COMPILER_TYPE:= gcc . elif ${_v:M\(GCC\)} ${X_}COMPILER_TYPE:= gcc -. elif ${_v:Mclang} +. elif ${_v:Mclang} || ${_v:M(clang-*.*.*)} ${X_}COMPILER_TYPE:= clang . else .error Unable to determine compiler type for ${cc}=${${cc}}. Consider setting ${X_}COMPILER_TYPE. From owner-svn-src-head@freebsd.org Mon Oct 24 18:03:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3440C1FA2B; Mon, 24 Oct 2016 18:03:05 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5533B33; Mon, 24 Oct 2016 18:03:05 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OI343i044305; Mon, 24 Oct 2016 18:03:04 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OI34Qb044304; Mon, 24 Oct 2016 18:03:04 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610241803.u9OI34Qb044304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Mon, 24 Oct 2016 18:03:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307873 - 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.23 Precedence: list List-Id: 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, 24 Oct 2016 18:03:06 -0000 Author: marcel Date: Mon Oct 24 18:03:04 2016 New Revision: 307873 URL: https://svnweb.freebsd.org/changeset/base/307873 Log: Include instead of when compiled as part of libsbuf. The former is the standard header, and allows us to compile libsbuf on macOS/linux. Modified: head/sys/kern/subr_prf.c Modified: head/sys/kern/subr_prf.c ============================================================================== --- head/sys/kern/subr_prf.c Mon Oct 24 17:59:25 2016 (r307872) +++ head/sys/kern/subr_prf.c Mon Oct 24 18:03:04 2016 (r307873) @@ -72,7 +72,11 @@ __FBSDID("$FreeBSD$"); * Note that stdarg.h and the ANSI style va_start macro is used for both * ANSI and traditional C compilers. */ +#ifdef _KERNEL #include +#else +#include +#endif #ifdef _KERNEL From owner-svn-src-head@freebsd.org Mon Oct 24 18:12:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F40CC1FF0F; Mon, 24 Oct 2016 18:12:58 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 711293F9; Mon, 24 Oct 2016 18:12:58 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OICv17047973; Mon, 24 Oct 2016 18:12:57 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OICvSF047972; Mon, 24 Oct 2016 18:12:57 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610241812.u9OICvSF047972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Mon, 24 Oct 2016 18:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307874 - head/sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 18:12:58 -0000 Author: marcel Date: Mon Oct 24 18:12:57 2016 New Revision: 307874 URL: https://svnweb.freebsd.org/changeset/base/307874 Log: Include explicitly instead of depending on that header being included by . When compiled as part of makefs(8) and on macOS or Linux, is not our own. Modified: head/sys/ufs/ffs/ffs_tables.c Modified: head/sys/ufs/ffs/ffs_tables.c ============================================================================== --- head/sys/ufs/ffs/ffs_tables.c Mon Oct 24 18:03:04 2016 (r307873) +++ head/sys/ufs/ffs/ffs_tables.c Mon Oct 24 18:12:57 2016 (r307874) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include From owner-svn-src-head@freebsd.org Mon Oct 24 19:09:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7649C1F20E; Mon, 24 Oct 2016 19:09:57 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CF91C48; Mon, 24 Oct 2016 19:09:57 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OJ9ujK067465; Mon, 24 Oct 2016 19:09:56 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OJ9uoh067464; Mon, 24 Oct 2016 19:09:56 GMT (envelope-from np@FreeBSD.org) Message-Id: <201610241909.u9OJ9uoh067464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 24 Oct 2016 19:09:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307876 - 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.23 Precedence: list List-Id: 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, 24 Oct 2016 19:09:57 -0000 Author: np Date: Mon Oct 24 19:09:56 2016 New Revision: 307876 URL: https://svnweb.freebsd.org/changeset/base/307876 Log: cxgbe(4): Fix bug in the calculation of the number of physically contiguous regions in an mbuf chain. If the payload of an mbuf ends at a page boundary count_mbuf_nsegs would incorrectly consider the next mbuf's payload physically contiguous based solely on a KVA comparison. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Mon Oct 24 18:27:24 2016 (r307875) +++ head/sys/dev/cxgbe/t4_sge.c Mon Oct 24 19:09:56 2016 (r307876) @@ -2110,24 +2110,6 @@ m_advance(struct mbuf **pm, int *poffset return ((void *)p); } -static inline int -same_paddr(char *a, char *b) -{ - - if (a == b) - return (1); - else if (a != NULL && b != NULL) { - vm_offset_t x = (vm_offset_t)a; - vm_offset_t y = (vm_offset_t)b; - - if ((x & PAGE_MASK) == (y & PAGE_MASK) && - pmap_kextract(x) == pmap_kextract(y)) - return (1); - } - - return (0); -} - /* * Can deal with empty mbufs in the chain that have m_len = 0, but the chain * must have at least one mbuf that's not empty. @@ -2135,24 +2117,25 @@ same_paddr(char *a, char *b) static inline int count_mbuf_nsegs(struct mbuf *m) { - char *prev_end, *start; + vm_paddr_t lastb, next; + vm_offset_t va; int len, nsegs; MPASS(m != NULL); nsegs = 0; - prev_end = NULL; + lastb = 0; for (; m; m = m->m_next) { len = m->m_len; if (__predict_false(len == 0)) continue; - start = mtod(m, char *); - - nsegs += sglist_count(start, len); - if (same_paddr(prev_end, start)) + va = mtod(m, vm_offset_t); + next = pmap_kextract(va); + nsegs += sglist_count(m->m_data, len); + if (lastb + 1 == next) nsegs--; - prev_end = start + len; + lastb = pmap_kextract(va + len - 1); } MPASS(nsegs > 0); From owner-svn-src-head@freebsd.org Mon Oct 24 20:33:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63B04C20FD4; Mon, 24 Oct 2016 20:33:44 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30D9BA01; Mon, 24 Oct 2016 20:33:44 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OKXhhD001631; Mon, 24 Oct 2016 20:33:43 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OKXhPA001627; Mon, 24 Oct 2016 20:33:43 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201610242033.u9OKXhPA001627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 24 Oct 2016 20:33:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307878 - in head/sys/arm: allwinner 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.23 Precedence: list List-Id: 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, 24 Oct 2016 20:33:44 -0000 Author: manu Date: Mon Oct 24 20:33:42 2016 New Revision: 307878 URL: https://svnweb.freebsd.org/changeset/base/307878 Log: allwinner: Add support for P2WI in RSB driver Push-Pull Two Wire interface is a almost compatible iic like bus used in sun6i SoC. It's only use is to communicate with the power management IC. Reviewed by: jmcneill MFC after: 1 week Relnotes: yes Modified: head/sys/arm/allwinner/aw_rsb.c head/sys/arm/allwinner/files.allwinner head/sys/arm/conf/GENERIC Modified: head/sys/arm/allwinner/aw_rsb.c ============================================================================== --- head/sys/arm/allwinner/aw_rsb.c Mon Oct 24 19:24:07 2016 (r307877) +++ head/sys/arm/allwinner/aw_rsb.c Mon Oct 24 20:33:42 2016 (r307878) @@ -27,7 +27,7 @@ */ /* - * Allwinner RSB (Reduced Serial Bus) + * Allwinner RSB (Reduced Serial Bus) and P2WI (Push-Pull Two Wire Interface) */ #include @@ -92,8 +92,12 @@ __FBSDID("$FreeBSD$"); #define RSB_ADDR_PMIC_SECONDARY 0x745 #define RSB_ADDR_PERIPH_IC 0xe89 +#define A31_P2WI 1 +#define A23_RSB 2 + static struct ofw_compat_data compat_data[] = { - { "allwinner,sun8i-a23-rsb", 1 }, + { "allwinner,sun6i-a31-p2wi", A31_P2WI }, + { "allwinner,sun8i-a23-rsb", A23_RSB }, { NULL, 0 } }; @@ -131,6 +135,7 @@ struct rsb_softc { int busy; uint32_t status; uint16_t cur_addr; + int type; struct iic_msg *msg; }; @@ -270,8 +275,8 @@ rsb_transfer(device_t dev, struct iic_ms sc = device_get_softc(dev); /* - * RSB is not really an I2C or SMBus controller, so there are some - * restrictions imposed by the driver. + * P2WI and RSB are not really I2C or SMBus controllers, so there are + * some restrictions imposed by the driver. * * Transfers must contain exactly two messages. The first is always * a write, containing a single data byte offset. Data will either @@ -284,34 +289,36 @@ rsb_transfer(device_t dev, struct iic_ms msgs[0].len != 1 || msgs[1].len > RSB_MAXLEN) return (EINVAL); - /* The controller can read or write 1, 2, or 4 bytes at a time. */ - if ((msgs[1].flags & IIC_M_RD) != 0) { - switch (msgs[1].len) { - case 1: - cmd = CMD_RD8; - break; - case 2: - cmd = CMD_RD16; - break; - case 4: - cmd = CMD_RD32; - break; - default: - return (EINVAL); - } - } else { - switch (msgs[1].len) { - case 1: - cmd = CMD_WR8; - break; - case 2: - cmd = CMD_WR16; - break; - case 4: - cmd = CMD_WR32; - break; - default: - return (EINVAL); + /* The RSB controller can read or write 1, 2, or 4 bytes at a time. */ + if (sc->type == A23_RSB) { + if ((msgs[1].flags & IIC_M_RD) != 0) { + switch (msgs[1].len) { + case 1: + cmd = CMD_RD8; + break; + case 2: + cmd = CMD_RD16; + break; + case 4: + cmd = CMD_RD32; + break; + default: + return (EINVAL); + } + } else { + switch (msgs[1].len) { + case 1: + cmd = CMD_WR8; + break; + case 2: + cmd = CMD_WR16; + break; + case 4: + cmd = CMD_WR32; + break; + default: + return (EINVAL); + } } } @@ -322,13 +329,15 @@ rsb_transfer(device_t dev, struct iic_ms sc->status = 0; /* Select current run-time address if necessary */ - device_addr = msgs[0].slave >> 1; - if (sc->cur_addr != device_addr) { - error = rsb_set_rta(dev, device_addr); - if (error != 0) - goto done; - sc->cur_addr = device_addr; - sc->status = 0; + if (sc->type == A23_RSB) { + device_addr = msgs[0].slave >> 1; + if (sc->cur_addr != device_addr) { + error = rsb_set_rta(dev, device_addr); + if (error != 0) + goto done; + sc->cur_addr = device_addr; + sc->status = 0; + } } /* Clear interrupt status */ @@ -344,8 +353,9 @@ rsb_transfer(device_t dev, struct iic_ms RSB_WRITE(sc, RSB_DATA0, data[0]); } - /* Set command type */ - RSB_WRITE(sc, RSB_CMD, cmd); + /* Set command type for RSB */ + if (sc->type == A23_RSB) + RSB_WRITE(sc, RSB_CMD, cmd); /* Program data length register and transfer direction */ dlen = msgs[0].len - 1; @@ -379,10 +389,17 @@ rsb_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) { + case A23_RSB: + device_set_desc(dev, "Allwinner RSB"); + break; + case A31_P2WI: + device_set_desc(dev, "Allwinner P2WI"); + break; + default: return (ENXIO); + } - device_set_desc(dev, "Allwinner RSB"); return (BUS_PROBE_DEFAULT); } @@ -395,6 +412,8 @@ rsb_attach(device_t dev) sc = device_get_softc(dev); mtx_init(&sc->mtx, device_get_nameunit(dev), "rsb", MTX_DEF); + sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (clk_get_by_ofw_index(dev, 0, 0, &sc->clk) == 0) { error = clk_enable(sc->clk); if (error != 0) { Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Mon Oct 24 19:24:07 2016 (r307877) +++ head/sys/arm/allwinner/files.allwinner Mon Oct 24 20:33:42 2016 (r307878) @@ -12,7 +12,7 @@ arm/allwinner/a10_mmc.c optional mmc arm/allwinner/a10_sramc.c standard arm/allwinner/aw_nmi.c optional intrng arm/allwinner/aw_if_dwc.c optional dwc -arm/allwinner/aw_rsb.c optional rsb +arm/allwinner/aw_rsb.c optional rsb | p2wi arm/allwinner/aw_rtc.c standard arm/allwinner/aw_ts.c standard arm/allwinner/aw_wdog.c standard Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Mon Oct 24 19:24:07 2016 (r307877) +++ head/sys/arm/conf/GENERIC Mon Oct 24 20:33:42 2016 (r307878) @@ -106,7 +106,8 @@ device psci device iicbus device iic device twsi -device rsb +device rsb # Allwinner Reduced Serial Bus +device p2wi # Allwinner Push-Pull Two Wire device axp209 # AXP209 Power Management Unit device axp81x # AXP813/818 Power Management Unit device bcm2835_bsc From owner-svn-src-head@freebsd.org Mon Oct 24 20:36:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E88EC1F235; Mon, 24 Oct 2016 20:36:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C003D2D; Mon, 24 Oct 2016 20:36:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OKatxt001804; Mon, 24 Oct 2016 20:36:55 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OKasqL001797; Mon, 24 Oct 2016 20:36:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610242036.u9OKasqL001797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 24 Oct 2016 20:36:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307879 - in head/sys/boot: efi/libefi efi/loader ficl forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 20:36:56 -0000 Author: imp Date: Mon Oct 24 20:36:54 2016 New Revision: 307879 URL: https://svnweb.freebsd.org/changeset/base/307879 Log: Preliminary support for EFI in boot loader. Define efi-boot forth environment variable to allow conditional compilation based on EFI being present or not. Provide efi-setenv, efi-getenv, and efi-unsetenv, though those need improvement. Move the efi definition to libefi (but include a reference so they get included). Added: head/sys/boot/forth/efi.4th (contents, props changed) Deleted: head/sys/boot/ficl/efi.c Modified: head/sys/boot/efi/libefi/Makefile head/sys/boot/efi/libefi/env.c head/sys/boot/efi/loader/main.c head/sys/boot/ficl/loader.c head/sys/boot/forth/Makefile.inc head/sys/boot/forth/loader.4th Modified: head/sys/boot/efi/libefi/Makefile ============================================================================== --- head/sys/boot/efi/libefi/Makefile Mon Oct 24 20:33:42 2016 (r307878) +++ head/sys/boot/efi/libefi/Makefile Mon Oct 24 20:36:54 2016 (r307879) @@ -26,6 +26,7 @@ CFLAGS+= -msoft-float -mgeneral-regs-onl .if ${MACHINE_ARCH} == "amd64" CFLAGS+= -fPIC -mno-red-zone .endif +CFLAGS+= -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/${MACHINE} CFLAGS+= -I${.CURDIR}/../include CFLAGS+= -I${.CURDIR}/../include/${MACHINE} CFLAGS+= -I${.CURDIR}/../../../../lib/libstand Modified: head/sys/boot/efi/libefi/env.c ============================================================================== --- head/sys/boot/efi/libefi/env.c Mon Oct 24 20:33:42 2016 (r307878) +++ head/sys/boot/efi/libefi/env.c Mon Oct 24 20:36:54 2016 (r307879) @@ -26,8 +26,15 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include #include +#include +#include "bootstrap.h" +#include "ficl.h" + +int efi_variable_support = 1; /* * Simple wrappers to the underlying UEFI functions. @@ -53,3 +60,175 @@ efi_set_variable(CHAR16 *variable_name, { return RS->SetVariable(variable_name, vendor_guid, attributes, data_size, data); } + +/* + * FreeBSD's loader interaction words and extras + * + * efi-setenv ( value n name n guid n attr -- 0 | -1) + * efi-getenv ( guid n addr n -- addr' n' | -1 ) + * efi-unsetenv ( name n guid n'' -- ) + */ + +/* + * efi-setenv + * efi-setenv ( value n name n guid n attr -- 0 | -1) + * + * Set environment variables using the SetVariable EFI runtime service. + * + * Value and guid are passed through in binary form (so guid needs to be + * converted to binary form from its string form). Name is converted from + * ASCII to CHAR16. Since ficl doesn't have support for internationalization, + * there's no native CHAR16 interface provided. + * + * attr is an int in the bitmask of the following attributes for this variable. + * + * 1 Non volatile + * 2 Boot service access + * 4 Run time access + * (corresponding to the same bits in the UEFI spec). + */ +void +ficlEfiSetenv(FICL_VM *pVM) +{ +#ifndef TESTMAIN + char *value = NULL, *guid = NULL; + CHAR16 *name = NULL; + int i; +#endif + char *namep, *valuep, *guidp; + int names, values, guids, attr; + int status; + uuid_t u; + uint32_t ustatus; + +#if FICL_ROBUST > 1 + vmCheckStack(pVM, 6, 0); +#endif + attr = stackPopINT(pVM->pStack); + guids = stackPopINT(pVM->pStack); + guidp = (char*)stackPopPtr(pVM->pStack); + names = stackPopINT(pVM->pStack); + namep = (char*)stackPopPtr(pVM->pStack); + values = stackPopINT(pVM->pStack); + valuep = (char*)stackPopPtr(pVM->pStack); + +#ifndef TESTMAIN + guid = (char*)ficlMalloc(guids); + if (guid != NULL) + vmThrowErr(pVM, "Error: out of memory"); + memcpy(guid, guidp, guids); + uuid_from_string(guid, &u, &ustatus); + if (ustatus != uuid_s_ok) { + stackPushINT(pVM->pStack, -1); + goto out; + } + + name = (CHAR16 *)ficlMalloc((names + 1) * sizeof(CHAR16)); + if (name == NULL) + vmThrowErr(pVM, "Error: out of memory"); + for (i = 0; i < names; i++) + name[i] = namep[i]; + name[names] = (CHAR16)0; + + value = (char*)ficlMalloc(values + 1); + if (value != NULL) + vmThrowErr(pVM, "Error: out of memory"); + memcpy(value, valuep, values); + + status = efi_set_variable(name, (EFI_GUID *)&u, attr, values, value); + if (status == EFI_SUCCESS) + stackPushINT(pVM->pStack, 0); + else + stackPushINT(pVM->pStack, -1); +out: + ficlFree(name); + ficlFree(value); + ficlFree(guid); +#endif + + return; +} + +void +ficlEfiGetenv(FICL_VM *pVM) +{ +#ifndef TESTMAIN + char *name, *value; +#endif + char *namep; + int names; + +#if FICL_ROBUST > 1 + vmCheckStack(pVM, 2, 2); +#endif + names = stackPopINT(pVM->pStack); + namep = (char*) stackPopPtr(pVM->pStack); + +#ifndef TESTMAIN + name = (char*) ficlMalloc(names+1); + if (!name) + vmThrowErr(pVM, "Error: out of memory"); + strncpy(name, namep, names); + name[names] = '\0'; + + value = getenv(name); + ficlFree(name); + + if(value != NULL) { + stackPushPtr(pVM->pStack, value); + stackPushINT(pVM->pStack, strlen(value)); + } else +#endif + stackPushINT(pVM->pStack, -1); + + return; +} + +void +ficlEfiUnsetenv(FICL_VM *pVM) +{ +#ifndef TESTMAIN + char *name; +#endif + char *namep; + int names; + +#if FICL_ROBUST > 1 + vmCheckStack(pVM, 2, 0); +#endif + names = stackPopINT(pVM->pStack); + namep = (char*) stackPopPtr(pVM->pStack); + +#ifndef TESTMAIN + name = (char*) ficlMalloc(names+1); + if (!name) + vmThrowErr(pVM, "Error: out of memory"); + strncpy(name, namep, names); + name[names] = '\0'; + + unsetenv(name); + ficlFree(name); +#endif + + return; +} + +/************************************************************************** +** Add FreeBSD UEFI platform extensions into the system dictionary +**************************************************************************/ +void ficlEfiCompilePlatform(FICL_SYSTEM *pSys) +{ + FICL_DICT *dp = pSys->dp; + assert (dp); + + dictAppendWord(dp, "efi-setenv", ficlEfiSetenv, FW_DEFAULT); + dictAppendWord(dp, "efi-getenv", ficlEfiGetenv, FW_DEFAULT); + dictAppendWord(dp, "efi-unsetenv", ficlEfiUnsetenv, FW_DEFAULT); + + /* Would like to export the EFI version, but this will do for now */ + ficlSetEnv(pSys, "efi-boot", 1); + + return; +} + +FICL_COMPILE_SET(ficlEfiCompilePlatform); Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Mon Oct 24 20:33:42 2016 (r307878) +++ head/sys/boot/efi/loader/main.c Mon Oct 24 20:36:54 2016 (r307879) @@ -55,6 +55,10 @@ extern char bootprog_rev[]; extern char bootprog_date[]; extern char bootprog_maker[]; +/* Force a reference to bring in EFI support from the library */ +extern int efi_variable_support; +int *dummy1 = &efi_variable_support; + struct arch_switch archsw; /* MI/MD interface boundary */ EFI_GUID acpi = ACPI_TABLE_GUID; @@ -906,8 +910,8 @@ command_efi_show(int argc, char *argv[]) return (rv); } - if (argc != 0) { - printf("Too many args\n"); + if (argc > 0) { + printf("Too many args %d\n", argc); pager_close(); return (CMD_ERROR); } Modified: head/sys/boot/ficl/loader.c ============================================================================== --- head/sys/boot/ficl/loader.c Mon Oct 24 20:33:42 2016 (r307878) +++ head/sys/boot/ficl/loader.c Mon Oct 24 20:36:54 2016 (r307879) @@ -824,9 +824,8 @@ void ficlCompilePlatform(FICL_SYSTEM *pS dictAppendWord(dp, "uuid-from-string", ficlUuidFromString, FW_DEFAULT); dictAppendWord(dp, "uuid-to-string", ficlUuidToString, FW_DEFAULT); - SET_FOREACH(fnpp, Xficl_compile_set) { + SET_FOREACH(fnpp, Xficl_compile_set) (*fnpp)(pSys); - } #if defined(PC98) ficlSetEnv(pSys, "arch-pc98", FICL_TRUE); Modified: head/sys/boot/forth/Makefile.inc ============================================================================== --- head/sys/boot/forth/Makefile.inc Mon Oct 24 20:33:42 2016 (r307878) +++ head/sys/boot/forth/Makefile.inc Mon Oct 24 20:36:54 2016 (r307879) @@ -6,6 +6,7 @@ FILES+= brand-fbsd.4th FILES+= check-password.4th FILES+= color.4th FILES+= delay.4th +FILES+= efi.4th FILES+= frames.4th FILES+= loader.4th FILES+= loader.conf Added: head/sys/boot/forth/efi.4th ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/forth/efi.4th Mon Oct 24 20:36:54 2016 (r307879) @@ -0,0 +1,30 @@ +\ Copyright (c) 2016 Netflix, Inc +\ 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. +\ +\ $FreeBSD$ + +only forth definitions + +\ Place holder for more functions +.( EFI boot environment) cr Modified: head/sys/boot/forth/loader.4th ============================================================================== --- head/sys/boot/forth/loader.4th Mon Oct 24 20:33:42 2016 (r307878) +++ head/sys/boot/forth/loader.4th Mon Oct 24 20:36:54 2016 (r307879) @@ -46,6 +46,9 @@ include /boot/support.4th include /boot/color.4th include /boot/delay.4th include /boot/check-password.4th +s" efi-boot" environment? [if] [if] + include /boot/efi.4th +[then] [then] only forth definitions From owner-svn-src-head@freebsd.org Mon Oct 24 20:47:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10BDBC1F998; Mon, 24 Oct 2016 20:47:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E00319C0; Mon, 24 Oct 2016 20:47:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OKll6w005755; Mon, 24 Oct 2016 20:47:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OKlknk005749; Mon, 24 Oct 2016 20:47:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610242047.u9OKlknk005749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 24 Oct 2016 20:47:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307880 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 20:47:48 -0000 Author: kib Date: Mon Oct 24 20:47:46 2016 New Revision: 307880 URL: https://svnweb.freebsd.org/changeset/base/307880 Log: Follow-up to r307866: - Make !KDB config buildable. - Simplify interface to nmi_handle_intr() by evaluating panic_on_nmi in one place, namely nmi_call_kdb(). This allows to remove do_panic argument from the functions, and to remove i386/amd64 duplication of the variable and sysctl definitions. Note that now NMI causes panic(9) instead of trap_fatal() reporting and then panic(9), consistently for NMIs delivered while CPU operated in ring 0 and 3. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/amd64/amd64/trap.c head/sys/i386/i386/trap.c head/sys/x86/include/x86_var.h head/sys/x86/x86/cpu_machdep.c head/sys/x86/x86/mp_x86.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Mon Oct 24 20:36:54 2016 (r307879) +++ head/sys/amd64/amd64/trap.c Mon Oct 24 20:47:46 2016 (r307880) @@ -144,9 +144,6 @@ static char *trap_msg[] = { "DTrace pid return trap", /* 32 T_DTRACE_RET */ }; -static int panic_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN, - &panic_on_nmi, 0, "Panic on NMI"); static int prot_fault_translation; SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RWTUN, &prot_fault_translation, 0, @@ -372,7 +369,7 @@ trap(struct trapframe *frame) #ifdef DEV_ISA case T_NMI: - nmi_handle_intr(type, frame, true); + nmi_handle_intr(type, frame); break; #endif /* DEV_ISA */ @@ -544,10 +541,8 @@ trap(struct trapframe *frame) #ifdef DEV_ISA case T_NMI: - if (nmi_handle_intr(type, frame, false) || - !panic_on_nmi) - goto out; - /* FALLTHROUGH */ + nmi_handle_intr(type, frame); + goto out; #endif /* DEV_ISA */ } Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Mon Oct 24 20:36:54 2016 (r307879) +++ head/sys/i386/i386/trap.c Mon Oct 24 20:47:46 2016 (r307880) @@ -158,14 +158,6 @@ static char *trap_msg[] = { int has_f00f_bug = 0; /* Initialized so that it can be patched. */ #endif -#ifdef KDB -static int kdb_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN, - &kdb_on_nmi, 0, "Go to KDB on NMI"); -#endif -static int panic_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN, - &panic_on_nmi, 0, "Panic on NMI"); static int prot_fault_translation = 0; SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW, &prot_fault_translation, 0, "Select signal to deliver on protection fault"); @@ -467,7 +459,7 @@ user_trctrap_out: } goto userout; #else /* !POWERFAIL_NMI */ - nmi_handle_intr(type, frame, true); + nmi_handle_intr(type, frame); break; #endif /* POWERFAIL_NMI */ #endif /* DEV_ISA */ @@ -716,10 +708,8 @@ kernel_trctrap: } goto out; #else /* !POWERFAIL_NMI */ - if (nmi_handle_intr(type, frame, false) || - !panic_on_nmi) - goto out; - /* FALLTHROUGH */ + nmi_handle_intr(type, frame); + goto out; #endif /* POWERFAIL_NMI */ #endif /* DEV_ISA */ } Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Mon Oct 24 20:36:54 2016 (r307879) +++ head/sys/x86/include/x86_var.h Mon Oct 24 20:47:46 2016 (r307880) @@ -108,10 +108,9 @@ bool fix_cpuid(void); void fillw(int /*u_short*/ pat, void *base, size_t cnt); int is_physical_memory(vm_paddr_t addr); int isa_nmi(int cd); -bool nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame, - bool panic); -bool nmi_call_kdb_smp(u_int type, struct trapframe *frame, bool panic); -int nmi_handle_intr(u_int type, struct trapframe *frame, bool panic); +void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); +void nmi_call_kdb_smp(u_int type, struct trapframe *frame); +void nmi_handle_intr(u_int type, struct trapframe *frame); void pagecopy(void *from, void *to); void printcpuinfo(void); int user_dbreg_trap(void); Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Mon Oct 24 20:36:54 2016 (r307879) +++ head/sys/x86/x86/cpu_machdep.c Mon Oct 24 20:47:46 2016 (r307880) @@ -524,6 +524,10 @@ idle_sysctl(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, idle_sysctl, "A", "currently selected idle function"); +static int panic_on_nmi = 1; +SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN, + &panic_on_nmi, 0, + "Panic on NMI"); int nmi_is_broadcast = 1; SYSCTL_INT(_machdep, OID_AUTO, nmi_is_broadcast, CTLFLAG_RWTUN, &nmi_is_broadcast, 0, @@ -536,8 +540,8 @@ SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nm #endif #ifdef DEV_ISA -bool -nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame, bool do_panic) +void +nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame) { /* machine/parity/power fail/"kitchen sink" faults */ @@ -549,26 +553,25 @@ nmi_call_kdb(u_int cpu, u_int type, stru if (kdb_on_nmi) { printf ("NMI/cpu%d ... going to debugger\n", cpu); kdb_trap(type, 0, frame); - return (true); } - } else #endif /* KDB */ - if (do_panic) + } else if (panic_on_nmi) { panic("NMI indicates hardware failure"); - return (false); + } } #endif -int -nmi_handle_intr(u_int type, struct trapframe *frame, bool panic) +void +nmi_handle_intr(u_int type, struct trapframe *frame) { #ifdef DEV_ISA #ifdef SMP - if (nmi_is_broadcast) - return (nmi_call_kdb_smp(type, frame, panic)); - else + if (nmi_is_broadcast) { + nmi_call_kdb_smp(type, frame); + return; + } #endif - return (nmi_call_kdb(0, type, frame, panic)); + nmi_call_kdb(0, type, frame); #endif } Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Mon Oct 24 20:36:54 2016 (r307879) +++ head/sys/x86/x86/mp_x86.c Mon Oct 24 20:47:46 2016 (r307880) @@ -1216,18 +1216,17 @@ ipi_nmi_handler(void) #ifdef DEV_ISA int nmi_kdb_lock; -bool -nmi_call_kdb_smp(u_int type, struct trapframe *frame, bool do_panic) +void +nmi_call_kdb_smp(u_int type, struct trapframe *frame) { int cpu; - bool call_post, ret; + bool call_post; cpu = PCPU_GET(cpuid); if (atomic_cmpset_acq_int(&nmi_kdb_lock, 0, 1)) { - ret = nmi_call_kdb(cpu, type, frame, do_panic); + nmi_call_kdb(cpu, type, frame); call_post = false; } else { - ret = true; savectx(&stoppcbs[cpu]); CPU_SET_ATOMIC(cpu, &stopped_cpus); while (!atomic_cmpset_acq_int(&nmi_kdb_lock, 0, 1)) @@ -1237,7 +1236,6 @@ nmi_call_kdb_smp(u_int type, struct trap atomic_store_rel_int(&nmi_kdb_lock, 0); if (call_post) cpustop_handler_post(cpu); - return (ret); } #endif From owner-svn-src-head@freebsd.org Mon Oct 24 20:53:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FC86C1FB9D; Mon, 24 Oct 2016 20:53:45 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47CB9F1C; Mon, 24 Oct 2016 20:53:45 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OKriEN009551; Mon, 24 Oct 2016 20:53:44 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OKriuB009550; Mon, 24 Oct 2016 20:53:44 GMT (envelope-from np@FreeBSD.org) Message-Id: <201610242053.u9OKriuB009550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 24 Oct 2016 20:53:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307881 - head/sys/contrib/rdma/krping X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 20:53:45 -0000 Author: np Date: Mon Oct 24 20:53:44 2016 New Revision: 307881 URL: https://svnweb.freebsd.org/changeset/base/307881 Log: krping: Allow the underlying ib_device to handle DMA mappings. Submitted by: Vijay Singh @ Netapp Modified: head/sys/contrib/rdma/krping/krping.c Modified: head/sys/contrib/rdma/krping/krping.c ============================================================================== --- head/sys/contrib/rdma/krping/krping.c Mon Oct 24 20:47:46 2016 (r307880) +++ head/sys/contrib/rdma/krping/krping.c Mon Oct 24 20:53:44 2016 (r307881) @@ -548,11 +548,11 @@ static int krping_setup_buffers(struct k DEBUG_LOG(cb, "krping_setup_buffers called on cb %p\n", cb); - cb->recv_dma_addr = dma_map_single(cb->pd->device->dma_device, + cb->recv_dma_addr = ib_dma_map_single(cb->pd->device, &cb->recv_buf, sizeof(cb->recv_buf), DMA_BIDIRECTIONAL); pci_unmap_addr_set(cb, recv_mapping, cb->recv_dma_addr); - cb->send_dma_addr = dma_map_single(cb->pd->device->dma_device, + cb->send_dma_addr = ib_dma_map_single(cb->pd->device, &cb->send_buf, sizeof(cb->send_buf), DMA_BIDIRECTIONAL); pci_unmap_addr_set(cb, send_mapping, cb->send_dma_addr); @@ -606,7 +606,7 @@ static int krping_setup_buffers(struct k goto bail; } - cb->rdma_dma_addr = dma_map_single(cb->pd->device->dma_device, + cb->rdma_dma_addr = ib_dma_map_single(cb->pd->device, cb->rdma_buf, cb->size, DMA_BIDIRECTIONAL); pci_unmap_addr_set(cb, rdma_mapping, cb->rdma_dma_addr); @@ -676,7 +676,7 @@ static int krping_setup_buffers(struct k goto bail; } - cb->start_dma_addr = dma_map_single(cb->pd->device->dma_device, + cb->start_dma_addr = ib_dma_map_single(cb->pd->device, cb->start_buf, cb->size, DMA_BIDIRECTIONAL); pci_unmap_addr_set(cb, start_mapping, cb->start_dma_addr); @@ -1707,7 +1707,7 @@ static void krping_fr_test5(struct krpin goto err2; } DEBUG_LOG(cb, "%s buf[%u] %p\n", __func__, scnt, buf[scnt]); - dma_addr[scnt] = dma_map_single(cb->pd->device->dma_device, + dma_addr[scnt] = ib_dma_map_single(cb->pd->device, buf[scnt], cb->size, DMA_BIDIRECTIONAL); if (dma_mapping_error(cb->pd->device->dma_device, @@ -2032,7 +2032,7 @@ static void krping_fr_test6(struct krpin goto err2; } DEBUG_LOG(cb, "%s buf[%u] %p\n", __func__, scnt, buf[scnt]); - dma_addr[scnt] = dma_map_single(cb->pd->device->dma_device, + dma_addr[scnt] = ib_dma_map_single(cb->pd->device, buf[scnt], cb->size, DMA_BIDIRECTIONAL); if (dma_mapping_error(cb->pd->device->dma_device, From owner-svn-src-head@freebsd.org Mon Oct 24 21:05:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEBA9C2003D; Mon, 24 Oct 2016 21:05:24 +0000 (UTC) (envelope-from syrinx@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9095CA51; Mon, 24 Oct 2016 21:05:24 +0000 (UTC) (envelope-from syrinx@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OL5N2N013429; Mon, 24 Oct 2016 21:05:23 GMT (envelope-from syrinx@FreeBSD.org) Received: (from syrinx@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OL5NdK013428; Mon, 24 Oct 2016 21:05:23 GMT (envelope-from syrinx@FreeBSD.org) Message-Id: <201610242105.u9OL5NdK013428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: syrinx set sender to syrinx@FreeBSD.org using -f From: Shteryana Shopova Date: Mon, 24 Oct 2016 21:05:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307882 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 21:05:24 -0000 Author: syrinx Date: Mon Oct 24 21:05:23 2016 New Revision: 307882 URL: https://svnweb.freebsd.org/changeset/base/307882 Log: Fix a regression introduced in SVN r256678 that breaks USM header parsing Reviewed by: bz@ Modified: head/contrib/bsnmp/lib/snmp.c Modified: head/contrib/bsnmp/lib/snmp.c ============================================================================== --- head/contrib/bsnmp/lib/snmp.c Mon Oct 24 20:53:44 2016 (r307881) +++ head/contrib/bsnmp/lib/snmp.c Mon Oct 24 21:05:23 2016 (r307882) @@ -288,7 +288,7 @@ parse_secparams(struct asn_buf *b, struc memset(buf, 0, 256); tb.asn_ptr = buf; tb.asn_len = 256; - u_int len; + u_int len = 256; if (asn_get_octetstring(b, buf, &len) != ASN_ERR_OK) { snmp_error("cannot parse usm header"); From owner-svn-src-head@freebsd.org Mon Oct 24 21:09:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B74CC202C8; Mon, 24 Oct 2016 21:09:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E185FF52; Mon, 24 Oct 2016 21:09:49 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OL9nPS013666; Mon, 24 Oct 2016 21:09:49 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OL9ntn013665; Mon, 24 Oct 2016 21:09:49 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201610242109.u9OL9ntn013665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 24 Oct 2016 21:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307883 - head/sys/boot/fdt/dts/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.23 Precedence: list List-Id: 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, 24 Oct 2016 21:09:50 -0000 Author: manu Date: Mon Oct 24 21:09:48 2016 New Revision: 307883 URL: https://svnweb.freebsd.org/changeset/base/307883 Log: Add needed cpu-supply property for cpufreq. Patch is merged upstream, in the meantime add it in our DTS. Modified: head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts Modified: head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts Mon Oct 24 21:05:23 2016 (r307882) +++ head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts Mon Oct 24 21:09:48 2016 (r307883) @@ -41,3 +41,7 @@ }; }; }; + +&cpu0 { + cpu-supply = <®_dcdc2>; +}; From owner-svn-src-head@freebsd.org Mon Oct 24 21:16:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E3D9C2047A; Mon, 24 Oct 2016 21:16:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2DE7A623; Mon, 24 Oct 2016 21:16:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OLGL3N017568; Mon, 24 Oct 2016 21:16:21 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OLGLQ8017567; Mon, 24 Oct 2016 21:16:21 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610242116.u9OLGLQ8017567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 24 Oct 2016 21:16:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307884 - head/release/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 21:16:22 -0000 Author: gjb Date: Mon Oct 24 21:16:21 2016 New Revision: 307884 URL: https://svnweb.freebsd.org/changeset/base/307884 Log: Belatedly revert r303119, which was determined to not be needed. Sponsored by: The FreeBSD Foundation Modified: head/release/tools/arm.subr Modified: head/release/tools/arm.subr ============================================================================== --- head/release/tools/arm.subr Mon Oct 24 21:09:48 2016 (r307883) +++ head/release/tools/arm.subr Mon Oct 24 21:16:21 2016 (r307884) @@ -88,7 +88,6 @@ arm_create_user() { -c 'FreeBSD User' -d '/home/freebsd' -s '/bin/csh' chroot ${CHROOTDIR} /usr/sbin/pw -R ${DESTDIR} \ usermod root -w yes - chroot ${CHROOTDIR} ln -s /home ${DESTDIR}/usr/home return 0 } From owner-svn-src-head@freebsd.org Mon Oct 24 22:11:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB496C20F9D; Mon, 24 Oct 2016 22:11:34 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79E643DE; Mon, 24 Oct 2016 22:11:34 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OMBXxW039062; Mon, 24 Oct 2016 22:11:33 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OMBXia039061; Mon, 24 Oct 2016 22:11:33 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201610242211.u9OMBXia039061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Mon, 24 Oct 2016 22:11:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307887 - 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.23 Precedence: list List-Id: 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, 24 Oct 2016 22:11:34 -0000 Author: rstone Date: Mon Oct 24 22:11:33 2016 New Revision: 307887 URL: https://svnweb.freebsd.org/changeset/base/307887 Log: Fix ip_output() on point-to-point links In r304435, ip_output() was changed to use the result of the route lookup to decide whether the outgoing packet was a broadcast or not. This introduced a regression on interfaces where IFF_BROADCAST was not set (e.g. point-to-point links), as the algorithm could incorrectly treat the destination address as a broadcast address, and ip_output() would subsequently drop the packet as broadcasting on a non-IFF_BROADCAST interface is not allowed. Differential Revision: https://reviews.freebsd.org/D8303 Reviewed by: jtl Reported by: ambrisko MFC after: 2 weeks X-MFC-With: r304435 Sponsored by: Dell EMC Isilon Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Mon Oct 24 21:33:00 2016 (r307886) +++ head/sys/netinet/ip_output.c Mon Oct 24 22:11:33 2016 (r307887) @@ -350,7 +350,8 @@ again: have_ia_ref = 1; ifp = ia->ia_ifp; ip->ip_ttl = 1; - isbroadcast = in_ifaddr_broadcast(dst->sin_addr, ia); + isbroadcast = ifp->if_flags & IFF_BROADCAST ? + in_ifaddr_broadcast(dst->sin_addr, ia) : 0; } else if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) && imo != NULL && imo->imo_multicast_ifp != NULL) { /* @@ -403,8 +404,10 @@ again: gw = (struct sockaddr_in *)rte->rt_gateway; if (rte->rt_flags & RTF_HOST) isbroadcast = (rte->rt_flags & RTF_BROADCAST); - else + else if (ifp->if_flags & IFF_BROADCAST) isbroadcast = in_ifaddr_broadcast(gw->sin_addr, ia); + else + isbroadcast = 0; } /* From owner-svn-src-head@freebsd.org Mon Oct 24 22:35:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20149C1F8A6; Mon, 24 Oct 2016 22:35:14 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0A2AFC0; Mon, 24 Oct 2016 22:35:13 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OMZCUO048270; Mon, 24 Oct 2016 22:35:12 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OMZChp048269; Mon, 24 Oct 2016 22:35:12 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201610242235.u9OMZChp048269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 24 Oct 2016 22:35:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307888 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 24 Oct 2016 22:35:14 -0000 Author: jmcneill Date: Mon Oct 24 22:35:12 2016 New Revision: 307888 URL: https://svnweb.freebsd.org/changeset/base/307888 Log: Defer cpufreq updates from intr handler to the taskqueue_thread queue. Modified: head/sys/arm/allwinner/aw_thermal.c Modified: head/sys/arm/allwinner/aw_thermal.c ============================================================================== --- head/sys/arm/allwinner/aw_thermal.c Mon Oct 24 22:11:33 2016 (r307887) +++ head/sys/arm/allwinner/aw_thermal.c Mon Oct 24 22:35:12 2016 (r307888) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -249,6 +250,7 @@ struct aw_thermal_softc { struct resource *res[2]; struct aw_thermal_config *conf; + struct task cf_task; int throttle; int min_freq; struct cf_level levels[MAX_CF_LEVELS]; @@ -390,6 +392,16 @@ aw_thermal_throttle(struct aw_thermal_so } static void +aw_thermal_cf_task(void *arg, int pending) +{ + struct aw_thermal_softc *sc; + + sc = arg; + + aw_thermal_throttle(sc, 1); +} + +static void aw_thermal_cf_pre_change(void *arg, const struct cf_level *level, int *status) { struct aw_thermal_softc *sc; @@ -430,7 +442,7 @@ aw_thermal_intr(void *arg) } if ((ints & ALARM_INT_ALL) != 0) - aw_thermal_throttle(sc, 1); + taskqueue_enqueue(taskqueue_thread, &sc->cf_task); } static int @@ -461,6 +473,7 @@ aw_thermal_attach(device_t dev) ih = NULL; sc->conf = THS_CONF(dev); + TASK_INIT(&sc->cf_task, 0, aw_thermal_cf_task, sc); if (bus_alloc_resources(dev, aw_thermal_spec, sc->res) != 0) { device_printf(dev, "cannot allocate resources for device\n"); From owner-svn-src-head@freebsd.org Mon Oct 24 22:35:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DE6DC1F8F5; Mon, 24 Oct 2016 22:35:47 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F151C188; Mon, 24 Oct 2016 22:35:46 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OMZkZ8048332; Mon, 24 Oct 2016 22:35:46 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OMZkXX048331; Mon, 24 Oct 2016 22:35:46 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201610242235.u9OMZkXX048331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 24 Oct 2016 22:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307889 - 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.23 Precedence: list List-Id: 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, 24 Oct 2016 22:35:47 -0000 Author: jmcneill Date: Mon Oct 24 22:35:45 2016 New Revision: 307889 URL: https://svnweb.freebsd.org/changeset/base/307889 Log: Enable driver for SY8106A Buck Regulator. Modified: head/sys/arm/conf/GENERIC Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Mon Oct 24 22:35:12 2016 (r307888) +++ head/sys/arm/conf/GENERIC Mon Oct 24 22:35:45 2016 (r307889) @@ -112,6 +112,7 @@ device axp209 # AXP209 Power Manageme device axp81x # AXP813/818 Power Management Unit device bcm2835_bsc device icee +device sy8106a # SY8106A Buck Regulator # GPIO device gpio From owner-svn-src-head@freebsd.org Tue Oct 25 00:52:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F2C6C1ED0A; Tue, 25 Oct 2016 00:52:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C14E9C6; Tue, 25 Oct 2016 00:52:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9P0qgU3000864; Tue, 25 Oct 2016 00:52:42 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9P0qgr3000863; Tue, 25 Oct 2016 00:52:42 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201610250052.u9P0qgr3000863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Oct 2016 00:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307890 - head/usr.sbin/mountd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 00:52:43 -0000 Author: rmacklem Date: Tue Oct 25 00:52:42 2016 New Revision: 307890 URL: https://svnweb.freebsd.org/changeset/base/307890 Log: mountd(8) was erroneously setting the sysctl for the old NFS server when the new/default NFS server was running, for the "-n" option. This patch fixes the problem for head and stable/11. For stable/10 the patch will need to be modified when MFC'd, since the stable/10 mountd.c handles both old and new NFS servers. Since the new NFS server uses vfs.nfsd.nfs_privport == 0 by default, there wouldn't have been many users affected by the code not setting it to 0 when the "-n" option was specified. PR: 213450 Submitted by: rs@bytecamp.net MFC after: 2 weeks Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Mon Oct 24 22:35:45 2016 (r307889) +++ head/usr.sbin/mountd/mountd.c Tue Oct 25 00:52:42 2016 (r307890) @@ -476,7 +476,7 @@ main(int argc, char **argv) rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); if (!resvport_only) { - if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL, + if (sysctlbyname("vfs.nfsd.nfs_privport", NULL, NULL, &resvport_only, sizeof(resvport_only)) != 0 && errno != ENOENT) { syslog(LOG_ERR, "sysctl: %m"); From owner-svn-src-head@freebsd.org Tue Oct 25 00:59:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C3F5C1EDEB; Tue, 25 Oct 2016 00:59:24 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B10CBB2; Tue, 25 Oct 2016 00:59:24 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9P0xN3o001150; Tue, 25 Oct 2016 00:59:23 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9P0xNeN001149; Tue, 25 Oct 2016 00:59:23 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201610250059.u9P0xNeN001149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Oct 2016 00:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307891 - head/usr.sbin/mountd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 00:59:24 -0000 Author: rmacklem Date: Tue Oct 25 00:59:23 2016 New Revision: 307891 URL: https://svnweb.freebsd.org/changeset/base/307891 Log: Fix the man page to reflect the change done by r307890 to mountd.c so that the "-n" option uses the sysctl for the new NFS server. This is a content change. PR: 213450 Submitted by: rs@bytecamp.net MFC after: 2 weeks Modified: head/usr.sbin/mountd/mountd.8 Modified: head/usr.sbin/mountd/mountd.8 ============================================================================== --- head/usr.sbin/mountd/mountd.8 Tue Oct 25 00:52:42 2016 (r307890) +++ head/usr.sbin/mountd/mountd.8 Tue Oct 25 00:59:23 2016 (r307891) @@ -28,7 +28,7 @@ .\" @(#)mountd.8 8.4 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd October 14, 2012 +.Dd October 24, 2016 .Dt MOUNTD 8 .Os .Sh NAME @@ -95,7 +95,7 @@ requests to be logged. Allow non-root mount requests to be served. This should only be specified if there are clients such as PC's, that require it. -It will automatically clear the vfs.nfsrv.nfs_privport sysctl flag, which +It will automatically clear the vfs.nfsd.nfs_privport sysctl flag, which controls if the kernel will accept NFS requests from reserved ports only. .It Fl p Ar port Force From owner-svn-src-head@freebsd.org Tue Oct 25 01:32:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDAB8C1FDE2; Tue, 25 Oct 2016 01:32:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F790F03; Tue, 25 Oct 2016 01:32:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9P1WZJd015825; Tue, 25 Oct 2016 01:32:35 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9P1WZWJ015824; Tue, 25 Oct 2016 01:32:35 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610250132.u9P1WZWJ015824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 25 Oct 2016 01:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307892 - head/lib/libc/powerpc/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.23 Precedence: list List-Id: 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, 25 Oct 2016 01:32:36 -0000 Author: jhibbits Date: Tue Oct 25 01:32:35 2016 New Revision: 307892 URL: https://svnweb.freebsd.org/changeset/base/307892 Log: Fix a typo which broke the build for powerpc. It's spelled LIBC_SRCTOP not LIBC_SRC. Pointy-hat to: jhibbits Reported by: kib Modified: head/lib/libc/powerpc/gen/Makefile.inc Modified: head/lib/libc/powerpc/gen/Makefile.inc ============================================================================== --- head/lib/libc/powerpc/gen/Makefile.inc Tue Oct 25 00:59:23 2016 (r307891) +++ head/lib/libc/powerpc/gen/Makefile.inc Tue Oct 25 01:32:35 2016 (r307892) @@ -1,6 +1,6 @@ # $FreeBSD$ -.include "${LIBC_SRC}/powerpc/gen/Makefile.common" +.include "${LIBC_SRCTOP}/powerpc/gen/Makefile.common" SRCS += fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ fpgetsticky.c fpsetmask.c fpsetround.c \ From owner-svn-src-head@freebsd.org Tue Oct 25 01:41:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B540C1FFE5; Tue, 25 Oct 2016 01:41:41 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D41B26B; Tue, 25 Oct 2016 01:41:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9P1feKB016879; Tue, 25 Oct 2016 01:41:40 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9P1fe7F016878; Tue, 25 Oct 2016 01:41:40 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610250141.u9P1fe7F016878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 25 Oct 2016 01:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307893 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 01:41:41 -0000 Author: sephe Date: Tue Oct 25 01:41:39 2016 New Revision: 307893 URL: https://svnweb.freebsd.org/changeset/base/307893 Log: hyperv/hn: Set baudrate properly PR: 208931 Submitted by: Eugene Grosbein Reported by: Eugene Grosbein MFC after: 1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Oct 25 01:32:35 2016 (r307892) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Oct 25 01:41:39 2016 (r307893) @@ -789,6 +789,7 @@ netvsc_attach(device_t dev) * Setup the ifnet for this interface. */ + ifp->if_baudrate = IF_Gbps(10); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; ifp->if_init = hn_init; From owner-svn-src-head@freebsd.org Tue Oct 25 03:55:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3B8BC2087B; Tue, 25 Oct 2016 03:55:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9EE6B98F; Tue, 25 Oct 2016 03:55:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9P3tuko069967; Tue, 25 Oct 2016 03:55:56 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9P3tuHQ069966; Tue, 25 Oct 2016 03:55:56 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201610250355.u9P3tuHQ069966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 25 Oct 2016 03:55:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307897 - head/sys/dev/bxe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 03:55:57 -0000 Author: bdrewery Date: Tue Oct 25 03:55:56 2016 New Revision: 307897 URL: https://svnweb.freebsd.org/changeset/base/307897 Log: Use proper if_getdrvflags() API. This is a NOP. Sponsored by: Dell EMC Isilon Modified: head/sys/dev/bxe/bxe.c Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Tue Oct 25 03:34:24 2016 (r307896) +++ head/sys/dev/bxe/bxe.c Tue Oct 25 03:55:56 2016 (r307897) @@ -5603,7 +5603,7 @@ bxe_tx_start(if_t ifp) fp = &sc->fp[0]; - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE) { fp->eth_q_stats.tx_queue_full_return++; return; } @@ -5643,7 +5643,7 @@ bxe_tx_mq_start_locked(struct bxe_softc } } - if (!sc->link_vars.link_up || !(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + if (!sc->link_vars.link_up || !(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) { fp->eth_q_stats.tx_request_link_down_failures++; goto bxe_tx_mq_start_locked_exit; } From owner-svn-src-head@freebsd.org Tue Oct 25 05:03:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 272C4C20B11; Tue, 25 Oct 2016 05:03:35 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0089BBF3; Tue, 25 Oct 2016 05:03:34 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9P53YHR096547; Tue, 25 Oct 2016 05:03:34 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9P53XjF096540; Tue, 25 Oct 2016 05:03:33 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201610250503.u9P53XjF096540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Tue, 25 Oct 2016 05:03:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307899 - in head/sys/netinet: . cc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 05:03:35 -0000 Author: hiren Date: Tue Oct 25 05:03:33 2016 New Revision: 307899 URL: https://svnweb.freebsd.org/changeset/base/307899 Log: In Collaboration with: Matt Macy Reviewed by: jtl Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D8225 Modified: head/sys/netinet/cc/cc_cdg.c head/sys/netinet/cc/cc_chd.c head/sys/netinet/cc/cc_cubic.c head/sys/netinet/cc/cc_dctcp.c head/sys/netinet/cc/cc_htcp.c head/sys/netinet/cc/cc_newreno.c head/sys/netinet/tcp_input.c Modified: head/sys/netinet/cc/cc_cdg.c ============================================================================== --- head/sys/netinet/cc/cc_cdg.c Tue Oct 25 04:14:03 2016 (r307898) +++ head/sys/netinet/cc/cc_cdg.c Tue Oct 25 05:03:33 2016 (r307899) @@ -431,6 +431,11 @@ static void cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type) { struct cdg *cdg_data = ccv->cc_data; + uint32_t cwin; + u_int mss; + + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); switch(signal_type) { case CC_CDG_DELAY: @@ -448,7 +453,7 @@ cdg_cong_signal(struct cc_var *ccv, uint */ if (IN_CONGRECOVERY(CCV(ccv, t_flags)) || cdg_data->queue_state < CDG_Q_FULL) { - CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd); + CCV(ccv, snd_ssthresh) = cwin; CCV(ccv, snd_recover) = CCV(ccv, snd_max); } else { /* @@ -461,13 +466,17 @@ cdg_cong_signal(struct cc_var *ccv, uint cdg_data->shadow_w, RENO_BETA); CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w, - cdg_window_decrease(ccv, CCV(ccv, snd_cwnd), - V_cdg_beta_loss)); + cdg_window_decrease(ccv, cwin, V_cdg_beta_loss)); + CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); cdg_data->window_incr = cdg_data->rtt_count = 0; } ENTER_RECOVERY(CCV(ccv, t_flags)); break; + case CC_RTO: + CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2); + CCV(ccv, snd_cwnd) = mss; + break; default: newreno_cc_algo.cong_signal(ccv, signal_type); break; Modified: head/sys/netinet/cc/cc_chd.c ============================================================================== --- head/sys/netinet/cc/cc_chd.c Tue Oct 25 04:14:03 2016 (r307898) +++ head/sys/netinet/cc/cc_chd.c Tue Oct 25 05:03:33 2016 (r307899) @@ -330,10 +330,14 @@ chd_cong_signal(struct cc_var *ccv, uint struct ertt *e_t; struct chd *chd_data; int qdly; + uint32_t cwin; + u_int mss; e_t = khelp_get_osd(CCV(ccv, osd), ertt_id); chd_data = ccv->cc_data; qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt; + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); switch(signal_type) { case CC_CHD_DELAY: @@ -373,6 +377,10 @@ chd_cong_signal(struct cc_var *ccv, uint } ENTER_FASTRECOVERY(CCV(ccv, t_flags)); break; + case CC_RTO: + CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2); + CCV(ccv, snd_cwnd) = mss; + break; default: newreno_cc_algo.cong_signal(ccv, signal_type); Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Tue Oct 25 04:14:03 2016 (r307898) +++ head/sys/netinet/cc/cc_cubic.c Tue Oct 25 05:03:33 2016 (r307899) @@ -225,8 +225,12 @@ static void cubic_cong_signal(struct cc_var *ccv, uint32_t type) { struct cubic *cubic_data; + uint32_t cwin; + u_int mss; cubic_data = ccv->cc_data; + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: @@ -235,7 +239,8 @@ cubic_cong_signal(struct cc_var *ccv, ui cubic_ssthresh_update(ccv); cubic_data->num_cong_events++; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = CCV(ccv, snd_cwnd); + cubic_data->max_cwnd = cwin; + CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -246,7 +251,7 @@ cubic_cong_signal(struct cc_var *ccv, ui cubic_ssthresh_update(ccv); cubic_data->num_cong_events++; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = CCV(ccv, snd_cwnd); + cubic_data->max_cwnd = cwin; cubic_data->t_last_cong = ticks; CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); @@ -261,9 +266,13 @@ cubic_cong_signal(struct cc_var *ccv, ui * chance the first one is a false alarm and may not indicate * congestion. */ - if (CCV(ccv, t_rxtshift) >= 2) + if (CCV(ccv, t_rxtshift) >= 2) { cubic_data->num_cong_events++; cubic_data->t_last_cong = ticks; + cubic_ssthresh_update(ccv); + cubic_data->max_cwnd = cwin; + CCV(ccv, snd_cwnd) = mss; + } break; } } Modified: head/sys/netinet/cc/cc_dctcp.c ============================================================================== --- head/sys/netinet/cc/cc_dctcp.c Tue Oct 25 04:14:03 2016 (r307898) +++ head/sys/netinet/cc/cc_dctcp.c Tue Oct 25 05:03:33 2016 (r307899) @@ -230,10 +230,11 @@ static void dctcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct dctcp *dctcp_data; - u_int win, mss; + uint32_t cwin; + u_int mss; dctcp_data = ccv->cc_data; - win = CCV(ccv, snd_cwnd); + cwin = CCV(ccv, snd_cwnd); mss = CCV(ccv, t_maxseg); switch (type) { @@ -241,16 +242,16 @@ dctcp_cong_signal(struct cc_var *ccv, ui if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { CCV(ccv, snd_ssthresh) = mss * - max(win / 2 / mss, 2); + max(cwin / 2 / mss, 2); dctcp_data->num_cong_events++; } else { /* cwnd has already updated as congestion * recovery. Reverse cwnd value using * snd_cwnd_prev and recalculate snd_ssthresh */ - win = CCV(ccv, snd_cwnd_prev); + cwin = CCV(ccv, snd_cwnd_prev); CCV(ccv, snd_ssthresh) = - max(win / 2 / mss, 2) * mss; + max(cwin / 2 / mss, 2) * mss; } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -260,18 +261,18 @@ dctcp_cong_signal(struct cc_var *ccv, ui * Save current snd_cwnd when the host encounters both * congestion recovery and fast recovery. */ - CCV(ccv, snd_cwnd_prev) = win; + CCV(ccv, snd_cwnd_prev) = cwin; if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { if (V_dctcp_slowstart && dctcp_data->num_cong_events++ == 0) { CCV(ccv, snd_ssthresh) = - mss * max(win / 2 / mss, 2); + mss * max(cwin / 2 / mss, 2); dctcp_data->alpha = MAX_ALPHA_VALUE; dctcp_data->bytes_ecn = 0; dctcp_data->bytes_total = 0; dctcp_data->save_sndnxt = CCV(ccv, snd_nxt); } else - CCV(ccv, snd_ssthresh) = max((win - ((win * + CCV(ccv, snd_ssthresh) = max((cwin - ((cwin * dctcp_data->alpha) >> 11)) / mss, 2) * mss; CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); @@ -284,6 +285,8 @@ dctcp_cong_signal(struct cc_var *ccv, ui dctcp_update_alpha(ccv); dctcp_data->save_sndnxt += CCV(ccv, t_maxseg); dctcp_data->num_cong_events++; + CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2); + CCV(ccv, snd_cwnd) = mss; } break; } Modified: head/sys/netinet/cc/cc_htcp.c ============================================================================== --- head/sys/netinet/cc/cc_htcp.c Tue Oct 25 04:14:03 2016 (r307898) +++ head/sys/netinet/cc/cc_htcp.c Tue Oct 25 05:03:33 2016 (r307899) @@ -271,8 +271,12 @@ static void htcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct htcp *htcp_data; + uint32_t cwin; + u_int mss; htcp_data = ccv->cc_data; + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: @@ -287,8 +291,9 @@ htcp_cong_signal(struct cc_var *ccv, uin (htcp_data->maxrtt - htcp_data->minrtt) * 95) / 100; htcp_ssthresh_update(ccv); + CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); htcp_data->t_last_cong = ticks; - htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); + htcp_data->prev_cwnd = cwin; } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -305,7 +310,7 @@ htcp_cong_signal(struct cc_var *ccv, uin htcp_ssthresh_update(ccv); CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); htcp_data->t_last_cong = ticks; - htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); + htcp_data->prev_cwnd = cwin; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; @@ -320,6 +325,8 @@ htcp_cong_signal(struct cc_var *ccv, uin */ if (CCV(ccv, t_rxtshift) >= 2) htcp_data->t_last_cong = ticks; + CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2); + CCV(ccv, snd_cwnd) = mss; break; } } Modified: head/sys/netinet/cc/cc_newreno.c ============================================================================== --- head/sys/netinet/cc/cc_newreno.c Tue Oct 25 04:14:03 2016 (r307898) +++ head/sys/netinet/cc/cc_newreno.c Tue Oct 25 05:03:33 2016 (r307899) @@ -182,30 +182,39 @@ newreno_after_idle(struct cc_var *ccv) static void newreno_cong_signal(struct cc_var *ccv, uint32_t type) { - u_int win; + uint32_t cwin; + u_int mss; + + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); /* Catch algos which mistakenly leak private signal types. */ KASSERT((type & CC_SIGPRIVMASK) == 0, ("%s: congestion signal type 0x%08x is private\n", __func__, type)); - win = max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) * - CCV(ccv, t_maxseg); + cwin = max(2*mss, cwin/2); switch (type) { case CC_NDUPACK: if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { - if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) - CCV(ccv, snd_ssthresh) = win; + if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { + CCV(ccv, snd_ssthresh) = cwin; + CCV(ccv, snd_cwnd) = cwin; + } ENTER_RECOVERY(CCV(ccv, t_flags)); } break; case CC_ECN: if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = win; - CCV(ccv, snd_cwnd) = win; + CCV(ccv, snd_ssthresh) = cwin; + CCV(ccv, snd_cwnd) = cwin; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; + case CC_RTO: + CCV(ccv, snd_ssthresh) = cwin; + CCV(ccv, snd_cwnd) = mss; + break; } } Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Oct 25 04:14:03 2016 (r307898) +++ head/sys/netinet/tcp_input.c Tue Oct 25 05:03:33 2016 (r307899) @@ -438,9 +438,15 @@ cc_cong_signal(struct tcpcb *tp, struct tp->t_dupacks = 0; tp->t_bytes_acked = 0; EXIT_RECOVERY(tp->t_flags); - tp->snd_ssthresh = max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 / - maxseg) * maxseg; - tp->snd_cwnd = maxseg; + if (CC_ALGO(tp)->cong_signal == NULL) { + /* + * RFC5681 Section 3.1 + * ssthresh = max (FlightSize / 2, 2*SMSS) eq (4) + */ + tp->snd_ssthresh = + max((tp->snd_max - tp->snd_una) / 2, 2 * maxseg); + tp->snd_cwnd = maxseg; + } break; case CC_RTO_ERR: TCPSTAT_INC(tcps_sndrexmitbad); @@ -2613,6 +2619,15 @@ tcp_do_segment(struct mbuf *m, struct tc if (awnd < tp->snd_ssthresh) { tp->snd_cwnd += maxseg; + /* + * RFC5681 Section 3.2 talks about cwnd + * inflation on additional dupacks and + * deflation on recovering from loss. + * + * We keep cwnd into check so that + * we don't have to 'deflate' it when we + * get out of recovery. + */ if (tp->snd_cwnd > tp->snd_ssthresh) tp->snd_cwnd = tp->snd_ssthresh; } @@ -2652,19 +2667,22 @@ tcp_do_segment(struct mbuf *m, struct tc TCPSTAT_INC( tcps_sack_recovery_episode); tp->sack_newdata = tp->snd_nxt; - tp->snd_cwnd = maxseg; + if (CC_ALGO(tp)->cong_signal == NULL) + tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); goto drop; } tp->snd_nxt = th->th_ack; - tp->snd_cwnd = maxseg; + if (CC_ALGO(tp)->cong_signal == NULL) + tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", __func__)); - tp->snd_cwnd = tp->snd_ssthresh + - maxseg * - (tp->t_dupacks - tp->snd_limited); + if (CC_ALGO(tp)->cong_signal == NULL) + tp->snd_cwnd = tp->snd_ssthresh + + maxseg * + (tp->t_dupacks - tp->snd_limited); if (SEQ_GT(onxt, tp->snd_nxt)) tp->snd_nxt = onxt; goto drop; From owner-svn-src-head@freebsd.org Tue Oct 25 05:04:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1617EC20CB3; Tue, 25 Oct 2016 05:04:28 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id 08A32F8C; Tue, 25 Oct 2016 05:04:27 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id 0A13E17B5E; Mon, 24 Oct 2016 22:04:27 -0700 (PDT) Date: Mon, 24 Oct 2016 22:04:26 -0700 From: Hiren Panchasara To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307899 - in head/sys/netinet: . cc Message-ID: <20161025050426.GE18015@strugglingcoder.info> References: <201610250503.u9P53XjF096540@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ILuaRSyQpoVaJ1HG" Content-Disposition: inline In-Reply-To: <201610250503.u9P53XjF096540@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 05:04:28 -0000 --ILuaRSyQpoVaJ1HG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Sigh. I'll revert this and do it right. On 10/25/16 at 05:03P, Hiren Panchasara wrote: > Author: hiren > Date: Tue Oct 25 05:03:33 2016 > New Revision: 307899 > URL: https://svnweb.freebsd.org/changeset/base/307899 >=20 > Log: > In Collaboration with: Matt Macy > Reviewed by: jtl > Sponsored by: Limelight Networks > Differential Revision: https://reviews.freebsd.org/D8225 >=20 > Modified: > head/sys/netinet/cc/cc_cdg.c > head/sys/netinet/cc/cc_chd.c > head/sys/netinet/cc/cc_cubic.c > head/sys/netinet/cc/cc_dctcp.c > head/sys/netinet/cc/cc_htcp.c > head/sys/netinet/cc/cc_newreno.c > head/sys/netinet/tcp_input.c >=20 > Modified: head/sys/netinet/cc/cc_cdg.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_cdg.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_cdg.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -431,6 +431,11 @@ static void > cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type) > { > struct cdg *cdg_data =3D ccv->cc_data; > + uint32_t cwin; > + u_int mss; > + > + cwin =3D CCV(ccv, snd_cwnd); > + mss =3D CCV(ccv, t_maxseg); > =20 > switch(signal_type) { > case CC_CDG_DELAY: > @@ -448,7 +453,7 @@ cdg_cong_signal(struct cc_var *ccv, uint > */ > if (IN_CONGRECOVERY(CCV(ccv, t_flags)) || > cdg_data->queue_state < CDG_Q_FULL) { > - CCV(ccv, snd_ssthresh) =3D CCV(ccv, snd_cwnd); > + CCV(ccv, snd_ssthresh) =3D cwin; > CCV(ccv, snd_recover) =3D CCV(ccv, snd_max); > } else { > /* > @@ -461,13 +466,17 @@ cdg_cong_signal(struct cc_var *ccv, uint > cdg_data->shadow_w, RENO_BETA); > =20 > CCV(ccv, snd_ssthresh) =3D max(cdg_data->shadow_w, > - cdg_window_decrease(ccv, CCV(ccv, snd_cwnd), > - V_cdg_beta_loss)); > + cdg_window_decrease(ccv, cwin, V_cdg_beta_loss)); > + CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > =20 > cdg_data->window_incr =3D cdg_data->rtt_count =3D 0; > } > ENTER_RECOVERY(CCV(ccv, t_flags)); > break; > + case CC_RTO: > + CCV(ccv, snd_ssthresh) =3D max(2*mss, cwin/2); > + CCV(ccv, snd_cwnd) =3D mss; > + break; > default: > newreno_cc_algo.cong_signal(ccv, signal_type); > break; >=20 > Modified: head/sys/netinet/cc/cc_chd.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_chd.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_chd.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -330,10 +330,14 @@ chd_cong_signal(struct cc_var *ccv, uint > struct ertt *e_t; > struct chd *chd_data; > int qdly; > + uint32_t cwin; > + u_int mss; > =20 > e_t =3D khelp_get_osd(CCV(ccv, osd), ertt_id); > chd_data =3D ccv->cc_data; > qdly =3D imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt; > + cwin =3D CCV(ccv, snd_cwnd); > + mss =3D CCV(ccv, t_maxseg); > =20 > switch(signal_type) { > case CC_CHD_DELAY: > @@ -373,6 +377,10 @@ chd_cong_signal(struct cc_var *ccv, uint > } > ENTER_FASTRECOVERY(CCV(ccv, t_flags)); > break; > + case CC_RTO: > + CCV(ccv, snd_ssthresh) =3D max(2*mss, cwin/2); > + CCV(ccv, snd_cwnd) =3D mss; > + break; > =20 > default: > newreno_cc_algo.cong_signal(ccv, signal_type); >=20 > Modified: head/sys/netinet/cc/cc_cubic.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_cubic.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_cubic.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -225,8 +225,12 @@ static void > cubic_cong_signal(struct cc_var *ccv, uint32_t type) > { > struct cubic *cubic_data; > + uint32_t cwin; > + u_int mss; > =20 > cubic_data =3D ccv->cc_data; > + cwin =3D CCV(ccv, snd_cwnd); > + mss =3D CCV(ccv, t_maxseg); > =20 > switch (type) { > case CC_NDUPACK: > @@ -235,7 +239,8 @@ cubic_cong_signal(struct cc_var *ccv, ui > cubic_ssthresh_update(ccv); > cubic_data->num_cong_events++; > cubic_data->prev_max_cwnd =3D cubic_data->max_cwnd; > - cubic_data->max_cwnd =3D CCV(ccv, snd_cwnd); > + cubic_data->max_cwnd =3D cwin; > + CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > } > ENTER_RECOVERY(CCV(ccv, t_flags)); > } > @@ -246,7 +251,7 @@ cubic_cong_signal(struct cc_var *ccv, ui > cubic_ssthresh_update(ccv); > cubic_data->num_cong_events++; > cubic_data->prev_max_cwnd =3D cubic_data->max_cwnd; > - cubic_data->max_cwnd =3D CCV(ccv, snd_cwnd); > + cubic_data->max_cwnd =3D cwin; > cubic_data->t_last_cong =3D ticks; > CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > ENTER_CONGRECOVERY(CCV(ccv, t_flags)); > @@ -261,9 +266,13 @@ cubic_cong_signal(struct cc_var *ccv, ui > * chance the first one is a false alarm and may not indicate > * congestion. > */ > - if (CCV(ccv, t_rxtshift) >=3D 2) > + if (CCV(ccv, t_rxtshift) >=3D 2) { > cubic_data->num_cong_events++; > cubic_data->t_last_cong =3D ticks; > + cubic_ssthresh_update(ccv); > + cubic_data->max_cwnd =3D cwin; > + CCV(ccv, snd_cwnd) =3D mss; > + } > break; > } > } >=20 > Modified: head/sys/netinet/cc/cc_dctcp.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_dctcp.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_dctcp.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -230,10 +230,11 @@ static void > dctcp_cong_signal(struct cc_var *ccv, uint32_t type) > { > struct dctcp *dctcp_data; > - u_int win, mss; > + uint32_t cwin; > + u_int mss; > =20 > dctcp_data =3D ccv->cc_data; > - win =3D CCV(ccv, snd_cwnd); > + cwin =3D CCV(ccv, snd_cwnd); > mss =3D CCV(ccv, t_maxseg); > =20 > switch (type) { > @@ -241,16 +242,16 @@ dctcp_cong_signal(struct cc_var *ccv, ui > if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { > if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { > CCV(ccv, snd_ssthresh) =3D mss * > - max(win / 2 / mss, 2); > + max(cwin / 2 / mss, 2); > dctcp_data->num_cong_events++; > } else { > /* cwnd has already updated as congestion > * recovery. Reverse cwnd value using > * snd_cwnd_prev and recalculate snd_ssthresh > */ > - win =3D CCV(ccv, snd_cwnd_prev); > + cwin =3D CCV(ccv, snd_cwnd_prev); > CCV(ccv, snd_ssthresh) =3D > - max(win / 2 / mss, 2) * mss; > + max(cwin / 2 / mss, 2) * mss; > } > ENTER_RECOVERY(CCV(ccv, t_flags)); > } > @@ -260,18 +261,18 @@ dctcp_cong_signal(struct cc_var *ccv, ui > * Save current snd_cwnd when the host encounters both > * congestion recovery and fast recovery. > */ > - CCV(ccv, snd_cwnd_prev) =3D win; > + CCV(ccv, snd_cwnd_prev) =3D cwin; > if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { > if (V_dctcp_slowstart && > dctcp_data->num_cong_events++ =3D=3D 0) { > CCV(ccv, snd_ssthresh) =3D > - mss * max(win / 2 / mss, 2); > + mss * max(cwin / 2 / mss, 2); > dctcp_data->alpha =3D MAX_ALPHA_VALUE; > dctcp_data->bytes_ecn =3D 0; > dctcp_data->bytes_total =3D 0; > dctcp_data->save_sndnxt =3D CCV(ccv, snd_nxt); > } else > - CCV(ccv, snd_ssthresh) =3D max((win - ((win * > + CCV(ccv, snd_ssthresh) =3D max((cwin - ((cwin * > dctcp_data->alpha) >> 11)) / mss, 2) * mss; > CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > ENTER_CONGRECOVERY(CCV(ccv, t_flags)); > @@ -284,6 +285,8 @@ dctcp_cong_signal(struct cc_var *ccv, ui > dctcp_update_alpha(ccv); > dctcp_data->save_sndnxt +=3D CCV(ccv, t_maxseg); > dctcp_data->num_cong_events++; > + CCV(ccv, snd_ssthresh) =3D max(2 * mss, cwin / 2); > + CCV(ccv, snd_cwnd) =3D mss; > } > break; > } >=20 > Modified: head/sys/netinet/cc/cc_htcp.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_htcp.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_htcp.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -271,8 +271,12 @@ static void > htcp_cong_signal(struct cc_var *ccv, uint32_t type) > { > struct htcp *htcp_data; > + uint32_t cwin; > + u_int mss; > =20 > htcp_data =3D ccv->cc_data; > + cwin =3D CCV(ccv, snd_cwnd); > + mss =3D CCV(ccv, t_maxseg); > =20 > switch (type) { > case CC_NDUPACK: > @@ -287,8 +291,9 @@ htcp_cong_signal(struct cc_var *ccv, uin > (htcp_data->maxrtt - htcp_data->minrtt) * > 95) / 100; > htcp_ssthresh_update(ccv); > + CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > htcp_data->t_last_cong =3D ticks; > - htcp_data->prev_cwnd =3D CCV(ccv, snd_cwnd); > + htcp_data->prev_cwnd =3D cwin; > } > ENTER_RECOVERY(CCV(ccv, t_flags)); > } > @@ -305,7 +310,7 @@ htcp_cong_signal(struct cc_var *ccv, uin > htcp_ssthresh_update(ccv); > CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > htcp_data->t_last_cong =3D ticks; > - htcp_data->prev_cwnd =3D CCV(ccv, snd_cwnd); > + htcp_data->prev_cwnd =3D cwin; > ENTER_CONGRECOVERY(CCV(ccv, t_flags)); > } > break; > @@ -320,6 +325,8 @@ htcp_cong_signal(struct cc_var *ccv, uin > */ > if (CCV(ccv, t_rxtshift) >=3D 2) > htcp_data->t_last_cong =3D ticks; > + CCV(ccv, snd_ssthresh) =3D max(2 * mss, cwin / 2); > + CCV(ccv, snd_cwnd) =3D mss; > break; > } > } >=20 > Modified: head/sys/netinet/cc/cc_newreno.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_newreno.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_newreno.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -182,30 +182,39 @@ newreno_after_idle(struct cc_var *ccv) > static void > newreno_cong_signal(struct cc_var *ccv, uint32_t type) > { > - u_int win; > + uint32_t cwin; > + u_int mss; > + > + cwin =3D CCV(ccv, snd_cwnd); > + mss =3D CCV(ccv, t_maxseg); > =20 > /* Catch algos which mistakenly leak private signal types. */ > KASSERT((type & CC_SIGPRIVMASK) =3D=3D 0, > ("%s: congestion signal type 0x%08x is private\n", __func__, type)); > =20 > - win =3D max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) * > - CCV(ccv, t_maxseg); > + cwin =3D max(2*mss, cwin/2); > =20 > switch (type) { > case CC_NDUPACK: > if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { > - if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) > - CCV(ccv, snd_ssthresh) =3D win; > + if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { > + CCV(ccv, snd_ssthresh) =3D cwin; > + CCV(ccv, snd_cwnd) =3D cwin; > + } > ENTER_RECOVERY(CCV(ccv, t_flags)); > } > break; > case CC_ECN: > if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { > - CCV(ccv, snd_ssthresh) =3D win; > - CCV(ccv, snd_cwnd) =3D win; > + CCV(ccv, snd_ssthresh) =3D cwin; > + CCV(ccv, snd_cwnd) =3D cwin; > ENTER_CONGRECOVERY(CCV(ccv, t_flags)); > } > break; > + case CC_RTO: > + CCV(ccv, snd_ssthresh) =3D cwin; > + CCV(ccv, snd_cwnd) =3D mss; > + break; > } > } > =20 >=20 > Modified: head/sys/netinet/tcp_input.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/tcp_input.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/tcp_input.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -438,9 +438,15 @@ cc_cong_signal(struct tcpcb *tp, struct=20 > tp->t_dupacks =3D 0; > tp->t_bytes_acked =3D 0; > EXIT_RECOVERY(tp->t_flags); > - tp->snd_ssthresh =3D max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 / > - maxseg) * maxseg; > - tp->snd_cwnd =3D maxseg; > + if (CC_ALGO(tp)->cong_signal =3D=3D NULL) { > + /* > + * RFC5681 Section 3.1=20 > + * ssthresh =3D max (FlightSize / 2, 2*SMSS) eq (4) > + */ > + tp->snd_ssthresh =3D > + max((tp->snd_max - tp->snd_una) / 2, 2 * maxseg); > + tp->snd_cwnd =3D maxseg; > + } > break; > case CC_RTO_ERR: > TCPSTAT_INC(tcps_sndrexmitbad); > @@ -2613,6 +2619,15 @@ tcp_do_segment(struct mbuf *m, struct tc > =20 > if (awnd < tp->snd_ssthresh) { > tp->snd_cwnd +=3D maxseg; > + /* > + * RFC5681 Section 3.2 talks about cwnd > + * inflation on additional dupacks and > + * deflation on recovering from loss. > + * > + * We keep cwnd into check so that > + * we don't have to 'deflate' it when we > + * get out of recovery. > + */ > if (tp->snd_cwnd > tp->snd_ssthresh) > tp->snd_cwnd =3D tp->snd_ssthresh; > } > @@ -2652,19 +2667,22 @@ tcp_do_segment(struct mbuf *m, struct tc > TCPSTAT_INC( > tcps_sack_recovery_episode); > tp->sack_newdata =3D tp->snd_nxt; > - tp->snd_cwnd =3D maxseg; > + if (CC_ALGO(tp)->cong_signal =3D=3D NULL) > + tp->snd_cwnd =3D maxseg; > (void) tp->t_fb->tfb_tcp_output(tp); > goto drop; > } > tp->snd_nxt =3D th->th_ack; > - tp->snd_cwnd =3D maxseg; > + if (CC_ALGO(tp)->cong_signal =3D=3D NULL) > + tp->snd_cwnd =3D maxseg; > (void) tp->t_fb->tfb_tcp_output(tp); > KASSERT(tp->snd_limited <=3D 2, > ("%s: tp->snd_limited too big", > __func__)); > - tp->snd_cwnd =3D tp->snd_ssthresh + > - maxseg * > - (tp->t_dupacks - tp->snd_limited); > + if (CC_ALGO(tp)->cong_signal =3D=3D NULL) > + tp->snd_cwnd =3D tp->snd_ssthresh + > + maxseg * > + (tp->t_dupacks - tp->snd_limited); > if (SEQ_GT(onxt, tp->snd_nxt)) > tp->snd_nxt =3D onxt; > goto drop; >=20 --ILuaRSyQpoVaJ1HG Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJYDufXXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/lT5QH/1HNZsJL3YglDEKXtFulhE2A xOsHGLPpWr3+qudZP8h9H0euOk1SfxqAatKpagJOZBcEz3wwuYUr+cGzxAZ8l6cQ 81n549mEx1n180Sr2jA8Hpq3sKGalnLSPNMwcomGaFvEa098XUyIjp9VAKmrPj0B kPUBwnNZbwgHiRJ+fOxf4zUiLAQH7XlHsMl2YikgtJLWn0vqhVbffrWvYMh9LMOm 0GQHIZiKveBtLlOSlyPI5u6sp9omKeE3weB8BFtpCAWxoOGxG//AubEyVUw3zE4p 2MtvEjlkMnIK/mYmbj70NCXY8HFA9E26rnKH2ZcRVGc2p59ZMo7JQiB7ZjksxAM= =oYl+ -----END PGP SIGNATURE----- --ILuaRSyQpoVaJ1HG-- From owner-svn-src-head@freebsd.org Tue Oct 25 05:07:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36E00C20DE2; Tue, 25 Oct 2016 05:07:53 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 112941D3; Tue, 25 Oct 2016 05:07:52 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9P57qDW096744; Tue, 25 Oct 2016 05:07:52 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9P57p0M096737; Tue, 25 Oct 2016 05:07:51 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201610250507.u9P57p0M096737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Tue, 25 Oct 2016 05:07:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307900 - in head/sys/netinet: . cc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 05:07:53 -0000 Author: hiren Date: Tue Oct 25 05:07:51 2016 New Revision: 307900 URL: https://svnweb.freebsd.org/changeset/base/307900 Log: Undo r307899. It needs a bit more work and proper commit log. Modified: head/sys/netinet/cc/cc_cdg.c head/sys/netinet/cc/cc_chd.c head/sys/netinet/cc/cc_cubic.c head/sys/netinet/cc/cc_dctcp.c head/sys/netinet/cc/cc_htcp.c head/sys/netinet/cc/cc_newreno.c head/sys/netinet/tcp_input.c Modified: head/sys/netinet/cc/cc_cdg.c ============================================================================== --- head/sys/netinet/cc/cc_cdg.c Tue Oct 25 05:03:33 2016 (r307899) +++ head/sys/netinet/cc/cc_cdg.c Tue Oct 25 05:07:51 2016 (r307900) @@ -431,11 +431,6 @@ static void cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type) { struct cdg *cdg_data = ccv->cc_data; - uint32_t cwin; - u_int mss; - - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); switch(signal_type) { case CC_CDG_DELAY: @@ -453,7 +448,7 @@ cdg_cong_signal(struct cc_var *ccv, uint */ if (IN_CONGRECOVERY(CCV(ccv, t_flags)) || cdg_data->queue_state < CDG_Q_FULL) { - CCV(ccv, snd_ssthresh) = cwin; + CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd); CCV(ccv, snd_recover) = CCV(ccv, snd_max); } else { /* @@ -466,17 +461,13 @@ cdg_cong_signal(struct cc_var *ccv, uint cdg_data->shadow_w, RENO_BETA); CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w, - cdg_window_decrease(ccv, cwin, V_cdg_beta_loss)); - CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); + cdg_window_decrease(ccv, CCV(ccv, snd_cwnd), + V_cdg_beta_loss)); cdg_data->window_incr = cdg_data->rtt_count = 0; } ENTER_RECOVERY(CCV(ccv, t_flags)); break; - case CC_RTO: - CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2); - CCV(ccv, snd_cwnd) = mss; - break; default: newreno_cc_algo.cong_signal(ccv, signal_type); break; Modified: head/sys/netinet/cc/cc_chd.c ============================================================================== --- head/sys/netinet/cc/cc_chd.c Tue Oct 25 05:03:33 2016 (r307899) +++ head/sys/netinet/cc/cc_chd.c Tue Oct 25 05:07:51 2016 (r307900) @@ -330,14 +330,10 @@ chd_cong_signal(struct cc_var *ccv, uint struct ertt *e_t; struct chd *chd_data; int qdly; - uint32_t cwin; - u_int mss; e_t = khelp_get_osd(CCV(ccv, osd), ertt_id); chd_data = ccv->cc_data; qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt; - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); switch(signal_type) { case CC_CHD_DELAY: @@ -377,10 +373,6 @@ chd_cong_signal(struct cc_var *ccv, uint } ENTER_FASTRECOVERY(CCV(ccv, t_flags)); break; - case CC_RTO: - CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2); - CCV(ccv, snd_cwnd) = mss; - break; default: newreno_cc_algo.cong_signal(ccv, signal_type); Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Tue Oct 25 05:03:33 2016 (r307899) +++ head/sys/netinet/cc/cc_cubic.c Tue Oct 25 05:07:51 2016 (r307900) @@ -225,12 +225,8 @@ static void cubic_cong_signal(struct cc_var *ccv, uint32_t type) { struct cubic *cubic_data; - uint32_t cwin; - u_int mss; cubic_data = ccv->cc_data; - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: @@ -239,8 +235,7 @@ cubic_cong_signal(struct cc_var *ccv, ui cubic_ssthresh_update(ccv); cubic_data->num_cong_events++; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = cwin; - CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); + cubic_data->max_cwnd = CCV(ccv, snd_cwnd); } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -251,7 +246,7 @@ cubic_cong_signal(struct cc_var *ccv, ui cubic_ssthresh_update(ccv); cubic_data->num_cong_events++; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = cwin; + cubic_data->max_cwnd = CCV(ccv, snd_cwnd); cubic_data->t_last_cong = ticks; CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); @@ -266,13 +261,9 @@ cubic_cong_signal(struct cc_var *ccv, ui * chance the first one is a false alarm and may not indicate * congestion. */ - if (CCV(ccv, t_rxtshift) >= 2) { + if (CCV(ccv, t_rxtshift) >= 2) cubic_data->num_cong_events++; cubic_data->t_last_cong = ticks; - cubic_ssthresh_update(ccv); - cubic_data->max_cwnd = cwin; - CCV(ccv, snd_cwnd) = mss; - } break; } } Modified: head/sys/netinet/cc/cc_dctcp.c ============================================================================== --- head/sys/netinet/cc/cc_dctcp.c Tue Oct 25 05:03:33 2016 (r307899) +++ head/sys/netinet/cc/cc_dctcp.c Tue Oct 25 05:07:51 2016 (r307900) @@ -230,11 +230,10 @@ static void dctcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct dctcp *dctcp_data; - uint32_t cwin; - u_int mss; + u_int win, mss; dctcp_data = ccv->cc_data; - cwin = CCV(ccv, snd_cwnd); + win = CCV(ccv, snd_cwnd); mss = CCV(ccv, t_maxseg); switch (type) { @@ -242,16 +241,16 @@ dctcp_cong_signal(struct cc_var *ccv, ui if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { CCV(ccv, snd_ssthresh) = mss * - max(cwin / 2 / mss, 2); + max(win / 2 / mss, 2); dctcp_data->num_cong_events++; } else { /* cwnd has already updated as congestion * recovery. Reverse cwnd value using * snd_cwnd_prev and recalculate snd_ssthresh */ - cwin = CCV(ccv, snd_cwnd_prev); + win = CCV(ccv, snd_cwnd_prev); CCV(ccv, snd_ssthresh) = - max(cwin / 2 / mss, 2) * mss; + max(win / 2 / mss, 2) * mss; } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -261,18 +260,18 @@ dctcp_cong_signal(struct cc_var *ccv, ui * Save current snd_cwnd when the host encounters both * congestion recovery and fast recovery. */ - CCV(ccv, snd_cwnd_prev) = cwin; + CCV(ccv, snd_cwnd_prev) = win; if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { if (V_dctcp_slowstart && dctcp_data->num_cong_events++ == 0) { CCV(ccv, snd_ssthresh) = - mss * max(cwin / 2 / mss, 2); + mss * max(win / 2 / mss, 2); dctcp_data->alpha = MAX_ALPHA_VALUE; dctcp_data->bytes_ecn = 0; dctcp_data->bytes_total = 0; dctcp_data->save_sndnxt = CCV(ccv, snd_nxt); } else - CCV(ccv, snd_ssthresh) = max((cwin - ((cwin * + CCV(ccv, snd_ssthresh) = max((win - ((win * dctcp_data->alpha) >> 11)) / mss, 2) * mss; CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); @@ -285,8 +284,6 @@ dctcp_cong_signal(struct cc_var *ccv, ui dctcp_update_alpha(ccv); dctcp_data->save_sndnxt += CCV(ccv, t_maxseg); dctcp_data->num_cong_events++; - CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2); - CCV(ccv, snd_cwnd) = mss; } break; } Modified: head/sys/netinet/cc/cc_htcp.c ============================================================================== --- head/sys/netinet/cc/cc_htcp.c Tue Oct 25 05:03:33 2016 (r307899) +++ head/sys/netinet/cc/cc_htcp.c Tue Oct 25 05:07:51 2016 (r307900) @@ -271,12 +271,8 @@ static void htcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct htcp *htcp_data; - uint32_t cwin; - u_int mss; htcp_data = ccv->cc_data; - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: @@ -291,9 +287,8 @@ htcp_cong_signal(struct cc_var *ccv, uin (htcp_data->maxrtt - htcp_data->minrtt) * 95) / 100; htcp_ssthresh_update(ccv); - CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); htcp_data->t_last_cong = ticks; - htcp_data->prev_cwnd = cwin; + htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -310,7 +305,7 @@ htcp_cong_signal(struct cc_var *ccv, uin htcp_ssthresh_update(ccv); CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); htcp_data->t_last_cong = ticks; - htcp_data->prev_cwnd = cwin; + htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; @@ -325,8 +320,6 @@ htcp_cong_signal(struct cc_var *ccv, uin */ if (CCV(ccv, t_rxtshift) >= 2) htcp_data->t_last_cong = ticks; - CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2); - CCV(ccv, snd_cwnd) = mss; break; } } Modified: head/sys/netinet/cc/cc_newreno.c ============================================================================== --- head/sys/netinet/cc/cc_newreno.c Tue Oct 25 05:03:33 2016 (r307899) +++ head/sys/netinet/cc/cc_newreno.c Tue Oct 25 05:07:51 2016 (r307900) @@ -182,39 +182,30 @@ newreno_after_idle(struct cc_var *ccv) static void newreno_cong_signal(struct cc_var *ccv, uint32_t type) { - uint32_t cwin; - u_int mss; - - cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); + u_int win; /* Catch algos which mistakenly leak private signal types. */ KASSERT((type & CC_SIGPRIVMASK) == 0, ("%s: congestion signal type 0x%08x is private\n", __func__, type)); - cwin = max(2*mss, cwin/2); + win = max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) * + CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { - if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = cwin; - CCV(ccv, snd_cwnd) = cwin; - } + if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) + CCV(ccv, snd_ssthresh) = win; ENTER_RECOVERY(CCV(ccv, t_flags)); } break; case CC_ECN: if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = cwin; - CCV(ccv, snd_cwnd) = cwin; + CCV(ccv, snd_ssthresh) = win; + CCV(ccv, snd_cwnd) = win; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; - case CC_RTO: - CCV(ccv, snd_ssthresh) = cwin; - CCV(ccv, snd_cwnd) = mss; - break; } } Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Oct 25 05:03:33 2016 (r307899) +++ head/sys/netinet/tcp_input.c Tue Oct 25 05:07:51 2016 (r307900) @@ -438,15 +438,9 @@ cc_cong_signal(struct tcpcb *tp, struct tp->t_dupacks = 0; tp->t_bytes_acked = 0; EXIT_RECOVERY(tp->t_flags); - if (CC_ALGO(tp)->cong_signal == NULL) { - /* - * RFC5681 Section 3.1 - * ssthresh = max (FlightSize / 2, 2*SMSS) eq (4) - */ - tp->snd_ssthresh = - max((tp->snd_max - tp->snd_una) / 2, 2 * maxseg); - tp->snd_cwnd = maxseg; - } + tp->snd_ssthresh = max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 / + maxseg) * maxseg; + tp->snd_cwnd = maxseg; break; case CC_RTO_ERR: TCPSTAT_INC(tcps_sndrexmitbad); @@ -2619,15 +2613,6 @@ tcp_do_segment(struct mbuf *m, struct tc if (awnd < tp->snd_ssthresh) { tp->snd_cwnd += maxseg; - /* - * RFC5681 Section 3.2 talks about cwnd - * inflation on additional dupacks and - * deflation on recovering from loss. - * - * We keep cwnd into check so that - * we don't have to 'deflate' it when we - * get out of recovery. - */ if (tp->snd_cwnd > tp->snd_ssthresh) tp->snd_cwnd = tp->snd_ssthresh; } @@ -2667,22 +2652,19 @@ tcp_do_segment(struct mbuf *m, struct tc TCPSTAT_INC( tcps_sack_recovery_episode); tp->sack_newdata = tp->snd_nxt; - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = maxseg; + tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); goto drop; } tp->snd_nxt = th->th_ack; - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = maxseg; + tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", __func__)); - if (CC_ALGO(tp)->cong_signal == NULL) - tp->snd_cwnd = tp->snd_ssthresh + - maxseg * - (tp->t_dupacks - tp->snd_limited); + tp->snd_cwnd = tp->snd_ssthresh + + maxseg * + (tp->t_dupacks - tp->snd_limited); if (SEQ_GT(onxt, tp->snd_nxt)) tp->snd_nxt = onxt; goto drop; From owner-svn-src-head@freebsd.org Tue Oct 25 05:45:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8D01C20CE2; Tue, 25 Oct 2016 05:45:49 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA2A2988; Tue, 25 Oct 2016 05:45:49 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9P5jmGZ011790; Tue, 25 Oct 2016 05:45:48 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9P5jm3u011781; Tue, 25 Oct 2016 05:45:48 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201610250545.u9P5jm3u011781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Tue, 25 Oct 2016 05:45:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307901 - in head/sys/netinet: . cc tcp_stacks X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 05:45:50 -0000 Author: hiren Date: Tue Oct 25 05:45:47 2016 New Revision: 307901 URL: https://svnweb.freebsd.org/changeset/base/307901 Log: FreeBSD tcp stack used to inform respective congestion control module about the loss event but not use or obay the recommendations i.e. values set by it in some cases. Here is an attempt to solve that confusion by following relevant RFCs/drafts. Stack only sets congestion window/slow start threshold values when there is no CC module availalbe to take that action. All CC modules are inspected and updated when needed to take appropriate action on loss. tcp_stacks/fastpath module has been updated to adapt these changes. Note: Probably, the most significant change would be to not bring congestion window down to 1MSS on a loss signaled by 3-duplicate acks and letting respective CC decide that value. In collaboration with: Matt Macy Discussed on: transport@ mailing list Reviewed by: jtl MFC after: 1 month Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D8225 Modified: head/sys/netinet/cc/cc_cdg.c head/sys/netinet/cc/cc_chd.c head/sys/netinet/cc/cc_cubic.c head/sys/netinet/cc/cc_dctcp.c head/sys/netinet/cc/cc_htcp.c head/sys/netinet/cc/cc_newreno.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/fastpath.c Modified: head/sys/netinet/cc/cc_cdg.c ============================================================================== --- head/sys/netinet/cc/cc_cdg.c Tue Oct 25 05:07:51 2016 (r307900) +++ head/sys/netinet/cc/cc_cdg.c Tue Oct 25 05:45:47 2016 (r307901) @@ -431,6 +431,11 @@ static void cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type) { struct cdg *cdg_data = ccv->cc_data; + uint32_t cwin; + u_int mss; + + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); switch(signal_type) { case CC_CDG_DELAY: @@ -448,7 +453,7 @@ cdg_cong_signal(struct cc_var *ccv, uint */ if (IN_CONGRECOVERY(CCV(ccv, t_flags)) || cdg_data->queue_state < CDG_Q_FULL) { - CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd); + CCV(ccv, snd_ssthresh) = cwin; CCV(ccv, snd_recover) = CCV(ccv, snd_max); } else { /* @@ -461,13 +466,17 @@ cdg_cong_signal(struct cc_var *ccv, uint cdg_data->shadow_w, RENO_BETA); CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w, - cdg_window_decrease(ccv, CCV(ccv, snd_cwnd), - V_cdg_beta_loss)); + cdg_window_decrease(ccv, cwin, V_cdg_beta_loss)); + CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); cdg_data->window_incr = cdg_data->rtt_count = 0; } ENTER_RECOVERY(CCV(ccv, t_flags)); break; + case CC_RTO: + CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2); + CCV(ccv, snd_cwnd) = mss; + break; default: newreno_cc_algo.cong_signal(ccv, signal_type); break; Modified: head/sys/netinet/cc/cc_chd.c ============================================================================== --- head/sys/netinet/cc/cc_chd.c Tue Oct 25 05:07:51 2016 (r307900) +++ head/sys/netinet/cc/cc_chd.c Tue Oct 25 05:45:47 2016 (r307901) @@ -330,10 +330,14 @@ chd_cong_signal(struct cc_var *ccv, uint struct ertt *e_t; struct chd *chd_data; int qdly; + uint32_t cwin; + u_int mss; e_t = khelp_get_osd(CCV(ccv, osd), ertt_id); chd_data = ccv->cc_data; qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt; + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); switch(signal_type) { case CC_CHD_DELAY: @@ -373,6 +377,10 @@ chd_cong_signal(struct cc_var *ccv, uint } ENTER_FASTRECOVERY(CCV(ccv, t_flags)); break; + case CC_RTO: + CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2); + CCV(ccv, snd_cwnd) = mss; + break; default: newreno_cc_algo.cong_signal(ccv, signal_type); Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Tue Oct 25 05:07:51 2016 (r307900) +++ head/sys/netinet/cc/cc_cubic.c Tue Oct 25 05:45:47 2016 (r307901) @@ -225,8 +225,12 @@ static void cubic_cong_signal(struct cc_var *ccv, uint32_t type) { struct cubic *cubic_data; + uint32_t cwin; + u_int mss; cubic_data = ccv->cc_data; + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: @@ -235,7 +239,8 @@ cubic_cong_signal(struct cc_var *ccv, ui cubic_ssthresh_update(ccv); cubic_data->num_cong_events++; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = CCV(ccv, snd_cwnd); + cubic_data->max_cwnd = cwin; + CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -246,7 +251,7 @@ cubic_cong_signal(struct cc_var *ccv, ui cubic_ssthresh_update(ccv); cubic_data->num_cong_events++; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; - cubic_data->max_cwnd = CCV(ccv, snd_cwnd); + cubic_data->max_cwnd = cwin; cubic_data->t_last_cong = ticks; CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); @@ -261,9 +266,13 @@ cubic_cong_signal(struct cc_var *ccv, ui * chance the first one is a false alarm and may not indicate * congestion. */ - if (CCV(ccv, t_rxtshift) >= 2) + if (CCV(ccv, t_rxtshift) >= 2) { cubic_data->num_cong_events++; cubic_data->t_last_cong = ticks; + cubic_ssthresh_update(ccv); + cubic_data->max_cwnd = cwin; + CCV(ccv, snd_cwnd) = mss; + } break; } } Modified: head/sys/netinet/cc/cc_dctcp.c ============================================================================== --- head/sys/netinet/cc/cc_dctcp.c Tue Oct 25 05:07:51 2016 (r307900) +++ head/sys/netinet/cc/cc_dctcp.c Tue Oct 25 05:45:47 2016 (r307901) @@ -230,10 +230,11 @@ static void dctcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct dctcp *dctcp_data; - u_int win, mss; + uint32_t cwin; + u_int mss; dctcp_data = ccv->cc_data; - win = CCV(ccv, snd_cwnd); + cwin = CCV(ccv, snd_cwnd); mss = CCV(ccv, t_maxseg); switch (type) { @@ -241,16 +242,16 @@ dctcp_cong_signal(struct cc_var *ccv, ui if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { CCV(ccv, snd_ssthresh) = mss * - max(win / 2 / mss, 2); + max(cwin / 2 / mss, 2); dctcp_data->num_cong_events++; } else { /* cwnd has already updated as congestion * recovery. Reverse cwnd value using * snd_cwnd_prev and recalculate snd_ssthresh */ - win = CCV(ccv, snd_cwnd_prev); + cwin = CCV(ccv, snd_cwnd_prev); CCV(ccv, snd_ssthresh) = - max(win / 2 / mss, 2) * mss; + max(cwin / 2 / mss, 2) * mss; } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -260,18 +261,18 @@ dctcp_cong_signal(struct cc_var *ccv, ui * Save current snd_cwnd when the host encounters both * congestion recovery and fast recovery. */ - CCV(ccv, snd_cwnd_prev) = win; + CCV(ccv, snd_cwnd_prev) = cwin; if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { if (V_dctcp_slowstart && dctcp_data->num_cong_events++ == 0) { CCV(ccv, snd_ssthresh) = - mss * max(win / 2 / mss, 2); + mss * max(cwin / 2 / mss, 2); dctcp_data->alpha = MAX_ALPHA_VALUE; dctcp_data->bytes_ecn = 0; dctcp_data->bytes_total = 0; dctcp_data->save_sndnxt = CCV(ccv, snd_nxt); } else - CCV(ccv, snd_ssthresh) = max((win - ((win * + CCV(ccv, snd_ssthresh) = max((cwin - ((cwin * dctcp_data->alpha) >> 11)) / mss, 2) * mss; CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); @@ -284,6 +285,8 @@ dctcp_cong_signal(struct cc_var *ccv, ui dctcp_update_alpha(ccv); dctcp_data->save_sndnxt += CCV(ccv, t_maxseg); dctcp_data->num_cong_events++; + CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2); + CCV(ccv, snd_cwnd) = mss; } break; } Modified: head/sys/netinet/cc/cc_htcp.c ============================================================================== --- head/sys/netinet/cc/cc_htcp.c Tue Oct 25 05:07:51 2016 (r307900) +++ head/sys/netinet/cc/cc_htcp.c Tue Oct 25 05:45:47 2016 (r307901) @@ -271,8 +271,12 @@ static void htcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct htcp *htcp_data; + uint32_t cwin; + u_int mss; htcp_data = ccv->cc_data; + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); switch (type) { case CC_NDUPACK: @@ -287,8 +291,9 @@ htcp_cong_signal(struct cc_var *ccv, uin (htcp_data->maxrtt - htcp_data->minrtt) * 95) / 100; htcp_ssthresh_update(ccv); + CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); htcp_data->t_last_cong = ticks; - htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); + htcp_data->prev_cwnd = cwin; } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -305,7 +310,7 @@ htcp_cong_signal(struct cc_var *ccv, uin htcp_ssthresh_update(ccv); CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); htcp_data->t_last_cong = ticks; - htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); + htcp_data->prev_cwnd = cwin; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; @@ -320,6 +325,8 @@ htcp_cong_signal(struct cc_var *ccv, uin */ if (CCV(ccv, t_rxtshift) >= 2) htcp_data->t_last_cong = ticks; + CCV(ccv, snd_ssthresh) = max(2 * mss, cwin / 2); + CCV(ccv, snd_cwnd) = mss; break; } } Modified: head/sys/netinet/cc/cc_newreno.c ============================================================================== --- head/sys/netinet/cc/cc_newreno.c Tue Oct 25 05:07:51 2016 (r307900) +++ head/sys/netinet/cc/cc_newreno.c Tue Oct 25 05:45:47 2016 (r307901) @@ -182,30 +182,39 @@ newreno_after_idle(struct cc_var *ccv) static void newreno_cong_signal(struct cc_var *ccv, uint32_t type) { - u_int win; + uint32_t cwin; + u_int mss; + + cwin = CCV(ccv, snd_cwnd); + mss = CCV(ccv, t_maxseg); /* Catch algos which mistakenly leak private signal types. */ KASSERT((type & CC_SIGPRIVMASK) == 0, ("%s: congestion signal type 0x%08x is private\n", __func__, type)); - win = max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) * - CCV(ccv, t_maxseg); + cwin = max(2*mss, cwin/2); switch (type) { case CC_NDUPACK: if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { - if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) - CCV(ccv, snd_ssthresh) = win; + if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { + CCV(ccv, snd_ssthresh) = cwin; + CCV(ccv, snd_cwnd) = cwin; + } ENTER_RECOVERY(CCV(ccv, t_flags)); } break; case CC_ECN: if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - CCV(ccv, snd_ssthresh) = win; - CCV(ccv, snd_cwnd) = win; + CCV(ccv, snd_ssthresh) = cwin; + CCV(ccv, snd_cwnd) = cwin; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; + case CC_RTO: + CCV(ccv, snd_ssthresh) = cwin; + CCV(ccv, snd_cwnd) = mss; + break; } } Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Oct 25 05:07:51 2016 (r307900) +++ head/sys/netinet/tcp_input.c Tue Oct 25 05:45:47 2016 (r307901) @@ -438,9 +438,15 @@ cc_cong_signal(struct tcpcb *tp, struct tp->t_dupacks = 0; tp->t_bytes_acked = 0; EXIT_RECOVERY(tp->t_flags); - tp->snd_ssthresh = max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 / - maxseg) * maxseg; - tp->snd_cwnd = maxseg; + if (CC_ALGO(tp)->cong_signal == NULL) { + /* + * RFC5681 Section 3.1 + * ssthresh = max (FlightSize / 2, 2*SMSS) eq (4) + */ + tp->snd_ssthresh = + max((tp->snd_max - tp->snd_una) / 2, 2 * maxseg); + tp->snd_cwnd = maxseg; + } break; case CC_RTO_ERR: TCPSTAT_INC(tcps_sndrexmitbad); @@ -2613,6 +2619,15 @@ tcp_do_segment(struct mbuf *m, struct tc if (awnd < tp->snd_ssthresh) { tp->snd_cwnd += maxseg; + /* + * RFC5681 Section 3.2 talks about cwnd + * inflation on additional dupacks and + * deflation on recovering from loss. + * + * We keep cwnd into check so that + * we don't have to 'deflate' it when we + * get out of recovery. + */ if (tp->snd_cwnd > tp->snd_ssthresh) tp->snd_cwnd = tp->snd_ssthresh; } @@ -2652,19 +2667,22 @@ tcp_do_segment(struct mbuf *m, struct tc TCPSTAT_INC( tcps_sack_recovery_episode); tp->sack_newdata = tp->snd_nxt; - tp->snd_cwnd = maxseg; + if (CC_ALGO(tp)->cong_signal == NULL) + tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); goto drop; } tp->snd_nxt = th->th_ack; - tp->snd_cwnd = maxseg; + if (CC_ALGO(tp)->cong_signal == NULL) + tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", __func__)); - tp->snd_cwnd = tp->snd_ssthresh + - maxseg * - (tp->t_dupacks - tp->snd_limited); + if (CC_ALGO(tp)->cong_signal == NULL) + tp->snd_cwnd = tp->snd_ssthresh + + maxseg * + (tp->t_dupacks - tp->snd_limited); if (SEQ_GT(onxt, tp->snd_nxt)) tp->snd_nxt = onxt; goto drop; Modified: head/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- head/sys/netinet/tcp_stacks/fastpath.c Tue Oct 25 05:07:51 2016 (r307900) +++ head/sys/netinet/tcp_stacks/fastpath.c Tue Oct 25 05:45:47 2016 (r307901) @@ -1119,6 +1119,15 @@ tcp_do_slowpath(struct mbuf *m, struct t if (awnd < tp->snd_ssthresh) { tp->snd_cwnd += tp->t_maxseg; + /* + * RFC5681 Section 3.2 talks about cwnd + * inflation on additional dupacks and + * deflation on recovering from loss. + * + * We keep cwnd into check so that + * we don't have to 'deflate' it when we + * get out of recovery. + */ if (tp->snd_cwnd > tp->snd_ssthresh) tp->snd_cwnd = tp->snd_ssthresh; } @@ -1158,19 +1167,22 @@ tcp_do_slowpath(struct mbuf *m, struct t TCPSTAT_INC( tcps_sack_recovery_episode); tp->sack_newdata = tp->snd_nxt; - tp->snd_cwnd = tp->t_maxseg; + if (CC_ALGO(tp)->cong_signal == NULL) + tp->snd_cwnd = tp->t_maxseg; (void) tp->t_fb->tfb_tcp_output(tp); goto drop; } tp->snd_nxt = th->th_ack; - tp->snd_cwnd = tp->t_maxseg; + if (CC_ALGO(tp)->cong_signal == NULL) + tp->snd_cwnd = tp->t_maxseg; (void) tp->t_fb->tfb_tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", __func__)); - tp->snd_cwnd = tp->snd_ssthresh + - tp->t_maxseg * - (tp->t_dupacks - tp->snd_limited); + if (CC_ALGO(tp)->cong_signal == NULL) + tp->snd_cwnd = tp->snd_ssthresh + + tp->t_maxseg * + (tp->t_dupacks - tp->snd_limited); if (SEQ_GT(onxt, tp->snd_nxt)) tp->snd_nxt = onxt; goto drop; From owner-svn-src-head@freebsd.org Tue Oct 25 07:48:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CB63C2150D; Tue, 25 Oct 2016 07:48:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B86E2E2; Tue, 25 Oct 2016 07:48:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9P7mJae056856; Tue, 25 Oct 2016 07:48:19 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9P7mJMg056855; Tue, 25 Oct 2016 07:48:19 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201610250748.u9P7mJMg056855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 25 Oct 2016 07:48:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307902 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 07:48:20 -0000 Author: trasz Date: Tue Oct 25 07:48:19 2016 New Revision: 307902 URL: https://svnweb.freebsd.org/changeset/base/307902 Log: Make the USB attach strings in dmesg include product name. Note to self: MFC this to 9 and 8. Reviewed by: hselasky@, imp@ MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8259 Modified: head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Tue Oct 25 05:45:47 2016 (r307901) +++ head/sys/dev/usb/usb_device.c Tue Oct 25 07:48:19 2016 (r307902) @@ -1938,8 +1938,8 @@ config_done: udev->ugen_symlink = usb_alloc_symlink(udev->ugen_name); /* Announce device */ - printf("%s: <%s> at %s\n", udev->ugen_name, - usb_get_manufacturer(udev), + printf("%s: <%s %s> at %s\n", udev->ugen_name, + usb_get_manufacturer(udev), usb_get_product(udev), device_get_nameunit(udev->bus->bdev)); #endif @@ -2148,8 +2148,9 @@ usb_free_device(struct usb_device *udev, #if USB_HAVE_UGEN if (!rebooting) { - printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name, - usb_get_manufacturer(udev), device_get_nameunit(bus->bdev)); + printf("%s: <%s %s> at %s (disconnected)\n", udev->ugen_name, + usb_get_manufacturer(udev), usb_get_product(udev), + device_get_nameunit(bus->bdev)); } /* Destroy UGEN symlink, if any */ From owner-svn-src-head@freebsd.org Tue Oct 25 10:34:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05257BED620; Tue, 25 Oct 2016 10:34:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBE0778E; Tue, 25 Oct 2016 10:34:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PAYEil021591; Tue, 25 Oct 2016 10:34:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PAYEfR021590; Tue, 25 Oct 2016 10:34:14 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201610251034.u9PAYEfR021590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 25 Oct 2016 10:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307903 - head/sys/amd64/vmm/amd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 10:34:16 -0000 Author: avg Date: Tue Oct 25 10:34:14 2016 New Revision: 307903 URL: https://svnweb.freebsd.org/changeset/base/307903 Log: vmm/svm: iopm_bitmap and msr_bitmap must be contiguous in physical memory To achieve that the whole svm_softc is allocated with contigmalloc now. It would be more effient to de-embed those arrays and allocate only them with contigmalloc. Previously, if malloc(9) used non-contiguous pages for the arrays, then random bits in physical pages next to the first page would be used to determine permissions for I/O port and MSR accesses. That could result in a guest dangerously modifying the host hardware configuration. One example is that sometimes NMI watchdog driver in a Linux guest would be able to configure a performance counter on a host system. The counter would generate an interrupt and if hwpmc(4) driver is loaded on the host, then the interrupt would be delivered as an NMI. Discussed with: jhb Reviewed by: grehan MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D8321 Modified: head/sys/amd64/vmm/amd/svm.c Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Tue Oct 25 07:48:19 2016 (r307902) +++ head/sys/amd64/vmm/amd/svm.c Tue Oct 25 10:34:14 2016 (r307903) @@ -517,7 +517,8 @@ svm_vminit(struct vm *vm, pmap_t pmap) vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; int i; - svm_sc = malloc(sizeof (struct svm_softc), M_SVM, M_WAITOK | M_ZERO); + svm_sc = contigmalloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO, + 0, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); svm_sc->vm = vm; svm_sc->nptp = (vm_offset_t)vtophys(pmap->pm_pml4); @@ -2042,7 +2043,7 @@ svm_vmcleanup(void *arg) { struct svm_softc *sc = arg; - free(sc, M_SVM); + contigfree(sc, sizeof (*sc), M_SVM); } static register_t * From owner-svn-src-head@freebsd.org Tue Oct 25 10:59:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80EDEBEDB10; Tue, 25 Oct 2016 10:59:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F7061AF; Tue, 25 Oct 2016 10:59:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PAxLED029221; Tue, 25 Oct 2016 10:59:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PAxLet029220; Tue, 25 Oct 2016 10:59:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201610251059.u9PAxLet029220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 25 Oct 2016 10:59:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307904 - head/sys/amd64/vmm/amd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 10:59:22 -0000 Author: avg Date: Tue Oct 25 10:59:21 2016 New Revision: 307904 URL: https://svnweb.freebsd.org/changeset/base/307904 Log: fix up r307903, use correct max address definition MFC after: 1 week X-MFC with: r307903 Modified: head/sys/amd64/vmm/amd/svm.c Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Tue Oct 25 10:34:14 2016 (r307903) +++ head/sys/amd64/vmm/amd/svm.c Tue Oct 25 10:59:21 2016 (r307904) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "vmm_lapic.h" #include "vmm_stat.h" @@ -518,7 +519,7 @@ svm_vminit(struct vm *vm, pmap_t pmap) int i; svm_sc = contigmalloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO, - 0, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); + 0, VM_MAX_ADDRESS, PAGE_SIZE, 0); svm_sc->vm = vm; svm_sc->nptp = (vm_offset_t)vtophys(pmap->pm_pml4); From owner-svn-src-head@freebsd.org Tue Oct 25 13:46:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14393C216DD; Tue, 25 Oct 2016 13:46:01 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DECD7834; Tue, 25 Oct 2016 13:46:00 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PDjx2n093617; Tue, 25 Oct 2016 13:45:59 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PDjx7g093616; Tue, 25 Oct 2016 13:45:59 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610251345.u9PDjx7g093616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 25 Oct 2016 13:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307907 - head/sys/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.23 Precedence: list List-Id: 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, 25 Oct 2016 13:46:01 -0000 Author: andrew Date: Tue Oct 25 13:45:59 2016 New Revision: 307907 URL: https://svnweb.freebsd.org/changeset/base/307907 Log: Update the armv6 tlb handling functions to detect if it is running on hardware that supports the mp extensions. If so it should use the broadcast tlb invalidate instructions as other CPUs or devices may need to know about the invalidation. To simplify the code have the compiler optimise out the else case when not builing for Cortex-A8. Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D8092 Modified: head/sys/arm/include/cpu-v6.h Modified: head/sys/arm/include/cpu-v6.h ============================================================================== --- head/sys/arm/include/cpu-v6.h Tue Oct 25 12:58:36 2016 (r307906) +++ head/sys/arm/include/cpu-v6.h Tue Oct 25 13:45:59 2016 (r307907) @@ -347,12 +347,21 @@ tlb_flush_range_local(vm_offset_t va, vm /* Broadcasting operations. */ #if __ARM_ARCH >= 7 && defined SMP +#if defined(CPU_CORTEXA8) +#define ARM_HAVE_MP_EXTENSIONS (cpuinfo.mp_ext != 0) +#else +#define ARM_HAVE_MP_EXTENSIONS 1 +#endif + static __inline void tlb_flush_all(void) { dsb(); - _CP15_TLBIALLIS(); + if (ARM_HAVE_MP_EXTENSIONS) + _CP15_TLBIALLIS(); + else + _CP15_TLBIALL(); dsb(); } @@ -361,7 +370,10 @@ tlb_flush_all_ng(void) { dsb(); - _CP15_TLBIASIDIS(CPU_ASID_KERNEL); + if (ARM_HAVE_MP_EXTENSIONS) + _CP15_TLBIASIDIS(CPU_ASID_KERNEL); + else + _CP15_TLBIASID(CPU_ASID_KERNEL); dsb(); } @@ -372,7 +384,10 @@ tlb_flush(vm_offset_t va) KASSERT((va & PAGE_MASK) == 0, ("%s: va %#x not aligned", __func__, va)); dsb(); - _CP15_TLBIMVAAIS(va); + if (ARM_HAVE_MP_EXTENSIONS) + _CP15_TLBIMVAAIS(va); + else + _CP15_TLBIMVA(va | CPU_ASID_KERNEL); dsb(); } @@ -386,8 +401,13 @@ tlb_flush_range(vm_offset_t va, vm_size size)); dsb(); - for (; va < eva; va += PAGE_SIZE) - _CP15_TLBIMVAAIS(va); + if (ARM_HAVE_MP_EXTENSIONS) { + for (; va < eva; va += PAGE_SIZE) + _CP15_TLBIMVAAIS(va); + } else { + for (; va < eva; va += PAGE_SIZE) + _CP15_TLBIMVA(va | CPU_ASID_KERNEL); + } dsb(); } #else /* SMP */ @@ -411,19 +431,23 @@ icache_sync(vm_offset_t va, vm_size_t si dsb(); va &= ~cpuinfo.dcache_line_mask; - for ( ; va < eva; va += cpuinfo.dcache_line_size) { #if __ARM_ARCH >= 7 && defined SMP - _CP15_DCCMVAU(va); -#else - _CP15_DCCMVAC(va); + if (ARM_HAVE_MP_EXTENSIONS) { + for ( ; va < eva; va += cpuinfo.dcache_line_size) + _CP15_DCCMVAU(va); + } else #endif + { + for ( ; va < eva; va += cpuinfo.dcache_line_size) + _CP15_DCCMVAC(va); } dsb(); #if __ARM_ARCH >= 7 && defined SMP - _CP15_ICIALLUIS(); -#else - _CP15_ICIALLU(); + if (ARM_HAVE_MP_EXTENSIONS) + _CP15_ICIALLUIS(); + else #endif + _CP15_ICIALLU(); dsb(); isb(); } @@ -433,10 +457,11 @@ static __inline void icache_inv_all(void) { #if __ARM_ARCH >= 7 && defined SMP - _CP15_ICIALLUIS(); -#else - _CP15_ICIALLU(); + if (ARM_HAVE_MP_EXTENSIONS) + _CP15_ICIALLUIS(); + else #endif + _CP15_ICIALLU(); dsb(); isb(); } @@ -446,10 +471,11 @@ static __inline void bpb_inv_all(void) { #if __ARM_ARCH >= 7 && defined SMP - _CP15_BPIALLIS(); -#else - _CP15_BPIALL(); + if (ARM_HAVE_MP_EXTENSIONS) + _CP15_BPIALLIS(); + else #endif + _CP15_BPIALL(); dsb(); isb(); } @@ -462,12 +488,15 @@ dcache_wb_pou(vm_offset_t va, vm_size_t dsb(); va &= ~cpuinfo.dcache_line_mask; - for ( ; va < eva; va += cpuinfo.dcache_line_size) { #if __ARM_ARCH >= 7 && defined SMP - _CP15_DCCMVAU(va); -#else - _CP15_DCCMVAC(va); + if (ARM_HAVE_MP_EXTENSIONS) { + for ( ; va < eva; va += cpuinfo.dcache_line_size) + _CP15_DCCMVAU(va); + } else #endif + { + for ( ; va < eva; va += cpuinfo.dcache_line_size) + _CP15_DCCMVAC(va); } dsb(); } From owner-svn-src-head@freebsd.org Tue Oct 25 14:01:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AB10C21DEB; Tue, 25 Oct 2016 14:01:15 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 010E3307; Tue, 25 Oct 2016 14:01:14 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PE1E9F000785; Tue, 25 Oct 2016 14:01:14 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PE1E41000783; Tue, 25 Oct 2016 14:01:14 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610251401.u9PE1E41000783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 25 Oct 2016 14:01:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307908 - in head/sys/boot/efi: libefi loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 14:01:15 -0000 Author: andrew Date: Tue Oct 25 14:01:13 2016 New Revision: 307908 URL: https://svnweb.freebsd.org/changeset/base/307908 Log: Fix the build on both arm64 and when WITHOUT_FORTH is defined. * On arm64 we need to use the ${MACHINE_CPUARCH} subdirectory. * env.c is only needed when using forth so only build it there. Sponsored by: ABT Systems Ltd Modified: head/sys/boot/efi/libefi/Makefile head/sys/boot/efi/loader/main.c Modified: head/sys/boot/efi/libefi/Makefile ============================================================================== --- head/sys/boot/efi/libefi/Makefile Tue Oct 25 13:45:59 2016 (r307907) +++ head/sys/boot/efi/libefi/Makefile Tue Oct 25 14:01:13 2016 (r307908) @@ -1,10 +1,12 @@ # $FreeBSD$ +.include + LIB= efi INTERNALLIB= WARNS?= 2 -SRCS= delay.c devpath.c efi_console.c efinet.c efipart.c env.c errno.c \ +SRCS= delay.c devpath.c efi_console.c efinet.c efipart.c errno.c \ handles.c libefi.c .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" @@ -12,6 +14,11 @@ SRCS+= time.c .elif ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" SRCS+= time_event.c .endif +.if ${MK_FORTH} != "no" +SRCS+= env.c +CFLAGS+= -I${.CURDIR}/../../ficl +CFLAGS+= -I${.CURDIR}/../../ficl/${MACHINE_CPUARCH} +.endif # We implement a slightly non-standard %S in that it always takes a # CHAR16 that's common in UEFI-land instead of a wchar_t. This only @@ -26,7 +33,6 @@ CFLAGS+= -msoft-float -mgeneral-regs-onl .if ${MACHINE_ARCH} == "amd64" CFLAGS+= -fPIC -mno-red-zone .endif -CFLAGS+= -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/${MACHINE} CFLAGS+= -I${.CURDIR}/../include CFLAGS+= -I${.CURDIR}/../include/${MACHINE} CFLAGS+= -I${.CURDIR}/../../../../lib/libstand Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Tue Oct 25 13:45:59 2016 (r307907) +++ head/sys/boot/efi/loader/main.c Tue Oct 25 14:01:13 2016 (r307908) @@ -55,9 +55,11 @@ extern char bootprog_rev[]; extern char bootprog_date[]; extern char bootprog_maker[]; +#ifdef BOOT_FORTH /* Force a reference to bring in EFI support from the library */ extern int efi_variable_support; int *dummy1 = &efi_variable_support; +#endif struct arch_switch archsw; /* MI/MD interface boundary */ From owner-svn-src-head@freebsd.org Tue Oct 25 14:04:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBEF5C21FCA; Tue, 25 Oct 2016 14:04:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97932AD6; Tue, 25 Oct 2016 14:04:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PE4Z3F002318; Tue, 25 Oct 2016 14:04:35 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PE4ZgB002315; Tue, 25 Oct 2016 14:04:35 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610251404.u9PE4ZgB002315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 25 Oct 2016 14:04:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307909 - in head/sys: arm64/arm64 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.23 Precedence: list List-Id: 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, 25 Oct 2016 14:04:36 -0000 Author: andrew Date: Tue Oct 25 14:04:35 2016 New Revision: 307909 URL: https://svnweb.freebsd.org/changeset/base/307909 Log: Import the Cortex String memcpy and memmove into the kernel. On ThunderX these show a 9-10% reduction in user and system time for a buildworld -j48. Obtained from: ABT Systems Ltd MFC after: 1 week Sponsored by: The FreeBSD Foundation Added: head/sys/arm64/arm64/memcpy.S - copied, changed from r307901, head/contrib/cortex-strings/src/aarch64/memcpy.S head/sys/arm64/arm64/memmove.S - copied, changed from r307901, head/contrib/cortex-strings/src/aarch64/memmove.S Deleted: head/sys/arm64/arm64/bcopy.c Modified: head/sys/conf/files.arm64 Copied and modified: head/sys/arm64/arm64/memcpy.S (from r307901, head/contrib/cortex-strings/src/aarch64/memcpy.S) ============================================================================== --- head/contrib/cortex-strings/src/aarch64/memcpy.S Tue Oct 25 05:45:47 2016 (r307901, copy source) +++ head/sys/arm64/arm64/memcpy.S Tue Oct 25 14:04:35 2016 (r307909) @@ -52,6 +52,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + /* Assumptions: * * ARMv8-a, AArch64, unaligned accesses. @@ -83,14 +86,6 @@ #define L(l) .L ## l - .macro def_fn f p2align=0 - .text - .p2align \p2align - .global \f - .type \f, %function -\f: - .endm - /* Copies are split into 3 main cases: small copies of up to 16 bytes, medium copies of 17..96 bytes which are fully unrolled. Large copies of more than 96 bytes align the destination and use an unrolled loop @@ -100,7 +95,7 @@ well as non-overlapping copies. */ -def_fn memcpy p2align=6 +ENTRY(memcpy) prfm PLDL1KEEP, [src] add srcend, src, count add dstend, dstin, count @@ -221,5 +216,4 @@ L(copy_long): stp B_l, B_h, [dstend, -32] stp C_l, C_h, [dstend, -16] ret - - .size memcpy, . - memcpy +END(memcpy) Copied and modified: head/sys/arm64/arm64/memmove.S (from r307901, head/contrib/cortex-strings/src/aarch64/memmove.S) ============================================================================== --- head/contrib/cortex-strings/src/aarch64/memmove.S Tue Oct 25 05:45:47 2016 (r307901, copy source) +++ head/sys/arm64/arm64/memmove.S Tue Oct 25 14:04:35 2016 (r307909) @@ -52,19 +52,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + /* Assumptions: * * ARMv8-a, AArch64, unaligned accesses */ - .macro def_fn f p2align=0 - .text - .p2align \p2align - .global \f - .type \f, %function -\f: - .endm - /* Parameters and result. */ #define dstin x0 #define src x1 @@ -89,7 +84,12 @@ unrolled loop processes 64 bytes per iteration. */ -def_fn memmove, 6 +ENTRY(bcopy) + /* Switch the input pointers when called as bcopy */ + mov x3, x1 + mov x1, x0 + mov x0, x3 +EENTRY(memmove) sub tmp1, dstin, src cmp count, 96 ccmp tmp1, count, 2, hi @@ -146,5 +146,5 @@ def_fn memmove, 6 stp B_l, B_h, [dstin, 16] stp C_l, C_h, [dstin] 3: ret - - .size memmove, . - memmove +EEND(memmove) +END(bcopy) Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Tue Oct 25 14:01:13 2016 (r307908) +++ head/sys/conf/files.arm64 Tue Oct 25 14:04:35 2016 (r307909) @@ -72,7 +72,6 @@ arm64/acpica/OsdEnvironment.c optional a arm64/acpica/acpi_wakeup.c optional acpi arm64/acpica/pci_cfgreg.c optional acpi pci arm64/arm64/autoconf.c standard -arm64/arm64/bcopy.c standard arm64/arm64/bus_machdep.c standard arm64/arm64/bus_space_asm.S standard arm64/arm64/busdma_bounce.c standard @@ -98,6 +97,8 @@ arm64/arm64/in_cksum.c optional inet | arm64/arm64/locore.S standard no-obj arm64/arm64/machdep.c standard arm64/arm64/mem.c standard +arm64/arm64/memcpy.S standard +arm64/arm64/memmove.S standard arm64/arm64/minidump_machdep.c standard arm64/arm64/mp_machdep.c optional smp arm64/arm64/nexus.c standard @@ -178,7 +179,6 @@ libkern/ffsll.c standard libkern/fls.c standard libkern/flsl.c standard libkern/flsll.c standard -libkern/memmove.c standard libkern/memset.c standard cddl/contrib/opensolaris/common/atomic/aarch64/opensolaris_atomic.S optional zfs | dtrace compile-with "${CDDL_C}" cddl/dev/dtrace/aarch64/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" From owner-svn-src-head@freebsd.org Tue Oct 25 14:18:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A751CC2135B; Tue, 25 Oct 2016 14:18:29 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5105723F; Tue, 25 Oct 2016 14:18:29 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PEISV2006229; Tue, 25 Oct 2016 14:18:28 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PEISSQ006225; Tue, 25 Oct 2016 14:18:28 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610251418.u9PEISSQ006225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 25 Oct 2016 14:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307910 - in head/sys: arm64/arm64 dev/psci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 14:18:29 -0000 Author: andrew Date: Tue Oct 25 14:18:27 2016 New Revision: 307910 URL: https://svnweb.freebsd.org/changeset/base/307910 Log: Create a new PSCI error code and use it to signal that starting the CPU is impossible as the PSCI firmware is missing. Sponsored by: ABT Systmes Ltd Modified: head/sys/arm64/arm64/mp_machdep.c head/sys/dev/psci/psci.c head/sys/dev/psci/psci.h Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Tue Oct 25 14:04:35 2016 (r307909) +++ head/sys/arm64/arm64/mp_machdep.c Tue Oct 25 14:18:27 2016 (r307910) @@ -461,9 +461,13 @@ cpu_init_fdt(u_int id, phandle_t node, u err = psci_cpu_on(target_cpu, pa, cpuid); if (err != PSCI_RETVAL_SUCCESS) { - /* Panic here if INVARIANTS are enabled */ - KASSERT(0, ("Failed to start CPU %u (%lx)\n", id, - target_cpu)); + /* + * Panic here if INVARIANTS are enabled and PSCI failed to + * start the requested CPU. If psci_cpu_on returns PSCI_MISSING + * to indicate we are unable to use it to start the given CPU. + */ + KASSERT(err == PSCI_MISSING, + ("Failed to start CPU %u (%lx)\n", id, target_cpu)); pcpu_destroy(pcpup); kmem_free(kernel_arena, (vm_offset_t)dpcpu[cpuid - 1], Modified: head/sys/dev/psci/psci.c ============================================================================== --- head/sys/dev/psci/psci.c Tue Oct 25 14:04:35 2016 (r307909) +++ head/sys/dev/psci/psci.c Tue Oct 25 14:18:27 2016 (r307910) @@ -189,12 +189,12 @@ psci_cpu_on(unsigned long cpu, unsigned node = ofw_bus_find_compatible(OF_peer(0), "arm,psci-0.2"); if (node == 0) /* TODO: Handle psci 0.1 */ - return (PSCI_RETVAL_INTERNAL_FAILURE); + return (PSCI_MISSING); fnid = PSCI_FNID_CPU_ON; callfn = psci_get_callfn(node); if (callfn == NULL) - return (PSCI_RETVAL_INTERNAL_FAILURE); + return (PSCI_MISSING); } else { callfn = psci_softc->psci_call; fnid = psci_softc->psci_fnids[PSCI_FN_CPU_ON]; Modified: head/sys/dev/psci/psci.h ============================================================================== --- head/sys/dev/psci/psci.h Tue Oct 25 14:04:35 2016 (r307909) +++ head/sys/dev/psci/psci.h Tue Oct 25 14:18:27 2016 (r307910) @@ -54,6 +54,10 @@ int psci_smc_despatch(register_t, regist #define PSCI_RETVAL_INTERNAL_FAILURE -6 #define PSCI_RETVAL_NOT_PRESENT -7 #define PSCI_RETVAL_DISABLED -8 +/* + * Used to signal PSCI is not available, e.g. to start a CPU. + */ +#define PSCI_MISSING 1 /* * PSCI function codes (as per PSCI v0.2). From owner-svn-src-head@freebsd.org Tue Oct 25 14:42:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96A30C21B13; Tue, 25 Oct 2016 14:42:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 671C12A2; Tue, 25 Oct 2016 14:42:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PEg9hR017453; Tue, 25 Oct 2016 14:42:09 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PEg9Ga017452; Tue, 25 Oct 2016 14:42:09 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610251442.u9PEg9Ga017452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Oct 2016 14:42:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307911 - head/sys/boot/efi/loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 14:42:10 -0000 Author: imp Date: Tue Oct 25 14:42:09 2016 New Revision: 307911 URL: https://svnweb.freebsd.org/changeset/base/307911 Log: Add better comment... Modified: head/sys/boot/efi/loader/main.c Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Tue Oct 25 14:18:27 2016 (r307910) +++ head/sys/boot/efi/loader/main.c Tue Oct 25 14:42:09 2016 (r307911) @@ -56,7 +56,17 @@ extern char bootprog_date[]; extern char bootprog_maker[]; #ifdef BOOT_FORTH -/* Force a reference to bring in EFI support from the library */ +/* + * Normally, efi.o from libefi.a would be brought in due to a function we call + * there that's defined there. However, none of its functions are callable from + * here since it just adds words to the FORTH environment or implement those + * words. So, add a reference to a symbol in efi.o to force it to be be brought + * in so the init function there gets added to the "compile" linker set happens + * correctly. + * + * This assumes there's no global analysys that notices dummy1 isn't used + * anywhere and tries to eliminate it. + */ extern int efi_variable_support; int *dummy1 = &efi_variable_support; #endif From owner-svn-src-head@freebsd.org Tue Oct 25 15:16:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 635C0C21BE4 for ; Tue, 25 Oct 2016 15:16:05 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk0-x22c.google.com (mail-qk0-x22c.google.com [IPv6:2607:f8b0:400d:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 18A2B6E2 for ; Tue, 25 Oct 2016 15:16:05 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk0-x22c.google.com with SMTP id v138so22378699qka.5 for ; Tue, 25 Oct 2016 08:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zZa/mFueiptfFtrjshHKB1cqEIj/u0eBtlmsZdRDD54=; b=SXjeU4Vkko0YVp9gHQ2GsGMg5KPqkAJ+CQ0C5FPuuFDAmLlsAeKngvyK2OoIu01Mth dXuD2t2IBG97FXh8NPqMIr/X3C9MdCZ8BSamOSW+4HNlQg0KP9os5sW238caanMFcC5z y9VT3fwRpp5NFFYmVvjGVuBWaQwGeOEkfuNQhO4ds2tkJFoFY133vvUk1kqBWPdIu5xa xp7YAoLpSG2en9kuWgo90/UQfqCDxCXe1zDreruXYZWVkFRKrjxM1vaOdhhgNT3pecsn 36wKqS2ei8b1NvGGHhlzdWasRkSnvS89w2W2gDH4gBOUEs+A70IHH1SLxBbXYOro7L0w 1R3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zZa/mFueiptfFtrjshHKB1cqEIj/u0eBtlmsZdRDD54=; b=MyRQixEPKG30yfv4iGJPqkfLB5iECqhRtEdiMrgfcvLocJLiS3k2mprjV0RQqWEOtR QCa4NhXhLBqcZFe4ID61GiPTGYMUixMKGtaX9m0lKzbURWf41m/AmAhv6sufZRVocoDS 0Hk1fUTKG7iLUFy8TKSXoMPyxZSpRpgElW53CYWo4mb/p247ZEvl69q+mQr1JgLgKF9T xJPUUkccCcwPNxOS6SsdLq1vE67HHQLZJJPecOa97KKewmHvrxZfD6KyaWmVkgzP/Ywf g73ZU94gWXye4xZf1EdJOAJQzcbqQweGgubUYubxcZMDm/Qz9Nk4iCIUrM36HrApWB02 MKxA== X-Gm-Message-State: ABUngvf+AiG+5wyYAhobv1Tvt+DGuj+n53r1MWtiblsePuSGDQf1GkMXqp3XESt1IXPtU00N X-Received: by 10.55.129.1 with SMTP id c1mr18941553qkd.53.1477408564225; Tue, 25 Oct 2016 08:16:04 -0700 (PDT) Received: from mutt-hardenedbsd ([63.88.83.66]) by smtp.gmail.com with ESMTPSA id x75sm11206369qkg.35.2016.10.25.08.16.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Oct 2016 08:16:03 -0700 (PDT) Date: Tue, 25 Oct 2016 11:16:00 -0400 From: Shawn Webb To: Martin Matuska Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307861 - in head: contrib/libarchive contrib/libarchive/cat/test contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/te... Message-ID: <20161025151600.GA58807@mutt-hardenedbsd> References: <201610241408.u9OE86Rn050959@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yrj/dFKFPuw6o+aM" Content-Disposition: inline In-Reply-To: <201610241408.u9OE86Rn050959@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hardenedbsd 12.0-CURRENT-HBSD FreeBSD 12.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 15:16:05 -0000 --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 24, 2016 at 02:08:06PM +0000, Martin Matuska wrote: > Author: mm > Date: Mon Oct 24 14:08:05 2016 > New Revision: 307861 > URL: https://svnweb.freebsd.org/changeset/base/307861 >=20 > Log: > MFV r307859: > Update libarchive to 3.2.2 Hey Martin, Thanks for doing this upgrade! Any plans to MFC? Thanks, --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --yrj/dFKFPuw6o+aM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYD3cuAAoJEGqEZY9SRW7uRpEQAJZcF4NGKTeQudPMRH4otDUp SX8hOtjx8fiBslZf7ncOwBG+vYyBhdhoBu19nmRsyiDMEp2VxpRuNtGLojJmEYez IPvDdivQSWfdY9zRgvrVszt4ws9GTDQi8SI2LqVq6z/eJUZhulhOqci/YIkHIOUI OgatFKreVOi0jMYoLn8DBYq8njhjjqDIPK0KVXsqThdrHMk1MofY9UJIL3fFmfQ4 jkp7o7A8lCEqhNF+iNYacm6AHET3NvDV/iMQZG9kHPcKpgjf0fRoZm3/PDyJfliC QW/eSIysJt9bwPmjpwFkPC+ZAd+gYUi0nP47zS8xcXed+AfcYuFbYOmyeyLNcdB5 ohK8IakCJn9C1Om8q1r/sJBXeQ6j11R29kvfMvjpwYAnczafuXapC/1C8a9hMBCc KXYP/D2c+5EUkJFc36KLOsgXgrW3uhRVXhR8s4T23PCarXNd8yhCXHtgeQC/zCxc i4cv6EeCdHaJ/Ty7yIr9TxWH3j3qg95ijKdB6j4Liai4uKKjzYKOJdsJA5fuzsYF 1ef6gHncTtKxPjr3PumAZ8SQ2yHWFMzREBkrCE4te+0lFDvq2MPmg/xIO85X6JOZ qEbIODm5MagQhZ0JMrziL2FRPVojV/hl77UYktJA6Yr0r6yPUBFtqmN7dzxmjBfK 6jf0S5G2cD/1yayER9jC =n0yz -----END PGP SIGNATURE----- --yrj/dFKFPuw6o+aM-- From owner-svn-src-head@freebsd.org Tue Oct 25 15:20:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0ED81C21D8E; Tue, 25 Oct 2016 15:20:08 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3480C4C; Tue, 25 Oct 2016 15:20:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PFK67M029391; Tue, 25 Oct 2016 15:20:06 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PFK6ti029390; Tue, 25 Oct 2016 15:20:06 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610251520.u9PFK6ti029390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 25 Oct 2016 15:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307917 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 15:20:08 -0000 Author: bapt Date: Tue Oct 25 15:20:06 2016 New Revision: 307917 URL: https://svnweb.freebsd.org/changeset/base/307917 Log: accept4 actually expect SOCK_NONBLOCK and not O_NONBLOCK Reported by: jhb Pointyhat to: bapt Modified: head/usr.sbin/bhyve/dbgport.c Modified: head/usr.sbin/bhyve/dbgport.c ============================================================================== --- head/usr.sbin/bhyve/dbgport.c Tue Oct 25 14:58:49 2016 (r307916) +++ head/usr.sbin/bhyve/dbgport.c Tue Oct 25 15:20:06 2016 (r307917) @@ -73,7 +73,7 @@ again: printf("Waiting for connection from gdb\r\n"); printonce = 1; } - conn_fd = accept4(listen_fd, NULL, NULL, O_NONBLOCK); + conn_fd = accept4(listen_fd, NULL, NULL, SOCK_NONBLOCK); if (conn_fd < 0 && errno != EINTR) perror("accept"); } From owner-svn-src-head@freebsd.org Tue Oct 25 15:21:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BCC5C21E2B; Tue, 25 Oct 2016 15:21:10 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3375F1A; Tue, 25 Oct 2016 15:21:09 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PFL8vc032963; Tue, 25 Oct 2016 15:21:08 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PFL8pN032962; Tue, 25 Oct 2016 15:21:08 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201610251521.u9PFL8pN032962@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 25 Oct 2016 15:21:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307918 - head/sys/arm/allwinner/clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 15:21:10 -0000 Author: manu Date: Tue Oct 25 15:21:08 2016 New Revision: 307918 URL: https://svnweb.freebsd.org/changeset/base/307918 Log: allwinner A10 Pll1 allow changing freq PLL1 is used by the cpu core, allowing changing freq is needed for cpufreq. The factors table contains all the frequencies in the operating point table present in the DTS. MFC after: 1 week Modified: head/sys/arm/allwinner/clk/aw_pll.c Modified: head/sys/arm/allwinner/clk/aw_pll.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_pll.c Tue Oct 25 15:20:06 2016 (r307917) +++ head/sys/arm/allwinner/clk/aw_pll.c Tue Oct 25 15:21:08 2016 (r307918) @@ -192,6 +192,16 @@ struct aw_pll_factor { #define PLLFACTOR(_n, _k, _m, _p, _freq) \ { .n = (_n), .k = (_k), .m = (_m), .p = (_p), .freq = (_freq) } +static struct aw_pll_factor aw_a10_pll1_factors[] = { + PLLFACTOR(6, 0, 0, 0, 144000000), + PLLFACTOR(12, 0, 0, 0, 312000000), + PLLFACTOR(21, 0, 0, 0, 528000000), + PLLFACTOR(29, 0, 0, 0, 720000000), + PLLFACTOR(18, 1, 0, 0, 864000000), + PLLFACTOR(19, 1, 0, 0, 912000000), + PLLFACTOR(20, 1, 0, 0, 960000000), +}; + static struct aw_pll_factor aw_a23_pll1_factors[] = { PLLFACTOR(9, 0, 0, 2, 60000000), PLLFACTOR(10, 0, 0, 2, 66000000), @@ -300,6 +310,47 @@ struct aw_pll_funcs { #define DEVICE_UNLOCK(sc) CLKDEV_DEVICE_UNLOCK((sc)->clkdev) static int +a10_pll1_init(device_t dev, bus_addr_t reg, struct clknode_init_def *def) +{ + /* Allow changing PLL frequency while enabled */ + def->flags = CLK_NODE_GLITCH_FREE; + + return (0); +} + +static int +a10_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout, + int flags) +{ + struct aw_pll_factor *f; + uint32_t val; + int n; + + f = NULL; + for (n = 0; n < nitems(aw_a10_pll1_factors); n++) { + if (aw_a10_pll1_factors[n].freq == *fout) { + f = &aw_a10_pll1_factors[n]; + break; + } + } + if (f == NULL) + return (EINVAL); + + DEVICE_LOCK(sc); + PLL_READ(sc, &val); + val &= ~(A10_PLL1_FACTOR_N|A10_PLL1_FACTOR_K|A10_PLL1_FACTOR_M| + A10_PLL1_OUT_EXT_DIVP); + val |= (f->p << A10_PLL1_OUT_EXT_DIVP_SHIFT); + val |= (f->n << A10_PLL1_FACTOR_N_SHIFT); + val |= (f->k << A10_PLL1_FACTOR_K_SHIFT); + val |= (f->m << A10_PLL1_FACTOR_M_SHIFT); + PLL_WRITE(sc, val); + DEVICE_UNLOCK(sc); + + return (0); +} + +static int a10_pll1_recalc(struct aw_pll_sc *sc, uint64_t *freq) { uint32_t val, m, n, k, p; @@ -948,7 +999,7 @@ a83t_pllcpux_set_freq(struct aw_pll_sc * } static struct aw_pll_funcs aw_pll_func[] = { - PLL(AWPLL_A10_PLL1, a10_pll1_recalc, NULL, NULL), + PLL(AWPLL_A10_PLL1, a10_pll1_recalc, a10_pll1_set_freq, a10_pll1_init), PLL(AWPLL_A10_PLL2, a10_pll2_recalc, a10_pll2_set_freq, NULL), PLL(AWPLL_A10_PLL3, a10_pll3_recalc, a10_pll3_set_freq, a10_pll3_init), PLL(AWPLL_A10_PLL5, a10_pll5_recalc, NULL, NULL), From owner-svn-src-head@freebsd.org Tue Oct 25 16:21:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88BA5C218A2; Tue, 25 Oct 2016 16:21:40 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45C9FD76; Tue, 25 Oct 2016 16:21:40 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PGLd1C055110; Tue, 25 Oct 2016 16:21:39 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PGLd4s055107; Tue, 25 Oct 2016 16:21:39 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610251621.u9PGLd4s055107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Tue, 25 Oct 2016 16:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307923 - in head/usr.sbin/makefs: . cd9660 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.23 Precedence: list List-Id: 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, 25 Oct 2016 16:21:40 -0000 Author: marcel Date: Tue Oct 25 16:21:38 2016 New Revision: 307923 URL: https://svnweb.freebsd.org/changeset/base/307923 Log: Allow building makefs(8) from another Makefile (such as one in a seperate directory hierarchy used to build tools). This boils down to replacing the use of ${.CURDIR} with either ${SRCDIR} or ${SRCTOP}. SRCDIR is defined as the directory in which the Makefile lives that bmake(1) is currently reading. Use SRCTOP when reaching outside of makefs's directory. Modified: head/usr.sbin/makefs/Makefile head/usr.sbin/makefs/cd9660/Makefile.inc head/usr.sbin/makefs/ffs/Makefile.inc Modified: head/usr.sbin/makefs/Makefile ============================================================================== --- head/usr.sbin/makefs/Makefile Tue Oct 25 16:14:11 2016 (r307922) +++ head/usr.sbin/makefs/Makefile Tue Oct 25 16:21:38 2016 (r307923) @@ -1,10 +1,12 @@ # $FreeBSD$ +SRCDIR:=${.PARSEDIR:tA} + .include PROG= makefs -CFLAGS+=-I${.CURDIR} +CFLAGS+=-I${SRCDIR} SRCS= cd9660.c ffs.c \ makefs.c \ @@ -14,24 +16,24 @@ MAN= makefs.8 WARNS?= 2 -.include "${.CURDIR}/cd9660/Makefile.inc" -.include "${.CURDIR}/ffs/Makefile.inc" +.include "${SRCDIR}/cd9660/Makefile.inc" +.include "${SRCDIR}/ffs/Makefile.inc" CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1 CFLAGS+=-DHAVE_STRUCT_STAT_ST_GEN=1 -.PATH: ${.CURDIR}/../../contrib/mtree -CFLAGS+=-I${.CURDIR}/../../contrib/mtree +.PATH: ${SRCTOP}/contrib/mtree +CFLAGS+=-I${SRCTOP}/contrib/mtree SRCS+= getid.c misc.c spec.c -.PATH: ${.CURDIR}/../../contrib/mknod -CFLAGS+=-I${.CURDIR}/../../contrib/mknod +.PATH: ${SRCTOP}/contrib/mknod +CFLAGS+=-I${SRCTOP}/contrib/mknod SRCS+= pack_dev.c -.PATH: ${.CURDIR}/../../sys/ufs/ffs +.PATH: ${SRCTOP}/sys/ufs/ffs SRCS+= ffs_tables.c -CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd +CFLAGS+= -I${SRCTOP}/lib/libnetbsd LIBADD= netbsd util sbuf .if ${MK_TESTS} != "no" Modified: head/usr.sbin/makefs/cd9660/Makefile.inc ============================================================================== --- head/usr.sbin/makefs/cd9660/Makefile.inc Tue Oct 25 16:14:11 2016 (r307922) +++ head/usr.sbin/makefs/cd9660/Makefile.inc Tue Oct 25 16:21:38 2016 (r307923) @@ -1,9 +1,9 @@ # $FreeBSD$ # -.PATH: ${.CURDIR}/cd9660 ${.CURDIR}/../../sys/fs/cd9660/ +.PATH: ${SRCDIR}/cd9660 ${SRCTOP}/sys/fs/cd9660/ -CFLAGS+=-I${.CURDIR}/../../sys/fs/cd9660/ +CFLAGS+=-I${SRCTOP}/sys/fs/cd9660/ SRCS+= cd9660_strings.c cd9660_debug.c cd9660_eltorito.c \ cd9660_write.c cd9660_conversion.c iso9660_rrip.c cd9660_archimedes.c Modified: head/usr.sbin/makefs/ffs/Makefile.inc ============================================================================== --- head/usr.sbin/makefs/ffs/Makefile.inc Tue Oct 25 16:14:11 2016 (r307922) +++ head/usr.sbin/makefs/ffs/Makefile.inc Tue Oct 25 16:21:38 2016 (r307923) @@ -1,9 +1,9 @@ # $FreeBSD$ # -.PATH: ${.CURDIR}/ffs ${.CURDIR}/../../sys/ufs/ffs +.PATH: ${SRCDIR}/ffs ${SRCTOP}/sys/ufs/ffs -CFLAGS+= -I${.CURDIR}/../../sys/ufs/ffs +CFLAGS+= -I${SRCTOP}/sys/ufs/ffs SRCS+= ffs_alloc.c ffs_balloc.c ffs_bswap.c ffs_subr.c ufs_bmap.c SRCS+= buf.c mkfs.c From owner-svn-src-head@freebsd.org Tue Oct 25 16:25:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A750DC21A15; Tue, 25 Oct 2016 16:25:07 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7EEF01C8; Tue, 25 Oct 2016 16:25:07 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PGP6hk056696; Tue, 25 Oct 2016 16:25:06 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PGP6Ji056694; Tue, 25 Oct 2016 16:25:06 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610251625.u9PGP6Ji056694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 25 Oct 2016 16:25:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307925 - 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.23 Precedence: list List-Id: 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, 25 Oct 2016 16:25:07 -0000 Author: andrew Date: Tue Oct 25 16:25:06 2016 New Revision: 307925 URL: https://svnweb.freebsd.org/changeset/base/307925 Log: Remove arm11x6_setttb and armv7_setttb as they are unused. While here remove unneeded code from the ARMv7 cpu assembly code. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/arm/cpufunc_asm_arm11x6.S head/sys/arm/arm/cpufunc_asm_armv7.S head/sys/arm/include/cpufunc.h Modified: head/sys/arm/arm/cpufunc_asm_arm11x6.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_arm11x6.S Tue Oct 25 16:22:43 2016 (r307924) +++ head/sys/arm/arm/cpufunc_asm_arm11x6.S Tue Oct 25 16:25:06 2016 (r307925) @@ -64,14 +64,6 @@ __FBSDID("$FreeBSD$"); .cpu arm1176jz-s -ENTRY(arm11x6_setttb) - mov r1, #0 - mcr p15, 0, r0, c2, c0, 0 /* load new TTB */ - mcr p15, 0, r1, c8, c7, 0 /* invalidate I+D TLBs */ - mcr p15, 0, r1, c7, c10, 4 /* drain write buffer */ - RET -END(arm11x6_setttb) - /* * Preload the cache before issuing the WFI by conditionally disabling the * mcr intstructions the first time around the loop. Ensure the function is Modified: head/sys/arm/arm/cpufunc_asm_armv7.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_armv7.S Tue Oct 25 16:22:43 2016 (r307924) +++ head/sys/arm/arm/cpufunc_asm_armv7.S Tue Oct 25 16:25:06 2016 (r307925) @@ -37,56 +37,16 @@ __FBSDID("$FreeBSD$"); .cpu cortex-a8 +#ifdef ELF_TRAMPOLINE .Lcoherency_level: .word _C_LABEL(arm_cache_loc) .Lcache_type: .word _C_LABEL(arm_cache_type) -.Larmv7_dcache_line_size: - .word _C_LABEL(arm_dcache_min_line_size) -.Larmv7_icache_line_size: - .word _C_LABEL(arm_icache_min_line_size) -.Larmv7_idcache_line_size: - .word _C_LABEL(arm_idcache_min_line_size) .Lway_mask: .word 0x3ff .Lmax_index: .word 0x7fff -.Lpage_mask: - .word 0xfff - -#define PT_NOS (1 << 5) -#define PT_S (1 << 1) -#define PT_INNER_NC 0 -#define PT_INNER_WT (1 << 0) -#define PT_INNER_WB ((1 << 0) | (1 << 6)) -#define PT_INNER_WBWA (1 << 6) -#define PT_OUTER_NC 0 -#define PT_OUTER_WT (2 << 3) -#define PT_OUTER_WB (3 << 3) -#define PT_OUTER_WBWA (1 << 3) -#ifdef SMP -#define PT_ATTR (PT_S|PT_INNER_WBWA|PT_OUTER_WBWA|PT_NOS) -#else -#define PT_ATTR (PT_INNER_WBWA|PT_OUTER_WBWA) -#endif - -ENTRY(armv7_setttb) - dsb - orr r0, r0, #PT_ATTR - mcr CP15_TTBR0(r0) - isb -#ifdef SMP - mcr CP15_TLBIALLIS -#else - mcr CP15_TLBIALL -#endif - dsb - isb - RET -END(armv7_setttb) - -#ifdef ELF_TRAMPOLINE /* Based on algorithm from ARM Architecture Reference Manual */ ENTRY(armv7_dcache_wbinv_all) stmdb sp!, {r4, r5, r6, r7, r8, r9} Modified: head/sys/arm/include/cpufunc.h ============================================================================== --- head/sys/arm/include/cpufunc.h Tue Oct 25 16:22:43 2016 (r307924) +++ head/sys/arm/include/cpufunc.h Tue Oct 25 16:25:06 2016 (r307925) @@ -279,7 +279,6 @@ void armv6_idcache_wbinv_all (void); #endif #if defined(CPU_CORTEXA8) || defined(CPU_CORTEXA_MP) || \ defined(CPU_MV_PJ4B) || defined(CPU_KRAIT) -void armv7_setttb (u_int); void armv7_idcache_wbinv_all (void); void armv7_cpu_sleep (int); void armv7_setup (void); @@ -297,7 +296,6 @@ void pj4bv7_setup (void); #if defined(CPU_ARM1176) void arm11_drain_writebuf (void); -void arm11x6_setttb (u_int); void arm11x6_setup (void); void arm11x6_sleep (int); /* no ref. for errata */ #endif From owner-svn-src-head@freebsd.org Tue Oct 25 16:28:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1E9BC21B90; Tue, 25 Oct 2016 16:28:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93CF164E; Tue, 25 Oct 2016 16:28:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PGSU2i056850; Tue, 25 Oct 2016 16:28:30 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PGSUAq056849; Tue, 25 Oct 2016 16:28:30 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201610251628.u9PGSUAq056849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 25 Oct 2016 16:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307926 - head/sys/dev/bfe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 16:28:31 -0000 Author: glebius Date: Tue Oct 25 16:28:30 2016 New Revision: 307926 URL: https://svnweb.freebsd.org/changeset/base/307926 Log: Check m_getcl() return value. CID: 611376 Modified: head/sys/dev/bfe/if_bfe.c Modified: head/sys/dev/bfe/if_bfe.c ============================================================================== --- head/sys/dev/bfe/if_bfe.c Tue Oct 25 16:25:06 2016 (r307925) +++ head/sys/dev/bfe/if_bfe.c Tue Oct 25 16:28:30 2016 (r307926) @@ -793,6 +793,8 @@ bfe_list_newbuf(struct bfe_softc *sc, in int nsegs; m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) + return (ENOBUFS); m->m_len = m->m_pkthdr.len = MCLBYTES; if (bus_dmamap_load_mbuf_sg(sc->bfe_rxmbuf_tag, sc->bfe_rx_sparemap, From owner-svn-src-head@freebsd.org Tue Oct 25 16:29:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7D58C21C46; Tue, 25 Oct 2016 16:29:17 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65DEA8AB; Tue, 25 Oct 2016 16:29:17 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PGTG0Y056985; Tue, 25 Oct 2016 16:29:16 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PGTFKa056978; Tue, 25 Oct 2016 16:29:15 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610251629.u9PGTFKa056978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Tue, 25 Oct 2016 16:29:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307927 - in head/usr.sbin/makefs: . cd9660 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.23 Precedence: list List-Id: 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, 25 Oct 2016 16:29:17 -0000 Author: marcel Date: Tue Oct 25 16:29:15 2016 New Revision: 307927 URL: https://svnweb.freebsd.org/changeset/base/307927 Log: Be more precise when including headers so that we're less likely to depend on namespace pollution and as such become more portable. This means including headers like or , but also making sure we include system/host headers before local headers. While here: define ENOATTR as ENOMSG in mtree.c. There is no ENOATTR on Linux. With this, makefs is ready for compilation on macOS and Linux. Modified: head/usr.sbin/makefs/cd9660.c head/usr.sbin/makefs/cd9660/cd9660_archimedes.c head/usr.sbin/makefs/cd9660/iso9660_rrip.c head/usr.sbin/makefs/ffs/ffs_bswap.c head/usr.sbin/makefs/ffs/ffs_subr.c head/usr.sbin/makefs/mtree.c head/usr.sbin/makefs/walk.c Modified: head/usr.sbin/makefs/cd9660.c ============================================================================== --- head/usr.sbin/makefs/cd9660.c Tue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/cd9660.c Tue Oct 25 16:29:15 2016 (r307927) @@ -98,10 +98,11 @@ #include __FBSDID("$FreeBSD$"); -#include -#include #include #include +#include +#include +#include #include "makefs.h" #include "cd9660.h" Modified: head/usr.sbin/makefs/cd9660/cd9660_archimedes.c ============================================================================== --- head/usr.sbin/makefs/cd9660/cd9660_archimedes.c Tue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/cd9660/cd9660_archimedes.c Tue Oct 25 16:29:15 2016 (r307927) @@ -40,9 +40,11 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include +#include #include #include "makefs.h" Modified: head/usr.sbin/makefs/cd9660/iso9660_rrip.c ============================================================================== --- head/usr.sbin/makefs/cd9660/iso9660_rrip.c Tue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/cd9660/iso9660_rrip.c Tue Oct 25 16:29:15 2016 (r307927) @@ -35,14 +35,16 @@ * defined in iso9660_rrip.h */ -#include "makefs.h" -#include "cd9660.h" -#include "iso9660_rrip.h" +#include +__FBSDID("$FreeBSD$"); + #include +#include #include -#include -__FBSDID("$FreeBSD$"); +#include "makefs.h" +#include "cd9660.h" +#include "iso9660_rrip.h" static void cd9660_rrip_initialize_inode(cd9660node *); static int cd9660_susp_handle_continuation(cd9660node *); Modified: head/usr.sbin/makefs/ffs/ffs_bswap.c ============================================================================== --- head/usr.sbin/makefs/ffs/ffs_bswap.c Tue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/ffs/ffs_bswap.c Tue Oct 25 16:29:15 2016 (r307927) @@ -38,18 +38,19 @@ __FBSDID("$FreeBSD$"); #include #endif -#include -#include "ffs/ufs_bswap.h" -#include - #if !defined(_KERNEL) #include +#include #include #include #include #define panic(x) printf("%s\n", (x)), abort() #endif +#include +#include "ffs/ufs_bswap.h" +#include + #define fs_old_postbloff fs_spare5[0] #define fs_old_rotbloff fs_spare5[1] #define fs_old_postbl_start fs_maxbsize Modified: head/usr.sbin/makefs/ffs/ffs_subr.c ============================================================================== --- head/usr.sbin/makefs/ffs/ffs_subr.c Tue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/ffs/ffs_subr.c Tue Oct 25 16:29:15 2016 (r307927) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include Modified: head/usr.sbin/makefs/mtree.c ============================================================================== --- head/usr.sbin/makefs/mtree.c Tue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/mtree.c Tue Oct 25 16:29:15 2016 (r307927) @@ -44,10 +44,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "makefs.h" +#ifndef ENOATTR +#define ENOATTR ENOMSG +#endif + #define IS_DOT(nm) ((nm)[0] == '.' && (nm)[1] == '\0') #define IS_DOTDOT(nm) ((nm)[0] == '.' && (nm)[1] == '.' && (nm)[2] == '\0') Modified: head/usr.sbin/makefs/walk.c ============================================================================== --- head/usr.sbin/makefs/walk.c Tue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/walk.c Tue Oct 25 16:29:15 2016 (r307927) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include From owner-svn-src-head@freebsd.org Tue Oct 25 16:33:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52520C21EC3; Tue, 25 Oct 2016 16:33:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24279E13; Tue, 25 Oct 2016 16:33:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PGX5J0060589; Tue, 25 Oct 2016 16:33:05 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PGX5Sc060588; Tue, 25 Oct 2016 16:33:05 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610251633.u9PGX5Sc060588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 25 Oct 2016 16:33:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307928 - head/sys/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.23 Precedence: list List-Id: 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, 25 Oct 2016 16:33:06 -0000 Author: andrew Date: Tue Oct 25 16:33:05 2016 New Revision: 307928 URL: https://svnweb.freebsd.org/changeset/base/307928 Log: Remove armadaxp_idcache_wbinv_all, it's a static function in the ELF trampoline and not used outside this. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/include/cpufunc.h Modified: head/sys/arm/include/cpufunc.h ============================================================================== --- head/sys/arm/include/cpufunc.h Tue Oct 25 16:29:15 2016 (r307927) +++ head/sys/arm/include/cpufunc.h Tue Oct 25 16:33:05 2016 (r307928) @@ -284,8 +284,6 @@ void armv7_cpu_sleep (int); void armv7_setup (void); void armv7_drain_writebuf (void); -void armadaxp_idcache_wbinv_all (void); - void cortexa_setup (void); #endif #if defined(CPU_MV_PJ4B) From owner-svn-src-head@freebsd.org Tue Oct 25 17:13:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B052C2112E; Tue, 25 Oct 2016 17:13:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57C6C1459; Tue, 25 Oct 2016 17:13:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PHDkJH076227; Tue, 25 Oct 2016 17:13:46 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PHDkq2076226; Tue, 25 Oct 2016 17:13:46 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201610251713.u9PHDkq2076226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 25 Oct 2016 17:13:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307936 - 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.23 Precedence: list List-Id: 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, 25 Oct 2016 17:13:47 -0000 Author: glebius Date: Tue Oct 25 17:13:46 2016 New Revision: 307936 URL: https://svnweb.freebsd.org/changeset/base/307936 Log: The argument validation in r296956 was not enough to close all possible overflows in sysarch(2). Submitted by: Kun Yang Patch by: kib Security: SA-16:15 Modified: head/sys/amd64/amd64/sys_machdep.c Modified: head/sys/amd64/amd64/sys_machdep.c ============================================================================== --- head/sys/amd64/amd64/sys_machdep.c Tue Oct 25 17:11:20 2016 (r307935) +++ head/sys/amd64/amd64/sys_machdep.c Tue Oct 25 17:13:46 2016 (r307936) @@ -608,6 +608,8 @@ amd64_set_ldt(td, uap, descs) largest_ld = uap->start + uap->num; if (largest_ld > max_ldt_segment) largest_ld = max_ldt_segment; + if (largest_ld < uap->start) + return (EINVAL); i = largest_ld - uap->start; mtx_lock(&dt_lock); bzero(&((struct user_segment_descriptor *)(pldt->ldt_base)) @@ -620,7 +622,8 @@ amd64_set_ldt(td, uap, descs) /* verify range of descriptors to modify */ largest_ld = uap->start + uap->num; if (uap->start >= max_ldt_segment || - largest_ld > max_ldt_segment) + largest_ld > max_ldt_segment || + largest_ld < uap->start) return (EINVAL); } From owner-svn-src-head@freebsd.org Tue Oct 25 17:13:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64F0BC21172; Tue, 25 Oct 2016 17:13:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 351BA15EF; Tue, 25 Oct 2016 17:13:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PHDwsa076279; Tue, 25 Oct 2016 17:13:58 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PHDwXo076278; Tue, 25 Oct 2016 17:13:58 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201610251713.u9PHDwXo076278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 25 Oct 2016 17:13:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307937 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 17:13:59 -0000 Author: glebius Date: Tue Oct 25 17:13:58 2016 New Revision: 307937 URL: https://svnweb.freebsd.org/changeset/base/307937 Log: Fix unchecked array reference in the VGA device emulation code. Submitted by: Ilja Van Sprundel Patch by: tychon Security: SA-16:32 Modified: head/usr.sbin/bhyve/vga.c Modified: head/usr.sbin/bhyve/vga.c ============================================================================== --- head/usr.sbin/bhyve/vga.c Tue Oct 25 17:13:46 2016 (r307936) +++ head/usr.sbin/bhyve/vga.c Tue Oct 25 17:13:58 2016 (r307937) @@ -161,10 +161,10 @@ struct vga_softc { */ struct { uint8_t dac_state; - int dac_rd_index; - int dac_rd_subindex; - int dac_wr_index; - int dac_wr_subindex; + uint8_t dac_rd_index; + uint8_t dac_rd_subindex; + uint8_t dac_wr_index; + uint8_t dac_wr_subindex; uint8_t dac_palette[3 * 256]; uint32_t dac_palette_rgb[256]; } vga_dac; From owner-svn-src-head@freebsd.org Tue Oct 25 17:31:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E2A7C21B17; Tue, 25 Oct 2016 17:31:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1794C9AA; Tue, 25 Oct 2016 17:31:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PHVwrA084253; Tue, 25 Oct 2016 17:31:58 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PHVvjj084243; Tue, 25 Oct 2016 17:31:57 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610251731.u9PHVvjj084243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Oct 2016 17:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307942 - in head/sys/boot: common efi/libefi ficl ficl32 i386/libi386 i386/loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 17:31:59 -0000 Author: imp Date: Tue Oct 25 17:31:57 2016 New Revision: 307942 URL: https://svnweb.freebsd.org/changeset/base/307942 Log: Really make WITHOUT_FORTH (MK_FORTH==no) work. The recent inclusion of FICL definitions not in ficl/ficl32 files broke this generally. This makes that stuff conditional on BOOT_FORTH. Also, move definitions related to the architecture (FICL_CPUARCH and friends) into Makefile.ficl that all parts of the tree that include files with ficl need to include (but only if MK_FORTH == yes). In addition, had to fix library ordering issue with LIBSTAND to keep it last. Without boot forth, there's no references to memset to bring in memset.o from libstand.a to satisfy libgeliboot.a's use of it. Listing libstand last solves this issue (and it's the proper place for libstand to boot). Modified: head/sys/boot/common/Makefile.inc head/sys/boot/common/pnp.c head/sys/boot/efi/libefi/Makefile head/sys/boot/ficl/Makefile head/sys/boot/ficl32/Makefile head/sys/boot/i386/libi386/biospci.c head/sys/boot/i386/loader/Makefile Modified: head/sys/boot/common/Makefile.inc ============================================================================== --- head/sys/boot/common/Makefile.inc Tue Oct 25 17:16:58 2016 (r307941) +++ head/sys/boot/common/Makefile.inc Tue Oct 25 17:31:57 2016 (r307942) @@ -60,6 +60,7 @@ SRCS+= pnp.c # Forth interpreter .if defined(BOOT_FORTH) SRCS+= interp_forth.c +.include "${SRCTOP}/sys/boot/Makefile.ficl" .endif .if defined(BOOT_PROMPT_123) Modified: head/sys/boot/common/pnp.c ============================================================================== --- head/sys/boot/common/pnp.c Tue Oct 25 17:16:58 2016 (r307941) +++ head/sys/boot/common/pnp.c Tue Oct 25 17:31:57 2016 (r307942) @@ -17,7 +17,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef BOOT_FORTH #include "ficl.h" +#endif static struct pnpinfo_stql pnp_devices; static int pnp_devices_initted = 0; @@ -186,6 +188,7 @@ pnp_eisaformat(u_int8_t *data) return(idbuf); } +#ifdef BOOT_FORTH void ficlPnpdevices(FICL_VM *pVM) { @@ -230,3 +233,4 @@ static void ficlCompilePnp(FICL_SYSTEM * } FICL_COMPILE_SET(ficlCompilePnp); +#endif Modified: head/sys/boot/efi/libefi/Makefile ============================================================================== --- head/sys/boot/efi/libefi/Makefile Tue Oct 25 17:16:58 2016 (r307941) +++ head/sys/boot/efi/libefi/Makefile Tue Oct 25 17:31:57 2016 (r307942) @@ -2,6 +2,10 @@ .include +.if ${MK_FORTH} != "no" +.include "${.CURDIR}/../../Makefile.ficl" +.endif + LIB= efi INTERNALLIB= WARNS?= 2 @@ -16,8 +20,6 @@ SRCS+= time_event.c .endif .if ${MK_FORTH} != "no" SRCS+= env.c -CFLAGS+= -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/${MACHINE_CPUARCH} .endif # We implement a slightly non-standard %S in that it always takes a Modified: head/sys/boot/ficl/Makefile ============================================================================== --- head/sys/boot/ficl/Makefile Tue Oct 25 17:16:58 2016 (r307941) +++ head/sys/boot/ficl/Makefile Tue Oct 25 17:31:57 2016 (r307942) @@ -1,15 +1,8 @@ # $FreeBSD$ # -FICLDIR?= ${.CURDIR} +.include "${.CURDIR}/../Makefile.ficl" -.if defined(FICL32) -.PATH: ${FICLDIR}/${MACHINE_CPUARCH:S/amd64/i386/} -.elif ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el" -.PATH: ${FICLDIR}/mips64 -.else -.PATH: ${FICLDIR}/${MACHINE_CPUARCH} -.endif BASE_SRCS= dict.c ficl.c fileaccess.c float.c loader.c math64.c \ prefix.c search.c stack.c tools.c vm.c words.c @@ -41,42 +34,6 @@ SOFTWORDS= softcore.fr jhlocal.fr marker # Optional OO extension softwords #SOFTWORDS+= oo.fr classes.fr -.if ${MACHINE_CPUARCH} == "amd64" -.if defined(FICL32) -CFLAGS+= -m32 -I. -.else -CFLAGS+= -fPIC -.endif -.endif - -.if ${MACHINE_ARCH} == "powerpc64" -CFLAGS+= -m32 -mcpu=powerpc -I. -.endif - -.if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32) -FICL_CPUARCH= i386 -.elif ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el" -FICL_CPUARCH= mips64 -.else -FICL_CPUARCH= ${MACHINE_CPUARCH} -.endif - -CFLAGS+= -I${FICLDIR} -I${FICLDIR}/${FICL_CPUARCH} \ - -I${FICLDIR}/../common - softcore.c: ${SOFTWORDS} softcore.awk (cd ${FICLDIR}/softwords; cat ${SOFTWORDS} \ | awk -f softcore.awk -v datestamp="`LC_ALL=C date`") > ${.TARGET} - -.if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32) -.if !exists(machine) -${SRCS:M*.c:R:S/$/.o/g}: machine - -beforedepend ${OBJS}: machine -.endif - -machine: .NOMETA - ln -sf ${.CURDIR}/../../i386/include machine - -CLEANFILES+= machine -.endif Modified: head/sys/boot/ficl32/Makefile ============================================================================== --- head/sys/boot/ficl32/Makefile Tue Oct 25 17:16:58 2016 (r307941) +++ head/sys/boot/ficl32/Makefile Tue Oct 25 17:31:57 2016 (r307942) @@ -1,8 +1,5 @@ # $FreeBSD$ FICL32= -FICLDIR= ${.CURDIR}/../ficl -.PATH: ${FICLDIR} - -.include "${FICLDIR}/Makefile" +.include "${.CURDIR}/../ficl/Makefile" Modified: head/sys/boot/i386/libi386/biospci.c ============================================================================== --- head/sys/boot/i386/libi386/biospci.c Tue Oct 25 17:16:58 2016 (r307941) +++ head/sys/boot/i386/libi386/biospci.c Tue Oct 25 17:31:57 2016 (r307942) @@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$"); #include #include #include "libi386.h" +#ifdef BOOT_FORTH #include "ficl.h" +#endif /* * Stupid PCI BIOS interface doesn't let you simply enumerate everything @@ -429,6 +431,7 @@ biospci_count_device_type(uint32_t devid return i; } +#ifdef BOOT_FORTH /* * pcibios-device-count (devid -- count) * @@ -582,3 +585,4 @@ static void ficlCompilePciBios(FICL_SYST } FICL_COMPILE_SET(ficlCompilePciBios); +#endif Modified: head/sys/boot/i386/loader/Makefile ============================================================================== --- head/sys/boot/i386/loader/Makefile Tue Oct 25 17:16:58 2016 (r307941) +++ head/sys/boot/i386/loader/Makefile Tue Oct 25 17:31:57 2016 (r307942) @@ -123,8 +123,8 @@ FILES+= loader.rc menu.rc # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} -DPADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND} ${LIBGELIBOOT} -LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND} ${LIBGELIBOOT} +DPADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSTAND} +LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSTAND} .include From owner-svn-src-head@freebsd.org Tue Oct 25 17:57:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CC30C201BD; Tue, 25 Oct 2016 17:57:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CE72AD0; Tue, 25 Oct 2016 17:57:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PHvVLL092556; Tue, 25 Oct 2016 17:57:31 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PHvV61092555; Tue, 25 Oct 2016 17:57:31 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610251757.u9PHvV61092555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 25 Oct 2016 17:57:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307943 - head/sys/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.23 Precedence: list List-Id: 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, 25 Oct 2016 17:57:32 -0000 Author: andrew Date: Tue Oct 25 17:57:31 2016 New Revision: 307943 URL: https://svnweb.freebsd.org/changeset/base/307943 Log: Remove the need for the delay to be zero when MULTIDELAY is undefined, it may be useful to only enable this in some configs. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/include/platformvar.h Modified: head/sys/arm/include/platformvar.h ============================================================================== --- head/sys/arm/include/platformvar.h Tue Oct 25 17:31:57 2016 (r307942) +++ head/sys/arm/include/platformvar.h Tue Oct 25 17:57:31 2016 (r307943) @@ -93,7 +93,7 @@ extern platform_method_t fdt_platform_me #ifdef MULTIDELAY #define FDT_PLATFORM_CTASSERT(delay) CTASSERT(delay > 0) #else -#define FDT_PLATFORM_CTASSERT(delay) CTASSERT(delay == 0) +#define FDT_PLATFORM_CTASSERT(delay) #endif #define FDT_PLATFORM_DEF2(NAME, VAR_NAME, NAME_STR, size, compatible, \ From owner-svn-src-head@freebsd.org Tue Oct 25 18:01:21 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0352BC20433; Tue, 25 Oct 2016 18:01:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BADDAED4; Tue, 25 Oct 2016 18:01:20 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PI1J0B093355; Tue, 25 Oct 2016 18:01:19 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PI1Jq1093353; Tue, 25 Oct 2016 18:01:19 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610251801.u9PI1Jq1093353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 25 Oct 2016 18:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307944 - 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.23 Precedence: list List-Id: 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, 25 Oct 2016 18:01:21 -0000 Author: andrew Date: Tue Oct 25 18:01:19 2016 New Revision: 307944 URL: https://svnweb.freebsd.org/changeset/base/307944 Log: Add MULTIDELAY support to the am335x dmtimer. This will be useful for testing Cortex-A8 support in GENERIC. Sponsored by: ABT Systems Ltd Modified: head/sys/arm/ti/am335x/am335x_dmtimer.c head/sys/arm/ti/ti_machdep.c Modified: head/sys/arm/ti/am335x/am335x_dmtimer.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_dmtimer.c Tue Oct 25 17:57:31 2016 (r307943) +++ head/sys/arm/ti/am335x/am335x_dmtimer.c Tue Oct 25 18:01:19 2016 (r307944) @@ -38,6 +38,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef MULTIDELAY +#include /* For arm_set_delay */ +#endif + #include #include #include @@ -67,6 +71,8 @@ struct am335x_dmtimer_softc { static struct am335x_dmtimer_softc *am335x_dmtimer_et_sc = NULL; static struct am335x_dmtimer_softc *am335x_dmtimer_tc_sc = NULL; +static void am335x_dmtimer_delay(int, void *); + /* * We use dmtimer2 for eventtimer and dmtimer3 for timecounter. */ @@ -235,6 +241,10 @@ am335x_dmtimer_tc_init(struct am335x_dmt am335x_dmtimer_tc_sc = sc; tc_init(&sc->func.tc); +#ifdef MULTIDELAY + arm_set_delay(am335x_dmtimer_delay, sc); +#endif + return (0); } @@ -328,23 +338,13 @@ static devclass_t am335x_dmtimer_devclas DRIVER_MODULE(am335x_dmtimer, simplebus, am335x_dmtimer_driver, am335x_dmtimer_devclass, 0, 0); MODULE_DEPEND(am335x_dmtimer, am335x_prcm, 1, 1, 1); -void -DELAY(int usec) +static void +am335x_dmtimer_delay(int usec, void *arg) { - struct am335x_dmtimer_softc *sc; + struct am335x_dmtimer_softc *sc = arg; int32_t counts; uint32_t first, last; - sc = am335x_dmtimer_tc_sc; - - if (sc == NULL) { - for (; usec > 0; usec--) - for (counts = 200; counts > 0; counts--) - /* Prevent gcc from optimizing out the loop */ - cpufunc_nullop(); - return; - } - /* Get the number of times to count */ counts = (usec + 1) * (sc->sysclk_freq / 1000000); @@ -361,3 +361,19 @@ DELAY(int usec) } } +#ifndef MULTIDELAY +void +DELAY(int usec) +{ + int32_t counts; + + if (am335x_dmtimer_tc_sc == NULL) { + for (; usec > 0; usec--) + for (counts = 200; counts > 0; counts--) + /* Prevent gcc from optimizing out the loop */ + cpufunc_nullop(); + return; + } else + am335x_dmtimer_delay(usec, am335x_dmtimer_tc_sc); +} +#endif Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Tue Oct 25 17:57:31 2016 (r307943) +++ head/sys/arm/ti/ti_machdep.c Tue Oct 25 18:01:19 2016 (r307944) @@ -124,5 +124,5 @@ static platform_method_t am335x_methods[ PLATFORMMETHOD_END, }; -FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am335x", 0); +FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am335x", 200); #endif From owner-svn-src-head@freebsd.org Tue Oct 25 18:36:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BBD1C216D1; Tue, 25 Oct 2016 18:36:17 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF4CDBCB; Tue, 25 Oct 2016 18:36:16 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PIaGC4007768; Tue, 25 Oct 2016 18:36:16 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PIaGtK007767; Tue, 25 Oct 2016 18:36:16 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201610251836.u9PIaGtK007767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 25 Oct 2016 18:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307946 - head/sys/dev/usb/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.23 Precedence: list List-Id: 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, 25 Oct 2016 18:36:17 -0000 Author: cem Date: Tue Oct 25 18:36:15 2016 New Revision: 307946 URL: https://svnweb.freebsd.org/changeset/base/307946 Log: uhso(4): Fix a null pointer dereference The directly following m_defrag() call can wait, so there is no reason this call can't as well. Reported by: Coverity CID: 1353551 Sponsored by: Dell EMC Isilon Modified: head/sys/dev/usb/net/uhso.c Modified: head/sys/dev/usb/net/uhso.c ============================================================================== --- head/sys/dev/usb/net/uhso.c Tue Oct 25 18:17:03 2016 (r307945) +++ head/sys/dev/usb/net/uhso.c Tue Oct 25 18:36:15 2016 (r307946) @@ -1752,7 +1752,7 @@ uhso_if_rxflush(void *arg) * Allocate a new mbuf for this IP packet and * copy the IP-packet into it. */ - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_WAITOK, MT_DATA, M_PKTHDR); memcpy(mtod(m, uint8_t *), mtod(m0, uint8_t *), iplen); m->m_pkthdr.len = m->m_len = iplen; From owner-svn-src-head@freebsd.org Tue Oct 25 18:43:38 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3260AC21BE9; Tue, 25 Oct 2016 18:43:38 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00E7F69F; Tue, 25 Oct 2016 18:43:37 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PIhbvm011560; Tue, 25 Oct 2016 18:43:37 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PIhbte011559; Tue, 25 Oct 2016 18:43:37 GMT (envelope-from br@FreeBSD.org) Message-Id: <201610251843.u9PIhbte011559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 25 Oct 2016 18:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307947 - head/tests/sys/geom/class/uzip X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 18:43:38 -0000 Author: br Date: Tue Oct 25 18:43:36 2016 New Revision: 307947 URL: https://svnweb.freebsd.org/changeset/base/307947 Log: Change fs image name so it will not be regenerated (we have both big and little-endian images in tree). Also we don't known the endianness of the platform the image was generated on. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/tests/sys/geom/class/uzip/Makefile Modified: head/tests/sys/geom/class/uzip/Makefile ============================================================================== --- head/tests/sys/geom/class/uzip/Makefile Tue Oct 25 18:36:15 2016 (r307946) +++ head/tests/sys/geom/class/uzip/Makefile Tue Oct 25 18:43:36 2016 (r307947) @@ -8,7 +8,7 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} -IMAGE= 1_endian_little.img +IMAGE= 1_endian_unknown_autogenerated.img ZIMAGE= ${IMAGE}.uzip UZIMAGE= ${ZIMAGE}.uue @@ -26,7 +26,7 @@ ${UZIMAGE}: ${IMAGE} ${ZIMAGE} uuencode ${ZIMAGE} ${ZIMAGE} >>${.TARGET} ${PACKAGE}FILES+= conf.sh 1_endian_big.img.uzip.uue \ - ${UZIMAGE} + 1_endian_little.img.uzip.uue FILESGROUPS+= etalon etalon+= etalon/etalon.txt From owner-svn-src-head@freebsd.org Tue Oct 25 18:45:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DB14C21C8E; Tue, 25 Oct 2016 18:45:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F474899; Tue, 25 Oct 2016 18:45:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PIjEQb011686; Tue, 25 Oct 2016 18:45:14 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PIjEJ0011685; Tue, 25 Oct 2016 18:45:14 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610251845.u9PIjEJ0011685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 25 Oct 2016 18:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307948 - head/lib/libsysdecode X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 18:45:15 -0000 Author: jhb Date: Tue Oct 25 18:45:14 2016 New Revision: 307948 URL: https://svnweb.freebsd.org/changeset/base/307948 Log: Use binary and (&) instead of logical to extract the mask of a capability. CID: 1365227 Submitted by: cem Modified: head/lib/libsysdecode/flags.c Modified: head/lib/libsysdecode/flags.c ============================================================================== --- head/lib/libsysdecode/flags.c Tue Oct 25 18:43:36 2016 (r307947) +++ head/lib/libsysdecode/flags.c Tue Oct 25 18:45:14 2016 (r307948) @@ -959,7 +959,7 @@ sysdecode_umtx_rwlock_flags(FILE *fp, u_ } /* XXX: This should be in */ -#define CAPMASK(right) ((right) && (((uint64_t)1 << 57) - 1)) +#define CAPMASK(right) ((right) & (((uint64_t)1 << 57) - 1)) void sysdecode_cap_rights(FILE *fp, cap_rights_t *rightsp) From owner-svn-src-head@freebsd.org Tue Oct 25 18:57:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7C9DC21FE3; Tue, 25 Oct 2016 18:57:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77ED4FBE; Tue, 25 Oct 2016 18:57:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PIvPcG015565; Tue, 25 Oct 2016 18:57:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PIvP9n015564; Tue, 25 Oct 2016 18:57:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610251857.u9PIvP9n015564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Oct 2016 18:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307949 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 18:57:26 -0000 Author: imp Date: Tue Oct 25 18:57:25 2016 New Revision: 307949 URL: https://svnweb.freebsd.org/changeset/base/307949 Log: Add missing file Added: head/Makefile.ficl (contents, props changed) Added: head/Makefile.ficl ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/Makefile.ficl Tue Oct 25 18:57:25 2016 (r307949) @@ -0,0 +1,43 @@ +# $FreeBSD$ + +# Common flags to build FICL related files + +FICLDIR?= ${SRCTOP}/sys/boot/ficl + +.if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32) +FICL_CPUARCH= i386 +.elif ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el" +FICL_CPUARCH= mips64 +.else +FICL_CPUARCH= ${MACHINE_CPUARCH} +.endif + +.PATH: ${FICLDIR} ${FICLDIR}/${FICL_CPUARCH} + +.if ${MACHINE_CPUARCH} == "amd64" +.if defined(FICL32) +CFLAGS+= -m32 -I. +.else +CFLAGS+= -fPIC +.endif +.endif + +.if ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -m32 -mcpu=powerpc -I. +.endif + +CFLAGS+= -I${FICLDIR} -I${FICLDIR}/${FICL_CPUARCH} \ + -I${FICLDIR}/../common + +.if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32) +.if !exists(machine) +${SRCS:M*.c:R:S/$/.o/g}: machine + +beforedepend ${OBJS}: machine +.endif + +machine: .NOMETA + ln -sf ${.CURDIR}/../../i386/include machine + +CLEANFILES+= machine +.endif From owner-svn-src-head@freebsd.org Tue Oct 25 19:04:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D912C2235F; Tue, 25 Oct 2016 19:04:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A39B8D8; Tue, 25 Oct 2016 19:04:45 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PJ4iXr019206; Tue, 25 Oct 2016 19:04:44 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PJ4iHs019205; Tue, 25 Oct 2016 19:04:44 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610251904.u9PJ4iHs019205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Oct 2016 19:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307951 - in head: . sys/boot/efi/libefi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 19:04:45 -0000 Author: imp Date: Tue Oct 25 19:04:44 2016 New Revision: 307951 URL: https://svnweb.freebsd.org/changeset/base/307951 Log: Fix two backwards tests. CID: 1365227, 1365228 Deleted: head/Makefile.ficl Modified: head/sys/boot/efi/libefi/env.c Modified: head/sys/boot/efi/libefi/env.c ============================================================================== --- head/sys/boot/efi/libefi/env.c Tue Oct 25 19:04:42 2016 (r307950) +++ head/sys/boot/efi/libefi/env.c Tue Oct 25 19:04:44 2016 (r307951) @@ -114,7 +114,7 @@ ficlEfiSetenv(FICL_VM *pVM) #ifndef TESTMAIN guid = (char*)ficlMalloc(guids); - if (guid != NULL) + if (guid == NULL) vmThrowErr(pVM, "Error: out of memory"); memcpy(guid, guidp, guids); uuid_from_string(guid, &u, &ustatus); @@ -131,7 +131,7 @@ ficlEfiSetenv(FICL_VM *pVM) name[names] = (CHAR16)0; value = (char*)ficlMalloc(values + 1); - if (value != NULL) + if (value == NULL) vmThrowErr(pVM, "Error: out of memory"); memcpy(value, valuep, values); @@ -166,7 +166,7 @@ ficlEfiGetenv(FICL_VM *pVM) #ifndef TESTMAIN name = (char*) ficlMalloc(names+1); - if (!name) + if (name == NULL) vmThrowErr(pVM, "Error: out of memory"); strncpy(name, namep, names); name[names] = '\0'; @@ -201,7 +201,7 @@ ficlEfiUnsetenv(FICL_VM *pVM) #ifndef TESTMAIN name = (char*) ficlMalloc(names+1); - if (!name) + if (name == NULL) vmThrowErr(pVM, "Error: out of memory"); strncpy(name, namep, names); name[names] = '\0'; From owner-svn-src-head@freebsd.org Tue Oct 25 19:04:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B27F4C22340; Tue, 25 Oct 2016 19:04:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 673DC8C6; Tue, 25 Oct 2016 19:04:43 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9PJ4g15019162; Tue, 25 Oct 2016 19:04:42 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9PJ4gjW019161; Tue, 25 Oct 2016 19:04:42 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610251904.u9PJ4gjW019161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 25 Oct 2016 19:04:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307950 - head/sys/boot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 19:04:43 -0000 Author: imp Date: Tue Oct 25 19:04:42 2016 New Revision: 307950 URL: https://svnweb.freebsd.org/changeset/base/307950 Log: Add it to the right place Added: head/sys/boot/Makefile.ficl - copied, changed from r307949, head/Makefile.ficl Copied and modified: head/sys/boot/Makefile.ficl (from r307949, head/Makefile.ficl) ============================================================================== From owner-svn-src-head@freebsd.org Tue Oct 25 19:26:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00FEFC22933; Tue, 25 Oct 2016 19:26:13 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay106.isp.belgacom.be (mailrelay106.isp.belgacom.be [195.238.20.133]) (using TLSv1.2 with cipher RC4-SHA (128/128 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign Organization Validation CA - SHA256 - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D56C68AB; Tue, 25 Oct 2016 19:26:10 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2CrBgB1sA9Y/1QiyVBcGwEBAQMBAQEJA?= =?us-ascii?q?QEBgy8BAQEBAR1KDm0QpDOWRieFdAQCAoFyRBABAgEBAQEBAQFiKIRjAQEEOhw?= =?us-ascii?q?jEAsUBAklDyoeBgESiFcKwXEBAQEBAQEBAQEBAQEBAQEBAQEfixKKJgEEmhaGK?= =?us-ascii?q?olicnFkjUeNCIQBNR9ehQQ8NIVkK4ICAQEB?= Received: from 84.34-201-80.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([80.201.34.84]) by relay.skynet.be with ESMTP; 25 Oct 2016 21:26:01 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id u9PJQ1oh093546; Tue, 25 Oct 2016 21:26:01 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Tue, 25 Oct 2016 21:26:00 +0200 From: Tijl Coosemans To: Gleb Smirnoff , kib@FreeBSD.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307936 - head/sys/amd64/amd64 Message-ID: <20161025212600.36e91455@kalimero.tijl.coosemans.org> In-Reply-To: <201610251713.u9PHDkq2076226@repo.freebsd.org> References: <201610251713.u9PHDkq2076226@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 19:26:13 -0000 On Tue, 25 Oct 2016 17:13:46 +0000 (UTC) Gleb Smirnoff wrote: > Author: glebius > Date: Tue Oct 25 17:13:46 2016 > New Revision: 307936 > URL: https://svnweb.freebsd.org/changeset/base/307936 > > Log: > The argument validation in r296956 was not enough to close all possible > overflows in sysarch(2). > > Submitted by: Kun Yang > Patch by: kib > Security: SA-16:15 > > Modified: > head/sys/amd64/amd64/sys_machdep.c This patch and r296956 need to be applied to i386 too, don't they? From owner-svn-src-head@freebsd.org Tue Oct 25 19:36:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 360B7C22D4D for ; Tue, 25 Oct 2016 19:36:44 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C1374F1 for ; Tue, 25 Oct 2016 19:36:43 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-wm0-x236.google.com with SMTP id c78so182513020wme.0 for ; Tue, 25 Oct 2016 12:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=bTnt8AQmrB9AfpIxjjrvwrOsJ0g/B09IcIbz1GFNcYc=; b=OXoCgKF2Jio69xHVFHOs6Vs9E1o1sirVqPGvySC06NU+z+RO0vB2eDCkCykXBOLFd9 730goVgrhMA05OnZOuteU2OEpCjt6ZxRlITOdmaiEphXrZQ3Lf5rdxx5njSOaeKQcBre RoFBgMk+acNL4Eob/qwSV2hRB1ZU7ZmfXAMdg0S5ntmcjcPHOmaIWox+580bYEqSuMpc K0vzEhjI9sdKwo7RXNxe0tnwsEdldhsFEKiByiPbwe6kwgv8TmnhF/5UMAXZc5VkxyoH 2yTplBPrepJiTqYteAgHLFBB5wEHvDjJsj/ng0wP1SRCCz38pwRcJxXh6nsFiI58eq+Q MB8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=bTnt8AQmrB9AfpIxjjrvwrOsJ0g/B09IcIbz1GFNcYc=; b=Y6wu+/QvQKJgHqS/cWxAibntnwiXmFfoEnPBNwfTsbpdej4yTTEWq4ThNnTVfzQYgV uwzo3dq9QW1o0Td98I/2uCg+9G4LNP9Iq8H9phoE8gts+Se8PNTIueVFQdoemJoJnbS6 /Tx67sMe6nAGLvo5CmRCLbQBSlbTBzdKdua1yDp8RYLs4k8CFVBmf4n3d0T7+UhAra/q 0qlHVwxCADm4dlmcUIfAiuZr+Ir62rZPRqlhztWCyF6CGV7kLS4CeUE4UHStmPyO+BMT ntNDRC1pFu8UEAZYdzd/FmZ/eEf+ux7Jjf4RGZSyHtF2/wYYnQHE8H/+MmbcD6kq6Du9 n9iA== X-Gm-Message-State: ABUngvd3z++pU+LQzz2ySgMFfWWJ2vUTHOvgXU0pVrkGDbbp/lp4smlYmCRQXjUq3jNB3qqIa6uJv8ik7thPlBjK X-Received: by 10.28.211.71 with SMTP id k68mr4704577wmg.21.1477424202221; Tue, 25 Oct 2016 12:36:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.146.35 with HTTP; Tue, 25 Oct 2016 12:36:41 -0700 (PDT) In-Reply-To: <20161025212600.36e91455@kalimero.tijl.coosemans.org> References: <201610251713.u9PHDkq2076226@repo.freebsd.org> <20161025212600.36e91455@kalimero.tijl.coosemans.org> From: Oliver Pinter Date: Tue, 25 Oct 2016 21:36:41 +0200 Message-ID: Subject: Re: svn commit: r307936 - head/sys/amd64/amd64 To: Tijl Coosemans Cc: Gleb Smirnoff , kib@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 19:36:44 -0000 On 10/25/16, Tijl Coosemans wrote: > On Tue, 25 Oct 2016 17:13:46 +0000 (UTC) Gleb Smirnoff > wrote: >> Author: glebius >> Date: Tue Oct 25 17:13:46 2016 >> New Revision: 307936 >> URL: https://svnweb.freebsd.org/changeset/base/307936 >> >> Log: >> The argument validation in r296956 was not enough to close all possible >> overflows in sysarch(2). >> >> Submitted by: Kun Yang >> Patch by: kib >> Security: SA-16:15 >> >> Modified: >> head/sys/amd64/amd64/sys_machdep.c > > This patch and r296956 need to be applied to i386 too, don't they? And what's about this for i386: commit 3f32edbd77088eb3437503cca9fc4881d8e382e6 Author: tijl Date: Sun Sep 25 18:29:02 2016 +0000 MFamd64: r266901 Allocate a zeroed LDT. Failing to do this might result in the LDT appearing to run out of free descriptors because of random junk in the descriptor's 'sd_type' field. http://lists.freebsd.org/pipermail/freebsd-amd64/2014-May/016088.html PR: 212639 Submitted by: wheelcomplex@gmail.com MFC after: 2 weeks > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Tue Oct 25 21:56:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC6FAC21734; Tue, 25 Oct 2016 21:56:50 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mail.vx.sk (mail.vx.sk [IPv6:2a01:4f8:190:61f0::4]) by mx1.freebsd.org (Postfix) with ESMTP id A799E359; Tue, 25 Oct 2016 21:56:50 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from [IPv6:2a02:2450:1023:80df:a920:c8de:8423:b521] (unknown [IPv6:2a02:2450:1023:80df:a920:c8de:8423:b521]) by mail.vx.sk (Postfix) with ESMTPSA id 1F4309892B; Tue, 25 Oct 2016 23:56:41 +0200 (CEST) Subject: Re: svn commit: r307861 - in head: contrib/libarchive contrib/libarchive/cat/test contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/te... To: Shawn Webb References: <201610241408.u9OE86Rn050959@repo.freebsd.org> <20161025151600.GA58807@mutt-hardenedbsd> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Martin Matuska Message-ID: <505c2570-9611-40af-92fe-7f12bc11e0e0@FreeBSD.org> Date: Tue, 25 Oct 2016 23:56:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161025151600.GA58807@mutt-hardenedbsd> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 21:56:51 -0000 Hi Shawn, I forgot to mention it in the commit message: MFC to stable/11 and stable/10 is 1 week. Cheers, mm On 25.10.2016 17:16, Shawn Webb wrote: > On Mon, Oct 24, 2016 at 02:08:06PM +0000, Martin Matuska wrote: >> Author: mm >> Date: Mon Oct 24 14:08:05 2016 >> New Revision: 307861 >> URL: https://svnweb.freebsd.org/changeset/base/307861 >> >> Log: >> MFV r307859: >> Update libarchive to 3.2.2 > Hey Martin, > > Thanks for doing this upgrade! Any plans to MFC? > > Thanks, > From owner-svn-src-head@freebsd.org Tue Oct 25 22:29:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A5F3C21DF0 for ; Tue, 25 Oct 2016 22:29:06 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt0-x22b.google.com (mail-qt0-x22b.google.com [IPv6:2607:f8b0:400d:c0d::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F0FC1390 for ; Tue, 25 Oct 2016 22:29:05 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt0-x22b.google.com with SMTP id p53so8534104qtp.7 for ; Tue, 25 Oct 2016 15:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ORBTZUeovcm2fBNg/Kl0FhVO/hcgCyJlbb6U5eEQPPs=; b=UDOQpk5tuyM/8s7A8cqbxHdgH7HF5djaYYnGqYru+EOp3UEoT3mR2JqvbXVYG+vKJQ bVOrt3NVzYKXZuXw6bG5wTF+tdxbqrDSorkdYmiZK/4LRutb5iOYOlzXw9F5ucwikWxM Oz2zkfk3DUy80mBbPIC8U5yV29PSNlu91YRnU6E3sq5EndFkUyybzn9+EYXALHcHnRwq roij1CmK0Q90dvCpdpxqw5YSYOuWKO2AoVWbWvolwk3qK8xZU/1SX3aOOe5jv7HX3Iod Khg6HbfneraRMLtu4tRUEJSy0/0V/DLuL8B4qT6lVoArK2y86PUB5Xwm0ebr8uScoBVM ffjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ORBTZUeovcm2fBNg/Kl0FhVO/hcgCyJlbb6U5eEQPPs=; b=ViZlIs+FQm1bnxzPGRIYmI8gRJ0WWExwedk/NSEtZjatVw8fK2klcvsrQRJA51ePIW UPHE/8I5NIRz159hBodDqZ70fgbPaYQ89kLGQHfjVBivDzgUzRt8k42TcIXa+CZUUxDY uHOeMFOLAdkc8+Ko7nDvs0X9TX5RIWv+RTPnXKADJZ38wUdSdr1O6I8Ah8LMuymhx/0o 5b2NOJL1ULnW89UqaniPNKarlMDkyHeOYWZ8ksgUFdVgNQ4erX5lh8EQzuZoLS9aR0Z4 9Q0+gND426EqIFcq3F86gIhf+w5acicmYMdNiAi8KMxFUaZkcDXI06S+yVdU53V3ueFx +HZQ== X-Gm-Message-State: ABUngvegfGl/w36msrnpZpDRgz/k/39ceM8KIrLep3SGCCWA1EuCNtLNwamnW7lokX29+xed X-Received: by 10.200.36.125 with SMTP id d58mr22499222qtd.147.1477434545035; Tue, 25 Oct 2016 15:29:05 -0700 (PDT) Received: from mutt-hardenedbsd (pool-100-16-218-231.bltmmd.fios.verizon.net. [100.16.218.231]) by smtp.gmail.com with ESMTPSA id i207sm12189822qke.40.2016.10.25.15.29.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Oct 2016 15:29:03 -0700 (PDT) Date: Tue, 25 Oct 2016 18:29:02 -0400 From: Shawn Webb To: Martin Matuska Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307861 - in head: contrib/libarchive contrib/libarchive/cat/test contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/te... Message-ID: <20161025222902.GA81499@mutt-hardenedbsd> References: <201610241408.u9OE86Rn050959@repo.freebsd.org> <20161025151600.GA58807@mutt-hardenedbsd> <505c2570-9611-40af-92fe-7f12bc11e0e0@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline In-Reply-To: <505c2570-9611-40af-92fe-7f12bc11e0e0@FreeBSD.org> X-Operating-System: FreeBSD mutt-hardenedbsd 12.0-CURRENT-HBSD FreeBSD 12.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 25 Oct 2016 22:29:06 -0000 --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Cool. Thanks! Also, does this need an SA like the previous libarchive updates? Thanks, Shawn On Tue, Oct 25, 2016 at 11:56:40PM +0200, Martin Matuska wrote: > Hi Shawn, >=20 > I forgot to mention it in the commit message: MFC to stable/11 and > stable/10 is 1 week. >=20 > Cheers, > mm >=20 >=20 > On 25.10.2016 17:16, Shawn Webb wrote: > > On Mon, Oct 24, 2016 at 02:08:06PM +0000, Martin Matuska wrote: > >> Author: mm > >> Date: Mon Oct 24 14:08:05 2016 > >> New Revision: 307861 > >> URL: https://svnweb.freebsd.org/changeset/base/307861 > >> > >> Log: > >> MFV r307859: > >> Update libarchive to 3.2.2 > > Hey Martin, > > > > Thanks for doing this upgrade! Any plans to MFC? > > > > Thanks, > > >=20 >=20 --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --EeQfGwPcQSOJBaQU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYD9yrAAoJEGqEZY9SRW7uFQgP/RiEbt7dUYMsZDYFtsYoX0Ip vKPKM+2JLR2kiKQjQ2YkpQh93MpvuAxZlJxHFQlHtfHdnEfRRNu5eymmodyKK0e2 shdEcBcgASIbAI6dwDD5b1GL5na/aTh07eIGeTJuTWW1ke9rUogxlIz17eeSWjA+ 6eykFN1MNTJv8ys8EO+6AQuwO/o2UyD2sGTL4jelr00o8IGsILinsaZEBXiZm1Pd kzYM+1oYNp2Iabl3V9t0hEb8C7ZxVQXwa2RvyvXdGtrhfYUvedZuUJj2FR0eaUhw KqMmBpvnpU0MSMx/e2+TeAanGq5pEDbgd50ZWna8Xa0fhbBPC9wKw7sHMTvz0pwo /MMjy5aS72PAOv1ipCUTH1paWNQBv3W5LD8hH3GmVOwo3B4g+Nmwv1tndSiGhzgC 7ev8SXBn5uZlwzrWqtGyPM/HGLVZVvr3t0J+YXDnJyIm+JvZnN5CBL+4HG1qC7eO lbUQyLTnv096k2M/y1rAVEBbet2AH1kZrLVGUfcufkvyJR3TwYcNaV6taSnbToG/ cDfacTjiCx1dW1q3voSne84O6ONmBjYH9A7Hf96WVxDNt3aPhNIaTks1E/XWNXYz imPInPkPQGwGt15PQZeGcYmAgQnjfHzn8fQuoVAeR/3nlNEdpbD2+2pRNLIOyeg9 oAJp6EHfl8O5GMYdLrzN =X/+Y -----END PGP SIGNATURE----- --EeQfGwPcQSOJBaQU-- From owner-svn-src-head@freebsd.org Wed Oct 26 04:26:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91CBAC20769; Wed, 26 Oct 2016 04:26:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6162FB70; Wed, 26 Oct 2016 04:26:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9Q4QHkv033768; Wed, 26 Oct 2016 04:26:17 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9Q4QH6T033767; Wed, 26 Oct 2016 04:26:17 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610260426.u9Q4QH6T033767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 26 Oct 2016 04:26:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307952 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 04:26:18 -0000 Author: sephe Date: Wed Oct 26 04:26:17 2016 New Revision: 307952 URL: https://svnweb.freebsd.org/changeset/base/307952 Log: hyperv/vmbus: Add missing white space. Submitted by: QianYue You MFC after: 1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Oct 25 19:04:44 2016 (r307951) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Oct 26 04:26:17 2016 (r307952) @@ -863,7 +863,7 @@ vmbus_intr_setup(struct vmbus_softc *sc) device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); return ENXIO; } - if(bootverbose) { + if (bootverbose) { device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", sc->vmbus_idtvec); } From owner-svn-src-head@freebsd.org Wed Oct 26 05:06:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90383C2216B; Wed, 26 Oct 2016 05:06:24 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A911EDF; Wed, 26 Oct 2016 05:06:24 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9Q56NrP048888; Wed, 26 Oct 2016 05:06:23 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9Q56N9o048887; Wed, 26 Oct 2016 05:06:23 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610260506.u9Q56N9o048887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 26 Oct 2016 05:06:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307953 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 05:06:24 -0000 Author: sephe Date: Wed Oct 26 05:06:23 2016 New Revision: 307953 URL: https://svnweb.freebsd.org/changeset/base/307953 Log: hyperv/vmbus: Implement vmbus_chan_printf. And use it for vmbus channel logging, which can log the channel owner's name properly, instead of vmbus0. Submitted by: QianYue You MFC after: 1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 26 04:26:17 2016 (r307952) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 26 05:06:23 2016 (r307953) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -39,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -90,6 +92,9 @@ static void vmbus_chan_msgproc_chresci struct vmbus_softc *, const struct vmbus_message *); +static int vmbus_chan_printf(const struct vmbus_channel *, + const char *, ...) __printflike(2, 3); + /* * Vmbus channel message processing. */ @@ -304,7 +309,7 @@ vmbus_chan_open(struct vmbus_channel *ch PAGE_SIZE, 0, txbr_size + rxbr_size, &chan->ch_bufring_dma, BUS_DMA_WAITOK); if (chan->ch_bufring == NULL) { - device_printf(chan->ch_dev, "bufring allocation failed\n"); + vmbus_chan_printf(chan, "bufring allocation failed\n"); return (ENOMEM); } @@ -336,7 +341,7 @@ vmbus_chan_open_br(struct vmbus_channel uint8_t *br; if (udlen > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "invalid udata len %d for chan%u\n", udlen, chan->ch_id); return EINVAL; } @@ -386,7 +391,7 @@ vmbus_chan_open_br(struct vmbus_channel error = vmbus_chan_gpadl_connect(chan, cbr->cbr_paddr, txbr_size + rxbr_size, &chan->ch_bufring_gpadl); if (error) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "failed to connect bufring GPADL to chan%u\n", chan->ch_id); goto failed; } @@ -402,7 +407,7 @@ vmbus_chan_open_br(struct vmbus_channel */ mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "can not get msg hypercall for chopen(chan%u)\n", chan->ch_id); error = ENXIO; @@ -421,7 +426,7 @@ vmbus_chan_open_br(struct vmbus_channel error = vmbus_msghc_exec(sc, mh); if (error) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "chopen(chan%u) msg hypercall exec failed: %d\n", chan->ch_id, error); vmbus_msghc_put(sc, mh); @@ -436,13 +441,12 @@ vmbus_chan_open_br(struct vmbus_channel if (status == 0) { if (bootverbose) { - device_printf(sc->vmbus_dev, "chan%u opened\n", - chan->ch_id); + vmbus_chan_printf(chan, "chan%u opened\n", chan->ch_id); } return 0; } - device_printf(sc->vmbus_dev, "failed to open chan%u\n", chan->ch_id); + vmbus_chan_printf(chan, "failed to open chan%u\n", chan->ch_id); error = ENXIO; failed: @@ -485,7 +489,7 @@ vmbus_chan_gpadl_connect(struct vmbus_ch * We don't support multiple GPA ranges. */ if (range_len > UINT16_MAX) { - device_printf(sc->vmbus_dev, "GPA too large, %d pages\n", + vmbus_chan_printf(chan, "GPA too large, %d pages\n", page_count); return EOPNOTSUPP; } @@ -514,8 +518,8 @@ vmbus_chan_gpadl_connect(struct vmbus_ch chm_range.gpa_page[cnt]); mh = vmbus_msghc_get(sc, reqsz); if (mh == NULL) { - device_printf(sc->vmbus_dev, - "can not get msg hypercall for gpadl->chan%u\n", + vmbus_chan_printf(chan, + "can not get msg hypercall for gpadl_conn(chan%u)\n", chan->ch_id); return EIO; } @@ -533,8 +537,8 @@ vmbus_chan_gpadl_connect(struct vmbus_ch error = vmbus_msghc_exec(sc, mh); if (error) { - device_printf(sc->vmbus_dev, - "gpadl->chan%u msg hypercall exec failed: %d\n", + vmbus_chan_printf(chan, + "gpadl_conn(chan%u) msg hypercall exec failed: %d\n", chan->ch_id, error); vmbus_msghc_put(sc, mh); return error; @@ -570,13 +574,13 @@ vmbus_chan_gpadl_connect(struct vmbus_ch vmbus_msghc_put(sc, mh); if (status != 0) { - device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " - "status %u\n", chan->ch_id, status); + vmbus_chan_printf(chan, "gpadl_conn(chan%u) failed: %u\n", + chan->ch_id, status); return EIO; } else { if (bootverbose) { - device_printf(sc->vmbus_dev, "gpadl->chan%u " - "succeeded\n", chan->ch_id); + vmbus_chan_printf(chan, + "gpadl_conn(chan%u) succeeded\n", chan->ch_id); } } return 0; @@ -595,8 +599,8 @@ vmbus_chan_gpadl_disconnect(struct vmbus mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { - device_printf(sc->vmbus_dev, - "can not get msg hypercall for gpa x->chan%u\n", + vmbus_chan_printf(chan, + "can not get msg hypercall for gpadl_disconn(chan%u)\n", chan->ch_id); return EBUSY; } @@ -608,8 +612,8 @@ vmbus_chan_gpadl_disconnect(struct vmbus error = vmbus_msghc_exec(sc, mh); if (error) { - device_printf(sc->vmbus_dev, - "gpa x->chan%u msg hypercall exec failed: %d\n", + vmbus_chan_printf(chan, + "gpadl_disconn(chan%u) msg hypercall exec failed: %d\n", chan->ch_id, error); vmbus_msghc_put(sc, mh); return error; @@ -681,7 +685,7 @@ vmbus_chan_close_internal(struct vmbus_c */ mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "can not get msg hypercall for chclose(chan%u)\n", chan->ch_id); return; @@ -695,12 +699,12 @@ vmbus_chan_close_internal(struct vmbus_c vmbus_msghc_put(sc, mh); if (error) { - device_printf(sc->vmbus_dev, + vmbus_chan_printf(chan, "chclose(chan%u) msg hypercall exec failed: %d\n", chan->ch_id, error); return; } else if (bootverbose) { - device_printf(sc->vmbus_dev, "close chan%u\n", chan->ch_id); + vmbus_chan_printf(chan, "close chan%u\n", chan->ch_id); } /* @@ -890,13 +894,12 @@ vmbus_chan_recv(struct vmbus_channel *ch return (error); if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) { - device_printf(chan->ch_dev, "invalid hlen %u\n", - pkt.cph_hlen); + vmbus_chan_printf(chan, "invalid hlen %u\n", pkt.cph_hlen); /* XXX this channel is dead actually. */ return (EIO); } if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) { - device_printf(chan->ch_dev, "invalid hlen %u and tlen %u\n", + vmbus_chan_printf(chan, "invalid hlen %u and tlen %u\n", pkt.cph_hlen, pkt.cph_tlen); /* XXX this channel is dead actually. */ return (EIO); @@ -933,13 +936,12 @@ vmbus_chan_recv_pkt(struct vmbus_channel return (error); if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) { - device_printf(chan->ch_dev, "invalid hlen %u\n", - pkt.cph_hlen); + vmbus_chan_printf(chan, "invalid hlen %u\n", pkt.cph_hlen); /* XXX this channel is dead actually. */ return (EIO); } if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) { - device_printf(chan->ch_dev, "invalid hlen %u and tlen %u\n", + vmbus_chan_printf(chan, "invalid hlen %u and tlen %u\n", pkt.cph_hlen, pkt.cph_tlen); /* XXX this channel is dead actually. */ return (EIO); @@ -1082,8 +1084,8 @@ vmbus_chan_update_evtflagcnt(struct vmbu break; if (atomic_cmpset_int(flag_cnt_ptr, old_flag_cnt, flag_cnt)) { if (bootverbose) { - device_printf(sc->vmbus_dev, - "channel%u update cpu%d flag_cnt to %d\n", + vmbus_chan_printf(chan, + "chan%u update cpu%d flag_cnt to %d\n", chan->ch_id, chan->ch_cpuid, flag_cnt); } break; @@ -1154,11 +1156,6 @@ vmbus_chan_add(struct vmbus_channel *new return EINVAL; } - if (bootverbose) { - device_printf(sc->vmbus_dev, "chan%u subidx%u offer\n", - newchan->ch_id, newchan->ch_subidx); - } - mtx_lock(&sc->vmbus_prichan_lock); TAILQ_FOREACH(prichan, &sc->vmbus_prichans, ch_prilink) { /* @@ -1179,15 +1176,15 @@ vmbus_chan_add(struct vmbus_channel *new goto done; } else { mtx_unlock(&sc->vmbus_prichan_lock); - device_printf(sc->vmbus_dev, "duplicated primary " - "chan%u\n", newchan->ch_id); + device_printf(sc->vmbus_dev, + "duplicated primary chan%u\n", newchan->ch_id); return EINVAL; } } else { /* Sub-channel */ if (prichan == NULL) { mtx_unlock(&sc->vmbus_prichan_lock); - device_printf(sc->vmbus_dev, "no primary chan for " - "chan%u\n", newchan->ch_id); + device_printf(sc->vmbus_dev, + "no primary chan for chan%u\n", newchan->ch_id); return EINVAL; } /* @@ -1224,6 +1221,15 @@ done: mtx_lock(&sc->vmbus_chan_lock); vmbus_chan_ins_list(sc, newchan); mtx_unlock(&sc->vmbus_chan_lock); + + if (bootverbose) { + vmbus_chan_printf(newchan, "chan%u subidx%u offer\n", + newchan->ch_id, newchan->ch_subidx); + } + + /* Select default cpu for this channel. */ + vmbus_chan_cpu_default(newchan); + return 0; } @@ -1242,7 +1248,8 @@ vmbus_chan_cpu_set(struct vmbus_channel chan->ch_vcpuid = VMBUS_PCPU_GET(chan->ch_vmbus, vcpuid, cpu); if (bootverbose) { - printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", + vmbus_chan_printf(chan, + "chan%u assigned to cpu%u [vcpu%u]\n", chan->ch_id, chan->ch_cpuid, chan->ch_vcpuid); } } @@ -1338,9 +1345,6 @@ vmbus_chan_msgproc_choffer(struct vmbus_ TASK_INIT(&chan->ch_attach_task, 0, attach_fn, chan); TASK_INIT(&chan->ch_detach_task, 0, detach_fn, chan); - /* Select default cpu for this channel. */ - vmbus_chan_cpu_default(chan); - error = vmbus_chan_add(chan); if (error) { device_printf(sc->vmbus_dev, "add chan%u failed: %d\n", @@ -1365,11 +1369,6 @@ vmbus_chan_msgproc_chrescind(struct vmbu return; } - if (bootverbose) { - device_printf(sc->vmbus_dev, "chan%u rescinded\n", - note->chm_chanid); - } - /* * Find and remove the target channel from the channel list. */ @@ -1400,6 +1399,9 @@ vmbus_chan_msgproc_chrescind(struct vmbu mtx_unlock(&sc->vmbus_prichan_lock); } + if (bootverbose) + vmbus_chan_printf(chan, "chan%u rescinded\n", note->chm_chanid); + /* Detach the target channel. */ taskqueue_enqueue(chan->ch_mgmt_tq, &chan->ch_detach_task); } @@ -1414,8 +1416,9 @@ vmbus_chan_release(struct vmbus_channel mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { - device_printf(sc->vmbus_dev, "can not get msg hypercall for " - "chfree(chan%u)\n", chan->ch_id); + vmbus_chan_printf(chan, + "can not get msg hypercall for chfree(chan%u)\n", + chan->ch_id); return (ENXIO); } @@ -1427,13 +1430,12 @@ vmbus_chan_release(struct vmbus_channel vmbus_msghc_put(sc, mh); if (error) { - device_printf(sc->vmbus_dev, "chfree(chan%u) failed: %d", + vmbus_chan_printf(chan, + "chfree(chan%u) msg hypercall exec failed: %d\n", chan->ch_id, error); } else { - if (bootverbose) { - device_printf(sc->vmbus_dev, "chan%u freed\n", - chan->ch_id); - } + if (bootverbose) + vmbus_chan_printf(chan, "chan%u freed\n", chan->ch_id); } return (error); } @@ -1714,6 +1716,26 @@ vmbus_chan_rx_empty(const struct vmbus_c return (vmbus_rxbr_empty(&chan->ch_rxbr)); } +static int +vmbus_chan_printf(const struct vmbus_channel *chan, const char *fmt, ...) +{ + va_list ap; + device_t dev; + int retval; + + if (chan->ch_dev == NULL || !device_is_alive(chan->ch_dev)) + dev = chan->ch_vmbus->vmbus_dev; + else + dev = chan->ch_dev; + + retval = device_print_prettyname(dev); + va_start(ap, fmt); + retval += vprintf(fmt, ap); + va_end(ap); + + return (retval); +} + void vmbus_chan_run_task(struct vmbus_channel *chan, struct task *task) { From owner-svn-src-head@freebsd.org Wed Oct 26 05:26:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49341C22628; Wed, 26 Oct 2016 05:26:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 199F7A2E; Wed, 26 Oct 2016 05:26:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9Q5QwBD056434; Wed, 26 Oct 2016 05:26:58 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9Q5QwPU056433; Wed, 26 Oct 2016 05:26:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610260526.u9Q5QwPU056433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 26 Oct 2016 05:26:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307954 - head/sys/boot/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 05:26:59 -0000 Author: imp Date: Wed Oct 26 05:26:58 2016 New Revision: 307954 URL: https://svnweb.freebsd.org/changeset/base/307954 Log: Back out the move to the loader script from -N. This should fix the crypto-using boot problems. Modified: head/sys/boot/i386/Makefile.inc Modified: head/sys/boot/i386/Makefile.inc ============================================================================== --- head/sys/boot/i386/Makefile.inc Wed Oct 26 05:06:23 2016 (r307953) +++ head/sys/boot/i386/Makefile.inc Wed Oct 26 05:26:58 2016 (r307954) @@ -30,7 +30,9 @@ BTXCRT= ${BTXDIR}/lib/crt0.o # compact binary with no padding between text, data, bss LDSCRIPT= ${SRCTOP}/sys/boot/i386/boot.ldscript -LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-T,${LDSCRIPT},-S,--oformat,binary -LD_FLAGS_BIN=-static -T ${LDSCRIPT} --gc-sections +# LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-T,${LDSCRIPT},-S,--oformat,binary +# LD_FLAGS_BIN=-static -T ${LDSCRIPT} --gc-sections +LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary +LD_FLAGS_BIN=-static -N --gc-sections .include "../Makefile.inc" From owner-svn-src-head@freebsd.org Wed Oct 26 05:27:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30104C22635; Wed, 26 Oct 2016 05:27:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3ABBA2F; Wed, 26 Oct 2016 05:27:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9Q5R0vX056484; Wed, 26 Oct 2016 05:27:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9Q5R06V056482; Wed, 26 Oct 2016 05:27:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610260527.u9Q5R06V056482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 26 Oct 2016 05:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307955 - in head/sys/boot/i386: gptboot gptzfsboot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 05:27:01 -0000 Author: imp Date: Wed Oct 26 05:26:59 2016 New Revision: 307955 URL: https://svnweb.freebsd.org/changeset/base/307955 Log: LIBSTAND goes last, so put it last here too. Modified: head/sys/boot/i386/gptboot/Makefile head/sys/boot/i386/gptzfsboot/Makefile Modified: head/sys/boot/i386/gptboot/Makefile ============================================================================== --- head/sys/boot/i386/gptboot/Makefile Wed Oct 26 05:26:58 2016 (r307954) +++ head/sys/boot/i386/gptboot/Makefile Wed Oct 26 05:26:59 2016 (r307955) @@ -75,7 +75,7 @@ gptboot.bin: gptboot.out ${OBJCOPY} -S -O binary gptboot.out ${.TARGET} gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o util.o ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND} ${LIBGELIBOOT} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSTAND} gptboot.o: ${.CURDIR}/../../common/ufsread.c Modified: head/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- head/sys/boot/i386/gptzfsboot/Makefile Wed Oct 26 05:26:58 2016 (r307954) +++ head/sys/boot/i386/gptzfsboot/Makefile Wed Oct 26 05:26:59 2016 (r307955) @@ -78,7 +78,7 @@ gptzfsboot.bin: gptzfsboot.out gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o \ skein.o skein_block.o ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND} ${LIBGELIBOOT} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSTAND} zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c From owner-svn-src-head@freebsd.org Wed Oct 26 08:47:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF1C7C225D0; Wed, 26 Oct 2016 08:47:36 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BD6DCB2; Wed, 26 Oct 2016 08:47:36 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9Q8lZGF032902; Wed, 26 Oct 2016 08:47:35 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9Q8lZhj032901; Wed, 26 Oct 2016 08:47:35 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201610260847.u9Q8lZhj032901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 26 Oct 2016 08:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307959 - head/sys/arm/allwinner/clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 08:47:36 -0000 Author: manu Date: Wed Oct 26 08:47:35 2016 New Revision: 307959 URL: https://svnweb.freebsd.org/changeset/base/307959 Log: The only consumer of pll1 is the CPU clock, we don't need to set it glitch free. Reported by: jmcneill MFC after: 1 week Modified: head/sys/arm/allwinner/clk/aw_pll.c Modified: head/sys/arm/allwinner/clk/aw_pll.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_pll.c Wed Oct 26 08:39:33 2016 (r307958) +++ head/sys/arm/allwinner/clk/aw_pll.c Wed Oct 26 08:47:35 2016 (r307959) @@ -310,15 +310,6 @@ struct aw_pll_funcs { #define DEVICE_UNLOCK(sc) CLKDEV_DEVICE_UNLOCK((sc)->clkdev) static int -a10_pll1_init(device_t dev, bus_addr_t reg, struct clknode_init_def *def) -{ - /* Allow changing PLL frequency while enabled */ - def->flags = CLK_NODE_GLITCH_FREE; - - return (0); -} - -static int a10_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout, int flags) { @@ -999,7 +990,7 @@ a83t_pllcpux_set_freq(struct aw_pll_sc * } static struct aw_pll_funcs aw_pll_func[] = { - PLL(AWPLL_A10_PLL1, a10_pll1_recalc, a10_pll1_set_freq, a10_pll1_init), + PLL(AWPLL_A10_PLL1, a10_pll1_recalc, a10_pll1_set_freq, NULL), PLL(AWPLL_A10_PLL2, a10_pll2_recalc, a10_pll2_set_freq, NULL), PLL(AWPLL_A10_PLL3, a10_pll3_recalc, a10_pll3_set_freq, a10_pll3_init), PLL(AWPLL_A10_PLL5, a10_pll5_recalc, NULL, NULL), From owner-svn-src-head@freebsd.org Wed Oct 26 12:29:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03AD4C222C8; Wed, 26 Oct 2016 12:29:58 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9A00C0E; Wed, 26 Oct 2016 12:29:57 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QCTvUw017162; Wed, 26 Oct 2016 12:29:57 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QCTvBd017161; Wed, 26 Oct 2016 12:29:57 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610261229.u9QCTvBd017161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 26 Oct 2016 12:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307960 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 12:29:58 -0000 Author: andrew Date: Wed Oct 26 12:29:56 2016 New Revision: 307960 URL: https://svnweb.freebsd.org/changeset/base/307960 Log: Use nitems to get the correct number of registers to read when dumping them. Previously this would walk past the end of the array and print whatever happened to be after the trapframe struct. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Wed Oct 26 08:47:35 2016 (r307959) +++ head/sys/arm64/arm64/trap.c Wed Oct 26 12:29:56 2016 (r307960) @@ -250,7 +250,7 @@ print_registers(struct trapframe *frame) { u_int reg; - for (reg = 0; reg < 31; reg++) { + for (reg = 0; reg < nitems(frame->tf_x); reg++) { printf(" %sx%d: %16lx\n", (reg < 10) ? " " : "", reg, frame->tf_x[reg]); } From owner-svn-src-head@freebsd.org Wed Oct 26 12:30:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0786C22328; Wed, 26 Oct 2016 12:30:54 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCC74DF2; Wed, 26 Oct 2016 12:30:54 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QCUrad017262; Wed, 26 Oct 2016 12:30:53 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QCUrR2017261; Wed, 26 Oct 2016 12:30:53 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610261230.u9QCUrR2017261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 26 Oct 2016 12:30:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307961 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 12:30:55 -0000 Author: andrew Date: Wed Oct 26 12:30:53 2016 New Revision: 307961 URL: https://svnweb.freebsd.org/changeset/base/307961 Log: Only release CPUs when they exist. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/mp_machdep.c Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Wed Oct 26 12:29:56 2016 (r307960) +++ head/sys/arm64/arm64/mp_machdep.c Wed Oct 26 12:30:53 2016 (r307961) @@ -203,6 +203,10 @@ release_aps(void *dummy __unused) { int i; + /* Only release CPUs if they exist */ + if (mp_ncpus == 1) + return; + intr_pic_ipi_setup(IPI_AST, "ast", ipi_ast, NULL); intr_pic_ipi_setup(IPI_PREEMPT, "preempt", ipi_preempt, NULL); intr_pic_ipi_setup(IPI_RENDEZVOUS, "rendezvous", ipi_rendezvous, NULL); From owner-svn-src-head@freebsd.org Wed Oct 26 12:41:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83D2DC22646; Wed, 26 Oct 2016 12:41:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55E678B2; Wed, 26 Oct 2016 12:41:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QCfiLI023720; Wed, 26 Oct 2016 12:41:44 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QCfiAr023718; Wed, 26 Oct 2016 12:41:44 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610261241.u9QCfiAr023718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 26 Oct 2016 12:41:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307962 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 12:41:45 -0000 Author: andrew Date: Wed Oct 26 12:41:44 2016 New Revision: 307962 URL: https://svnweb.freebsd.org/changeset/base/307962 Log: Stop including a possibly GPLd header from the GPIO code. Add the only needed macro to ofw_gpiobus.c. Reported by: emaste Sponsored by: DARPA, AFRL Modified: head/sys/dev/gpio/gpiobusvar.h head/sys/dev/gpio/ofw_gpiobus.c Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Wed Oct 26 12:30:53 2016 (r307961) +++ head/sys/dev/gpio/gpiobusvar.h Wed Oct 26 12:41:44 2016 (r307962) @@ -38,7 +38,6 @@ #ifdef FDT #include -#include #endif #ifdef INTRNG Modified: head/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- head/sys/dev/gpio/ofw_gpiobus.c Wed Oct 26 12:30:53 2016 (r307961) +++ head/sys/dev/gpio/ofw_gpiobus.c Wed Oct 26 12:41:44 2016 (r307962) @@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$"); #include "gpiobus_if.h" +#define GPIO_ACTIVE_LOW 1 + static struct ofw_gpiobus_devinfo *ofw_gpiobus_setup_devinfo(device_t, device_t, phandle_t); static void ofw_gpiobus_destroy_devinfo(device_t, struct ofw_gpiobus_devinfo *); From owner-svn-src-head@freebsd.org Wed Oct 26 13:25:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93624C2263B; Wed, 26 Oct 2016 13:25:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F2A718D6; Wed, 26 Oct 2016 13:25:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u9QDPoLW046329 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 26 Oct 2016 16:25:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u9QDPoLW046329 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u9QDPovN046328; Wed, 26 Oct 2016 16:25:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 26 Oct 2016 16:25:50 +0300 From: Konstantin Belousov To: Tijl Coosemans Cc: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307936 - head/sys/amd64/amd64 Message-ID: <20161026132550.GV54029@kib.kiev.ua> References: <201610251713.u9PHDkq2076226@repo.freebsd.org> <20161025212600.36e91455@kalimero.tijl.coosemans.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161025212600.36e91455@kalimero.tijl.coosemans.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 13:25:59 -0000 On Tue, Oct 25, 2016 at 09:26:00PM +0200, Tijl Coosemans wrote: > On Tue, 25 Oct 2016 17:13:46 +0000 (UTC) Gleb Smirnoff wrote: > > Author: glebius > > Date: Tue Oct 25 17:13:46 2016 > > New Revision: 307936 > > URL: https://svnweb.freebsd.org/changeset/base/307936 > > > > Log: > > The argument validation in r296956 was not enough to close all possible > > overflows in sysarch(2). > > > > Submitted by: Kun Yang > > Patch by: kib > > Security: SA-16:15 > > > > Modified: > > head/sys/amd64/amd64/sys_machdep.c > > This patch and r296956 need to be applied to i386 too, don't they? I do not think so. The amd64 bug is that I thought that the overflow checks were not needed, which appeared to be not true. i386_set_ldt(), which is the i386 version of amd64_set_ldt(), already contained the comparisions of largest_ld with pldt->ldt_len etc. Still, independend look at the i386 (and amd64 version as well) is more than welcomed, so please read the code yourself. From owner-svn-src-head@freebsd.org Wed Oct 26 14:09:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FE06C22985; Wed, 26 Oct 2016 14:09:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 502BDD18; Wed, 26 Oct 2016 14:09:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QE9UM7055727; Wed, 26 Oct 2016 14:09:30 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QE9UPV055726; Wed, 26 Oct 2016 14:09:30 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610261409.u9QE9UPV055726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 26 Oct 2016 14:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307963 - head/sys/arm/allwinner/clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 14:09:31 -0000 Author: andrew Date: Wed Oct 26 14:09:30 2016 New Revision: 307963 URL: https://svnweb.freebsd.org/changeset/base/307963 Log: Define the Allwinner PLL FDT constants in the file that uses them rather than including a file from under sys/gnu. Sponsored by: DARPA, AFRL Modified: head/sys/arm/allwinner/clk/aw_pll.c Modified: head/sys/arm/allwinner/clk/aw_pll.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_pll.c Wed Oct 26 12:41:44 2016 (r307962) +++ head/sys/arm/allwinner/clk/aw_pll.c Wed Oct 26 14:09:30 2016 (r307963) @@ -47,12 +47,15 @@ __FBSDID("$FreeBSD$"); #include -#include - #include #include "clkdev_if.h" +#define SUN4I_A10_PLL2_1X 0 +#define SUN4I_A10_PLL2_2X 1 +#define SUN4I_A10_PLL2_4X 2 +#define SUN4I_A10_PLL2_8X 3 + #define AW_PLL_ENABLE (1 << 31) #define A10_PLL1_OUT_EXT_DIVP (0x3 << 16) From owner-svn-src-head@freebsd.org Wed Oct 26 14:26:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96318C22DDE; Wed, 26 Oct 2016 14:26:46 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57813864; Wed, 26 Oct 2016 14:26:46 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QEQjaa063644; Wed, 26 Oct 2016 14:26:45 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QEQjot063643; Wed, 26 Oct 2016 14:26:45 GMT (envelope-from br@FreeBSD.org) Message-Id: <201610261426.u9QEQjot063643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 26 Oct 2016 14:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307964 - head/lib/libproc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 14:26:46 -0000 Author: br Date: Wed Oct 26 14:26:45 2016 New Revision: 307964 URL: https://svnweb.freebsd.org/changeset/base/307964 Log: Use uint32_t instead of u_long as a storage for breakpoint instruction to copy. All the platforms breakpoints fits this fine. This fixes operation on big-endian MIPS64 where we were coping zeroes instead of real instruction. Reviewed by: rpaulo Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D8250 Modified: head/lib/libproc/proc_bkpt.c Modified: head/lib/libproc/proc_bkpt.c ============================================================================== --- head/lib/libproc/proc_bkpt.c Wed Oct 26 14:09:30 2016 (r307963) +++ head/lib/libproc/proc_bkpt.c Wed Oct 26 14:26:45 2016 (r307964) @@ -68,6 +68,14 @@ __FBSDID("$FreeBSD$"); #error "Add support for your architecture" #endif +/* + * Use 4-bytes holder for breakpoint instruction on all the platforms. + * Works for x86 as well until it is endian-little platform. + * (We are coping one byte only on x86 from this 4-bytes piece of + * memory). + */ +typedef uint32_t instr_t; + static int proc_stop(struct proc_handle *phdl) { @@ -92,8 +100,9 @@ proc_bkptset(struct proc_handle *phdl, u unsigned long *saved) { struct ptrace_io_desc piod; - unsigned long paddr, caddr; + unsigned long caddr; int ret = 0, stopped; + instr_t instr; *saved = 0; if (phdl->status == PS_DEAD || phdl->status == PS_UNDEAD || @@ -115,10 +124,10 @@ proc_bkptset(struct proc_handle *phdl, u * Read the original instruction. */ caddr = address; - paddr = 0; + instr = 0; piod.piod_op = PIOD_READ_I; piod.piod_offs = (void *)caddr; - piod.piod_addr = &paddr; + piod.piod_addr = &instr; piod.piod_len = BREAKPOINT_INSTR_SZ; if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { DPRINTF("ERROR: couldn't read instruction at address 0x%" @@ -126,15 +135,15 @@ proc_bkptset(struct proc_handle *phdl, u ret = -1; goto done; } - *saved = paddr; + *saved = instr; /* * Write a breakpoint instruction to that address. */ caddr = address; - paddr = BREAKPOINT_INSTR; + instr = BREAKPOINT_INSTR; piod.piod_op = PIOD_WRITE_I; piod.piod_offs = (void *)caddr; - piod.piod_addr = &paddr; + piod.piod_addr = &instr; piod.piod_len = BREAKPOINT_INSTR_SZ; if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { DPRINTF("ERROR: couldn't write instruction at address 0x%" @@ -156,8 +165,9 @@ proc_bkptdel(struct proc_handle *phdl, u unsigned long saved) { struct ptrace_io_desc piod; - unsigned long paddr, caddr; + unsigned long caddr; int ret = 0, stopped; + instr_t instr; if (phdl->status == PS_DEAD || phdl->status == PS_UNDEAD || phdl->status == PS_IDLE) { @@ -178,10 +188,10 @@ proc_bkptdel(struct proc_handle *phdl, u * Overwrite the breakpoint instruction that we setup previously. */ caddr = address; - paddr = saved; + instr = saved; piod.piod_op = PIOD_WRITE_I; piod.piod_offs = (void *)caddr; - piod.piod_addr = &paddr; + piod.piod_addr = &instr; piod.piod_len = BREAKPOINT_INSTR_SZ; if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { DPRINTF("ERROR: couldn't write instruction at address 0x%" From owner-svn-src-head@freebsd.org Wed Oct 26 15:18:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B69BDC22B3D; Wed, 26 Oct 2016 15:18:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 778B9223; Wed, 26 Oct 2016 15:18:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QFI8AH082432; Wed, 26 Oct 2016 15:18:08 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QFI8Ub082429; Wed, 26 Oct 2016 15:18:08 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610261518.u9QFI8Ub082429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 26 Oct 2016 15:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307965 - in head/sys: arm/arm arm64/arm64 dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 15:18:09 -0000 Author: andrew Date: Wed Oct 26 15:18:08 2016 New Revision: 307965 URL: https://svnweb.freebsd.org/changeset/base/307965 Log: Pull the common FDT interrupt values into a new header rather than be magic numbers. Sponsored by: DARPA, AFRL Added: head/sys/dev/fdt/fdt_intr.h (contents, props changed) Modified: head/sys/arm/arm/gic.c head/sys/arm64/arm64/gic_v3.c Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Wed Oct 26 14:26:45 2016 (r307964) +++ head/sys/arm/arm/gic.c Wed Oct 26 15:18:08 2016 (r307965) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -821,13 +822,15 @@ gic_map_fdt(device_t dev, u_int ncells, } tripol = cells[2] & 0xff; - if (tripol & 0xf0 || (tripol & 0x0a && cells[0] == 0)) + if (tripol & 0xf0 || (tripol & FDT_INTR_LOW_MASK && + cells[0] == 0)) device_printf(dev, "unsupported trigger/polarity " "configuration 0x%02x\n", tripol); *irqp = irq; *polp = INTR_POLARITY_CONFORM; - *trigp = tripol & 0x03 ? INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL; + *trigp = tripol & FDT_INTR_EDGE_MASK ? + INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL; return (0); } return (EINVAL); Modified: head/sys/arm64/arm64/gic_v3.c ============================================================================== --- head/sys/arm64/arm64/gic_v3.c Wed Oct 26 14:26:45 2016 (r307964) +++ head/sys/arm64/arm64/gic_v3.c Wed Oct 26 15:18:08 2016 (r307965) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef FDT +#include #include #endif @@ -470,20 +471,20 @@ gic_map_fdt(device_t dev, u_int ncells, return (EINVAL); } - switch (cells[2] & 0xf) { - case 1: + switch (cells[2] & FDT_INTR_MASK) { + case FDT_INTR_EDGE_RISING: *trigp = INTR_TRIGGER_EDGE; *polp = INTR_POLARITY_HIGH; break; - case 2: + case FDT_INTR_EDGE_FALLING: *trigp = INTR_TRIGGER_EDGE; *polp = INTR_POLARITY_LOW; break; - case 4: + case FDT_INTR_LEVEL_HIGH: *trigp = INTR_TRIGGER_LEVEL; *polp = INTR_POLARITY_HIGH; break; - case 8: + case FDT_INTR_LEVEL_LOW: *trigp = INTR_TRIGGER_LEVEL; *polp = INTR_POLARITY_LOW; break; Added: head/sys/dev/fdt/fdt_intr.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/fdt/fdt_intr.h Wed Oct 26 15:18:08 2016 (r307965) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2016 Andrew Turner + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _FDT_INTR_H_ +#define _FDT_INTR_H_ + +#define FDT_INTR_EDGE_RISING 1 +#define FDT_INTR_EDGE_FALLING 2 +#define FDT_INTR_LEVEL_HIGH 4 +#define FDT_INTR_LEVEL_LOW 8 +#define FDT_INTR_LOW_MASK (FDT_INTR_EDGE_FALLING | FDT_INTR_LEVEL_LOW) +#define FDT_INTR_EDGE_MASK (FDT_INTR_EDGE_RISING | FDT_INTR_EDGE_FALLING) +#define FDT_INTR_MASK 0xf + +#endif /* _FDT_INTR_H_ */ From owner-svn-src-head@freebsd.org Wed Oct 26 15:19:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1180EC22B9F; Wed, 26 Oct 2016 15:19:20 +0000 (UTC) (envelope-from jch@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7D0140E; Wed, 26 Oct 2016 15:19:19 +0000 (UTC) (envelope-from jch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QFJJaL082524; Wed, 26 Oct 2016 15:19:19 GMT (envelope-from jch@FreeBSD.org) Received: (from jch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QFJJ9G082523; Wed, 26 Oct 2016 15:19:19 GMT (envelope-from jch@FreeBSD.org) Message-Id: <201610261519.u9QFJJ9G082523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jch set sender to jch@FreeBSD.org using -f From: Julien Charbon Date: Wed, 26 Oct 2016 15:19:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307966 - 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.23 Precedence: list List-Id: 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, 26 Oct 2016 15:19:20 -0000 Author: jch Date: Wed Oct 26 15:19:18 2016 New Revision: 307966 URL: https://svnweb.freebsd.org/changeset/base/307966 Log: Remove an extraneous call to soisconnected() in syncache_socket(), introduced with r261242. The useful and expected soisconnected() call is done in tcp_do_segment(). Has been found as part of unrelated PR:212920 investigation. Improve slightly (~2%) the maximum number of TCP accept per second. Tested by: kevin.bowling_kev009.com, jch Approved by: gnn, hiren MFC after: 1 week Sponsored by: Verisign, Inc Differential Revision: https://reviews.freebsd.org/D8072 Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Wed Oct 26 15:18:08 2016 (r307965) +++ head/sys/netinet/tcp_syncache.c Wed Oct 26 15:19:18 2016 (r307966) @@ -918,10 +918,6 @@ syncache_socket(struct syncache *sc, str tp->t_keepcnt = sototcpcb(lso)->t_keepcnt; tcp_timer_activate(tp, TT_KEEP, TP_KEEPINIT(tp)); - if ((so->so_options & SO_ACCEPTFILTER) == 0) { - soisconnected(so); - } - TCPSTAT_INC(tcps_accepts); return (so); From owner-svn-src-head@freebsd.org Wed Oct 26 15:58:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A285DC20933; Wed, 26 Oct 2016 15:58:42 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F076C70; Wed, 26 Oct 2016 15:58:42 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QFwf9G097722; Wed, 26 Oct 2016 15:58:41 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QFwfCP097721; Wed, 26 Oct 2016 15:58:41 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610261558.u9QFwfCP097721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Wed, 26 Oct 2016 15:58:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307967 - head/usr.sbin/config X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 15:58:42 -0000 Author: marcel Date: Wed Oct 26 15:58:41 2016 New Revision: 307967 URL: https://svnweb.freebsd.org/changeset/base/307967 Log: Allow config to be compiled from another source directory, such as one for building tools. This boils down to replacing ${.CURDIR} with ${SRCDIR}, where the latter is the directory in which this makefile lives. Also allow overriding where file2c comes from using ${FILE2C}. Modified: head/usr.sbin/config/Makefile Modified: head/usr.sbin/config/Makefile ============================================================================== --- head/usr.sbin/config/Makefile Wed Oct 26 15:19:18 2016 (r307966) +++ head/usr.sbin/config/Makefile Wed Oct 26 15:58:41 2016 (r307967) @@ -1,15 +1,20 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +SRCDIR:=${.PARSEDIR:tA} + PROG= config MAN= config.5 config.8 SRCS= config.y main.c lang.l mkmakefile.c mkheaders.c \ mkoptions.c y.tab.h kernconf.c +FILE2C?=file2c + kernconf.c: kernconf.tmpl - file2c 'char kernconfstr[] = {' ',0};' < ${.CURDIR}/kernconf.tmpl > kernconf.c + ${FILE2C} 'char kernconfstr[] = {' ',0};' < \ + ${SRCDIR}/kernconf.tmpl > kernconf.c -CFLAGS+= -I. -I${.CURDIR} +CFLAGS+= -I. -I${SRCDIR} NO_WMISSING_VARIABLE_DECLARATIONS= From owner-svn-src-head@freebsd.org Wed Oct 26 16:03:27 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E63EC20C3B; Wed, 26 Oct 2016 16:03:27 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B14075C; Wed, 26 Oct 2016 16:03:27 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QG3QDK001933; Wed, 26 Oct 2016 16:03:26 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QG3QhM001932; Wed, 26 Oct 2016 16:03:26 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610261603.u9QG3QhM001932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 26 Oct 2016 16:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307968 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 16:03:27 -0000 Author: andrew Date: Wed Oct 26 16:03:26 2016 New Revision: 307968 URL: https://svnweb.freebsd.org/changeset/base/307968 Log: Use the new fdt_intr.h constants in the Allwinner NMI driver. Sponsored by: DARPA, AFRL Modified: head/sys/arm/allwinner/aw_nmi.c Modified: head/sys/arm/allwinner/aw_nmi.c ============================================================================== --- head/sys/arm/allwinner/aw_nmi.c Wed Oct 26 15:58:41 2016 (r307967) +++ head/sys/arm/allwinner/aw_nmi.c Wed Oct 26 16:03:26 2016 (r307968) @@ -40,12 +40,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include -#include - #include "pic_if.h" #define NMI_IRQ_CTRL_REG 0x0 @@ -155,19 +154,19 @@ aw_nmi_map_fdt(device_t dev, u_int ncell tripol = cells[1]; switch (tripol) { - case IRQ_TYPE_EDGE_RISING: + case FDT_INTR_EDGE_RISING: trig = INTR_TRIGGER_EDGE; pol = INTR_POLARITY_HIGH; break; - case IRQ_TYPE_EDGE_FALLING: + case FDT_INTR_EDGE_FALLING: trig = INTR_TRIGGER_EDGE; pol = INTR_POLARITY_LOW; break; - case IRQ_TYPE_LEVEL_HIGH: + case FDT_INTR_LEVEL_HIGH: trig = INTR_TRIGGER_LEVEL; pol = INTR_POLARITY_HIGH; break; - case IRQ_TYPE_LEVEL_LOW: + case FDT_INTR_LEVEL_LOW: trig = INTR_TRIGGER_LEVEL; pol = INTR_POLARITY_LOW; break; From owner-svn-src-head@freebsd.org Wed Oct 26 17:07:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36B54C23205; Wed, 26 Oct 2016 17:07:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13BB1E3D; Wed, 26 Oct 2016 17:07:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QH7rsm025301; Wed, 26 Oct 2016 17:07:53 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QH7rIm025300; Wed, 26 Oct 2016 17:07:53 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610261707.u9QH7rIm025300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 26 Oct 2016 17:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307969 - head/contrib/elftoolchain/strings X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 17:07:54 -0000 Author: emaste Date: Wed Oct 26 17:07:53 2016 New Revision: 307969 URL: https://svnweb.freebsd.org/changeset/base/307969 Log: strings: fix exit status if a file before the last one fails Previously a command like "strings f1 f2 f3" reported the exit status based only on processing the last file. As with GNU strings, report an error exit status if an error was encountered processing any of the files. While here simplify the exit status handling to just success (0) / failure (1). Reviewed by: brooks MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8334 Modified: head/contrib/elftoolchain/strings/strings.c Modified: head/contrib/elftoolchain/strings/strings.c ============================================================================== --- head/contrib/elftoolchain/strings/strings.c Wed Oct 26 16:03:26 2016 (r307968) +++ head/contrib/elftoolchain/strings/strings.c Wed Oct 26 17:07:53 2016 (r307969) @@ -48,12 +48,6 @@ ELFTC_VCSID("$Id: strings.c 3446 2016-05-03 01:31:17Z emaste $"); -enum return_code { - RETURN_OK, - RETURN_NOINPUT, - RETURN_SOFTWARE -}; - enum radix_style { RADIX_DECIMAL, RADIX_HEX, @@ -107,7 +101,7 @@ main(int argc, char **argv) { int ch, rc; - rc = RETURN_OK; + rc = 0; min_len = 0; encoding_size = 1; if (elf_version(EV_CURRENT) == EV_NONE) @@ -197,7 +191,8 @@ main(int argc, char **argv) if (!*argv) rc = handle_file("{standard input}"); else while (*argv) { - rc = handle_file(*argv); + if (handle_file(*argv) != 0) + rc = 1; argv++; } return (rc); @@ -209,11 +204,11 @@ handle_file(const char *name) int fd, rt; if (name == NULL) - return (RETURN_NOINPUT); + return (1); if (strcmp("{standard input}", name) != 0) { if (freopen(name, "rb", stdin) == NULL) { warnx("'%s': %s", name, strerror(errno)); - return (RETURN_NOINPUT); + return (1); } } else { return (find_strings(name, (off_t)0, (off_t)0)); @@ -221,7 +216,7 @@ handle_file(const char *name) fd = fileno(stdin); if (fd < 0) - return (RETURN_NOINPUT); + return (1); rt = handle_elf(name, fd); return (rt); } @@ -239,7 +234,7 @@ handle_binary(const char *name, int fd) (void) lseek(fd, (off_t)0, SEEK_SET); if (!fstat(fd, &buf)) return (find_strings(name, (off_t)0, buf.st_size)); - return (RETURN_SOFTWARE); + return (1); } /* @@ -257,7 +252,7 @@ handle_elf(const char *name, int fd) Elf_Scn *scn; int rc; - rc = RETURN_OK; + rc = 0; /* If entire file is chosen, treat it as a binary file */ if (entire_file) return (handle_binary(name, fd)); @@ -272,7 +267,7 @@ handle_elf(const char *name, int fd) if (gelf_getehdr(elf, &elfhdr) == NULL) { (void) elf_end(elf); warnx("%s: ELF file could not be processed", name); - return (RETURN_SOFTWARE); + return (1); } if (elfhdr.e_shnum == 0 && elfhdr.e_type == ET_CORE) { @@ -352,7 +347,7 @@ find_strings(const char *name, off_t off if ((obuf = (char*)calloc(1, min_len + 1)) == NULL) { (void) fprintf(stderr, "Unable to allocate memory: %s\n", strerror(errno)); - return (RETURN_SOFTWARE); + return (1); } (void) fseeko(stdin, offset, SEEK_SET); @@ -426,7 +421,7 @@ find_strings(const char *name, off_t off } _exit1: free(obuf); - return (RETURN_OK); + return (0); } #define USAGE_MESSAGE "\ From owner-svn-src-head@freebsd.org Wed Oct 26 17:37:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A00AEC238ED; Wed, 26 Oct 2016 17:37:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 721A21B2; Wed, 26 Oct 2016 17:37:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QHb8La036832; Wed, 26 Oct 2016 17:37:08 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QHb8Ps036831; Wed, 26 Oct 2016 17:37:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610261737.u9QHb8Ps036831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 26 Oct 2016 17:37:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307971 - head/sys/mips/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.23 Precedence: list List-Id: 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, 26 Oct 2016 17:37:09 -0000 Author: jhb Date: Wed Oct 26 17:37:08 2016 New Revision: 307971 URL: https://svnweb.freebsd.org/changeset/base/307971 Log: Correct definition of 'struct sigcontext' on MIPS. Add missing fields ('sr' and 'mc_tls') to 'struct sigcontext'. The kernel doesn't use 'struct sigcontext' but instead uses 'ucontext_t' which includes 'mcontext_t' in 'struct sigframe' to build the signal frame. As a result, this change is not an ABI change but simply making 'struct sigcontext' correct. Note that 'struct sigcontext' is only used for "Traditional BSD style" signal handlers. While here, rename the 'xxx' field to '__spare__' to match 'mcontext_t'. Sponsored by: DARPA, AFRL Modified: head/sys/mips/include/signal.h Modified: head/sys/mips/include/signal.h ============================================================================== --- head/sys/mips/include/signal.h Wed Oct 26 17:34:33 2016 (r307970) +++ head/sys/mips/include/signal.h Wed Oct 26 17:37:08 2016 (r307971) @@ -68,11 +68,13 @@ struct sigcontext { int sc_onstack; /* sigstack state to restore */ __register_t sc_pc; /* pc at time of signal */ __register_t sc_regs[32]; /* processor regs 0 to 31 */ + __register_t sr; /* status register */ __register_t mullo, mulhi; /* mullo and mulhi registers... */ int sc_fpused; /* fp has been used */ f_register_t sc_fpregs[33]; /* fp regs 0 to 31 and csr */ __register_t sc_fpc_eir; /* fp exception instruction reg */ - int xxx[8]; /* XXX reserved */ + void *sc_tls; /* pointer to TLS area */ + int __spare__[8]; /* XXX reserved */ }; #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ From owner-svn-src-head@freebsd.org Wed Oct 26 18:47:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BD22C22382; Wed, 26 Oct 2016 18:47:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13F873E3; Wed, 26 Oct 2016 18:47:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QIllgO064602; Wed, 26 Oct 2016 18:47:47 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QIllRU064601; Wed, 26 Oct 2016 18:47:47 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610261847.u9QIllRU064601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 26 Oct 2016 18:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307975 - head/sys/i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 18:47:48 -0000 Author: jhb Date: Wed Oct 26 18:47:47 2016 New Revision: 307975 URL: https://svnweb.freebsd.org/changeset/base/307975 Log: Enable EFER_NXE properly on APs. EFER_NXE is set in the EFER MSR by initializecpu() and must be set on all CPUs in the system. When PG_NX support was added to PAE on i386, the block to enable EFER_NXE was placed in a section of initializecpu() that only runs if 'cpu == CPU_686'. During early boot, locore does an initial pass to set cpu that sets it to CPU_686 on all CPUs later than a Pentium. Later, printcpuinfo() adjusts the 'cpu' variable on PII and later CPUs to one of CPU_PII, CPU_PIII, or CPU_P4. However, printcpuinfo() is called after initializecpu() on the BSP, so the BSP would enable EFER_NXE and pg_nx. The APs execute initializecpu() much later after printcpuinfo() has run. The end result on a modern CPU was that cpu was set to CPU_PIII when the APs invoked initializecpu(), so they did not enable EFER_NXE. As a result, the APs would fault when trying to access any pages marked with PG_NX set. When booting a 2 CPU PAE kernel in bhyve this manifested as a hang before single user mode. The attempt to execute /bin/init tried to copy out the exec strings (argv, etc.) to a non-executable mapping while running on the AP. The instruction kept faulting due to invalid bits in the PTE in an infinite loop. Fix this by moving the code to enable EFER_NXE out of the switch statement on 'cpu' and always doing it if 'amd_feature' supports AMDID_NX. MFC after: 2 weeks Modified: head/sys/i386/i386/initcpu.c Modified: head/sys/i386/i386/initcpu.c ============================================================================== --- head/sys/i386/i386/initcpu.c Wed Oct 26 18:20:06 2016 (r307974) +++ head/sys/i386/i386/initcpu.c Wed Oct 26 18:47:47 2016 (r307975) @@ -753,16 +753,6 @@ initializecpu(void) init_transmeta(); break; } -#if defined(PAE) || defined(PAE_TABLES) - if ((amd_feature & AMDID_NX) != 0) { - uint64_t msr; - - msr = rdmsr(MSR_EFER) | EFER_NXE; - wrmsr(MSR_EFER, msr); - pg_nx = PG_NX; - elf32_nxstack = 1; - } -#endif break; #endif default: @@ -774,6 +764,16 @@ initializecpu(void) cpu_fxsr = hw_instruction_sse = 1; } #endif +#if defined(PAE) || defined(PAE_TABLES) + if ((amd_feature & AMDID_NX) != 0) { + uint64_t msr; + + msr = rdmsr(MSR_EFER) | EFER_NXE; + wrmsr(MSR_EFER, msr); + pg_nx = PG_NX; + elf32_nxstack = 1; + } +#endif } void From owner-svn-src-head@freebsd.org Wed Oct 26 20:02:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9922C235F0; Wed, 26 Oct 2016 20:02:24 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9731BC45; Wed, 26 Oct 2016 20:02:24 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QK2NNM095490; Wed, 26 Oct 2016 20:02:23 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QK2NJt095480; Wed, 26 Oct 2016 20:02:23 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201610262002.u9QK2NJt095480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 26 Oct 2016 20:02:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307976 - in head: crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/modes/asm secure/lib/libcrypto secure/lib/libcrypto/aarch64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 20:02:24 -0000 Author: jkim Date: Wed Oct 26 20:02:22 2016 New Revision: 307976 URL: https://svnweb.freebsd.org/changeset/base/307976 Log: Build OpenSSL assembly sources for aarch64. Tested with ThunderX by andrew. Added: head/secure/lib/libcrypto/aarch64/ head/secure/lib/libcrypto/aarch64/aesv8-armx.S (contents, props changed) head/secure/lib/libcrypto/aarch64/ghashv8-armx.S (contents, props changed) head/secure/lib/libcrypto/aarch64/sha1-armv8.S (contents, props changed) head/secure/lib/libcrypto/aarch64/sha256-armv8.S (contents, props changed) head/secure/lib/libcrypto/aarch64/sha512-armv8.S (contents, props changed) Modified: head/crypto/openssl/crypto/aes/asm/aesv8-armx.pl head/crypto/openssl/crypto/arm64cpuid.S head/crypto/openssl/crypto/modes/asm/ghashv8-armx.pl head/secure/lib/libcrypto/Makefile head/secure/lib/libcrypto/Makefile.asm head/secure/lib/libcrypto/Makefile.inc Modified: head/crypto/openssl/crypto/aes/asm/aesv8-armx.pl ============================================================================== --- head/crypto/openssl/crypto/aes/asm/aesv8-armx.pl Wed Oct 26 18:47:47 2016 (r307975) +++ head/crypto/openssl/crypto/aes/asm/aesv8-armx.pl Wed Oct 26 20:02:22 2016 (r307976) @@ -42,7 +42,7 @@ $code=<<___; #if __ARM_MAX_ARCH__>=7 .text ___ -$code.=".arch armv8-a+crypto\n" if ($flavour =~ /64/); +# $code.=".arch armv8-a+crypto\n" if ($flavour =~ /64/); $code.=".arch armv7-a\n.fpu neon\n.code 32\n" if ($flavour !~ /64/); #^^^^^^ this is done to simplify adoption by not depending # on latest binutils. Modified: head/crypto/openssl/crypto/arm64cpuid.S ============================================================================== --- head/crypto/openssl/crypto/arm64cpuid.S Wed Oct 26 18:47:47 2016 (r307975) +++ head/crypto/openssl/crypto/arm64cpuid.S Wed Oct 26 20:02:22 2016 (r307976) @@ -1,7 +1,6 @@ #include "arm_arch.h" .text -.arch armv8-a+crypto .align 5 .global _armv7_neon_probe Modified: head/crypto/openssl/crypto/modes/asm/ghashv8-armx.pl ============================================================================== --- head/crypto/openssl/crypto/modes/asm/ghashv8-armx.pl Wed Oct 26 18:47:47 2016 (r307975) +++ head/crypto/openssl/crypto/modes/asm/ghashv8-armx.pl Wed Oct 26 20:02:22 2016 (r307976) @@ -49,7 +49,7 @@ $code=<<___; .text ___ -$code.=".arch armv8-a+crypto\n" if ($flavour =~ /64/); +# $code.=".arch armv8-a+crypto\n" if ($flavour =~ /64/); $code.=".fpu neon\n.code 32\n" if ($flavour !~ /64/); ################################################################################ Modified: head/secure/lib/libcrypto/Makefile ============================================================================== --- head/secure/lib/libcrypto/Makefile Wed Oct 26 18:47:47 2016 (r307975) +++ head/secure/lib/libcrypto/Makefile Wed Oct 26 20:02:22 2016 (r307976) @@ -22,7 +22,10 @@ MAN+= config.5 des_modes.7 # base sources SRCS= cpt_err.c cryptlib.c cversion.c ex_data.c mem.c mem_dbg.c o_dir.c \ o_fips.c o_init.c o_str.c o_time.c uid.c -.if defined(ASM_amd64) +.if defined(ASM_aarch64) +SRCS+= arm64cpuid.S armcap.c mem_clr.c +CFLAGS.arm64cpuid.S= -march=armv8-a+crypto +.elif defined(ASM_amd64) SRCS+= x86_64cpuid.S .elif defined(ASM_arm) SRCS+= armcap.c armv4cpuid.S @@ -35,7 +38,10 @@ INCS+= crypto.h ebcdic.h opensslv.h ossl # aes SRCS+= aes_cfb.c aes_ctr.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c aes_wrap.c -.if defined(ASM_amd64) +.if defined(ASM_aarch64) +SRCS+= aes_cbc.c aes_core.c aesv8-armx.S +CFLAGS.aesv8-armx.S= -march=armv8-a+crypto +.elif defined(ASM_amd64) SRCS+= aes-x86_64.S aesni-mb-x86_64.S aesni-sha1-x86_64.S \ aesni-sha256-x86_64.S aesni-x86_64.S bsaes-x86_64.S vpaes-x86_64.S .elif defined(ASM_arm) @@ -238,7 +244,10 @@ INCS+= mdc2.h # modes SRCS+= cbc128.c ccm128.c cfb128.c ctr128.c cts128.c gcm128.c ofb128.c \ wrap128.c xts128.c -.if defined(ASM_amd64) +.if defined(ASM_aarch64) +SRCS+= ghashv8-armx.S +CFLAGS.ghashv8-armx.S= -march=armv8-a+crypto +.elif defined(ASM_amd64) SRCS+= aesni-gcm-x86_64.S ghash-x86_64.S .elif defined(ASM_arm) SRCS+= ghash-armv4.S ghashv8-armx.S @@ -324,7 +333,9 @@ INCS+= seed.h # sha SRCS+= sha1_one.c sha1dgst.c sha256.c sha512.c sha_dgst.c sha_one.c -.if defined(ASM_amd64) +.if defined(ASM_aarch64) +SRCS+= sha1-armv8.S sha256-armv8.S sha512-armv8.S +.elif defined(ASM_amd64) SRCS+= sha1-mb-x86_64.S sha1-x86_64.S sha256-mb-x86_64.S sha256-x86_64.S \ sha512-x86_64.S .elif defined(ASM_arm) Modified: head/secure/lib/libcrypto/Makefile.asm ============================================================================== --- head/secure/lib/libcrypto/Makefile.asm Wed Oct 26 18:47:47 2016 (r307975) +++ head/secure/lib/libcrypto/Makefile.asm Wed Oct 26 20:02:22 2016 (r307976) @@ -6,7 +6,44 @@ .include "Makefile.inc" -.if defined(ASM_amd64) +.if defined(ASM_aarch64) + +.PATH: ${LCRYPTO_SRC}/crypto \ + ${LCRYPTO_SRC}/crypto/aes/asm \ + ${LCRYPTO_SRC}/crypto/modes/asm \ + ${LCRYPTO_SRC}/crypto/sha/asm + +PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm + +# aes +SRCS= aesv8-armx.pl + +# modes +SRCS+= ghashv8-armx.pl + +# sha +SRCS+= sha1-armv8.pl sha512-armv8.pl + +ASM= ${SRCS:R:S/$/.S/} sha256-armv8.S + +all: ${ASM} + +CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/} sha256-armv8.s +.SUFFIXES: .pl + +sha256-armv8.S: sha512-armv8.pl + env CC=cc perl ${.ALLSRC} 64 ${.TARGET:R:S/$/.s/} + ( echo '/* $$'FreeBSD'$$ */' ;\ + echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ + cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} + +.pl.S: + env CC=cc perl ${.IMPSRC} 64 ${.TARGET:R:S/$/.s/} + ( echo '/* $$'FreeBSD'$$ */' ;\ + echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}. */' ;\ + cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} + +.elif defined(ASM_amd64) .PATH: ${LCRYPTO_SRC}/crypto \ ${LCRYPTO_SRC}/crypto/aes/asm \ Modified: head/secure/lib/libcrypto/Makefile.inc ============================================================================== --- head/secure/lib/libcrypto/Makefile.inc Wed Oct 26 18:47:47 2016 (r307975) +++ head/secure/lib/libcrypto/Makefile.inc Wed Oct 26 20:02:22 2016 (r307976) @@ -21,7 +21,9 @@ CFLAGS+=-DL_ENDIAN CFLAGS+=-DB_ENDIAN .endif -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" +ASM_${MACHINE_CPUARCH}= +.elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" _ASM_AVX!= { \ echo vzeroall | \ ${CC} -x assembler -o /dev/null -c - 2> /dev/null; \ @@ -29,11 +31,11 @@ _ASM_AVX!= { \ .if ${_ASM_AVX} == yes ASM_${MACHINE_CPUARCH}= .endif -.elif ${MACHINE_CPUARCH} == "arm" -ASM_arm= .endif -.if defined(ASM_amd64) +.if defined(ASM_aarch64) +CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM +.elif defined(ASM_amd64) CFLAGS+=-DOPENSSL_IA32_SSE2 CFLAGS+=-DAES_ASM -DBSAES_ASM -DVPAES_ASM CFLAGS+=-DECP_NISTZ256_ASM Added: head/secure/lib/libcrypto/aarch64/aesv8-armx.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/secure/lib/libcrypto/aarch64/aesv8-armx.S Wed Oct 26 20:02:22 2016 (r307976) @@ -0,0 +1,748 @@ +/* $FreeBSD$ */ +/* Do not modify. This file is auto-generated from aesv8-armx.pl. */ +#include "arm_arch.h" + +#if __ARM_MAX_ARCH__>=7 +.text +.align 5 +rcon: +.long 0x01,0x01,0x01,0x01 +.long 0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d // rotate-n-splat +.long 0x1b,0x1b,0x1b,0x1b + +.globl aes_v8_set_encrypt_key +.type aes_v8_set_encrypt_key,%function +.align 5 +aes_v8_set_encrypt_key: +.Lenc_key: + stp x29,x30,[sp,#-16]! + add x29,sp,#0 + mov x3,#-1 + cmp x0,#0 + b.eq .Lenc_key_abort + cmp x2,#0 + b.eq .Lenc_key_abort + mov x3,#-2 + cmp w1,#128 + b.lt .Lenc_key_abort + cmp w1,#256 + b.gt .Lenc_key_abort + tst w1,#0x3f + b.ne .Lenc_key_abort + + adr x3,rcon + cmp w1,#192 + + eor v0.16b,v0.16b,v0.16b + ld1 {v3.16b},[x0],#16 + mov w1,#8 // reuse w1 + ld1 {v1.4s,v2.4s},[x3],#32 + + b.lt .Loop128 + b.eq .L192 + b .L256 + +.align 4 +.Loop128: + tbl v6.16b,{v3.16b},v2.16b + ext v5.16b,v0.16b,v3.16b,#12 + st1 {v3.4s},[x2],#16 + aese v6.16b,v0.16b + subs w1,w1,#1 + + eor v3.16b,v3.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v3.16b,v3.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v6.16b,v6.16b,v1.16b + eor v3.16b,v3.16b,v5.16b + shl v1.16b,v1.16b,#1 + eor v3.16b,v3.16b,v6.16b + b.ne .Loop128 + + ld1 {v1.4s},[x3] + + tbl v6.16b,{v3.16b},v2.16b + ext v5.16b,v0.16b,v3.16b,#12 + st1 {v3.4s},[x2],#16 + aese v6.16b,v0.16b + + eor v3.16b,v3.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v3.16b,v3.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v6.16b,v6.16b,v1.16b + eor v3.16b,v3.16b,v5.16b + shl v1.16b,v1.16b,#1 + eor v3.16b,v3.16b,v6.16b + + tbl v6.16b,{v3.16b},v2.16b + ext v5.16b,v0.16b,v3.16b,#12 + st1 {v3.4s},[x2],#16 + aese v6.16b,v0.16b + + eor v3.16b,v3.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v3.16b,v3.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v6.16b,v6.16b,v1.16b + eor v3.16b,v3.16b,v5.16b + eor v3.16b,v3.16b,v6.16b + st1 {v3.4s},[x2] + add x2,x2,#0x50 + + mov w12,#10 + b .Ldone + +.align 4 +.L192: + ld1 {v4.8b},[x0],#8 + movi v6.16b,#8 // borrow v6.16b + st1 {v3.4s},[x2],#16 + sub v2.16b,v2.16b,v6.16b // adjust the mask + +.Loop192: + tbl v6.16b,{v4.16b},v2.16b + ext v5.16b,v0.16b,v3.16b,#12 + st1 {v4.8b},[x2],#8 + aese v6.16b,v0.16b + subs w1,w1,#1 + + eor v3.16b,v3.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v3.16b,v3.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v3.16b,v3.16b,v5.16b + + dup v5.4s,v3.s[3] + eor v5.16b,v5.16b,v4.16b + eor v6.16b,v6.16b,v1.16b + ext v4.16b,v0.16b,v4.16b,#12 + shl v1.16b,v1.16b,#1 + eor v4.16b,v4.16b,v5.16b + eor v3.16b,v3.16b,v6.16b + eor v4.16b,v4.16b,v6.16b + st1 {v3.4s},[x2],#16 + b.ne .Loop192 + + mov w12,#12 + add x2,x2,#0x20 + b .Ldone + +.align 4 +.L256: + ld1 {v4.16b},[x0] + mov w1,#7 + mov w12,#14 + st1 {v3.4s},[x2],#16 + +.Loop256: + tbl v6.16b,{v4.16b},v2.16b + ext v5.16b,v0.16b,v3.16b,#12 + st1 {v4.4s},[x2],#16 + aese v6.16b,v0.16b + subs w1,w1,#1 + + eor v3.16b,v3.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v3.16b,v3.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v6.16b,v6.16b,v1.16b + eor v3.16b,v3.16b,v5.16b + shl v1.16b,v1.16b,#1 + eor v3.16b,v3.16b,v6.16b + st1 {v3.4s},[x2],#16 + b.eq .Ldone + + dup v6.4s,v3.s[3] // just splat + ext v5.16b,v0.16b,v4.16b,#12 + aese v6.16b,v0.16b + + eor v4.16b,v4.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v4.16b,v4.16b,v5.16b + ext v5.16b,v0.16b,v5.16b,#12 + eor v4.16b,v4.16b,v5.16b + + eor v4.16b,v4.16b,v6.16b + b .Loop256 + +.Ldone: + str w12,[x2] + mov x3,#0 + +.Lenc_key_abort: + mov x0,x3 // return value + ldr x29,[sp],#16 + ret +.size aes_v8_set_encrypt_key,.-aes_v8_set_encrypt_key + +.globl aes_v8_set_decrypt_key +.type aes_v8_set_decrypt_key,%function +.align 5 +aes_v8_set_decrypt_key: + stp x29,x30,[sp,#-16]! + add x29,sp,#0 + bl .Lenc_key + + cmp x0,#0 + b.ne .Ldec_key_abort + + sub x2,x2,#240 // restore original x2 + mov x4,#-16 + add x0,x2,x12,lsl#4 // end of key schedule + + ld1 {v0.4s},[x2] + ld1 {v1.4s},[x0] + st1 {v0.4s},[x0],x4 + st1 {v1.4s},[x2],#16 + +.Loop_imc: + ld1 {v0.4s},[x2] + ld1 {v1.4s},[x0] + aesimc v0.16b,v0.16b + aesimc v1.16b,v1.16b + st1 {v0.4s},[x0],x4 + st1 {v1.4s},[x2],#16 + cmp x0,x2 + b.hi .Loop_imc + + ld1 {v0.4s},[x2] + aesimc v0.16b,v0.16b + st1 {v0.4s},[x0] + + eor x0,x0,x0 // return value +.Ldec_key_abort: + ldp x29,x30,[sp],#16 + ret +.size aes_v8_set_decrypt_key,.-aes_v8_set_decrypt_key +.globl aes_v8_encrypt +.type aes_v8_encrypt,%function +.align 5 +aes_v8_encrypt: + ldr w3,[x2,#240] + ld1 {v0.4s},[x2],#16 + ld1 {v2.16b},[x0] + sub w3,w3,#2 + ld1 {v1.4s},[x2],#16 + +.Loop_enc: + aese v2.16b,v0.16b + aesmc v2.16b,v2.16b + ld1 {v0.4s},[x2],#16 + subs w3,w3,#2 + aese v2.16b,v1.16b + aesmc v2.16b,v2.16b + ld1 {v1.4s},[x2],#16 + b.gt .Loop_enc + + aese v2.16b,v0.16b + aesmc v2.16b,v2.16b + ld1 {v0.4s},[x2] + aese v2.16b,v1.16b + eor v2.16b,v2.16b,v0.16b + + st1 {v2.16b},[x1] + ret +.size aes_v8_encrypt,.-aes_v8_encrypt +.globl aes_v8_decrypt +.type aes_v8_decrypt,%function +.align 5 +aes_v8_decrypt: + ldr w3,[x2,#240] + ld1 {v0.4s},[x2],#16 + ld1 {v2.16b},[x0] + sub w3,w3,#2 + ld1 {v1.4s},[x2],#16 + +.Loop_dec: + aesd v2.16b,v0.16b + aesimc v2.16b,v2.16b + ld1 {v0.4s},[x2],#16 + subs w3,w3,#2 + aesd v2.16b,v1.16b + aesimc v2.16b,v2.16b + ld1 {v1.4s},[x2],#16 + b.gt .Loop_dec + + aesd v2.16b,v0.16b + aesimc v2.16b,v2.16b + ld1 {v0.4s},[x2] + aesd v2.16b,v1.16b + eor v2.16b,v2.16b,v0.16b + + st1 {v2.16b},[x1] + ret +.size aes_v8_decrypt,.-aes_v8_decrypt +.globl aes_v8_cbc_encrypt +.type aes_v8_cbc_encrypt,%function +.align 5 +aes_v8_cbc_encrypt: + stp x29,x30,[sp,#-16]! + add x29,sp,#0 + subs x2,x2,#16 + mov x8,#16 + b.lo .Lcbc_abort + csel x8,xzr,x8,eq + + cmp w5,#0 // en- or decrypting? + ldr w5,[x3,#240] + and x2,x2,#-16 + ld1 {v6.16b},[x4] + ld1 {v0.16b},[x0],x8 + + ld1 {v16.4s-v17.4s},[x3] // load key schedule... + sub w5,w5,#6 + add x7,x3,x5,lsl#4 // pointer to last 7 round keys + sub w5,w5,#2 + ld1 {v18.4s-v19.4s},[x7],#32 + ld1 {v20.4s-v21.4s},[x7],#32 + ld1 {v22.4s-v23.4s},[x7],#32 + ld1 {v7.4s},[x7] + + add x7,x3,#32 + mov w6,w5 + b.eq .Lcbc_dec + + cmp w5,#2 + eor v0.16b,v0.16b,v6.16b + eor v5.16b,v16.16b,v7.16b + b.eq .Lcbc_enc128 + + ld1 {v2.4s-v3.4s},[x7] + add x7,x3,#16 + add x6,x3,#16*4 + add x12,x3,#16*5 + aese v0.16b,v16.16b + aesmc v0.16b,v0.16b + add x14,x3,#16*6 + add x3,x3,#16*7 + b .Lenter_cbc_enc + +.align 4 +.Loop_cbc_enc: + aese v0.16b,v16.16b + aesmc v0.16b,v0.16b + st1 {v6.16b},[x1],#16 +.Lenter_cbc_enc: + aese v0.16b,v17.16b + aesmc v0.16b,v0.16b + aese v0.16b,v2.16b + aesmc v0.16b,v0.16b + ld1 {v16.4s},[x6] + cmp w5,#4 + aese v0.16b,v3.16b + aesmc v0.16b,v0.16b + ld1 {v17.4s},[x12] + b.eq .Lcbc_enc192 + + aese v0.16b,v16.16b + aesmc v0.16b,v0.16b + ld1 {v16.4s},[x14] + aese v0.16b,v17.16b + aesmc v0.16b,v0.16b + ld1 {v17.4s},[x3] + nop + +.Lcbc_enc192: + aese v0.16b,v16.16b + aesmc v0.16b,v0.16b + subs x2,x2,#16 + aese v0.16b,v17.16b + aesmc v0.16b,v0.16b + csel x8,xzr,x8,eq + aese v0.16b,v18.16b + aesmc v0.16b,v0.16b + aese v0.16b,v19.16b + aesmc v0.16b,v0.16b + ld1 {v16.16b},[x0],x8 + aese v0.16b,v20.16b + aesmc v0.16b,v0.16b + eor v16.16b,v16.16b,v5.16b + aese v0.16b,v21.16b + aesmc v0.16b,v0.16b + ld1 {v17.4s},[x7] // re-pre-load rndkey[1] + aese v0.16b,v22.16b + aesmc v0.16b,v0.16b + aese v0.16b,v23.16b + eor v6.16b,v0.16b,v7.16b + b.hs .Loop_cbc_enc + + st1 {v6.16b},[x1],#16 + b .Lcbc_done + +.align 5 +.Lcbc_enc128: + ld1 {v2.4s-v3.4s},[x7] + aese v0.16b,v16.16b + aesmc v0.16b,v0.16b + b .Lenter_cbc_enc128 +.Loop_cbc_enc128: + aese v0.16b,v16.16b + aesmc v0.16b,v0.16b + st1 {v6.16b},[x1],#16 +.Lenter_cbc_enc128: + aese v0.16b,v17.16b + aesmc v0.16b,v0.16b + subs x2,x2,#16 + aese v0.16b,v2.16b + aesmc v0.16b,v0.16b + csel x8,xzr,x8,eq + aese v0.16b,v3.16b + aesmc v0.16b,v0.16b + aese v0.16b,v18.16b + aesmc v0.16b,v0.16b + aese v0.16b,v19.16b + aesmc v0.16b,v0.16b + ld1 {v16.16b},[x0],x8 + aese v0.16b,v20.16b + aesmc v0.16b,v0.16b + aese v0.16b,v21.16b + aesmc v0.16b,v0.16b + aese v0.16b,v22.16b + aesmc v0.16b,v0.16b + eor v16.16b,v16.16b,v5.16b + aese v0.16b,v23.16b + eor v6.16b,v0.16b,v7.16b + b.hs .Loop_cbc_enc128 + + st1 {v6.16b},[x1],#16 + b .Lcbc_done +.align 5 +.Lcbc_dec: + ld1 {v18.16b},[x0],#16 + subs x2,x2,#32 // bias + add w6,w5,#2 + orr v3.16b,v0.16b,v0.16b + orr v1.16b,v0.16b,v0.16b + orr v19.16b,v18.16b,v18.16b + b.lo .Lcbc_dec_tail + + orr v1.16b,v18.16b,v18.16b + ld1 {v18.16b},[x0],#16 + orr v2.16b,v0.16b,v0.16b + orr v3.16b,v1.16b,v1.16b + orr v19.16b,v18.16b,v18.16b + +.Loop3x_cbc_dec: + aesd v0.16b,v16.16b + aesimc v0.16b,v0.16b + aesd v1.16b,v16.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v16.16b + aesimc v18.16b,v18.16b + ld1 {v16.4s},[x7],#16 + subs w6,w6,#2 + aesd v0.16b,v17.16b + aesimc v0.16b,v0.16b + aesd v1.16b,v17.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v17.16b + aesimc v18.16b,v18.16b + ld1 {v17.4s},[x7],#16 + b.gt .Loop3x_cbc_dec + + aesd v0.16b,v16.16b + aesimc v0.16b,v0.16b + aesd v1.16b,v16.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v16.16b + aesimc v18.16b,v18.16b + eor v4.16b,v6.16b,v7.16b + subs x2,x2,#0x30 + eor v5.16b,v2.16b,v7.16b + csel x6,x2,x6,lo // x6, w6, is zero at this point + aesd v0.16b,v17.16b + aesimc v0.16b,v0.16b + aesd v1.16b,v17.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v17.16b + aesimc v18.16b,v18.16b + eor v17.16b,v3.16b,v7.16b + add x0,x0,x6 // x0 is adjusted in such way that + // at exit from the loop v1.16b-v18.16b + // are loaded with last "words" + orr v6.16b,v19.16b,v19.16b + mov x7,x3 + aesd v0.16b,v20.16b + aesimc v0.16b,v0.16b + aesd v1.16b,v20.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v20.16b + aesimc v18.16b,v18.16b + ld1 {v2.16b},[x0],#16 + aesd v0.16b,v21.16b + aesimc v0.16b,v0.16b + aesd v1.16b,v21.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v21.16b + aesimc v18.16b,v18.16b + ld1 {v3.16b},[x0],#16 + aesd v0.16b,v22.16b + aesimc v0.16b,v0.16b + aesd v1.16b,v22.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v22.16b + aesimc v18.16b,v18.16b + ld1 {v19.16b},[x0],#16 + aesd v0.16b,v23.16b + aesd v1.16b,v23.16b + aesd v18.16b,v23.16b + ld1 {v16.4s},[x7],#16 // re-pre-load rndkey[0] + add w6,w5,#2 + eor v4.16b,v4.16b,v0.16b + eor v5.16b,v5.16b,v1.16b + eor v18.16b,v18.16b,v17.16b + ld1 {v17.4s},[x7],#16 // re-pre-load rndkey[1] + st1 {v4.16b},[x1],#16 + orr v0.16b,v2.16b,v2.16b + st1 {v5.16b},[x1],#16 + orr v1.16b,v3.16b,v3.16b + st1 {v18.16b},[x1],#16 + orr v18.16b,v19.16b,v19.16b + b.hs .Loop3x_cbc_dec + + cmn x2,#0x30 + b.eq .Lcbc_done + nop + +.Lcbc_dec_tail: + aesd v1.16b,v16.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v16.16b + aesimc v18.16b,v18.16b + ld1 {v16.4s},[x7],#16 + subs w6,w6,#2 + aesd v1.16b,v17.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v17.16b + aesimc v18.16b,v18.16b + ld1 {v17.4s},[x7],#16 + b.gt .Lcbc_dec_tail + + aesd v1.16b,v16.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v16.16b + aesimc v18.16b,v18.16b + aesd v1.16b,v17.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v17.16b + aesimc v18.16b,v18.16b + aesd v1.16b,v20.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v20.16b + aesimc v18.16b,v18.16b + cmn x2,#0x20 + aesd v1.16b,v21.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v21.16b + aesimc v18.16b,v18.16b + eor v5.16b,v6.16b,v7.16b + aesd v1.16b,v22.16b + aesimc v1.16b,v1.16b + aesd v18.16b,v22.16b + aesimc v18.16b,v18.16b + eor v17.16b,v3.16b,v7.16b + aesd v1.16b,v23.16b + aesd v18.16b,v23.16b + b.eq .Lcbc_dec_one + eor v5.16b,v5.16b,v1.16b + eor v17.16b,v17.16b,v18.16b + orr v6.16b,v19.16b,v19.16b + st1 {v5.16b},[x1],#16 + st1 {v17.16b},[x1],#16 + b .Lcbc_done + +.Lcbc_dec_one: + eor v5.16b,v5.16b,v18.16b + orr v6.16b,v19.16b,v19.16b + st1 {v5.16b},[x1],#16 + +.Lcbc_done: + st1 {v6.16b},[x4] +.Lcbc_abort: + ldr x29,[sp],#16 + ret +.size aes_v8_cbc_encrypt,.-aes_v8_cbc_encrypt +.globl aes_v8_ctr32_encrypt_blocks +.type aes_v8_ctr32_encrypt_blocks,%function +.align 5 +aes_v8_ctr32_encrypt_blocks: + stp x29,x30,[sp,#-16]! + add x29,sp,#0 + ldr w5,[x3,#240] + + ldr w8, [x4, #12] + ld1 {v0.4s},[x4] + + ld1 {v16.4s-v17.4s},[x3] // load key schedule... + sub w5,w5,#4 + mov x12,#16 + cmp x2,#2 + add x7,x3,x5,lsl#4 // pointer to last 5 round keys + sub w5,w5,#2 + ld1 {v20.4s-v21.4s},[x7],#32 + ld1 {v22.4s-v23.4s},[x7],#32 + ld1 {v7.4s},[x7] + add x7,x3,#32 + mov w6,w5 + csel x12,xzr,x12,lo +#ifndef __ARMEB__ + rev w8, w8 +#endif + orr v1.16b,v0.16b,v0.16b + add w10, w8, #1 + orr v18.16b,v0.16b,v0.16b + add w8, w8, #2 + orr v6.16b,v0.16b,v0.16b + rev w10, w10 + mov v1.s[3],w10 + b.ls .Lctr32_tail + rev w12, w8 + sub x2,x2,#3 // bias + mov v18.s[3],w12 + b .Loop3x_ctr32 + +.align 4 +.Loop3x_ctr32: + aese v0.16b,v16.16b + aesmc v0.16b,v0.16b + aese v1.16b,v16.16b + aesmc v1.16b,v1.16b + aese v18.16b,v16.16b + aesmc v18.16b,v18.16b + ld1 {v16.4s},[x7],#16 + subs w6,w6,#2 + aese v0.16b,v17.16b + aesmc v0.16b,v0.16b + aese v1.16b,v17.16b + aesmc v1.16b,v1.16b + aese v18.16b,v17.16b + aesmc v18.16b,v18.16b + ld1 {v17.4s},[x7],#16 + b.gt .Loop3x_ctr32 + + aese v0.16b,v16.16b + aesmc v4.16b,v0.16b + aese v1.16b,v16.16b + aesmc v5.16b,v1.16b + ld1 {v2.16b},[x0],#16 + orr v0.16b,v6.16b,v6.16b + aese v18.16b,v16.16b + aesmc v18.16b,v18.16b + ld1 {v3.16b},[x0],#16 + orr v1.16b,v6.16b,v6.16b + aese v4.16b,v17.16b + aesmc v4.16b,v4.16b + aese v5.16b,v17.16b + aesmc v5.16b,v5.16b + ld1 {v19.16b},[x0],#16 + mov x7,x3 + aese v18.16b,v17.16b + aesmc v17.16b,v18.16b + orr v18.16b,v6.16b,v6.16b + add w9,w8,#1 + aese v4.16b,v20.16b + aesmc v4.16b,v4.16b + aese v5.16b,v20.16b + aesmc v5.16b,v5.16b + eor v2.16b,v2.16b,v7.16b + add w10,w8,#2 + aese v17.16b,v20.16b + aesmc v17.16b,v17.16b + eor v3.16b,v3.16b,v7.16b + add w8,w8,#3 + aese v4.16b,v21.16b + aesmc v4.16b,v4.16b + aese v5.16b,v21.16b + aesmc v5.16b,v5.16b + eor v19.16b,v19.16b,v7.16b + rev w9,w9 + aese v17.16b,v21.16b + aesmc v17.16b,v17.16b + mov v0.s[3], w9 + rev w10,w10 + aese v4.16b,v22.16b + aesmc v4.16b,v4.16b + aese v5.16b,v22.16b + aesmc v5.16b,v5.16b + mov v1.s[3], w10 + rev w12,w8 + aese v17.16b,v22.16b + aesmc v17.16b,v17.16b + mov v18.s[3], w12 + subs x2,x2,#3 + aese v4.16b,v23.16b + aese v5.16b,v23.16b + aese v17.16b,v23.16b + + eor v2.16b,v2.16b,v4.16b + ld1 {v16.4s},[x7],#16 // re-pre-load rndkey[0] + st1 {v2.16b},[x1],#16 + eor v3.16b,v3.16b,v5.16b + mov w6,w5 + st1 {v3.16b},[x1],#16 + eor v19.16b,v19.16b,v17.16b + ld1 {v17.4s},[x7],#16 // re-pre-load rndkey[1] + st1 {v19.16b},[x1],#16 + b.hs .Loop3x_ctr32 + + adds x2,x2,#3 + b.eq .Lctr32_done + cmp x2,#1 + mov x12,#16 + csel x12,xzr,x12,eq + +.Lctr32_tail: + aese v0.16b,v16.16b + aesmc v0.16b,v0.16b + aese v1.16b,v16.16b + aesmc v1.16b,v1.16b + ld1 {v16.4s},[x7],#16 + subs w6,w6,#2 + aese v0.16b,v17.16b + aesmc v0.16b,v0.16b + aese v1.16b,v17.16b + aesmc v1.16b,v1.16b + ld1 {v17.4s},[x7],#16 + b.gt .Lctr32_tail + + aese v0.16b,v16.16b + aesmc v0.16b,v0.16b + aese v1.16b,v16.16b + aesmc v1.16b,v1.16b + aese v0.16b,v17.16b + aesmc v0.16b,v0.16b + aese v1.16b,v17.16b + aesmc v1.16b,v1.16b + ld1 {v2.16b},[x0],x12 + aese v0.16b,v20.16b + aesmc v0.16b,v0.16b + aese v1.16b,v20.16b + aesmc v1.16b,v1.16b + ld1 {v3.16b},[x0] + aese v0.16b,v21.16b + aesmc v0.16b,v0.16b + aese v1.16b,v21.16b + aesmc v1.16b,v1.16b + eor v2.16b,v2.16b,v7.16b + aese v0.16b,v22.16b + aesmc v0.16b,v0.16b + aese v1.16b,v22.16b + aesmc v1.16b,v1.16b + eor v3.16b,v3.16b,v7.16b + aese v0.16b,v23.16b + aese v1.16b,v23.16b + + cmp x2,#1 + eor v2.16b,v2.16b,v0.16b + eor v3.16b,v3.16b,v1.16b + st1 {v2.16b},[x1],#16 + b.eq .Lctr32_done + st1 {v3.16b},[x1] + +.Lctr32_done: + ldr x29,[sp],#16 + ret +.size aes_v8_ctr32_encrypt_blocks,.-aes_v8_ctr32_encrypt_blocks +#endif Added: head/secure/lib/libcrypto/aarch64/ghashv8-armx.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/secure/lib/libcrypto/aarch64/ghashv8-armx.S Wed Oct 26 20:02:22 2016 (r307976) @@ -0,0 +1,228 @@ +/* $FreeBSD$ */ +/* Do not modify. This file is auto-generated from ghashv8-armx.pl. */ +#include "arm_arch.h" + +.text +.global gcm_init_v8 +.type gcm_init_v8,%function +.align 4 +gcm_init_v8: + ld1 {v17.2d},[x1] //load input H + movi v19.16b,#0xe1 + shl v19.2d,v19.2d,#57 //0xc2.0 + ext v3.16b,v17.16b,v17.16b,#8 + ushr v18.2d,v19.2d,#63 + dup v17.4s,v17.s[1] + ext v16.16b,v18.16b,v19.16b,#8 //t0=0xc2....01 + ushr v18.2d,v3.2d,#63 + sshr v17.4s,v17.4s,#31 //broadcast carry bit + and v18.16b,v18.16b,v16.16b + shl v3.2d,v3.2d,#1 + ext v18.16b,v18.16b,v18.16b,#8 + and v16.16b,v16.16b,v17.16b + orr v3.16b,v3.16b,v18.16b //H<<<=1 + eor v20.16b,v3.16b,v16.16b //twisted H + st1 {v20.2d},[x0],#16 //store Htable[0] + + //calculate H^2 + ext v16.16b,v20.16b,v20.16b,#8 //Karatsuba pre-processing + pmull v0.1q,v20.1d,v20.1d + eor v16.16b,v16.16b,v20.16b + pmull2 v2.1q,v20.2d,v20.2d + pmull v1.1q,v16.1d,v16.1d + + ext v17.16b,v0.16b,v2.16b,#8 //Karatsuba post-processing + eor v18.16b,v0.16b,v2.16b + eor v1.16b,v1.16b,v17.16b + eor v1.16b,v1.16b,v18.16b + pmull v18.1q,v0.1d,v19.1d //1st phase + + ins v2.d[0],v1.d[1] + ins v1.d[1],v0.d[0] + eor v0.16b,v1.16b,v18.16b + + ext v18.16b,v0.16b,v0.16b,#8 //2nd phase + pmull v0.1q,v0.1d,v19.1d + eor v18.16b,v18.16b,v2.16b + eor v22.16b,v0.16b,v18.16b + + ext v17.16b,v22.16b,v22.16b,#8 //Karatsuba pre-processing + eor v17.16b,v17.16b,v22.16b + ext v21.16b,v16.16b,v17.16b,#8 //pack Karatsuba pre-processed + st1 {v21.2d-v22.2d},[x0] //store Htable[1..2] + + ret +.size gcm_init_v8,.-gcm_init_v8 +.global gcm_gmult_v8 +.type gcm_gmult_v8,%function +.align 4 +gcm_gmult_v8: + ld1 {v17.2d},[x0] //load Xi + movi v19.16b,#0xe1 + ld1 {v20.2d-v21.2d},[x1] //load twisted H, ... + shl v19.2d,v19.2d,#57 +#ifndef __ARMEB__ + rev64 v17.16b,v17.16b +#endif + ext v3.16b,v17.16b,v17.16b,#8 + + pmull v0.1q,v20.1d,v3.1d //H.lo·Xi.lo + eor v17.16b,v17.16b,v3.16b //Karatsuba pre-processing + pmull2 v2.1q,v20.2d,v3.2d //H.hi·Xi.hi + pmull v1.1q,v21.1d,v17.1d //(H.lo+H.hi)·(Xi.lo+Xi.hi) + + ext v17.16b,v0.16b,v2.16b,#8 //Karatsuba post-processing + eor v18.16b,v0.16b,v2.16b + eor v1.16b,v1.16b,v17.16b + eor v1.16b,v1.16b,v18.16b + pmull v18.1q,v0.1d,v19.1d //1st phase of reduction + + ins v2.d[0],v1.d[1] + ins v1.d[1],v0.d[0] + eor v0.16b,v1.16b,v18.16b + + ext v18.16b,v0.16b,v0.16b,#8 //2nd phase of reduction + pmull v0.1q,v0.1d,v19.1d + eor v18.16b,v18.16b,v2.16b + eor v0.16b,v0.16b,v18.16b + +#ifndef __ARMEB__ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Oct 26 20:12:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFDE6C237CB; Wed, 26 Oct 2016 20:12:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C03821A; Wed, 26 Oct 2016 20:12:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QKCUHu099286; Wed, 26 Oct 2016 20:12:30 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QKCUAD099285; Wed, 26 Oct 2016 20:12:30 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201610262012.u9QKCUAD099285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 26 Oct 2016 20:12:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307977 - head/secure/lib/libcrypto X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 20:12:31 -0000 Author: jkim Date: Wed Oct 26 20:12:30 2016 New Revision: 307977 URL: https://svnweb.freebsd.org/changeset/base/307977 Log: Prefer ACFLAGS over CFLAGS for compiling aarch64 assembly files. Modified: head/secure/lib/libcrypto/Makefile Modified: head/secure/lib/libcrypto/Makefile ============================================================================== --- head/secure/lib/libcrypto/Makefile Wed Oct 26 20:02:22 2016 (r307976) +++ head/secure/lib/libcrypto/Makefile Wed Oct 26 20:12:30 2016 (r307977) @@ -24,7 +24,7 @@ SRCS= cpt_err.c cryptlib.c cversion.c ex o_fips.c o_init.c o_str.c o_time.c uid.c .if defined(ASM_aarch64) SRCS+= arm64cpuid.S armcap.c mem_clr.c -CFLAGS.arm64cpuid.S= -march=armv8-a+crypto +ACFLAGS.arm64cpuid.S= -march=armv8-a+crypto .elif defined(ASM_amd64) SRCS+= x86_64cpuid.S .elif defined(ASM_arm) @@ -40,7 +40,7 @@ INCS+= crypto.h ebcdic.h opensslv.h ossl SRCS+= aes_cfb.c aes_ctr.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c aes_wrap.c .if defined(ASM_aarch64) SRCS+= aes_cbc.c aes_core.c aesv8-armx.S -CFLAGS.aesv8-armx.S= -march=armv8-a+crypto +ACFLAGS.aesv8-armx.S= -march=armv8-a+crypto .elif defined(ASM_amd64) SRCS+= aes-x86_64.S aesni-mb-x86_64.S aesni-sha1-x86_64.S \ aesni-sha256-x86_64.S aesni-x86_64.S bsaes-x86_64.S vpaes-x86_64.S @@ -246,7 +246,7 @@ SRCS+= cbc128.c ccm128.c cfb128.c ctr128 wrap128.c xts128.c .if defined(ASM_aarch64) SRCS+= ghashv8-armx.S -CFLAGS.ghashv8-armx.S= -march=armv8-a+crypto +ACFLAGS.ghashv8-armx.S= -march=armv8-a+crypto .elif defined(ASM_amd64) SRCS+= aesni-gcm-x86_64.S ghash-x86_64.S .elif defined(ASM_arm) From owner-svn-src-head@freebsd.org Wed Oct 26 20:28:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3BFCC23AEA; Wed, 26 Oct 2016 20:28:24 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A01CBE4C; Wed, 26 Oct 2016 20:28:24 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QKSNeX003648; Wed, 26 Oct 2016 20:28:23 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QKSNpN003647; Wed, 26 Oct 2016 20:28:23 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201610262028.u9QKSNpN003647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 26 Oct 2016 20:28:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307978 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 26 Oct 2016 20:28:24 -0000 Author: mckusick Date: Wed Oct 26 20:28:23 2016 New Revision: 307978 URL: https://svnweb.freebsd.org/changeset/base/307978 Log: The UFS/FFS filesystem checks directory link counts when doing directory create and delete operations. If it ever finds a directory with a link count less than 2, it panics. Thus, an rm -rf that encounters a directory with a link count below 2 causes a kernel panic. The proposed fix is to return the error EINVAL rather than panicing. The effect is that the requested operation is not done, but the system continues to run. At a more convenient later time, the filesystem can be unmounted and cleaned (with fsck or journal run). Once cleaned, the operation can be rerun to successful completion. This fix takes that approach. The panic message has been converted into a uprintf(9) to provide the user with the inode number and filesystem mount point of the offending directory and EINVAL is returned for the operation. The long (three year) delay in fixing this problem occurred because the bug was misclassified when originally assigned and only this week was found during a sweep of old unresolved bug reports. PR: 180894 Reviewed by: kib MFC after: 2 weeks Modified: head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Wed Oct 26 20:12:30 2016 (r307977) +++ head/sys/ufs/ufs/ufs_vnops.c Wed Oct 26 20:28:23 2016 (r307978) @@ -105,7 +105,7 @@ static vop_create_t ufs_create; static vop_getattr_t ufs_getattr; static vop_ioctl_t ufs_ioctl; static vop_link_t ufs_link; -static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *); +static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *, const char *); static vop_markatime_t ufs_markatime; static vop_mkdir_t ufs_mkdir; static vop_mknod_t ufs_mknod; @@ -204,7 +204,7 @@ ufs_create(ap) error = ufs_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode), - ap->a_dvp, ap->a_vpp, ap->a_cnp); + ap->a_dvp, ap->a_vpp, ap->a_cnp, "ufs_create"); if (error != 0) return (error); if ((ap->a_cnp->cn_flags & MAKEENTRY) != 0) @@ -232,7 +232,7 @@ ufs_mknod(ap) int error; error = ufs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode), - ap->a_dvp, vpp, ap->a_cnp); + ap->a_dvp, vpp, ap->a_cnp, "ufs_mknod"); if (error) return (error); ip = VTOI(*vpp); @@ -942,6 +942,17 @@ out: return (error); } +static void +print_bad_link_count(const char *funcname, struct vnode *dvp) +{ + struct inode *dip; + + dip = VTOI(dvp); + uprintf("%s: Bad link count %d on parent inode %d in file system %s\n", + funcname, dip->i_effnlink, dip->i_number, + dvp->v_mount->mnt_stat.f_mntonname); +} + /* * link vnode call */ @@ -964,9 +975,11 @@ ufs_link(ap) if ((cnp->cn_flags & HASBUF) == 0) panic("ufs_link: no name"); #endif - if (VTOI(tdvp)->i_effnlink < 2) - panic("ufs_link: Bad link count %d on parent", - VTOI(tdvp)->i_effnlink); + if (VTOI(tdvp)->i_effnlink < 2) { + print_bad_link_count("ufs_link", tdvp); + error = EINVAL; + goto out; + } ip = VTOI(vp); if ((nlink_t)ip->i_nlink >= LINK_MAX) { error = EMLINK; @@ -1710,10 +1723,10 @@ ufs_do_posix1e_acl_inheritance_file(stru * XXX: This should not happen, as EOPNOTSUPP above was * supposed to free acl. */ - printf("ufs_makeinode: VOP_GETACL() but no " - "VOP_SETACL()\n"); - /* panic("ufs_makeinode: VOP_GETACL() but no " - "VOP_SETACL()"); */ + printf("ufs_do_posix1e_acl_inheritance_file: VOP_GETACL() " + "but no VOP_SETACL()\n"); + /* panic("ufs_do_posix1e_acl_inheritance_file: VOP_GETACL() " + "but no VOP_SETACL()"); */ break; default: @@ -1791,6 +1804,11 @@ ufs_mkdir(ap) * but not have it entered in the parent directory. The entry is * made later after writing "." and ".." entries. */ + if (dp->i_effnlink < 2) { + print_bad_link_count("ufs_mkdir", dvp); + error = EINVAL; + goto out; + } error = UFS_VALLOC(dvp, dmode, cnp->cn_cred, &tvp); if (error) goto out; @@ -2021,13 +2039,12 @@ ufs_rmdir(ap) * tries to remove a locally mounted on directory). */ error = 0; - if (ip->i_effnlink < 2) { + if (dp->i_effnlink <= 2) { + if (dp->i_effnlink == 2) + print_bad_link_count("ufs_rmdir", dvp); error = EINVAL; goto out; } - if (dp->i_effnlink < 3) - panic("ufs_dirrem: Bad link count %d on parent", - dp->i_effnlink); if (!ufs_dirempty(ip, dp->i_number, cnp->cn_cred)) { error = ENOTEMPTY; goto out; @@ -2106,7 +2123,7 @@ ufs_symlink(ap) int len, error; error = ufs_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp, - vpp, ap->a_cnp); + vpp, ap->a_cnp, "ufs_symlink"); if (error) return (error); vp = *vpp; @@ -2558,11 +2575,12 @@ ufs_vinit(mntp, fifoops, vpp) * Vnode dvp must be locked. */ static int -ufs_makeinode(mode, dvp, vpp, cnp) +ufs_makeinode(mode, dvp, vpp, cnp, callfunc) int mode; struct vnode *dvp; struct vnode **vpp; struct componentname *cnp; + const char *callfunc; { struct inode *ip, *pdir; struct direct newdir; @@ -2572,15 +2590,16 @@ ufs_makeinode(mode, dvp, vpp, cnp) pdir = VTOI(dvp); #ifdef INVARIANTS if ((cnp->cn_flags & HASBUF) == 0) - panic("ufs_makeinode: no name"); + panic("%s: no name", callfunc); #endif *vpp = NULL; if ((mode & IFMT) == 0) mode |= IFREG; - if (VTOI(dvp)->i_effnlink < 2) - panic("ufs_makeinode: Bad link count %d on parent", - VTOI(dvp)->i_effnlink); + if (pdir->i_effnlink < 2) { + print_bad_link_count(callfunc, dvp); + return (EINVAL); + } error = UFS_VALLOC(dvp, mode, cnp->cn_cred, &tvp); if (error) return (error); From owner-svn-src-head@freebsd.org Wed Oct 26 23:40:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D1E6C238A9; Wed, 26 Oct 2016 23:40:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F133E6D; Wed, 26 Oct 2016 23:40:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9QNe7v9077146; Wed, 26 Oct 2016 23:40:07 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9QNe7p5077145; Wed, 26 Oct 2016 23:40:07 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201610262340.u9QNe7p5077145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 26 Oct 2016 23:40:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307979 - 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.23 Precedence: list List-Id: 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, 26 Oct 2016 23:40:08 -0000 Author: bdrewery Date: Wed Oct 26 23:40:07 2016 New Revision: 307979 URL: https://svnweb.freebsd.org/changeset/base/307979 Log: Remove excess CTLFLAG_VNET Sponsored by: Dell EMC Isilon Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Wed Oct 26 20:28:23 2016 (r307978) +++ head/sys/net/if_bridge.c Wed Oct 26 23:40:07 2016 (r307979) @@ -408,7 +408,7 @@ SYSCTL_INT(_net_link_bridge, OID_AUTO, i static VNET_DEFINE(int, allow_llz_overlap) = 0; #define V_allow_llz_overlap VNET(allow_llz_overlap) SYSCTL_INT(_net_link_bridge, OID_AUTO, allow_llz_overlap, - CTLFLAG_VNET | CTLFLAG_RW | CTLFLAG_VNET, &VNET_NAME(allow_llz_overlap), 0, + CTLFLAG_RW | CTLFLAG_VNET, &VNET_NAME(allow_llz_overlap), 0, "Allow overlap of link-local scope " "zones of a bridge interface and the member interfaces"); From owner-svn-src-head@freebsd.org Thu Oct 27 00:26:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1C9EC22355; Thu, 27 Oct 2016 00:26:18 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pf0-x22e.google.com (mail-pf0-x22e.google.com [IPv6:2607:f8b0:400e:c00::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6489676C; Thu, 27 Oct 2016 00:26:18 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pf0-x22e.google.com with SMTP id 197so5672369pfu.0; Wed, 26 Oct 2016 17:26:18 -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-disposition:in-reply-to:user-agent; bh=EzFjiTKr5KhFeYDI+OuqeBFfH0eKcLhwWw03UhtOV8g=; b=O1+ZRvQO1y/258bSjrRmbfgyEmTJgLJ/KDCuFD+1SuGOuUJDO41dtrhTO7XxpsbcGb qLCPwHHVcPqDMLDxsF17q7IkX5j6oLzEaAtM0sbx1E/kGikIXBcnvyNc6VCiMT7nyU4j +Qg1RFQuv1xzFq4MW+P08yx1BXcYUvxxd9P4WjN/k5klkVISCRldSMJUMV+icdXE/2H7 PMQ+d/CEY5klOH3eV3byDTdK8SG0HTjoyyRowH7Pg/flZJa4kj2KwQs2Nl2zjuFNPNiT KJmmhu0haoixZQ2qGEX1tnVH7u847Mf6gnhiyMaYrT/tIf/zplqjT/NjNtmsWQstCkNp 4sgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=EzFjiTKr5KhFeYDI+OuqeBFfH0eKcLhwWw03UhtOV8g=; b=EVjGkjEPVdAGN0Pz0XITJXFL2Pbkhw/JMhorKAQkCIKfwkav0w8/oCwDNMR6HELqiC SQuhCUwOHCkHkvkj0pgcMriasv271nWGueQ6kwK3fPI67Kq7L8bw4rYGAQ43WaZ+rA82 ReFGkPzeD4IrauU4fq4glvUqDfsKQeW/jiigfgSUIykj2wE7cQOQEuLl4n5YQvVfwEzA 8EdhV/PneB0CFxtyCe7MW8og7+PcI0JKckjJ7LuKKGf8OWKCoi7owDUsR1fauPoMCBFX jiTkMIsUkm8QvZsNvFuDqy5nJ4w5vbLL0jKta/RO44egfEP8EBDdDi9a/t/ZRViwhNyJ 24Xw== X-Gm-Message-State: ABUngvcLcPnZtZwHnMVZKZ+hAUVvI29vYqFlkABFm0ixMHkXknZo7tB/q16UaVBTBcwRbA== X-Received: by 10.99.161.2 with SMTP id b2mr7309273pgf.5.1477527977737; Wed, 26 Oct 2016 17:26:17 -0700 (PDT) Received: from wkstn-mjohnston.west.isilon.com (c-76-104-201-218.hsd1.wa.comcast.net. [76.104.201.218]) by smtp.gmail.com with ESMTPSA id d2sm801419pfd.38.2016.10.26.17.26.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Oct 2016 17:26:17 -0700 (PDT) Sender: Mark Johnston Date: Wed, 26 Oct 2016 17:32:28 -0700 From: Mark Johnston To: David C Somayajulu Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307578 - head/sys/dev/bxe Message-ID: <20161027003228.GB32399@wkstn-mjohnston.west.isilon.com> References: <201610182133.u9ILXvJ8094393@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201610182133.u9ILXvJ8094393@repo.freebsd.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 00:26:18 -0000 On Tue, Oct 18, 2016 at 09:33:57PM +0000, David C Somayajulu wrote: > Author: davidcs > Date: Tue Oct 18 21:33:57 2016 > New Revision: 307578 > URL: https://svnweb.freebsd.org/changeset/base/307578 > > Log: > 1. Use taskqueue_create() instead of taskqueue_create_fast() for both > fastpath and slowpath taskqueues. > 2. Service all transmits in taskqueue threads. > 3. additional stats counters for keeping track of > - bd availability > - tx buf ring not emptied in the fp task queue. > These are drained via timeout taskqueue. > - tx attempts during link down. > > MFC after: 5 days Submitted by: Matt Joras From owner-svn-src-head@freebsd.org Thu Oct 27 02:20:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10999C2266A; Thu, 27 Oct 2016 02:20:15 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4285214; Thu, 27 Oct 2016 02:20:14 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R2KEXH037278; Thu, 27 Oct 2016 02:20:14 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R2KEtQ037277; Thu, 27 Oct 2016 02:20:14 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201610270220.u9R2KEtQ037277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Thu, 27 Oct 2016 02:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307982 - head/sys/dev/re X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 02:20:15 -0000 Author: kevlo Date: Thu Oct 27 02:20:13 2016 New Revision: 307982 URL: https://svnweb.freebsd.org/changeset/base/307982 Log: Disable CLKREQ for ASPM since re(4) doesn't implement link level power saving. Reviewed by: yongari Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Thu Oct 27 00:33:14 2016 (r307981) +++ head/sys/dev/re/if_re.c Thu Oct 27 02:20:13 2016 (r307982) @@ -1358,15 +1358,17 @@ re_attach(device_t dev) CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); } - /* Disable ASPM L0S/L1. */ + /* Disable ASPM L0S/L1 and CLKREQ. */ if (sc->rl_expcap != 0) { cap = pci_read_config(dev, sc->rl_expcap + PCIER_LINK_CAP, 2); if ((cap & PCIEM_LINK_CAP_ASPM) != 0) { ctl = pci_read_config(dev, sc->rl_expcap + PCIER_LINK_CTL, 2); - if ((ctl & PCIEM_LINK_CTL_ASPMC) != 0) { - ctl &= ~PCIEM_LINK_CTL_ASPMC; + if ((ctl & (PCIEM_LINK_CTL_ECPM | + PCIEM_LINK_CTL_ASPMC))!= 0) { + ctl &= ~(PCIEM_LINK_CTL_ECPM | + PCIEM_LINK_CTL_ASPMC); pci_write_config(dev, sc->rl_expcap + PCIER_LINK_CTL, ctl, 2); device_printf(dev, "ASPM disabled\n"); From owner-svn-src-head@freebsd.org Thu Oct 27 03:43:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C77B5C218E3; Thu, 27 Oct 2016 03:43:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 910ED992; Thu, 27 Oct 2016 03:43:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R3hRZE071388; Thu, 27 Oct 2016 03:43:27 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R3hRsW071384; Thu, 27 Oct 2016 03:43:27 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610270343.u9R3hRsW071384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 27 Oct 2016 03:43:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307983 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 03:43:28 -0000 Author: sephe Date: Thu Oct 27 03:43:27 2016 New Revision: 307983 URL: https://svnweb.freebsd.org/changeset/base/307983 Log: hyperv/hn: Properly configure RSS according to RSS capabilities MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8338 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/ndis.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 02:20:13 2016 (r307982) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 03:43:27 2016 (r307983) @@ -255,6 +255,8 @@ struct hn_softc { int hn_ndis_tso_szmax; int hn_ndis_tso_sgmin; + int hn_rss_ind_size; + uint32_t hn_rss_hash; /* NDIS_HASH_ */ struct ndis_rssprm_toeplitz hn_rss; }; Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 02:20:13 2016 (r307982) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 03:43:27 2016 (r307983) @@ -329,6 +329,7 @@ static int hn_hwassist_sysctl(SYSCTL_HAN static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS); static int hn_check_iplen(const struct mbuf *, int); static int hn_create_tx_ring(struct hn_softc *, int); static void hn_destroy_tx_ring(struct hn_tx_ring *); @@ -770,6 +771,11 @@ netvsc_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_rxfilter_sysctl, "A", "rxfilter"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_hash", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rss_hash_sysctl, "A", "RSS hash"); + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rss_ind_size", + CTLFLAG_RD, &sc->hn_rss_ind_size, 0, "RSS indirect entry count"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key", CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_rss_key_sysctl, "IU", "RSS key"); @@ -2479,6 +2485,20 @@ back: } static int +hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char hash_str[128]; + uint32_t hash; + + HN_LOCK(sc); + hash = sc->hn_rss_hash; + HN_UNLOCK(sc); + snprintf(hash_str, sizeof(hash_str), "%b", hash, NDIS_HASH_BITS); + return sysctl_handle_string(oidp, hash_str, sizeof(hash_str), req); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; @@ -3642,6 +3662,10 @@ hn_synth_attach(struct hn_softc *sc, int old_caps = sc->hn_caps; sc->hn_caps = 0; + /* Clear RSS stuffs. */ + sc->hn_rss_ind_size = 0; + sc->hn_rss_hash = 0; + /* * Attach the primary channel _before_ attaching NVS and RNDIS. */ @@ -3716,7 +3740,6 @@ hn_synth_attach(struct hn_softc *sc, int if_printf(sc->hn_ifp, "setup default RSS indirect " "table\n"); } - /* TODO: Take ndis_rss_caps.ndis_nind into account. */ for (i = 0; i < NDIS_HASH_INDCNT; ++i) rss->rss_ind[i] = i % nchan; sc->hn_flags |= HN_FLAG_HAS_RSSIND; Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Thu Oct 27 02:20:13 2016 (r307982) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Thu Oct 27 03:43:27 2016 (r307983) @@ -747,13 +747,14 @@ done: } int -hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt) +hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt0) { struct ndis_rss_caps in, caps; size_t caps_len; - int error; + int error, indsz, rxr_cnt, hash_fnidx; + uint32_t hash_func = 0, hash_types = 0; - *rxr_cnt = 0; + *rxr_cnt0 = 0; if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_20) return (EOPNOTSUPP); @@ -792,18 +793,73 @@ hn_rndis_query_rsscaps(struct hn_softc * return (EINVAL); } + /* + * Save information for later RSS configuration. + */ if (caps.ndis_nrxr == 0) { if_printf(sc->hn_ifp, "0 RX rings!?\n"); return (EINVAL); } - *rxr_cnt = caps.ndis_nrxr; + if (bootverbose) + if_printf(sc->hn_ifp, "%u RX rings\n", caps.ndis_nrxr); + rxr_cnt = caps.ndis_nrxr; + + if (caps.ndis_hdr.ndis_size == NDIS_RSS_CAPS_SIZE && + caps.ndis_hdr.ndis_rev >= NDIS_RSS_CAPS_REV_2) { + if (caps.ndis_nind > NDIS_HASH_INDCNT) { + if_printf(sc->hn_ifp, + "too many RSS indirect table entries %u\n", + caps.ndis_nind); + return (EOPNOTSUPP); + } + if (!powerof2(caps.ndis_nind)) { + if_printf(sc->hn_ifp, "RSS indirect table size is not " + "power-of-2 %u\n", caps.ndis_nind); + } - if (caps.ndis_hdr.ndis_size == NDIS_RSS_CAPS_SIZE) { if (bootverbose) { if_printf(sc->hn_ifp, "RSS indirect table size %u\n", caps.ndis_nind); } + indsz = caps.ndis_nind; + } else { + indsz = NDIS_HASH_INDCNT; + } + if (indsz < rxr_cnt) { + if_printf(sc->hn_ifp, "# of RX rings (%d) > " + "RSS indirect table size %d\n", rxr_cnt, indsz); + rxr_cnt = indsz; } + + /* + * NOTE: + * Toeplitz is at the lowest bit, and it is prefered; so ffs(), + * instead of fls(), is used here. + */ + hash_fnidx = ffs(caps.ndis_caps & NDIS_RSS_CAP_HASHFUNC_MASK); + if (hash_fnidx == 0) { + if_printf(sc->hn_ifp, "no hash functions, caps 0x%08x\n", + caps.ndis_caps); + return (EOPNOTSUPP); + } + hash_func = 1 << (hash_fnidx - 1); /* ffs is 1-based */ + + if (caps.ndis_caps & NDIS_RSS_CAP_IPV4) + hash_types |= NDIS_HASH_IPV4 | NDIS_HASH_TCP_IPV4; + if (caps.ndis_caps & NDIS_RSS_CAP_IPV6) + hash_types |= NDIS_HASH_IPV6 | NDIS_HASH_TCP_IPV6; + if (caps.ndis_caps & NDIS_RSS_CAP_IPV6_EX) + hash_types |= NDIS_HASH_IPV6_EX | NDIS_HASH_TCP_IPV6_EX; + if (hash_types == 0) { + if_printf(sc->hn_ifp, "no hash types, caps 0x%08x\n", + caps.ndis_caps); + return (EOPNOTSUPP); + } + + /* Commit! */ + sc->hn_rss_ind_size = indsz; + sc->hn_rss_hash = hash_func | hash_types; + *rxr_cnt0 = rxr_cnt; return (0); } @@ -1033,7 +1089,7 @@ hn_rndis_conf_rss(struct hn_softc *sc, u { struct ndis_rssprm_toeplitz *rss = &sc->hn_rss; struct ndis_rss_params *prm = &rss->rss_params; - int error; + int error, rss_size; /* * Only NDIS 6.20+ is supported: @@ -1043,21 +1099,29 @@ hn_rndis_conf_rss(struct hn_softc *sc, u KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_20, ("NDIS 6.20+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); + /* XXX only one can be specified through, popcnt? */ + KASSERT((sc->hn_rss_hash & NDIS_HASH_FUNCTION_MASK), ("no hash func")); + KASSERT((sc->hn_rss_hash & NDIS_HASH_TYPE_MASK), ("no hash types")); + KASSERT(sc->hn_rss_ind_size > 0, ("no indirect table size")); + + if (bootverbose) { + if_printf(sc->hn_ifp, "RSS indirect table size %d, " + "hash 0x%08x\n", sc->hn_rss_ind_size, sc->hn_rss_hash); + } + /* * NOTE: * DO NOT whack rss_key and rss_ind, which are setup by the caller. */ memset(prm, 0, sizeof(*prm)); + rss_size = NDIS_RSSPRM_TOEPLITZ_SIZE(sc->hn_rss_ind_size); prm->ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_PARAMS; prm->ndis_hdr.ndis_rev = NDIS_RSS_PARAMS_REV_2; - prm->ndis_hdr.ndis_size = sizeof(*rss); + prm->ndis_hdr.ndis_size = rss_size; prm->ndis_flags = flags; - prm->ndis_hash = NDIS_HASH_FUNCTION_TOEPLITZ | - NDIS_HASH_IPV4 | NDIS_HASH_TCP_IPV4 | - NDIS_HASH_IPV6 | NDIS_HASH_TCP_IPV6; - /* TODO: Take ndis_rss_caps.ndis_nind into account */ - prm->ndis_indsize = sizeof(rss->rss_ind); + prm->ndis_hash = sc->hn_rss_hash; + prm->ndis_indsize = sizeof(rss->rss_ind[0]) * sc->hn_rss_ind_size; prm->ndis_indoffset = __offsetof(struct ndis_rssprm_toeplitz, rss_ind[0]); prm->ndis_keysize = sizeof(rss->rss_key); @@ -1065,7 +1129,7 @@ hn_rndis_conf_rss(struct hn_softc *sc, u __offsetof(struct ndis_rssprm_toeplitz, rss_key[0]); error = hn_rndis_set(sc, OID_GEN_RECEIVE_SCALE_PARAMETERS, - rss, sizeof(*rss)); + rss, rss_size); if (error) { if_printf(sc->hn_ifp, "RSS config failed: %d\n", error); } else { Modified: head/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/ndis.h Thu Oct 27 02:20:13 2016 (r307982) +++ head/sys/dev/hyperv/netvsc/ndis.h Thu Oct 27 03:43:27 2016 (r307983) @@ -57,6 +57,10 @@ #define NDIS_HASH_TCP_IPV6 0x00001000 #define NDIS_HASH_TCP_IPV6_EX 0x00002000 +/* Hash description for use with printf(9) %b identifier. */ +#define NDIS_HASH_BITS \ + "\20\1TOEPLITZ\11IP4\12TCP4\13IP6\14IP6EX\15TCP6\16TCP6EX" + #define NDIS_HASH_KEYSIZE_TOEPLITZ 40 #define NDIS_HASH_INDCNT 128 @@ -142,7 +146,7 @@ struct ndis_offload_params { */ struct ndis_rss_caps { struct ndis_object_hdr ndis_hdr; - uint32_t ndis_flags; /* NDIS_RSS_CAP_ */ + uint32_t ndis_caps; /* NDIS_RSS_CAP_ */ uint32_t ndis_nmsi; /* # of MSIs */ uint32_t ndis_nrxr; /* # of RX rings */ /* NDIS >= 6.30 */ @@ -165,7 +169,8 @@ struct ndis_rss_caps { #define NDIS_RSS_CAP_IPV4 0x00000100 #define NDIS_RSS_CAP_IPV6 0x00000200 #define NDIS_RSS_CAP_IPV6_EX 0x00000400 -#define NDIS_RSS_CAP_HASH_TOEPLITZ 0x00000001 +#define NDIS_RSS_CAP_HASH_TOEPLITZ NDIS_HASH_FUNCTION_TOEPLITZ +#define NDIS_RSS_CAP_HASHFUNC_MASK NDIS_HASH_FUNCTION_MASK /* * OID_GEN_RECEIVE_SCALE_PARAMETERS @@ -209,6 +214,9 @@ struct ndis_rssprm_toeplitz { uint32_t rss_ind[NDIS_HASH_INDCNT]; }; +#define NDIS_RSSPRM_TOEPLITZ_SIZE(nind) \ + __offsetof(struct ndis_rssprm_toeplitz, rss_ind[nind]) + /* * OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES * ndis_type: NDIS_OBJTYPE_OFFLOAD From owner-svn-src-head@freebsd.org Thu Oct 27 04:26:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9938BC220AA; Thu, 27 Oct 2016 04:26:34 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F85E8FC; Thu, 27 Oct 2016 04:26:34 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R4QXiP086853; Thu, 27 Oct 2016 04:26:33 GMT (envelope-from ganbold@FreeBSD.org) Received: (from ganbold@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R4QXAs086850; Thu, 27 Oct 2016 04:26:33 GMT (envelope-from ganbold@FreeBSD.org) Message-Id: <201610270426.u9R4QXAs086850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ganbold set sender to ganbold@FreeBSD.org using -f From: Ganbold Tsagaankhuu Date: Thu, 27 Oct 2016 04:26:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307984 - in head/sys/arm: allwinner 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.23 Precedence: list List-Id: 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, 27 Oct 2016 04:26:34 -0000 Author: ganbold Date: Thu Oct 27 04:26:33 2016 New Revision: 307984 URL: https://svnweb.freebsd.org/changeset/base/307984 Log: Add support for Allwinner Consumer IR interface. RX is supported now and the driver is using evdev framework. It was tested on Cubieboard2 (A20 SoC) using lirc with dfrobot's IR remote controller. Added: head/sys/arm/allwinner/aw_cir.c (contents, props changed) Modified: head/sys/arm/allwinner/files.allwinner head/sys/arm/conf/GENERIC Added: head/sys/arm/allwinner/aw_cir.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/aw_cir.c Thu Oct 27 04:26:33 2016 (r307984) @@ -0,0 +1,535 @@ +/*- + * Copyright (c) 2016 Ganbold Tsagaankhuu + * 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. + */ + +/* + * Allwinner Consumer IR controller + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#define READ(_sc, _r) bus_read_4((_sc)->res[0], (_r)) +#define WRITE(_sc, _r, _v) bus_write_4((_sc)->res[0], (_r), (_v)) + +/* IR Control */ +#define AW_IR_CTL 0x00 +/* Global Enable */ +#define AW_IR_CTL_GEN (1 << 0) +/* RX enable */ +#define AW_IR_CTL_RXEN (1 << 1) +/* CIR mode enable */ +#define AW_IR_CTL_MD (1 << 4) | (1 << 5) + +/* RX Config Reg */ +#define AW_IR_RXCTL 0x10 +/* Pulse Polarity Invert flag */ +#define AW_IR_RXCTL_RPPI (1 << 2) + +/* RX Data */ +#define AW_IR_RXFIFO 0x20 + +/* RX Interrupt Control */ +#define AW_IR_RXINT 0x2C +/* RX FIFO Overflow */ +#define AW_IR_RXINT_ROI_EN (1 << 0) +/* RX Packet End */ +#define AW_IR_RXINT_RPEI_EN (1 << 1) +/* RX FIFO Data Available */ +#define AW_IR_RXINT_RAI_EN (1 << 4) +/* RX FIFO available byte level */ +#define AW_IR_RXINT_RAL(val) ((val) << 8) + +/* RX Interrupt Status Reg */ +#define AW_IR_RXSTA 0x30 +/* RX FIFO Get Available Counter */ +#define AW_IR_RXSTA_COUNTER(val) (((val) >> 8) & (sc->fifo_size * 2 - 1)) +/* Clear all interrupt status */ +#define AW_IR_RXSTA_CLEARALL 0xff + +/* IR Sample Configure Reg */ +#define AW_IR_CIR 0x34 +/* Filter Threshold = 8 * 21.3 = ~128us < 200us */ +#define AW_IR_RXFILT_VAL (((8) & 0x3f) << 2) +/* Idle Threshold = (2 + 1) * 128 * 42.7 = ~16.4ms > 9ms */ +#define AW_IR_RXIDLE_VAL (((2) & 0xff) << 8) + +/* Bit 15 - value (pulse/space) */ +#define VAL_MASK 0x80 +/* Bits 0:14 - sample duration */ +#define PERIOD_MASK 0x7f + +/* Clock rate for IR0 or IR1 clock in CIR mode */ +#define AW_IR_BASE_CLK 3000000 +/* Frequency sample 3MHz/64 = 46875Hz (21.3us) */ +#define AW_IR_SAMPLE_64 (0 << 0) +/* Frequency sample 3MHz/128 = 23437.5Hz (42.7us) */ +#define AW_IR_SAMPLE_128 (1 << 0) + +#define AW_IR_ERROR_CODE 0xffffffff +#define AW_IR_REPEAT_CODE 0x0 + +/* 80 * 42.7 = ~3.4ms, Lead1(4.5ms) > AW_IR_L1_MIN */ +#define AW_IR_L1_MIN 80 +/* 40 * 42.7 = ~1.7ms, Lead0(4.5ms) Lead0R(2.25ms) > AW_IR_L0_MIN */ +#define AW_IR_L0_MIN 40 +/* 26 * 42.7 = ~1109us ~= 561 * 2, Pulse < AW_IR_PMAX */ +#define AW_IR_PMAX 26 +/* 26 * 42.7 = ~1109us ~= 561 * 2, D1 > AW_IR_DMID, D0 <= AW_IR_DMID */ +#define AW_IR_DMID 26 +/* 53 * 42.7 = ~2263us ~= 561 * 4, D < AW_IR_DMAX */ +#define AW_IR_DMAX 53 + +/* Active Thresholds */ +#define AW_IR_ACTIVE_T ((0 & 0xff) << 16) +#define AW_IR_ACTIVE_T_C ((1 & 0xff) << 23) + +/* Code masks */ +#define CODE_MASK 0x00ff00ff +#define INV_CODE_MASK 0xff00ff00 +#define VALID_CODE_MASK 0x00ff0000 + +#define A10_IR 1 +#define A13_IR 2 + +#define AW_IR_RAW_BUF_SIZE 128 + +struct aw_ir_softc { + device_t dev; + struct resource *res[2]; + void * intrhand; + int fifo_size; + int dcnt; /* Packet Count */ + unsigned char buf[AW_IR_RAW_BUF_SIZE]; + struct evdev_dev *sc_evdev; +}; + +static struct resource_spec aw_ir_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE | RF_SHAREABLE }, + { -1, 0 } +}; + +static struct ofw_compat_data compat_data[] = { + { "allwinner,sun4i-a10-ir", A10_IR }, + { "allwinner,sun5i-a13-ir", A13_IR }, + { NULL, 0 } +}; + +static void +aw_ir_buf_reset(struct aw_ir_softc *sc) +{ + + sc->dcnt = 0; +} + +static void +aw_ir_buf_write(struct aw_ir_softc *sc, unsigned char data) +{ + + if (sc->dcnt < AW_IR_RAW_BUF_SIZE) + sc->buf[sc->dcnt++] = data; + else + if (bootverbose) + device_printf(sc->dev, "IR RX Buffer Full!\n"); +} + +static int +aw_ir_buf_full(struct aw_ir_softc *sc) +{ + + return (sc->dcnt >= AW_IR_RAW_BUF_SIZE); +} + +static unsigned char +aw_ir_read_data(struct aw_ir_softc *sc) +{ + + return (unsigned char)(READ(sc, AW_IR_RXFIFO) & 0xff); +} + +static unsigned long +aw_ir_decode_packets(struct aw_ir_softc *sc) +{ + unsigned long len, code; + unsigned char val, last; + unsigned int active_delay; + int i, bitcount; + + if (bootverbose) + device_printf(sc->dev, "sc->dcnt = %d\n", sc->dcnt); + + /* Find Lead 1 (bit separator) */ + active_delay = (AW_IR_ACTIVE_T + 1) * (AW_IR_ACTIVE_T_C ? 128 : 1); + len = 0; + len += (active_delay >> 1); + if (bootverbose) + device_printf(sc->dev, "Initial len: %ld\n", len); + for (i = 0; i < sc->dcnt; i++) { + val = sc->buf[i]; + if (val & VAL_MASK) + len += val & PERIOD_MASK; + else { + if (len > AW_IR_L1_MIN) + break; + len = 0; + } + } + if (bootverbose) + device_printf(sc->dev, "len = %ld\n", len); + if ((val & VAL_MASK) || (len <= AW_IR_L1_MIN)) { + if (bootverbose) + device_printf(sc->dev, "Bit separator error\n"); + goto error_code; + } + + /* Find Lead 0 (bit length) */ + len = 0; + for (; i < sc->dcnt; i++) { + val = sc->buf[i]; + if (val & VAL_MASK) { + if(len > AW_IR_L0_MIN) + break; + len = 0; + } else + len += val & PERIOD_MASK; + } + if ((!(val & VAL_MASK)) || (len <= AW_IR_L0_MIN)) { + if (bootverbose) + device_printf(sc->dev, "Bit length error\n"); + goto error_code; + } + + /* Start decoding */ + code = 0; + bitcount = 0; + last = 1; + len = 0; + for (; i < sc->dcnt; i++) { + val = sc->buf[i]; + if (last) { + if (val & VAL_MASK) + len += val & PERIOD_MASK; + else { + if (len > AW_IR_PMAX) { + if (bootverbose) + device_printf(sc->dev, + "Pulse error\n"); + goto error_code; + } + last = 0; + len = val & PERIOD_MASK; + } + } else { + if (val & VAL_MASK) { + if (len > AW_IR_DMAX) { + if (bootverbose) + device_printf(sc->dev, + "Distant error\n"); + goto error_code; + } else { + if (len > AW_IR_DMID) { + /* Decode */ + code |= 1 << bitcount; + } + bitcount++; + if (bitcount == 32) + break; /* Finish decoding */ + } + last = 1; + len = val & PERIOD_MASK; + } else + len += val & PERIOD_MASK; + } + } + return (code); + +error_code: + + return (AW_IR_ERROR_CODE); +} + +static int +aw_ir_validate_code(unsigned long code) +{ + unsigned long v1, v2; + + /* Don't check address */ + v1 = code & CODE_MASK; + v2 = (code & INV_CODE_MASK) >> 8; + + if (((v1 ^ v2) & VALID_CODE_MASK) == VALID_CODE_MASK) + return (0); /* valid */ + else + return (1); /* invalid */ +} + +static void +aw_ir_intr(void *arg) +{ + struct aw_ir_softc *sc; + uint32_t val; + int i, dcnt; + unsigned long ir_code; + int stat; + + sc = (struct aw_ir_softc *)arg; + + /* Read RX interrupt status */ + val = READ(sc, AW_IR_RXSTA); + + /* Clean all pending interrupt statuses */ + WRITE(sc, AW_IR_RXSTA, val | AW_IR_RXSTA_CLEARALL); + + /* When Rx FIFO Data available or Packet end */ + if (val & (AW_IR_RXINT_RAI_EN | AW_IR_RXINT_RPEI_EN)) { + /* Get available message count in RX FIFO */ + dcnt = AW_IR_RXSTA_COUNTER(val); + /* Read FIFO */ + for (i = 0; i < dcnt; i++) { + if (aw_ir_buf_full(sc)) { + if (bootverbose) + device_printf(sc->dev, + "raw buffer full\n"); + break; + } else + aw_ir_buf_write(sc, aw_ir_read_data(sc)); + } + } + + if (val & AW_IR_RXINT_RPEI_EN) { + /* RX Packet end */ + if (bootverbose) + device_printf(sc->dev, "RX Packet end\n"); + ir_code = aw_ir_decode_packets(sc); + stat = aw_ir_validate_code(ir_code); + if (stat == 0) { + evdev_push_event(sc->sc_evdev, + EV_MSC, MSC_SCAN, ir_code); + evdev_sync(sc->sc_evdev); + } + if (bootverbose) { + device_printf(sc->dev, "Final IR code: %lx\n", + ir_code); + device_printf(sc->dev, "IR code status: %d\n", + stat); + } + sc->dcnt = 0; + } + if (val & AW_IR_RXINT_ROI_EN) { + /* RX FIFO overflow */ + if (bootverbose) + device_printf(sc->dev, "RX FIFO overflow\n"); + /* Flush raw buffer */ + aw_ir_buf_reset(sc); + } +} + +static int +aw_ir_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Allwinner CIR controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +aw_ir_attach(device_t dev) +{ + struct aw_ir_softc *sc; + hwreset_t rst_apb; + clk_t clk_ir, clk_gate; + int err; + uint32_t val = 0; + + clk_ir = clk_gate = NULL; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, aw_ir_spec, sc->res) != 0) { + device_printf(dev, "could not allocate memory resource\n"); + return (ENXIO); + } + + switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) { + case A10_IR: + sc->fifo_size = 16; + break; + case A13_IR: + sc->fifo_size = 64; + break; + } + + /* De-assert reset */ + if (hwreset_get_by_ofw_name(dev, 0, "apb", &rst_apb) == 0) { + err = hwreset_deassert(rst_apb); + if (err != 0) { + device_printf(dev, "cannot de-assert reset\n"); + goto error; + } + } + + /* Reset buffer */ + aw_ir_buf_reset(sc); + + /* Get clocks and enable them */ + err = clk_get_by_ofw_name(dev, 0, "apb", &clk_gate); + if (err != 0) { + device_printf(dev, "Cannot get gate clock\n"); + goto error; + } + err = clk_get_by_ofw_name(dev, 0, "ir", &clk_ir); + if (err != 0) { + device_printf(dev, "Cannot get IR clock\n"); + goto error; + } + /* Set clock rate */ + err = clk_set_freq(clk_ir, AW_IR_BASE_CLK, 0); + if (err != 0) { + device_printf(dev, "cannot set IR clock rate\n"); + goto error; + } + /* Enable clocks */ + err = clk_enable(clk_gate); + if (err != 0) { + device_printf(dev, "Cannot enable clk gate\n"); + goto error; + } + err = clk_enable(clk_ir); + if (err != 0) { + device_printf(dev, "Cannot enable IR clock\n"); + goto error; + } + + if (bus_setup_intr(dev, sc->res[1], + INTR_TYPE_MISC | INTR_MPSAFE, NULL, aw_ir_intr, sc, + &sc->intrhand)) { + bus_release_resources(dev, aw_ir_spec, sc->res); + device_printf(dev, "cannot setup interrupt handler\n"); + return (ENXIO); + } + + /* Enable CIR Mode */ + WRITE(sc, AW_IR_CTL, AW_IR_CTL_MD); + + /* + * Set clock sample, filter, idle thresholds. + * Frequency sample = 3MHz/128 = 23437.5Hz (42.7us) + */ + val = AW_IR_SAMPLE_128; + val |= (AW_IR_RXFILT_VAL | AW_IR_RXIDLE_VAL); + val |= (AW_IR_ACTIVE_T | AW_IR_ACTIVE_T_C); + WRITE(sc, AW_IR_CIR, val); + + /* Invert Input Signal */ + WRITE(sc, AW_IR_RXCTL, AW_IR_RXCTL_RPPI); + + /* Clear All RX Interrupt Status */ + WRITE(sc, AW_IR_RXSTA, AW_IR_RXSTA_CLEARALL); + + /* + * Enable RX interrupt in case of overflow, packet end + * and FIFO available. + * RX FIFO Threshold = FIFO size / 2 + */ + WRITE(sc, AW_IR_RXINT, AW_IR_RXINT_ROI_EN | AW_IR_RXINT_RPEI_EN | + AW_IR_RXINT_RAI_EN | AW_IR_RXINT_RAL((sc->fifo_size >> 1) - 1)); + + /* Enable IR Module */ + val = READ(sc, AW_IR_CTL); + WRITE(sc, AW_IR_CTL, val | AW_IR_CTL_GEN | AW_IR_CTL_RXEN); + + sc->sc_evdev = evdev_alloc(); + evdev_set_name(sc->sc_evdev, device_get_desc(sc->dev)); + evdev_set_phys(sc->sc_evdev, device_get_nameunit(sc->dev)); + evdev_set_id(sc->sc_evdev, BUS_HOST, 0, 0, 0); + evdev_support_event(sc->sc_evdev, EV_SYN); + evdev_support_event(sc->sc_evdev, EV_MSC); + evdev_support_msc(sc->sc_evdev, MSC_SCAN); + + err = evdev_register(sc->sc_evdev); + if (err) { + device_printf(dev, + "failed to register evdev: error=%d\n", err); + goto error; + } + + return (0); +error: + if (clk_gate != NULL) + clk_release(clk_gate); + if (clk_ir != NULL) + clk_release(clk_ir); + if (rst_apb != NULL) + hwreset_release(rst_apb); + evdev_free(sc->sc_evdev); + sc->sc_evdev = NULL; /* Avoid double free */ + + bus_release_resources(dev, aw_ir_spec, sc->res); + return (ENXIO); +} + +static device_method_t aw_ir_methods[] = { + DEVMETHOD(device_probe, aw_ir_probe), + DEVMETHOD(device_attach, aw_ir_attach), + + DEVMETHOD_END +}; + +static driver_t aw_ir_driver = { + "aw_ir", + aw_ir_methods, + sizeof(struct aw_ir_softc), +}; +static devclass_t aw_ir_devclass; + +DRIVER_MODULE(aw_ir, simplebus, aw_ir_driver, aw_ir_devclass, 0, 0); +MODULE_DEPEND(aw_ir, evdev, 1, 1, 1); Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Thu Oct 27 03:43:27 2016 (r307983) +++ head/sys/arm/allwinner/files.allwinner Thu Oct 27 04:26:33 2016 (r307984) @@ -29,6 +29,7 @@ dev/usb/controller/generic_usb_if.m opti arm/allwinner/aw_sid.c standard arm/allwinner/aw_thermal.c standard dev/iicbus/sy8106a.c optional sy8106a +arm/allwinner/aw_cir.c optional aw_cir evdev #arm/allwinner/console.c standard arm/allwinner/a10_fb.c optional vt Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Thu Oct 27 03:43:27 2016 (r307983) +++ head/sys/arm/conf/GENERIC Thu Oct 27 04:26:33 2016 (r307984) @@ -119,6 +119,12 @@ device gpio device gpioled device gpioregulator +# EVDEV support +device evdev # input event device support +options EVDEV_SUPPORT # evdev support in legacy drivers +device uinput # install /dev/uinput cdev +device aw_cir + # SPI device spibus device bcm2835_spi From owner-svn-src-head@freebsd.org Thu Oct 27 04:28:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C33BCC22155; Thu, 27 Oct 2016 04:28:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 813C6A93; Thu, 27 Oct 2016 04:28:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R4S1Uo086953; Thu, 27 Oct 2016 04:28:01 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R4S16i086950; Thu, 27 Oct 2016 04:28:01 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610270428.u9R4S16i086950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 27 Oct 2016 04:28:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307985 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 04:28:02 -0000 Author: sephe Date: Thu Oct 27 04:28:01 2016 New Revision: 307985 URL: https://svnweb.freebsd.org/changeset/base/307985 Log: hyperv/hn: Nuke unnecessary M_NETVSC MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8340 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 04:26:33 2016 (r307984) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 04:28:01 2016 (r307985) @@ -52,8 +52,6 @@ #include #include -MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver"); - /* * Forward declarations */ @@ -308,7 +306,7 @@ hn_nvs_conn_chim(struct hn_softc *sc) sc->hn_chim_bmap_cnt = sc->hn_chim_cnt / LONG_BIT; sc->hn_chim_bmap = malloc(sc->hn_chim_bmap_cnt * sizeof(u_long), - M_NETVSC, M_WAITOK | M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); /* Done! */ sc->hn_flags |= HN_FLAG_CHIM_CONNECTED; @@ -427,7 +425,7 @@ hn_nvs_disconn_chim(struct hn_softc *sc) } if (sc->hn_chim_bmap != NULL) { - free(sc->hn_chim_bmap, M_NETVSC); + free(sc->hn_chim_bmap, M_DEVBUF); sc->hn_chim_bmap = NULL; } return (0); Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 04:26:33 2016 (r307984) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 04:28:01 2016 (r307985) @@ -66,8 +66,6 @@ #define HN_USE_TXDESC_BUFRING -MALLOC_DECLARE(M_NETVSC); - /* * The following arguably belongs in a separate header file */ Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 04:26:33 2016 (r307984) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 04:28:01 2016 (r307985) @@ -2606,7 +2606,7 @@ hn_create_rx_data(struct hn_softc *sc, i sc->hn_rx_ring_inuse = sc->hn_rx_ring_cnt; sc->hn_rx_ring = malloc(sizeof(struct hn_rx_ring) * sc->hn_rx_ring_cnt, - M_NETVSC, M_WAITOK | M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); #if defined(INET) || defined(INET6) #if __FreeBSD_version >= 1100095 @@ -2647,7 +2647,7 @@ hn_create_rx_data(struct hn_softc *sc, i rxr->hn_ifp = sc->hn_ifp; if (i < sc->hn_tx_ring_cnt) rxr->hn_txr = &sc->hn_tx_ring[i]; - rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); + rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_DEVBUF, M_WAITOK); rxr->hn_rx_idx = i; rxr->hn_rxbuf = sc->hn_rxbuf; @@ -2794,9 +2794,9 @@ hn_destroy_rx_data(struct hn_softc *sc) #if defined(INET) || defined(INET6) tcp_lro_free(&rxr->hn_lro); #endif - free(rxr->hn_rdbuf, M_NETVSC); + free(rxr->hn_rdbuf, M_DEVBUF); } - free(sc->hn_rx_ring, M_NETVSC); + free(sc->hn_rx_ring, M_DEVBUF); sc->hn_rx_ring = NULL; sc->hn_rx_ring_cnt = 0; @@ -2821,11 +2821,11 @@ hn_create_tx_ring(struct hn_softc *sc, i txr->hn_txdesc_cnt = HN_TX_DESC_CNT; txr->hn_txdesc = malloc(sizeof(struct hn_txdesc) * txr->hn_txdesc_cnt, - M_NETVSC, M_WAITOK | M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); #ifndef HN_USE_TXDESC_BUFRING SLIST_INIT(&txr->hn_txlist); #else - txr->hn_txdesc_br = buf_ring_alloc(txr->hn_txdesc_cnt, M_NETVSC, + txr->hn_txdesc_br = buf_ring_alloc(txr->hn_txdesc_cnt, M_DEVBUF, M_WAITOK, &txr->hn_tx_lock); #endif @@ -2843,7 +2843,7 @@ hn_create_tx_ring(struct hn_softc *sc, i TASK_INIT(&txr->hn_txeof_task, 0, hn_xmit_txeof_taskfunc, txr); br_depth = hn_get_txswq_depth(txr); - txr->hn_mbuf_br = buf_ring_alloc(br_depth, M_NETVSC, + txr->hn_mbuf_br = buf_ring_alloc(br_depth, M_DEVBUF, M_WAITOK, &txr->hn_tx_lock); } @@ -3026,14 +3026,14 @@ hn_destroy_tx_ring(struct hn_tx_ring *tx bus_dma_tag_destroy(txr->hn_tx_rndis_dtag); #ifdef HN_USE_TXDESC_BUFRING - buf_ring_free(txr->hn_txdesc_br, M_NETVSC); + buf_ring_free(txr->hn_txdesc_br, M_DEVBUF); #endif - free(txr->hn_txdesc, M_NETVSC); + free(txr->hn_txdesc, M_DEVBUF); txr->hn_txdesc = NULL; if (txr->hn_mbuf_br != NULL) - buf_ring_free(txr->hn_mbuf_br, M_NETVSC); + buf_ring_free(txr->hn_mbuf_br, M_DEVBUF); #ifndef HN_USE_TXDESC_BUFRING mtx_destroy(&txr->hn_txlist_spin); @@ -3065,7 +3065,7 @@ hn_create_tx_data(struct hn_softc *sc, i sc->hn_tx_ring_inuse = sc->hn_tx_ring_cnt; sc->hn_tx_ring = malloc(sizeof(struct hn_tx_ring) * sc->hn_tx_ring_cnt, - M_NETVSC, M_WAITOK | M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); ctx = device_get_sysctl_ctx(sc->hn_dev); child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->hn_dev)); @@ -3225,7 +3225,7 @@ hn_destroy_tx_data(struct hn_softc *sc) for (i = 0; i < sc->hn_tx_ring_cnt; ++i) hn_destroy_tx_ring(&sc->hn_tx_ring[i]); - free(sc->hn_tx_ring, M_NETVSC); + free(sc->hn_tx_ring, M_DEVBUF); sc->hn_tx_ring = NULL; sc->hn_tx_ring_cnt = 0; @@ -4175,12 +4175,12 @@ hn_chan_callback(struct vmbus_channel *c } else if (ret == ENOBUFS) { /* Handle large packet */ if (bufferlen > NETVSC_PACKET_SIZE) { - free(buffer, M_NETVSC); + free(buffer, M_DEVBUF); buffer = NULL; } /* alloc new buffer */ - buffer = malloc(bytes_rxed, M_NETVSC, M_NOWAIT); + buffer = malloc(bytes_rxed, M_DEVBUF, M_NOWAIT); if (buffer == NULL) { if_printf(rxr->hn_ifp, "hv_cb malloc buffer failed, len=%u\n", @@ -4196,7 +4196,7 @@ hn_chan_callback(struct vmbus_channel *c } while (1); if (bufferlen > NETVSC_PACKET_SIZE) - free(buffer, M_NETVSC); + free(buffer, M_DEVBUF); hv_rf_channel_rollup(rxr, rxr->hn_txr); } From owner-svn-src-head@freebsd.org Thu Oct 27 04:42:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EAD1C223F5; Thu, 27 Oct 2016 04:42:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 405B018A; Thu, 27 Oct 2016 04:42:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R4gdaM094085; Thu, 27 Oct 2016 04:42:39 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R4gdFh094083; Thu, 27 Oct 2016 04:42:39 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610270442.u9R4gdFh094083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 27 Oct 2016 04:42:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307986 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 04:42:40 -0000 Author: sephe Date: Thu Oct 27 04:42:39 2016 New Revision: 307986 URL: https://svnweb.freebsd.org/changeset/base/307986 Log: hyperv/hn: Move %b format string for capabilities near their definition. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8341 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 04:28:01 2016 (r307985) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 04:42:39 2016 (r307986) @@ -275,6 +275,11 @@ struct hn_softc { #define HN_CAP_TSO6 0x0100 #define HN_CAP_HASHVAL 0x0200 +/* Capability description for use with printf(9) %b identifier. */ +#define HN_CAP_BITS \ + "\020\1VLAN\2MTU\3IPCS\4TCP4CS\5TCP6CS" \ + "\6UDP4CS\7UDP6CS\10TSO4\11TSO6\12HASHVAL" + #define HN_LINK_FLAG_LINKUP 0x0001 #define HN_LINK_FLAG_NETCHG 0x0002 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 04:28:01 2016 (r307985) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 04:42:39 2016 (r307986) @@ -2379,18 +2379,7 @@ hn_caps_sysctl(SYSCTL_HANDLER_ARGS) HN_LOCK(sc); caps = sc->hn_caps; HN_UNLOCK(sc); - snprintf(caps_str, sizeof(caps_str), "%b", caps, - "\020" - "\001VLAN" - "\002MTU" - "\003IPCS" - "\004TCP4CS" - "\005TCP6CS" - "\006UDP4CS" - "\007UDP6CS" - "\010TSO4" - "\011TSO6" - "\012HASHVAL"); + snprintf(caps_str, sizeof(caps_str), "%b", caps, HN_CAP_BITS); return sysctl_handle_string(oidp, caps_str, sizeof(caps_str), req); } From owner-svn-src-head@freebsd.org Thu Oct 27 04:55:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80844C225BF; Thu, 27 Oct 2016 04:55:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 380838C9; Thu, 27 Oct 2016 04:55:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R4tJIV098279; Thu, 27 Oct 2016 04:55:19 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R4tJHQ098276; Thu, 27 Oct 2016 04:55:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610270455.u9R4tJHQ098276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 27 Oct 2016 04:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307987 - in head/sys: dev/hyperv/netvsc 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.23 Precedence: list List-Id: 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, 27 Oct 2016 04:55:20 -0000 Author: sephe Date: Thu Oct 27 04:55:19 2016 New Revision: 307987 URL: https://svnweb.freebsd.org/changeset/base/307987 Log: hyperv/hn: Define empty packet filter. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8342 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/if_hnvar.h head/sys/net/rndis.h Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 04:42:39 2016 (r307986) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 04:55:19 2016 (r307987) @@ -3849,8 +3849,8 @@ hn_suspend_data(struct hn_softc *sc) /* * Disable RX by clearing RX filter. */ - hn_rndis_set_rxfilter(sc, 0); - sc->hn_rx_filter = 0; + sc->hn_rx_filter = NDIS_PACKET_TYPE_NONE; + hn_rndis_set_rxfilter(sc, sc->hn_rx_filter); /* * Give RNDIS enough time to flush all pending data packets. Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Thu Oct 27 04:42:39 2016 (r307986) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Thu Oct 27 04:55:19 2016 (r307987) @@ -106,7 +106,7 @@ int hn_rndis_query_rsscaps(struct hn_so int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr); int hn_rndis_get_linkstatus(struct hn_softc *sc, uint32_t *link_status); -/* filter: NDIS_PACKET_TYPE_ or 0. */ +/* filter: NDIS_PACKET_TYPE_. */ int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter); int hn_nvs_attach(struct hn_softc *sc, int mtu); Modified: head/sys/net/rndis.h ============================================================================== --- head/sys/net/rndis.h Thu Oct 27 04:42:39 2016 (r307986) +++ head/sys/net/rndis.h Thu Oct 27 04:55:19 2016 (r307987) @@ -352,6 +352,7 @@ struct rndis_keepalive_comp { }; /* Packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ +#define NDIS_PACKET_TYPE_NONE 0x00000000 #define NDIS_PACKET_TYPE_DIRECTED 0x00000001 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 From owner-svn-src-head@freebsd.org Thu Oct 27 05:04:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE313C227D5; Thu, 27 Oct 2016 05:04:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0787D82; Thu, 27 Oct 2016 05:04:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R54sKp002176; Thu, 27 Oct 2016 05:04:54 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R54sBb002173; Thu, 27 Oct 2016 05:04:54 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610270504.u9R54sBb002173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 27 Oct 2016 05:04:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307988 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 05:04:56 -0000 Author: sephe Date: Thu Oct 27 05:04:54 2016 New Revision: 307988 URL: https://svnweb.freebsd.org/changeset/base/307988 Log: hyperv/hn: Shuffle chimney sending buffer alloc/free around. This paves way for more chimney sending buffer reorganization. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8343 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 04:55:19 2016 (r307987) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:04:54 2016 (r307988) @@ -73,33 +73,6 @@ static const uint32_t hn_nvs_version[] HN_NVS_VERSION_1 }; -uint32_t -hn_chim_alloc(struct hn_softc *sc) -{ - int i, bmap_cnt = sc->hn_chim_bmap_cnt; - u_long *bmap = sc->hn_chim_bmap; - uint32_t ret = HN_NVS_CHIM_IDX_INVALID; - - for (i = 0; i < bmap_cnt; ++i) { - int idx; - - idx = ffsl(~bmap[i]); - if (idx == 0) - continue; - - --idx; /* ffsl is 1-based */ - KASSERT(i * LONG_BIT + idx < sc->hn_chim_cnt, - ("invalid i %d and idx %d", i, idx)); - - if (atomic_testandset_long(&bmap[i], idx)) - continue; - - ret = i * LONG_BIT + idx; - break; - } - return (ret); -} - static const void * hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, void *req, int reqlen, size_t *resplen0, uint32_t type) @@ -648,25 +621,6 @@ hn_nvs_sent_none(struct hn_send_ctx *snd /* EMPTY */ } -void -hn_chim_free(struct hn_softc *sc, uint32_t chim_idx) -{ - u_long mask; - uint32_t idx; - - idx = chim_idx / LONG_BIT; - KASSERT(idx < sc->hn_chim_bmap_cnt, - ("invalid chimney index 0x%x", chim_idx)); - - mask = 1UL << (chim_idx % LONG_BIT); - KASSERT(sc->hn_chim_bmap[idx] & mask, - ("index bitmap 0x%lx, chimney index %u, " - "bitmap idx %d, bitmask 0x%lx", - sc->hn_chim_bmap[idx], chim_idx, idx, mask)); - - atomic_clear_long(&sc->hn_chim_bmap[idx], mask); -} - int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch0) { Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 04:55:19 2016 (r307987) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 05:04:54 2016 (r307988) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -457,6 +458,52 @@ hn_sendpkt_rndis_chim(struct hn_tx_ring &rndis, sizeof(rndis), &txd->send_ctx)); } +static __inline uint32_t +hn_chim_alloc(struct hn_softc *sc) +{ + int i, bmap_cnt = sc->hn_chim_bmap_cnt; + u_long *bmap = sc->hn_chim_bmap; + uint32_t ret = HN_NVS_CHIM_IDX_INVALID; + + for (i = 0; i < bmap_cnt; ++i) { + int idx; + + idx = ffsl(~bmap[i]); + if (idx == 0) + continue; + + --idx; /* ffsl is 1-based */ + KASSERT(i * LONG_BIT + idx < sc->hn_chim_cnt, + ("invalid i %d and idx %d", i, idx)); + + if (atomic_testandset_long(&bmap[i], idx)) + continue; + + ret = i * LONG_BIT + idx; + break; + } + return (ret); +} + +static __inline void +hn_chim_free(struct hn_softc *sc, uint32_t chim_idx) +{ + u_long mask; + uint32_t idx; + + idx = chim_idx / LONG_BIT; + KASSERT(idx < sc->hn_chim_bmap_cnt, + ("invalid chimney index 0x%x", chim_idx)); + + mask = 1UL << (chim_idx % LONG_BIT); + KASSERT(sc->hn_chim_bmap[idx] & mask, + ("index bitmap 0x%lx, chimney index %u, " + "bitmap idx %d, bitmask 0x%lx", + sc->hn_chim_bmap[idx], chim_idx, idx, mask)); + + atomic_clear_long(&sc->hn_chim_bmap[idx], mask); +} + static int hn_set_rxfilter(struct hn_softc *sc) { Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Thu Oct 27 04:55:19 2016 (r307987) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Thu Oct 27 05:04:54 2016 (r307988) @@ -94,9 +94,6 @@ hn_nvs_send_sglist(struct vmbus_channel struct vmbus_xact; struct rndis_packet_msg; -uint32_t hn_chim_alloc(struct hn_softc *sc); -void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx); - int hn_rndis_attach(struct hn_softc *sc, int mtu); void hn_rndis_detach(struct hn_softc *sc); int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); From owner-svn-src-head@freebsd.org Thu Oct 27 05:13:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFCD2C22AC0; Thu, 27 Oct 2016 05:13:01 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A68A7303; Thu, 27 Oct 2016 05:13:01 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R5D0vL005822; Thu, 27 Oct 2016 05:13:00 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R5D0uT005818; Thu, 27 Oct 2016 05:13:00 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610270513.u9R5D0uT005818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 27 Oct 2016 05:13:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307989 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 05:13:02 -0000 Author: sephe Date: Thu Oct 27 05:13:00 2016 New Revision: 307989 URL: https://svnweb.freebsd.org/changeset/base/307989 Log: hyperv/hn: Move hn_softc to if_hnvar.h While I'm here, use consistent macro names. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8345 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:04:54 2016 (r307988) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:13:00 2016 (r307989) @@ -138,9 +138,9 @@ hn_nvs_conn_rxbuf(struct hn_softc *sc) * Limit RXBUF size for old NVS. */ if (sc->hn_nvs_ver <= HN_NVS_VERSION_2) - rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; + rxbuf_size = HN_RXBUF_SIZE_COMPAT; else - rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE; + rxbuf_size = HN_RXBUF_SIZE; /* * Connect the RXBUF GPADL to the primary channel. @@ -219,8 +219,7 @@ hn_nvs_conn_chim(struct hn_softc *sc) * Sub-channels just share this chimney sending buffer. */ error = vmbus_chan_gpadl_connect(sc->hn_prichan, - sc->hn_chim_dma.hv_paddr, NETVSC_SEND_BUFFER_SIZE, - &sc->hn_chim_gpadl); + sc->hn_chim_dma.hv_paddr, HN_CHIM_SIZE, &sc->hn_chim_gpadl); if (error) { if_printf(sc->hn_ifp, "chim gpadl conn failed: %d\n", error); goto cleanup; @@ -267,8 +266,8 @@ hn_nvs_conn_chim(struct hn_softc *sc) } sc->hn_chim_szmax = sectsz; - sc->hn_chim_cnt = NETVSC_SEND_BUFFER_SIZE / sc->hn_chim_szmax; - if (NETVSC_SEND_BUFFER_SIZE % sc->hn_chim_szmax != 0) { + sc->hn_chim_cnt = HN_CHIM_SIZE / sc->hn_chim_szmax; + if (HN_CHIM_SIZE % sc->hn_chim_szmax != 0) { if_printf(sc->hn_ifp, "chimney sending sections are " "not properly aligned\n"); } Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 05:04:54 2016 (r307988) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 05:13:00 2016 (r307989) @@ -28,13 +28,6 @@ * $FreeBSD$ */ -/* - * HyperV vmbus (virtual machine bus) network VSC (virtual services client) - * header file - * - * (Updated from unencumbered NvspProtocol.h) - */ - #ifndef __HV_NET_VSC_H__ #define __HV_NET_VSC_H__ @@ -64,224 +57,5 @@ #include -#define HN_USE_TXDESC_BUFRING - -/* - * The following arguably belongs in a separate header file - */ - -/* - * Defines - */ - -#define NETVSC_SEND_BUFFER_SIZE (1024*1024*15) /* 15M */ - -#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024*1024*15) /* 15MB */ -#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */ - -/* - * Maximum MTU we permit to be configured for a netvsc interface. - * When the code was developed, a max MTU of 12232 was tested and - * proven to work. 9K is a reasonable maximum for an Ethernet. - */ -#define NETVSC_MAX_CONFIGURABLE_MTU (9 * 1024) - -#define NETVSC_PACKET_SIZE PAGE_SIZE - -/* - * Data types - */ - -struct vmbus_channel; - -#define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) -#define NETVSC_PACKET_MAXPAGE 32 - -#define HN_XACT_REQ_PGCNT 2 -#define HN_XACT_RESP_PGCNT 2 -#define HN_XACT_REQ_SIZE (HN_XACT_REQ_PGCNT * PAGE_SIZE) -#define HN_XACT_RESP_SIZE (HN_XACT_RESP_PGCNT * PAGE_SIZE) - -struct hn_txdesc; -#ifndef HN_USE_TXDESC_BUFRING -SLIST_HEAD(hn_txdesc_list, hn_txdesc); -#else -struct buf_ring; -#endif - -struct hn_tx_ring; - -struct hn_rx_ring { - struct ifnet *hn_ifp; - struct hn_tx_ring *hn_txr; - void *hn_rdbuf; - uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ - int hn_rx_idx; - - /* Trust csum verification on host side */ - int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */ - struct lro_ctrl hn_lro; - - u_long hn_csum_ip; - u_long hn_csum_tcp; - u_long hn_csum_udp; - u_long hn_csum_trusted; - u_long hn_lro_tried; - u_long hn_small_pkts; - u_long hn_pkts; - u_long hn_rss_pkts; - - /* Rarely used stuffs */ - struct sysctl_oid *hn_rx_sysctl_tree; - int hn_rx_flags; - - void *hn_br; /* TX/RX bufring */ - struct hyperv_dma hn_br_dma; -} __aligned(CACHE_LINE_SIZE); - -#define HN_TRUST_HCSUM_IP 0x0001 -#define HN_TRUST_HCSUM_TCP 0x0002 -#define HN_TRUST_HCSUM_UDP 0x0004 - -#define HN_RX_FLAG_ATTACHED 0x1 - -struct hn_tx_ring { -#ifndef HN_USE_TXDESC_BUFRING - struct mtx hn_txlist_spin; - struct hn_txdesc_list hn_txlist; -#else - struct buf_ring *hn_txdesc_br; -#endif - int hn_txdesc_cnt; - int hn_txdesc_avail; - u_short hn_has_txeof; - u_short hn_txdone_cnt; - - int hn_sched_tx; - void (*hn_txeof)(struct hn_tx_ring *); - struct taskqueue *hn_tx_taskq; - struct task hn_tx_task; - struct task hn_txeof_task; - - struct buf_ring *hn_mbuf_br; - int hn_oactive; - int hn_tx_idx; - int hn_tx_flags; - - struct mtx hn_tx_lock; - struct hn_softc *hn_sc; - struct vmbus_channel *hn_chan; - - int hn_direct_tx_size; - int hn_chim_size; - bus_dma_tag_t hn_tx_data_dtag; - uint64_t hn_csum_assist; - - int (*hn_sendpkt)(struct hn_tx_ring *, struct hn_txdesc *); - int hn_suspended; - int hn_gpa_cnt; - struct vmbus_gpa hn_gpa[NETVSC_PACKET_MAXPAGE]; - - u_long hn_no_txdescs; - u_long hn_send_failed; - u_long hn_txdma_failed; - u_long hn_tx_collapsed; - u_long hn_tx_chimney_tried; - u_long hn_tx_chimney; - u_long hn_pkts; - - /* Rarely used stuffs */ - struct hn_txdesc *hn_txdesc; - bus_dma_tag_t hn_tx_rndis_dtag; - struct sysctl_oid *hn_tx_sysctl_tree; -} __aligned(CACHE_LINE_SIZE); - -#define HN_TX_FLAG_ATTACHED 0x1 -#define HN_TX_FLAG_HASHVAL 0x2 /* support HASHVAL pktinfo */ - -/* - * Device-specific softc structure - */ -struct hn_softc { - struct ifnet *hn_ifp; - struct ifmedia hn_media; - device_t hn_dev; - int hn_if_flags; - struct sx hn_lock; - struct vmbus_channel *hn_prichan; - - int hn_rx_ring_cnt; - int hn_rx_ring_inuse; - struct hn_rx_ring *hn_rx_ring; - - int hn_tx_ring_cnt; - int hn_tx_ring_inuse; - struct hn_tx_ring *hn_tx_ring; - - uint8_t *hn_chim; - u_long *hn_chim_bmap; - int hn_chim_bmap_cnt; - int hn_chim_cnt; - int hn_chim_szmax; - - int hn_cpu; - struct taskqueue *hn_tx_taskq; - struct sysctl_oid *hn_tx_sysctl_tree; - struct sysctl_oid *hn_rx_sysctl_tree; - struct vmbus_xact_ctx *hn_xact; - uint32_t hn_nvs_ver; - uint32_t hn_rx_filter; - - struct taskqueue *hn_mgmt_taskq; - struct taskqueue *hn_mgmt_taskq0; - struct task hn_link_task; - struct task hn_netchg_init; - struct timeout_task hn_netchg_status; - uint32_t hn_link_flags; /* HN_LINK_FLAG_ */ - - uint32_t hn_caps; /* HN_CAP_ */ - uint32_t hn_flags; /* HN_FLAG_ */ - void *hn_rxbuf; - uint32_t hn_rxbuf_gpadl; - struct hyperv_dma hn_rxbuf_dma; - - uint32_t hn_chim_gpadl; - struct hyperv_dma hn_chim_dma; - - uint32_t hn_rndis_rid; - uint32_t hn_ndis_ver; - int hn_ndis_tso_szmax; - int hn_ndis_tso_sgmin; - - int hn_rss_ind_size; - uint32_t hn_rss_hash; /* NDIS_HASH_ */ - struct ndis_rssprm_toeplitz hn_rss; -}; - -#define HN_FLAG_RXBUF_CONNECTED 0x0001 -#define HN_FLAG_CHIM_CONNECTED 0x0002 -#define HN_FLAG_HAS_RSSKEY 0x0004 -#define HN_FLAG_HAS_RSSIND 0x0008 -#define HN_FLAG_SYNTH_ATTACHED 0x0010 - -#define HN_CAP_VLAN 0x0001 -#define HN_CAP_MTU 0x0002 -#define HN_CAP_IPCS 0x0004 -#define HN_CAP_TCP4CS 0x0008 -#define HN_CAP_TCP6CS 0x0010 -#define HN_CAP_UDP4CS 0x0020 -#define HN_CAP_UDP6CS 0x0040 -#define HN_CAP_TSO4 0x0080 -#define HN_CAP_TSO6 0x0100 -#define HN_CAP_HASHVAL 0x0200 - -/* Capability description for use with printf(9) %b identifier. */ -#define HN_CAP_BITS \ - "\020\1VLAN\2MTU\3IPCS\4TCP4CS\5TCP6CS" \ - "\6UDP4CS\7UDP6CS\10TSO4\11TSO6\12HASHVAL" - -#define HN_LINK_FLAG_LINKUP 0x0001 -#define HN_LINK_FLAG_NETCHG 0x0002 - #endif /* __HV_NET_VSC_H__ */ Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 05:04:54 2016 (r307988) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 05:13:00 2016 (r307989) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -91,6 +92,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -116,11 +118,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include +#include +#include #include #include -#include #include "vmbus_if.h" @@ -155,7 +160,7 @@ __FBSDID("$FreeBSD$"); #define HN_TX_DATA_MAXSIZE IP_MAXPACKET #define HN_TX_DATA_SEGSIZE PAGE_SIZE /* -1 for RNDIS packet message */ -#define HN_TX_DATA_SEGCNT_MAX (NETVSC_PACKET_MAXPAGE - 1) +#define HN_TX_DATA_SEGCNT_MAX (HN_GPACNT_MAX - 1) #define HN_DIRECT_TX_SIZE_DEF 128 @@ -1855,7 +1860,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, switch (cmd) { case SIOCSIFMTU: - if (ifr->ifr_mtu > NETVSC_MAX_CONFIGURABLE_MTU) { + if (ifr->ifr_mtu > HN_MTU_MAX) { error = EINVAL; break; } @@ -2631,7 +2636,7 @@ hn_create_rx_data(struct hn_softc *sc, i * may further limit the usable space. */ sc->hn_rxbuf = hyperv_dmamem_alloc(bus_get_dma_tag(dev), - PAGE_SIZE, 0, NETVSC_RECEIVE_BUFFER_SIZE, &sc->hn_rxbuf_dma, + PAGE_SIZE, 0, HN_RXBUF_SIZE, &sc->hn_rxbuf_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); if (sc->hn_rxbuf == NULL) { device_printf(sc->hn_dev, "allocate rxbuf failed\n"); @@ -2665,9 +2670,7 @@ hn_create_rx_data(struct hn_softc *sc, i struct hn_rx_ring *rxr = &sc->hn_rx_ring[i]; rxr->hn_br = hyperv_dmamem_alloc(bus_get_dma_tag(dev), - PAGE_SIZE, 0, - NETVSC_DEVICE_RING_BUFFER_SIZE + - NETVSC_DEVICE_RING_BUFFER_SIZE, + PAGE_SIZE, 0, HN_TXBR_SIZE + HN_RXBR_SIZE, &rxr->hn_br_dma, BUS_DMA_WAITOK); if (rxr->hn_br == NULL) { device_printf(dev, "allocate bufring failed\n"); @@ -2683,7 +2686,7 @@ hn_create_rx_data(struct hn_softc *sc, i rxr->hn_ifp = sc->hn_ifp; if (i < sc->hn_tx_ring_cnt) rxr->hn_txr = &sc->hn_tx_ring[i]; - rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_DEVBUF, M_WAITOK); + rxr->hn_pktbuf = malloc(HN_PKTBUF_LEN, M_DEVBUF, M_WAITOK); rxr->hn_rx_idx = i; rxr->hn_rxbuf = sc->hn_rxbuf; @@ -2830,7 +2833,7 @@ hn_destroy_rx_data(struct hn_softc *sc) #if defined(INET) || defined(INET6) tcp_lro_free(&rxr->hn_lro); #endif - free(rxr->hn_rdbuf, M_DEVBUF); + free(rxr->hn_pktbuf, M_DEVBUF); } free(sc->hn_rx_ring, M_DEVBUF); sc->hn_rx_ring = NULL; @@ -3090,7 +3093,7 @@ hn_create_tx_data(struct hn_softc *sc, i * NOTE: It is shared by all channels. */ sc->hn_chim = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev), - PAGE_SIZE, 0, NETVSC_SEND_BUFFER_SIZE, &sc->hn_chim_dma, + PAGE_SIZE, 0, HN_CHIM_SIZE, &sc->hn_chim_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); if (sc->hn_chim == NULL) { device_printf(sc->hn_dev, "allocate txbuf failed\n"); @@ -3508,8 +3511,8 @@ hn_chan_attach(struct hn_softc *sc, stru */ cbr.cbr = rxr->hn_br; cbr.cbr_paddr = rxr->hn_br_dma.hv_paddr; - cbr.cbr_txsz = NETVSC_DEVICE_RING_BUFFER_SIZE; - cbr.cbr_rxsz = NETVSC_DEVICE_RING_BUFFER_SIZE; + cbr.cbr_txsz = HN_TXBR_SIZE; + cbr.cbr_rxsz = HN_RXBR_SIZE; error = vmbus_chan_open_br(chan, &cbr, NULL, 0, hn_chan_callback, rxr); if (error) { if_printf(sc->hn_ifp, "open chan%u failed: %d\n", @@ -4126,7 +4129,7 @@ hn_nvs_handle_rxbuf(struct hn_softc *sc, ofs = pkt->cp_rxbuf[i].rb_ofs; len = pkt->cp_rxbuf[i].rb_len; - if (__predict_false(ofs + len > NETVSC_RECEIVE_BUFFER_SIZE)) { + if (__predict_false(ofs + len > HN_RXBUF_SIZE)) { if_printf(rxr->hn_ifp, "%dth RNDIS msg overflow rxbuf, " "ofs %d, len %d\n", i, ofs, len); continue; @@ -4181,9 +4184,9 @@ hn_chan_callback(struct vmbus_channel *c struct hn_rx_ring *rxr = xrxr; struct hn_softc *sc = rxr->hn_ifp->if_softc; void *buffer; - int bufferlen = NETVSC_PACKET_SIZE; + int bufferlen = HN_PKTBUF_LEN; - buffer = rxr->hn_rdbuf; + buffer = rxr->hn_pktbuf; do { struct vmbus_chanpkt_hdr *pkt = buffer; uint32_t bytes_rxed; @@ -4210,7 +4213,7 @@ hn_chan_callback(struct vmbus_channel *c } } else if (ret == ENOBUFS) { /* Handle large packet */ - if (bufferlen > NETVSC_PACKET_SIZE) { + if (bufferlen > HN_PKTBUF_LEN) { free(buffer, M_DEVBUF); buffer = NULL; } @@ -4231,7 +4234,7 @@ hn_chan_callback(struct vmbus_channel *c } } while (1); - if (bufferlen > NETVSC_PACKET_SIZE) + if (bufferlen > HN_PKTBUF_LEN) free(buffer, M_DEVBUF); hv_rf_channel_rollup(rxr, rxr->hn_txr); Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Thu Oct 27 05:04:54 2016 (r307988) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Thu Oct 27 05:13:00 2016 (r307989) @@ -29,14 +29,30 @@ #ifndef _IF_HNVAR_H_ #define _IF_HNVAR_H_ -#include +#define HN_USE_TXDESC_BUFRING -#include -#include +#define HN_CHIM_SIZE (15 * 1024 * 1024) -struct hn_softc; +#define HN_RXBUF_SIZE (16 * 1024 * 1024) +#define HN_RXBUF_SIZE_COMPAT (15 * 1024 * 1024) + +/* Claimed to be 12232B */ +#define HN_MTU_MAX (9 * 1024) + +#define HN_PKTBUF_LEN 4096 + +#define HN_TXBR_SIZE (128 * PAGE_SIZE) +#define HN_RXBR_SIZE (128 * PAGE_SIZE) + +#define HN_XACT_REQ_PGCNT 2 +#define HN_XACT_RESP_PGCNT 2 +#define HN_XACT_REQ_SIZE (HN_XACT_REQ_PGCNT * PAGE_SIZE) +#define HN_XACT_RESP_SIZE (HN_XACT_RESP_PGCNT * PAGE_SIZE) + +#define HN_GPACNT_MAX 32 struct vmbus_channel; +struct hn_softc; struct hn_send_ctx; typedef void (*hn_sent_callback_t) @@ -48,6 +64,12 @@ struct hn_send_ctx { void *hn_cbarg; }; +#define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ +{ \ + .hn_cb = cb, \ + .hn_cbarg = cbarg \ +} + #define HN_NDIS_VLAN_INFO_INVALID 0xffffffff #define HN_NDIS_RXCSUM_INFO_INVALID 0 #define HN_NDIS_HASH_INFO_INVALID 0 @@ -59,11 +81,185 @@ struct hn_recvinfo { uint32_t hash_value; }; -#define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ -{ \ - .hn_cb = cb, \ - .hn_cbarg = cbarg \ -} +struct hn_txdesc; +#ifndef HN_USE_TXDESC_BUFRING +SLIST_HEAD(hn_txdesc_list, hn_txdesc); +#else +struct buf_ring; +#endif +struct hn_tx_ring; + +struct hn_rx_ring { + struct ifnet *hn_ifp; + struct hn_tx_ring *hn_txr; + void *hn_pktbuf; + uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ + int hn_rx_idx; + + /* Trust csum verification on host side */ + int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */ + struct lro_ctrl hn_lro; + + u_long hn_csum_ip; + u_long hn_csum_tcp; + u_long hn_csum_udp; + u_long hn_csum_trusted; + u_long hn_lro_tried; + u_long hn_small_pkts; + u_long hn_pkts; + u_long hn_rss_pkts; + + /* Rarely used stuffs */ + struct sysctl_oid *hn_rx_sysctl_tree; + int hn_rx_flags; + + void *hn_br; /* TX/RX bufring */ + struct hyperv_dma hn_br_dma; +} __aligned(CACHE_LINE_SIZE); + +#define HN_TRUST_HCSUM_IP 0x0001 +#define HN_TRUST_HCSUM_TCP 0x0002 +#define HN_TRUST_HCSUM_UDP 0x0004 + +#define HN_RX_FLAG_ATTACHED 0x1 + +struct hn_tx_ring { +#ifndef HN_USE_TXDESC_BUFRING + struct mtx hn_txlist_spin; + struct hn_txdesc_list hn_txlist; +#else + struct buf_ring *hn_txdesc_br; +#endif + int hn_txdesc_cnt; + int hn_txdesc_avail; + u_short hn_has_txeof; + u_short hn_txdone_cnt; + + int hn_sched_tx; + void (*hn_txeof)(struct hn_tx_ring *); + struct taskqueue *hn_tx_taskq; + struct task hn_tx_task; + struct task hn_txeof_task; + + struct buf_ring *hn_mbuf_br; + int hn_oactive; + int hn_tx_idx; + int hn_tx_flags; + + struct mtx hn_tx_lock; + struct hn_softc *hn_sc; + struct vmbus_channel *hn_chan; + + int hn_direct_tx_size; + int hn_chim_size; + bus_dma_tag_t hn_tx_data_dtag; + uint64_t hn_csum_assist; + + int (*hn_sendpkt)(struct hn_tx_ring *, struct hn_txdesc *); + int hn_suspended; + int hn_gpa_cnt; + struct vmbus_gpa hn_gpa[HN_GPACNT_MAX]; + + u_long hn_no_txdescs; + u_long hn_send_failed; + u_long hn_txdma_failed; + u_long hn_tx_collapsed; + u_long hn_tx_chimney_tried; + u_long hn_tx_chimney; + u_long hn_pkts; + + /* Rarely used stuffs */ + struct hn_txdesc *hn_txdesc; + bus_dma_tag_t hn_tx_rndis_dtag; + struct sysctl_oid *hn_tx_sysctl_tree; +} __aligned(CACHE_LINE_SIZE); + +#define HN_TX_FLAG_ATTACHED 0x1 +#define HN_TX_FLAG_HASHVAL 0x2 /* support HASHVAL pktinfo */ + +/* + * Device-specific softc structure + */ +struct hn_softc { + struct ifnet *hn_ifp; + struct ifmedia hn_media; + device_t hn_dev; + int hn_if_flags; + struct sx hn_lock; + struct vmbus_channel *hn_prichan; + + int hn_rx_ring_cnt; + int hn_rx_ring_inuse; + struct hn_rx_ring *hn_rx_ring; + + int hn_tx_ring_cnt; + int hn_tx_ring_inuse; + struct hn_tx_ring *hn_tx_ring; + + uint8_t *hn_chim; + u_long *hn_chim_bmap; + int hn_chim_bmap_cnt; + int hn_chim_cnt; + int hn_chim_szmax; + + int hn_cpu; + struct taskqueue *hn_tx_taskq; + struct sysctl_oid *hn_tx_sysctl_tree; + struct sysctl_oid *hn_rx_sysctl_tree; + struct vmbus_xact_ctx *hn_xact; + uint32_t hn_nvs_ver; + uint32_t hn_rx_filter; + + struct taskqueue *hn_mgmt_taskq; + struct taskqueue *hn_mgmt_taskq0; + struct task hn_link_task; + struct task hn_netchg_init; + struct timeout_task hn_netchg_status; + uint32_t hn_link_flags; /* HN_LINK_FLAG_ */ + + uint32_t hn_caps; /* HN_CAP_ */ + uint32_t hn_flags; /* HN_FLAG_ */ + void *hn_rxbuf; + uint32_t hn_rxbuf_gpadl; + struct hyperv_dma hn_rxbuf_dma; + + uint32_t hn_chim_gpadl; + struct hyperv_dma hn_chim_dma; + + uint32_t hn_rndis_rid; + uint32_t hn_ndis_ver; + int hn_ndis_tso_szmax; + int hn_ndis_tso_sgmin; + + int hn_rss_ind_size; + uint32_t hn_rss_hash; /* NDIS_HASH_ */ + struct ndis_rssprm_toeplitz hn_rss; +}; + +#define HN_FLAG_RXBUF_CONNECTED 0x0001 +#define HN_FLAG_CHIM_CONNECTED 0x0002 +#define HN_FLAG_HAS_RSSKEY 0x0004 +#define HN_FLAG_HAS_RSSIND 0x0008 +#define HN_FLAG_SYNTH_ATTACHED 0x0010 + +#define HN_CAP_VLAN 0x0001 +#define HN_CAP_MTU 0x0002 +#define HN_CAP_IPCS 0x0004 +#define HN_CAP_TCP4CS 0x0008 +#define HN_CAP_TCP6CS 0x0010 +#define HN_CAP_UDP4CS 0x0020 +#define HN_CAP_UDP6CS 0x0040 +#define HN_CAP_TSO4 0x0080 +#define HN_CAP_TSO6 0x0100 +#define HN_CAP_HASHVAL 0x0200 + +/* Capability description for use with printf(9) %b identifier. */ +#define HN_CAP_BITS \ + "\020\1VLAN\2MTU\3IPCS\4TCP4CS\5TCP6CS" \ + "\6UDP4CS\7UDP6CS\10TSO4\11TSO6\12HASHVAL" + +#define HN_LINK_FLAG_LINKUP 0x0001 +#define HN_LINK_FLAG_NETCHG 0x0002 static __inline void hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, void *cbarg) From owner-svn-src-head@freebsd.org Thu Oct 27 05:26:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DC37C22E0E; Thu, 27 Oct 2016 05:26:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F09B2A82; Thu, 27 Oct 2016 05:26:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R5Q5Ev009799; Thu, 27 Oct 2016 05:26:05 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R5Q4WY009793; Thu, 27 Oct 2016 05:26:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610270526.u9R5Q4WY009793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 27 Oct 2016 05:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307990 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 05:26:06 -0000 Author: sephe Date: Thu Oct 27 05:26:04 2016 New Revision: 307990 URL: https://svnweb.freebsd.org/changeset/base/307990 Log: hyperv/hn: Move send context to NVS domain. Since all sends are encapsulated in NVS messages. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8346 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:13:00 2016 (r307989) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:26:04 2016 (r307990) @@ -39,18 +39,24 @@ #include #include #include +#include + #include #include -#include -#include -#include +#include + +#include +#include #include +#include +#include #include -#include -#include + +#include #include #include +#include /* * Forward declarations @@ -59,12 +65,12 @@ static int hn_nvs_conn_chim(struct hn_s static int hn_nvs_conn_rxbuf(struct hn_softc *); static int hn_nvs_disconn_chim(struct hn_softc *sc); static int hn_nvs_disconn_rxbuf(struct hn_softc *sc); -static void hn_nvs_sent_none(struct hn_send_ctx *sndc, +static void hn_nvs_sent_none(struct hn_nvs_sendctx *sndc, struct hn_softc *, struct vmbus_channel *chan, const void *, int); -struct hn_send_ctx hn_send_ctx_none = - HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL); +struct hn_nvs_sendctx hn_nvs_sendctx_none = + HN_NVS_SENDCTX_INITIALIZER(hn_nvs_sent_none, NULL); static const uint32_t hn_nvs_version[] = { HN_NVS_VERSION_5, @@ -77,7 +83,7 @@ static const void * hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, void *req, int reqlen, size_t *resplen0, uint32_t type) { - struct hn_send_ctx sndc; + struct hn_nvs_sendctx sndc; size_t resplen, min_resplen = *resplen0; const struct hn_nvs_hdr *hdr; int error; @@ -88,7 +94,7 @@ hn_nvs_xact_execute(struct hn_softc *sc, /* * Execute the xact setup by the caller. */ - hn_send_ctx_init(&sndc, hn_nvs_sent_xact, xact); + hn_nvs_sendctx_init(&sndc, hn_nvs_sent_xact, xact); vmbus_xact_activate(xact); error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, @@ -121,7 +127,7 @@ hn_nvs_req_send(struct hn_softc *sc, voi { return (hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, - req, reqlen, &hn_send_ctx_none)); + req, reqlen, &hn_nvs_sendctx_none)); } static int @@ -604,7 +610,7 @@ hn_nvs_detach(struct hn_softc *sc) } void -hn_nvs_sent_xact(struct hn_send_ctx *sndc, +hn_nvs_sent_xact(struct hn_nvs_sendctx *sndc, struct hn_softc *sc __unused, struct vmbus_channel *chan __unused, const void *data, int dlen) { @@ -613,7 +619,7 @@ hn_nvs_sent_xact(struct hn_send_ctx *snd } static void -hn_nvs_sent_none(struct hn_send_ctx *sndc __unused, +hn_nvs_sent_none(struct hn_nvs_sendctx *sndc __unused, struct hn_softc *sc __unused, struct vmbus_channel *chan __unused, const void *data __unused, int dlen __unused) { @@ -670,3 +676,12 @@ done: vmbus_xact_put(xact); return (error); } + +int +hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + + return hn_nvs_send_rndis_sglist(chan, HN_NVS_RNDIS_MTYPE_CTRL, + sndc, gpa, gpa_cnt); +} Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 05:13:00 2016 (r307989) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Oct 27 05:26:04 2016 (r307990) @@ -31,31 +31,76 @@ #ifndef __HV_NET_VSC_H__ #define __HV_NET_VSC_H__ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include +struct hn_nvs_sendctx; +struct vmbus_channel; +struct hn_softc; + +typedef void (*hn_nvs_sent_t) + (struct hn_nvs_sendctx *, struct hn_softc *, + struct vmbus_channel *, const void *, int); + +struct hn_nvs_sendctx { + hn_nvs_sent_t hn_cb; + void *hn_cbarg; +}; + +#define HN_NVS_SENDCTX_INITIALIZER(cb, cbarg) \ +{ \ + .hn_cb = cb, \ + .hn_cbarg = cbarg \ +} + +static __inline void +hn_nvs_sendctx_init(struct hn_nvs_sendctx *sndc, hn_nvs_sent_t cb, void *cbarg) +{ + + sndc->hn_cb = cb; + sndc->hn_cbarg = cbarg; +} + +static __inline int +hn_nvs_send(struct vmbus_channel *chan, uint16_t flags, + void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc) +{ + + return (vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, flags, + nvs_msg, nvs_msglen, (uint64_t)(uintptr_t)sndc)); +} + +static __inline int +hn_nvs_send_sglist(struct vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, + void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc) +{ + + return (vmbus_chan_send_sglist(chan, sg, sglen, nvs_msg, nvs_msglen, + (uint64_t)(uintptr_t)sndc)); +} + +static __inline int +hn_nvs_send_rndis_sglist(struct vmbus_channel *chan, uint32_t rndis_mtype, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + struct hn_nvs_rndis rndis; + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = rndis_mtype; + rndis.nvs_chim_idx = HN_NVS_CHIM_IDX_INVALID; + rndis.nvs_chim_sz = 0; + + return (hn_nvs_send_sglist(chan, gpa, gpa_cnt, + &rndis, sizeof(rndis), sndc)); +} + +int hn_nvs_attach(struct hn_softc *sc, int mtu); +void hn_nvs_detach(struct hn_softc *sc); +int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch); +void hn_nvs_sent_xact(struct hn_nvs_sendctx *sndc, + struct hn_softc *sc, struct vmbus_channel *chan, + const void *data, int dlen); +int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, + int gpa_cnt); -#include +extern struct hn_nvs_sendctx hn_nvs_sendctx_none; #endif /* __HV_NET_VSC_H__ */ - Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 05:13:00 2016 (r307989) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Oct 27 05:26:04 2016 (r307990) @@ -174,7 +174,7 @@ struct hn_txdesc { struct hn_tx_ring *txr; int refs; uint32_t flags; /* HN_TXD_FLAG_ */ - struct hn_send_ctx send_ctx; + struct hn_nvs_sendctx send_ctx; uint32_t chim_index; int chim_size; @@ -412,37 +412,13 @@ hn_set_lro_lenlim(struct hn_softc *sc, i } #endif -static __inline int -hn_nvs_send_rndis_sglist1(struct vmbus_channel *chan, uint32_t rndis_mtype, - struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) -{ - struct hn_nvs_rndis rndis; - - rndis.nvs_type = HN_NVS_TYPE_RNDIS; - rndis.nvs_rndis_mtype = rndis_mtype; - rndis.nvs_chim_idx = HN_NVS_CHIM_IDX_INVALID; - rndis.nvs_chim_sz = 0; - - return (hn_nvs_send_sglist(chan, gpa, gpa_cnt, - &rndis, sizeof(rndis), sndc)); -} - -int -hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, - struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) -{ - - return hn_nvs_send_rndis_sglist1(chan, HN_NVS_RNDIS_MTYPE_CTRL, - sndc, gpa, gpa_cnt); -} - static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *txr, struct hn_txdesc *txd) { KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID && txd->chim_size == 0, ("invalid rndis sglist txd")); - return (hn_nvs_send_rndis_sglist1(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, + return (hn_nvs_send_rndis_sglist(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, &txd->send_ctx, txr->hn_gpa, txr->hn_gpa_cnt)); } @@ -1190,7 +1166,7 @@ hn_txeof(struct hn_tx_ring *txr) } static void -hn_tx_done(struct hn_send_ctx *sndc, struct hn_softc *sc, +hn_tx_done(struct hn_nvs_sendctx *sndc, struct hn_softc *sc, struct vmbus_channel *chan, const void *data __unused, int dlen __unused) { struct hn_txdesc *txd = sndc->hn_cbarg; @@ -1429,7 +1405,7 @@ done: txd->m = m_head; /* Set the completion routine */ - hn_send_ctx_init(&txd->send_ctx, hn_tx_done, txd); + hn_nvs_sendctx_init(&txd->send_ctx, hn_tx_done, txd); return 0; } @@ -4070,9 +4046,9 @@ static void hn_nvs_handle_comp(struct hn_softc *sc, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt) { - struct hn_send_ctx *sndc; + struct hn_nvs_sendctx *sndc; - sndc = (struct hn_send_ctx *)(uintptr_t)pkt->cph_xactid; + sndc = (struct hn_nvs_sendctx *)(uintptr_t)pkt->cph_xactid; sndc->hn_cb(sndc, sc, chan, VMBUS_CHANPKT_CONST_DATA(pkt), VMBUS_CHANPKT_DATALEN(pkt)); /* Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Thu Oct 27 05:13:00 2016 (r307989) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Thu Oct 27 05:26:04 2016 (r307990) @@ -34,26 +34,30 @@ __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 #define HV_RF_RECVINFO_VLAN 0x1 #define HV_RF_RECVINFO_CSUM 0x2 @@ -549,7 +553,7 @@ hn_rndis_get_linkstatus(struct hn_softc static const void * hn_rndis_xact_exec1(struct hn_softc *sc, struct vmbus_xact *xact, size_t reqlen, - struct hn_send_ctx *sndc, size_t *comp_len) + struct hn_nvs_sendctx *sndc, size_t *comp_len) { struct vmbus_gpa gpa[HN_XACT_REQ_PGCNT]; int gpa_cnt, error; @@ -608,7 +612,7 @@ hn_rndis_xact_execute(struct hn_softc *s /* * Execute the xact setup by the caller. */ - comp = hn_rndis_xact_exec1(sc, xact, reqlen, &hn_send_ctx_none, + comp = hn_rndis_xact_exec1(sc, xact, reqlen, &hn_nvs_sendctx_none, &comp_len); if (comp == NULL) return (NULL); @@ -1214,7 +1218,7 @@ hn_rndis_halt(struct hn_softc *sc) { struct vmbus_xact *xact; struct rndis_halt_req *halt; - struct hn_send_ctx sndc; + struct hn_nvs_sendctx sndc; size_t comp_len; xact = vmbus_xact_get(sc->hn_xact, sizeof(*halt)); @@ -1228,7 +1232,7 @@ hn_rndis_halt(struct hn_softc *sc) halt->rm_rid = hn_rndis_rid(sc); /* No RNDIS completion; rely on NVS message send completion */ - hn_send_ctx_init(&sndc, hn_nvs_sent_xact, xact); + hn_nvs_sendctx_init(&sndc, hn_nvs_sent_xact, xact); hn_rndis_xact_exec1(sc, xact, sizeof(*halt), &sndc, &comp_len); vmbus_xact_put(xact); Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Thu Oct 27 05:13:00 2016 (r307989) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Thu Oct 27 05:26:04 2016 (r307990) @@ -51,25 +51,6 @@ #define HN_GPACNT_MAX 32 -struct vmbus_channel; -struct hn_softc; -struct hn_send_ctx; - -typedef void (*hn_sent_callback_t) - (struct hn_send_ctx *, struct hn_softc *, - struct vmbus_channel *, const void *, int); - -struct hn_send_ctx { - hn_sent_callback_t hn_cb; - void *hn_cbarg; -}; - -#define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ -{ \ - .hn_cb = cb, \ - .hn_cbarg = cbarg \ -} - #define HN_NDIS_VLAN_INFO_INVALID 0xffffffff #define HN_NDIS_RXCSUM_INFO_INVALID 0 #define HN_NDIS_HASH_INFO_INVALID 0 @@ -261,33 +242,6 @@ struct hn_softc { #define HN_LINK_FLAG_LINKUP 0x0001 #define HN_LINK_FLAG_NETCHG 0x0002 -static __inline void -hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, void *cbarg) -{ - - sndc->hn_cb = cb; - sndc->hn_cbarg = cbarg; -} - -static __inline int -hn_nvs_send(struct vmbus_channel *chan, uint16_t flags, - void *nvs_msg, int nvs_msglen, struct hn_send_ctx *sndc) -{ - - return (vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, flags, - nvs_msg, nvs_msglen, (uint64_t)(uintptr_t)sndc)); -} - -static __inline int -hn_nvs_send_sglist(struct vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, - void *nvs_msg, int nvs_msglen, struct hn_send_ctx *sndc) -{ - - return (vmbus_chan_send_sglist(chan, sg, sglen, nvs_msg, nvs_msglen, - (uint64_t)(uintptr_t)sndc)); -} - -struct vmbus_xact; struct rndis_packet_msg; int hn_rndis_attach(struct hn_softc *sc, int mtu); @@ -302,21 +256,10 @@ int hn_rndis_get_linkstatus(struct hn_s /* filter: NDIS_PACKET_TYPE_. */ int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter); -int hn_nvs_attach(struct hn_softc *sc, int mtu); -void hn_nvs_detach(struct hn_softc *sc); -int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch); -void hn_nvs_sent_xact(struct hn_send_ctx *sndc, struct hn_softc *sc, - struct vmbus_channel *chan, const void *data, int dlen); -int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, - struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, - int gpa_cnt); - int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_recvinfo *info); void hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); void hn_link_status_update(struct hn_softc *sc); void hn_network_change(struct hn_softc *sc); -extern struct hn_send_ctx hn_send_ctx_none; - #endif /* !_IF_HNVAR_H_ */ From owner-svn-src-head@freebsd.org Thu Oct 27 05:33:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9945C220EC; Thu, 27 Oct 2016 05:33:49 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A14AAFB7; Thu, 27 Oct 2016 05:33:49 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R5XmsY013743; Thu, 27 Oct 2016 05:33:48 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R5Xmo4013742; Thu, 27 Oct 2016 05:33:48 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610270533.u9R5Xmo4013742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 27 Oct 2016 05:33:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307991 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 05:33:50 -0000 Author: sephe Date: Thu Oct 27 05:33:48 2016 New Revision: 307991 URL: https://svnweb.freebsd.org/changeset/base/307991 Log: hyperv/hn: NVS inclusion cleanup and forward declare functions. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8347 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:26:04 2016 (r307990) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Oct 27 05:33:48 2016 (r307991) @@ -24,21 +24,23 @@ * 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$ */ -/** - * HyperV vmbus network VSC (virtual services client) module - * +/* + * Network Virtualization Service. */ +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet6.h" +#include "opt_inet.h" #include #include -#include #include -#include +#include +#include #include #include @@ -58,18 +60,22 @@ #include #include -/* - * Forward declarations - */ -static int hn_nvs_conn_chim(struct hn_softc *sc); -static int hn_nvs_conn_rxbuf(struct hn_softc *); -static int hn_nvs_disconn_chim(struct hn_softc *sc); -static int hn_nvs_disconn_rxbuf(struct hn_softc *sc); -static void hn_nvs_sent_none(struct hn_nvs_sendctx *sndc, - struct hn_softc *, struct vmbus_channel *chan, - const void *, int); +static int hn_nvs_conn_chim(struct hn_softc *); +static int hn_nvs_conn_rxbuf(struct hn_softc *); +static int hn_nvs_disconn_chim(struct hn_softc *); +static int hn_nvs_disconn_rxbuf(struct hn_softc *); +static int hn_nvs_conf_ndis(struct hn_softc *, int); +static int hn_nvs_init_ndis(struct hn_softc *); +static int hn_nvs_doinit(struct hn_softc *, uint32_t); +static int hn_nvs_init(struct hn_softc *); +static const void *hn_nvs_xact_execute(struct hn_softc *, + struct vmbus_xact *, void *, int, + size_t *, uint32_t); +static void hn_nvs_sent_none(struct hn_nvs_sendctx *, + struct hn_softc *, struct vmbus_channel *, + const void *, int); -struct hn_nvs_sendctx hn_nvs_sendctx_none = +struct hn_nvs_sendctx hn_nvs_sendctx_none = HN_NVS_SENDCTX_INITIALIZER(hn_nvs_sent_none, NULL); static const uint32_t hn_nvs_version[] = { From owner-svn-src-head@freebsd.org Thu Oct 27 07:38:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD0C5C22E2E; Thu, 27 Oct 2016 07:38:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA063EB0; Thu, 27 Oct 2016 07:38:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R7c7CD059936; Thu, 27 Oct 2016 07:38:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R7c7qL059935; Thu, 27 Oct 2016 07:38:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201610270738.u9R7c7qL059935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 27 Oct 2016 07:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307994 - 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.23 Precedence: list List-Id: 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, 27 Oct 2016 07:38:09 -0000 Author: avg Date: Thu Oct 27 07:38:07 2016 New Revision: 307994 URL: https://svnweb.freebsd.org/changeset/base/307994 Log: 3746 ZRLs are racy illumos/illumos-gate@260af64db74a52d64de8c6c5f67dd0a71d228ca5 https://github.com/illumos/illumos-gate/commit/260af64db74a52d64de8c6c5f67dd0a71d228ca5 https://www.illumos.org/issues/3746 From the original change log: It was possible for a reference to be added even with the lock held, and for references added just after a lock release to be lost. This bug was also independently found and reported in wesunsolve.net issues 6985013 6995524. In zrl_add(), always use an atomic operation to update the refcount. The mutex in the ZRL only guarantees that wakeups occur for waiters on the lock. It offers no protection against concurrent updates of the refcount. The only refcount transition that is safe to perform without an atomic operation is from ZRL_LOCKED back to 0, since this can only be performed by the thread which has the ZRL locked. Authored by: Will Andrews Reviewed by: Boris Protopopov Reviewed by: Pavel Zakharov Reviewed by: Yuri Pankov Reviewed by: Justin T. Gibbs Approved by: Matt Ahrens Author: Youzhong Yang PR: 204037 MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c Thu Oct 27 07:11:31 2016 (r307993) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c Thu Oct 27 07:38:07 2016 (r307994) @@ -21,6 +21,7 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2015 by Delphix. All rights reserved. + * Copyright 2016 The MathWorks, Inc. All rights reserved. */ /* @@ -71,37 +72,32 @@ zrl_destroy(zrlock_t *zrl) void zrl_add_impl(zrlock_t *zrl, const char *zc) { - uint32_t n = (uint32_t)zrl->zr_refcount; - - while (n != ZRL_LOCKED) { - uint32_t cas = atomic_cas_32( - (uint32_t *)&zrl->zr_refcount, n, n + 1); - if (cas == n) { - ASSERT3S((int32_t)n, >=, 0); -#ifdef ZFS_DEBUG - if (zrl->zr_owner == curthread) { - DTRACE_PROBE2(zrlock__reentry, - zrlock_t *, zrl, uint32_t, n); - } - zrl->zr_owner = curthread; - zrl->zr_caller = zc; + for (;;) { + uint32_t n = (uint32_t)zrl->zr_refcount; + while (n != ZRL_LOCKED) { + uint32_t cas = atomic_cas_32( + (uint32_t *)&zrl->zr_refcount, n, n + 1); + if (cas == n) { + ASSERT3S((int32_t)n, >=, 0); +#ifdef ZFS_DEBUG + if (zrl->zr_owner == curthread) { + DTRACE_PROBE2(zrlock__reentry, + zrlock_t *, zrl, uint32_t, n); + } + zrl->zr_owner = curthread; + zrl->zr_caller = zc; #endif - return; + return; + } + n = cas; } - n = cas; - } - mutex_enter(&zrl->zr_mtx); - while (zrl->zr_refcount == ZRL_LOCKED) { - cv_wait(&zrl->zr_cv, &zrl->zr_mtx); + mutex_enter(&zrl->zr_mtx); + while (zrl->zr_refcount == ZRL_LOCKED) { + cv_wait(&zrl->zr_cv, &zrl->zr_mtx); + } + mutex_exit(&zrl->zr_mtx); } - ASSERT3S(zrl->zr_refcount, >=, 0); - zrl->zr_refcount++; -#ifdef ZFS_DEBUG - zrl->zr_owner = curthread; - zrl->zr_caller = zc; -#endif - mutex_exit(&zrl->zr_mtx); } void From owner-svn-src-head@freebsd.org Thu Oct 27 09:46:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40AF1C237D0; Thu, 27 Oct 2016 09:46:24 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6410E1; Thu, 27 Oct 2016 09:46:23 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9R9kNKQ010664; Thu, 27 Oct 2016 09:46:23 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9R9kMc0010656; Thu, 27 Oct 2016 09:46:22 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201610270946.u9R9kMc0010656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Thu, 27 Oct 2016 09:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308000 - in head/sys: dev/netmap 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.23 Precedence: list List-Id: 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, 27 Oct 2016 09:46:24 -0000 Author: luigi Date: Thu Oct 27 09:46:22 2016 New Revision: 308000 URL: https://svnweb.freebsd.org/changeset/base/308000 Log: Various fixes for ptnet/ptnetmap (passthrough of netmap ports). In detail: - use PCI_VENDOR and PCI_DEVICE ids from a publicly allocated range (thanks to RedHat) - export memory pool information through PCI registers - improve mechanism for configuring passthrough on different hypervisors Code is from Vincenzo Maffione as a follow up to his GSOC work. Modified: head/sys/dev/netmap/if_ptnet.c head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_mem2.c head/sys/dev/netmap/netmap_mem2.h head/sys/dev/netmap/netmap_pt.c head/sys/dev/netmap/netmap_vale.c head/sys/net/netmap.h head/sys/net/netmap_virt.h Modified: head/sys/dev/netmap/if_ptnet.c ============================================================================== --- head/sys/dev/netmap/if_ptnet.c Thu Oct 27 09:11:36 2016 (r307999) +++ head/sys/dev/netmap/if_ptnet.c Thu Oct 27 09:46:22 2016 (r308000) @@ -291,7 +291,7 @@ static inline void ptnet_kick(struct ptn static int ptnet_attach(device_t dev) { - uint32_t ptfeatures = PTNETMAP_F_BASE; + uint32_t ptfeatures = 0; unsigned int num_rx_rings, num_tx_rings; struct netmap_adapter na_arg; unsigned int nifp_offset; @@ -315,19 +315,12 @@ ptnet_attach(device_t dev) return (ENXIO); } - /* Check if we are supported by the hypervisor. If not, - * bail out immediately. */ + /* Negotiate features with the hypervisor. */ if (ptnet_vnet_hdr) { ptfeatures |= PTNETMAP_F_VNET_HDR; } bus_write_4(sc->iomem, PTNET_IO_PTFEAT, ptfeatures); /* wanted */ ptfeatures = bus_read_4(sc->iomem, PTNET_IO_PTFEAT); /* acked */ - if (!(ptfeatures & PTNETMAP_F_BASE)) { - device_printf(dev, "Hypervisor does not support netmap " - "passthorugh\n"); - err = ENXIO; - goto err_path; - } sc->ptfeatures = ptfeatures; /* Allocate CSB and carry out CSB allocation protocol (CSBBAH first, @@ -474,7 +467,8 @@ ptnet_attach(device_t dev) na_arg.nm_txsync = ptnet_nm_txsync; na_arg.nm_rxsync = ptnet_nm_rxsync; - netmap_pt_guest_attach(&na_arg, sc->csb, nifp_offset, ptnet_nm_ptctl); + netmap_pt_guest_attach(&na_arg, sc->csb, nifp_offset, + bus_read_4(sc->iomem, PTNET_IO_HOSTMEMID)); /* Now a netmap adapter for this ifp has been allocated, and it * can be accessed through NA(ifp). We also have to initialize the CSB @@ -1082,13 +1076,12 @@ static uint32_t ptnet_nm_ptctl(if_t ifp, uint32_t cmd) { struct ptnet_softc *sc = if_getsoftc(ifp); - int ret; - + /* + * Write a command and read back error status, + * with zero meaning success. + */ bus_write_4(sc->iomem, PTNET_IO_PTCTL, cmd); - ret = bus_read_4(sc->iomem, PTNET_IO_PTSTS); - device_printf(sc->dev, "PTCTL %u, ret %u\n", cmd, ret); - - return ret; + return bus_read_4(sc->iomem, PTNET_IO_PTCTL); } static int @@ -1196,7 +1189,7 @@ ptnet_nm_register(struct netmap_adapter /* Make sure the host adapter passed through is ready * for txsync/rxsync. */ - ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_REGIF); + ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_CREATE); if (ret) { return ret; } @@ -1246,7 +1239,7 @@ ptnet_nm_register(struct netmap_adapter } if (sc->ptna->backend_regifs == 0) { - ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_UNREGIF); + ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_DELETE); } } Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Thu Oct 27 09:11:36 2016 (r307999) +++ head/sys/dev/netmap/netmap.c Thu Oct 27 09:46:22 2016 (r308000) @@ -2186,7 +2186,11 @@ netmap_ioctl(struct netmap_priv_d *priv, break; case NIOCREGIF: - /* possibly attach/detach NIC and VALE switch */ + /* + * If nmr->nr_cmd is not zero, this NIOCREGIF is not really + * a regif operation, but a different one, specified by the + * value of nmr->nr_cmd. + */ i = nmr->nr_cmd; if (i == NETMAP_BDG_ATTACH || i == NETMAP_BDG_DETACH || i == NETMAP_BDG_VNET_HDR @@ -2194,12 +2198,15 @@ netmap_ioctl(struct netmap_priv_d *priv, || i == NETMAP_BDG_DELIF || i == NETMAP_BDG_POLLING_ON || i == NETMAP_BDG_POLLING_OFF) { + /* possibly attach/detach NIC and VALE switch */ error = netmap_bdg_ctl(nmr, NULL); break; } else if (i == NETMAP_PT_HOST_CREATE || i == NETMAP_PT_HOST_DELETE) { + /* forward the command to the ptnetmap subsystem */ error = ptnetmap_ctl(nmr, priv->np_na); break; } else if (i == NETMAP_VNET_HDR_GET) { + /* get vnet-header length for this netmap port */ struct ifnet *ifp; NMG_LOCK(); @@ -2210,6 +2217,10 @@ netmap_ioctl(struct netmap_priv_d *priv, netmap_unget_na(na, ifp); NMG_UNLOCK(); break; + } else if (i == NETMAP_POOLS_INFO_GET) { + /* get information from the memory allocator */ + error = netmap_mem_pools_info_get(nmr, priv->np_na); + break; } else if (i != 0) { D("nr_cmd must be 0 not %d", i); error = EINVAL; @@ -2873,17 +2884,15 @@ netmap_attach(struct netmap_adapter *arg #ifdef WITH_PTNETMAP_GUEST int -netmap_pt_guest_attach(struct netmap_adapter *arg, - void *csb, - unsigned int nifp_offset, - nm_pt_guest_ptctl_t ptctl) +netmap_pt_guest_attach(struct netmap_adapter *arg, void *csb, + unsigned int nifp_offset, unsigned int memid) { struct netmap_pt_guest_adapter *ptna; struct ifnet *ifp = arg ? arg->ifp : NULL; int error; /* get allocator */ - arg->nm_mem = netmap_mem_pt_guest_new(ifp, nifp_offset, ptctl); + arg->nm_mem = netmap_mem_pt_guest_new(ifp, nifp_offset, memid); if (arg->nm_mem == NULL) return ENOMEM; arg->na_flags |= NAF_MEM_OWNER; Modified: head/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- head/sys/dev/netmap/netmap_freebsd.c Thu Oct 27 09:11:36 2016 (r307999) +++ head/sys/dev/netmap/netmap_freebsd.c Thu Oct 27 09:46:22 2016 (r308000) @@ -626,38 +626,26 @@ DRIVER_MODULE_ORDERED(ptn_memdev, pci, p NULL, NULL, SI_ORDER_MIDDLE + 1); /* - * I/O port read/write wrappers. - * Some are not used, so we keep them commented out until needed - */ -#define ptn_ioread16(ptn_dev, reg) bus_read_2((ptn_dev)->pci_io, (reg)) -#define ptn_ioread32(ptn_dev, reg) bus_read_4((ptn_dev)->pci_io, (reg)) -#if 0 -#define ptn_ioread8(ptn_dev, reg) bus_read_1((ptn_dev)->pci_io, (reg)) -#define ptn_iowrite8(ptn_dev, reg, val) bus_write_1((ptn_dev)->pci_io, (reg), (val)) -#define ptn_iowrite16(ptn_dev, reg, val) bus_write_2((ptn_dev)->pci_io, (reg), (val)) -#define ptn_iowrite32(ptn_dev, reg, val) bus_write_4((ptn_dev)->pci_io, (reg), (val)) -#endif /* unused */ - -/* * Map host netmap memory through PCI-BAR in the guest OS, * returning physical (nm_paddr) and virtual (nm_addr) addresses * of the netmap memory mapped in the guest. */ int nm_os_pt_memdev_iomap(struct ptnetmap_memdev *ptn_dev, vm_paddr_t *nm_paddr, - void **nm_addr) + void **nm_addr, uint64_t *mem_size) { - uint32_t mem_size; int rid; D("ptn_memdev_driver iomap"); rid = PCIR_BAR(PTNETMAP_MEM_PCI_BAR); - mem_size = ptn_ioread32(ptn_dev, PTNETMAP_IO_PCI_MEMSIZE); + *mem_size = bus_read_4(ptn_dev->pci_io, PTNET_MDEV_IO_MEMSIZE_HI); + *mem_size = bus_read_4(ptn_dev->pci_io, PTNET_MDEV_IO_MEMSIZE_LO) | + (*mem_size << 32); /* map memory allocator */ ptn_dev->pci_mem = bus_alloc_resource(ptn_dev->dev, SYS_RES_MEMORY, - &rid, 0, ~0, mem_size, RF_ACTIVE); + &rid, 0, ~0, *mem_size, RF_ACTIVE); if (ptn_dev->pci_mem == NULL) { *nm_paddr = 0; *nm_addr = 0; @@ -667,14 +655,20 @@ nm_os_pt_memdev_iomap(struct ptnetmap_me *nm_paddr = rman_get_start(ptn_dev->pci_mem); *nm_addr = rman_get_virtual(ptn_dev->pci_mem); - D("=== BAR %d start %lx len %lx mem_size %x ===", + D("=== BAR %d start %lx len %lx mem_size %lx ===", PTNETMAP_MEM_PCI_BAR, (unsigned long)(*nm_paddr), (unsigned long)rman_get_size(ptn_dev->pci_mem), - mem_size); + (unsigned long)*mem_size); return (0); } +uint32_t +nm_os_pt_memdev_ioread(struct ptnetmap_memdev *ptn_dev, unsigned int reg) +{ + return bus_read_4(ptn_dev->pci_io, reg); +} + /* Unmap host netmap memory. */ void nm_os_pt_memdev_iounmap(struct ptnetmap_memdev *ptn_dev) @@ -730,7 +724,7 @@ ptn_memdev_attach(device_t dev) return (ENXIO); } - mem_id = ptn_ioread16(ptn_dev, PTNETMAP_IO_PCI_HOSTID); + mem_id = bus_read_4(ptn_dev->pci_io, PTNET_MDEV_IO_MEMID); /* create guest allocator */ ptn_dev->nm_mem = netmap_mem_pt_guest_attach(ptn_dev, mem_id); @@ -740,7 +734,7 @@ ptn_memdev_attach(device_t dev) } netmap_mem_get(ptn_dev->nm_mem); - D("ptn_memdev_driver probe OK - host_id: %d", mem_id); + D("ptn_memdev_driver probe OK - host_mem_id: %d", mem_id); return (0); } @@ -993,12 +987,7 @@ nm_os_ncpus(void) struct nm_kthread_ctx { struct thread *user_td; /* thread user-space (kthread creator) to send ioctl */ - /* notification to guest (interrupt) */ - int irq_fd; /* ioctl fd */ - struct nm_kth_ioctl irq_ioctl; /* ioctl arguments */ - - /* notification from guest */ - void *ioevent_file; /* tsleep() argument */ + struct ptnetmap_cfgentry_bhyve cfg; /* worker function and parameter */ nm_kthread_worker_fn_t worker_fn; @@ -1034,8 +1023,8 @@ nm_os_kthread_wakeup_worker(struct nm_kt */ mtx_lock(&nmk->worker_lock); nmk->scheduled++; - if (nmk->worker_ctx.ioevent_file) { - wakeup(nmk->worker_ctx.ioevent_file); + if (nmk->worker_ctx.cfg.wchan) { + wakeup((void *)nmk->worker_ctx.cfg.wchan); } mtx_unlock(&nmk->worker_lock); } @@ -1046,11 +1035,13 @@ nm_os_kthread_send_irq(struct nm_kthread struct nm_kthread_ctx *ctx = &nmk->worker_ctx; int err; - if (ctx->user_td && ctx->irq_fd > 0) { - err = kern_ioctl(ctx->user_td, ctx->irq_fd, ctx->irq_ioctl.com, (caddr_t)&ctx->irq_ioctl.data.msix); + if (ctx->user_td && ctx->cfg.ioctl_fd > 0) { + err = kern_ioctl(ctx->user_td, ctx->cfg.ioctl_fd, ctx->cfg.ioctl_cmd, + (caddr_t)&ctx->cfg.ioctl_data); if (err) { - D("kern_ioctl error: %d ioctl parameters: fd %d com %ju data %p", - err, ctx->irq_fd, (uintmax_t)ctx->irq_ioctl.com, &ctx->irq_ioctl.data); + D("kern_ioctl error: %d ioctl parameters: fd %d com %lu data %p", + err, ctx->cfg.ioctl_fd, (unsigned long)ctx->cfg.ioctl_cmd, + &ctx->cfg.ioctl_data); } } } @@ -1082,10 +1073,10 @@ nm_kthread_worker(void *data) } /* - * if ioevent_file is not defined, we don't have notification + * if wchan is not defined, we don't have notification * mechanism and we continually execute worker_fn() */ - if (!ctx->ioevent_file) { + if (!ctx->cfg.wchan) { ctx->worker_fn(ctx->worker_private); /* worker body */ } else { /* checks if there is a pending notification */ @@ -1099,7 +1090,7 @@ nm_kthread_worker(void *data) continue; } else if (nmk->run) { /* wait on event with one second timeout */ - msleep_spin(ctx->ioevent_file, &nmk->worker_lock, + msleep_spin((void *)ctx->cfg.wchan, &nmk->worker_lock, "nmk_ev", hz); nmk->scheduled++; } @@ -1110,29 +1101,6 @@ nm_kthread_worker(void *data) kthread_exit(); } -static int -nm_kthread_open_files(struct nm_kthread *nmk, struct nm_kthread_cfg *cfg) -{ - /* send irq through ioctl to bhyve (vmm.ko) */ - if (cfg->event.irqfd) { - nmk->worker_ctx.irq_fd = cfg->event.irqfd; - nmk->worker_ctx.irq_ioctl = cfg->event.ioctl; - } - /* ring.ioeventfd contains the chan where do tsleep to wait events */ - if (cfg->event.ioeventfd) { - nmk->worker_ctx.ioevent_file = (void *)cfg->event.ioeventfd; - } - - return 0; -} - -static void -nm_kthread_close_files(struct nm_kthread *nmk) -{ - nmk->worker_ctx.irq_fd = 0; - nmk->worker_ctx.ioevent_file = NULL; -} - void nm_os_kthread_set_affinity(struct nm_kthread *nmk, int affinity) { @@ -1140,10 +1108,15 @@ nm_os_kthread_set_affinity(struct nm_kth } struct nm_kthread * -nm_os_kthread_create(struct nm_kthread_cfg *cfg) +nm_os_kthread_create(struct nm_kthread_cfg *cfg, unsigned int cfgtype, + void *opaque) { struct nm_kthread *nmk = NULL; - int error; + + if (cfgtype != PTNETMAP_CFGTYPE_BHYVE) { + D("Unsupported cfgtype %u", cfgtype); + return NULL; + } nmk = malloc(sizeof(*nmk), M_DEVBUF, M_NOWAIT | M_ZERO); if (!nmk) @@ -1158,15 +1131,12 @@ nm_os_kthread_create(struct nm_kthread_c /* attach kthread to user process (ptnetmap) */ nmk->attach_user = cfg->attach_user; - /* open event fd */ - error = nm_kthread_open_files(nmk, cfg); - if (error) - goto err; + /* store kick/interrupt configuration */ + if (opaque) { + nmk->worker_ctx.cfg = *((struct ptnetmap_cfgentry_bhyve *)opaque); + } return nmk; -err: - free(nmk, M_DEVBUF); - return NULL; } int @@ -1194,7 +1164,7 @@ nm_os_kthread_start(struct nm_kthread *n goto err; } - D("nm_kthread started td 0x%p", nmk->worker); + D("nm_kthread started td %p", nmk->worker); return 0; err: @@ -1228,7 +1198,7 @@ nm_os_kthread_delete(struct nm_kthread * nm_os_kthread_stop(nmk); } - nm_kthread_close_files(nmk); + memset(&nmk->worker_ctx.cfg, 0, sizeof(nmk->worker_ctx.cfg)); free(nmk, M_DEVBUF); } Modified: head/sys/dev/netmap/netmap_kern.h ============================================================================== --- head/sys/dev/netmap/netmap_kern.h Thu Oct 27 09:11:36 2016 (r307999) +++ head/sys/dev/netmap/netmap_kern.h Thu Oct 27 09:46:22 2016 (r308000) @@ -2009,13 +2009,14 @@ typedef void (*nm_kthread_worker_fn_t)(v /* kthread configuration */ struct nm_kthread_cfg { long type; /* kthread type/identifier */ - struct ptnet_ring_cfg event; /* event/ioctl fd */ nm_kthread_worker_fn_t worker_fn; /* worker function */ void *worker_private;/* worker parameter */ int attach_user; /* attach kthread to user process */ }; /* kthread configuration */ -struct nm_kthread *nm_os_kthread_create(struct nm_kthread_cfg *cfg); +struct nm_kthread *nm_os_kthread_create(struct nm_kthread_cfg *cfg, + unsigned int cfgtype, + void *opaque); int nm_os_kthread_start(struct nm_kthread *); void nm_os_kthread_stop(struct nm_kthread *); void nm_os_kthread_delete(struct nm_kthread *); @@ -2053,8 +2054,6 @@ nm_ptnetmap_host_on(struct netmap_adapte #ifdef WITH_PTNETMAP_GUEST /* ptnetmap GUEST routines */ -typedef uint32_t (*nm_pt_guest_ptctl_t)(struct ifnet *, uint32_t); - /* * netmap adapter for guest ptnetmap ports */ @@ -2076,8 +2075,8 @@ struct netmap_pt_guest_adapter { }; -int netmap_pt_guest_attach(struct netmap_adapter *, void *, - unsigned int, nm_pt_guest_ptctl_t); +int netmap_pt_guest_attach(struct netmap_adapter *na, void *csb, + unsigned int nifp_offset, unsigned int memid); struct ptnet_ring; bool netmap_pt_guest_txsync(struct ptnet_ring *ptring, struct netmap_kring *kring, int flags); Modified: head/sys/dev/netmap/netmap_mem2.c ============================================================================== --- head/sys/dev/netmap/netmap_mem2.c Thu Oct 27 09:11:36 2016 (r307999) +++ head/sys/dev/netmap/netmap_mem2.c Thu Oct 27 09:46:22 2016 (r308000) @@ -147,39 +147,6 @@ struct netmap_mem_ops { typedef uint16_t nm_memid_t; -/* - * Shared info for netmap allocator - * - * Each allocator contains this structur as first netmap_if. - * In this way, we can share same details about allocator - * to the VM. - * Used in ptnetmap. - */ -struct netmap_mem_shared_info { -#ifndef _WIN32 - struct netmap_if up; /* ends with a 0-sized array, which VSC does not like */ -#else /* !_WIN32 */ - char up[sizeof(struct netmap_if)]; -#endif /* !_WIN32 */ - uint64_t features; -#define NMS_FEAT_BUF_POOL 0x0001 -#define NMS_FEAT_MEMSIZE 0x0002 - - uint32_t buf_pool_offset; - uint32_t buf_pool_objtotal; - uint32_t buf_pool_objsize; - uint32_t totalsize; -}; - -#define NMS_NAME "nms_info" -#define NMS_VERSION 1 -static const struct netmap_if nms_if_blueprint = { - .ni_name = NMS_NAME, - .ni_version = NMS_VERSION, - .ni_tx_rings = 0, - .ni_rx_rings = 0 -}; - struct netmap_mem_d { NMA_LOCK_T nm_mtx; /* protect the allocator */ u_int nm_totalsize; /* shorthand */ @@ -312,8 +279,6 @@ netmap_mem_finalize(struct netmap_mem_d return nmd->lasterr; } -static int netmap_mem_init_shared_info(struct netmap_mem_d *nmd); - void netmap_mem_deref(struct netmap_mem_d *nmd, struct netmap_adapter *na) { @@ -362,13 +327,9 @@ netmap_mem_deref(struct netmap_mem_d *nm if (nmd->pools[NETMAP_BUF_POOL].bitmap) { /* XXX This check is a workaround that prevents a * NULL pointer crash which currently happens only - * with ptnetmap guests. Also, - * netmap_mem_init_shared_info must not be called - * by ptnetmap guest. */ + * with ptnetmap guests. + * Removed shared-info --> is the bug still there? */ nmd->pools[NETMAP_BUF_POOL].bitmap[0] = ~3; - - /* expose info to the ptnetmap guest */ - netmap_mem_init_shared_info(nmd); } } nmd->ops->nmd_deref(nmd); @@ -1391,30 +1352,6 @@ netmap_mem_map(struct netmap_obj_pool *p } static int -netmap_mem_init_shared_info(struct netmap_mem_d *nmd) -{ - struct netmap_mem_shared_info *nms_info; - ssize_t base; - - /* Use the first slot in IF_POOL */ - nms_info = netmap_if_malloc(nmd, sizeof(*nms_info)); - if (nms_info == NULL) { - return ENOMEM; - } - - base = netmap_if_offset(nmd, nms_info); - - memcpy(&nms_info->up, &nms_if_blueprint, sizeof(nms_if_blueprint)); - nms_info->buf_pool_offset = nmd->pools[NETMAP_IF_POOL].memtotal + nmd->pools[NETMAP_RING_POOL].memtotal; - nms_info->buf_pool_objtotal = nmd->pools[NETMAP_BUF_POOL].objtotal; - nms_info->buf_pool_objsize = nmd->pools[NETMAP_BUF_POOL]._objsize; - nms_info->totalsize = nmd->nm_totalsize; - nms_info->features = NMS_FEAT_BUF_POOL | NMS_FEAT_MEMSIZE; - - return 0; -} - -static int netmap_mem_finalize_all(struct netmap_mem_d *nmd) { int i; @@ -1433,11 +1370,6 @@ netmap_mem_finalize_all(struct netmap_me nmd->pools[NETMAP_BUF_POOL].bitmap[0] = ~3; nmd->flags |= NETMAP_MEM_FINALIZED; - /* expose info to the ptnetmap guest */ - nmd->lasterr = netmap_mem_init_shared_info(nmd); - if (nmd->lasterr) - goto error; - if (netmap_verbose) D("interfaces %d KB, rings %d KB, buffers %d MB", nmd->pools[NETMAP_IF_POOL].memtotal >> 10, @@ -1929,12 +1861,54 @@ struct netmap_mem_ops netmap_mem_private .nmd_rings_delete = netmap_mem2_rings_delete }; +int +netmap_mem_pools_info_get(struct nmreq *nmr, struct netmap_adapter *na) +{ + uintptr_t *pp = (uintptr_t *)&nmr->nr_arg1; + struct netmap_pools_info *upi = (struct netmap_pools_info *)(*pp); + struct netmap_mem_d *nmd = na->nm_mem; + struct netmap_pools_info pi; + unsigned int memsize; + uint16_t memid; + int ret; + + if (!nmd) { + return -1; + } + + ret = netmap_mem_get_info(nmd, &memsize, NULL, &memid); + if (ret) { + return ret; + } + + pi.memsize = memsize; + pi.memid = memid; + pi.if_pool_offset = 0; + pi.if_pool_objtotal = nmd->pools[NETMAP_IF_POOL].objtotal; + pi.if_pool_objsize = nmd->pools[NETMAP_IF_POOL]._objsize; + + pi.ring_pool_offset = nmd->pools[NETMAP_IF_POOL].memtotal; + pi.ring_pool_objtotal = nmd->pools[NETMAP_RING_POOL].objtotal; + pi.ring_pool_objsize = nmd->pools[NETMAP_RING_POOL]._objsize; + + pi.buf_pool_offset = nmd->pools[NETMAP_IF_POOL].memtotal + + nmd->pools[NETMAP_RING_POOL].memtotal; + pi.buf_pool_objtotal = nmd->pools[NETMAP_BUF_POOL].objtotal; + pi.buf_pool_objsize = nmd->pools[NETMAP_BUF_POOL]._objsize; + + ret = copyout(&pi, upi, sizeof(pi)); + if (ret) { + return ret; + } + + return 0; +} + #ifdef WITH_PTNETMAP_GUEST struct mem_pt_if { struct mem_pt_if *next; struct ifnet *ifp; unsigned int nifp_offset; - nm_pt_guest_ptctl_t ptctl; }; /* Netmap allocator for ptnetmap guests. */ @@ -1944,16 +1918,15 @@ struct netmap_mem_ptg { vm_paddr_t nm_paddr; /* physical address in the guest */ void *nm_addr; /* virtual address in the guest */ struct netmap_lut buf_lut; /* lookup table for BUF pool in the guest */ - nm_memid_t nm_host_id; /* allocator identifier in the host */ - struct ptnetmap_memdev *ptn_dev; + nm_memid_t host_mem_id; /* allocator identifier in the host */ + struct ptnetmap_memdev *ptn_dev;/* ptnetmap memdev */ struct mem_pt_if *pt_ifs; /* list of interfaces in passthrough */ }; /* Link a passthrough interface to a passthrough netmap allocator. */ static int netmap_mem_pt_guest_ifp_add(struct netmap_mem_d *nmd, struct ifnet *ifp, - unsigned int nifp_offset, - nm_pt_guest_ptctl_t ptctl) + unsigned int nifp_offset) { struct netmap_mem_ptg *ptnmd = (struct netmap_mem_ptg *)nmd; struct mem_pt_if *ptif = malloc(sizeof(*ptif), M_NETMAP, @@ -1967,7 +1940,6 @@ netmap_mem_pt_guest_ifp_add(struct netma ptif->ifp = ifp; ptif->nifp_offset = nifp_offset; - ptif->ptctl = ptctl; if (ptnmd->pt_ifs) { ptif->next = ptnmd->pt_ifs; @@ -2029,62 +2001,6 @@ netmap_mem_pt_guest_ifp_del(struct netma return ret; } -/* Read allocator info from the first netmap_if (only on finalize) */ -static int -netmap_mem_pt_guest_read_shared_info(struct netmap_mem_d *nmd) -{ - struct netmap_mem_ptg *ptnmd = (struct netmap_mem_ptg *)nmd; - struct netmap_mem_shared_info *nms_info; - uint32_t bufsize; - uint32_t nbuffers; - char *vaddr; - vm_paddr_t paddr; - int i; - - nms_info = (struct netmap_mem_shared_info *)ptnmd->nm_addr; - if (strncmp(nms_info->up.ni_name, NMS_NAME, sizeof(NMS_NAME)) != 0) { - D("error, the first slot does not contain shared info"); - return EINVAL; - } - /* check features mem_shared info */ - if ((nms_info->features & (NMS_FEAT_BUF_POOL | NMS_FEAT_MEMSIZE)) != - (NMS_FEAT_BUF_POOL | NMS_FEAT_MEMSIZE)) { - D("error, the shared info does not contain BUF_POOL and MEMSIZE"); - return EINVAL; - } - - bufsize = nms_info->buf_pool_objsize; - nbuffers = nms_info->buf_pool_objtotal; - - /* allocate the lut */ - if (ptnmd->buf_lut.lut == NULL) { - D("allocating lut"); - ptnmd->buf_lut.lut = nm_alloc_lut(nbuffers); - if (ptnmd->buf_lut.lut == NULL) { - D("lut allocation failed"); - return ENOMEM; - } - } - - /* we have physically contiguous memory mapped through PCI BAR */ - vaddr = (char *)(ptnmd->nm_addr) + nms_info->buf_pool_offset; - paddr = ptnmd->nm_paddr + nms_info->buf_pool_offset; - - for (i = 0; i < nbuffers; i++) { - ptnmd->buf_lut.lut[i].vaddr = vaddr; - ptnmd->buf_lut.lut[i].paddr = paddr; - vaddr += bufsize; - paddr += bufsize; - } - - ptnmd->buf_lut.objtotal = nbuffers; - ptnmd->buf_lut.objsize = bufsize; - - nmd->nm_totalsize = nms_info->totalsize; - - return 0; -} - static int netmap_mem_pt_guest_get_lut(struct netmap_mem_d *nmd, struct netmap_lut *lut) { @@ -2147,6 +2063,13 @@ static int netmap_mem_pt_guest_finalize(struct netmap_mem_d *nmd) { struct netmap_mem_ptg *ptnmd = (struct netmap_mem_ptg *)nmd; + uint64_t mem_size; + uint32_t bufsize; + uint32_t nbuffers; + uint32_t poolofs; + vm_paddr_t paddr; + char *vaddr; + int i; int error = 0; nmd->active++; @@ -2159,16 +2082,45 @@ netmap_mem_pt_guest_finalize(struct netm error = ENOMEM; goto err; } - /* map memory through ptnetmap-memdev BAR */ + /* Map memory through ptnetmap-memdev BAR. */ error = nm_os_pt_memdev_iomap(ptnmd->ptn_dev, &ptnmd->nm_paddr, - &ptnmd->nm_addr); + &ptnmd->nm_addr, &mem_size); if (error) goto err; - /* read allcator info and create lut */ - error = netmap_mem_pt_guest_read_shared_info(nmd); - if (error) - goto err; + /* Initialize the lut using the information contained in the + * ptnetmap memory device. */ + bufsize = nm_os_pt_memdev_ioread(ptnmd->ptn_dev, + PTNET_MDEV_IO_BUF_POOL_OBJSZ); + nbuffers = nm_os_pt_memdev_ioread(ptnmd->ptn_dev, + PTNET_MDEV_IO_BUF_POOL_OBJNUM); + + /* allocate the lut */ + if (ptnmd->buf_lut.lut == NULL) { + D("allocating lut"); + ptnmd->buf_lut.lut = nm_alloc_lut(nbuffers); + if (ptnmd->buf_lut.lut == NULL) { + D("lut allocation failed"); + return ENOMEM; + } + } + + /* we have physically contiguous memory mapped through PCI BAR */ + poolofs = nm_os_pt_memdev_ioread(ptnmd->ptn_dev, + PTNET_MDEV_IO_BUF_POOL_OFS); + vaddr = (char *)(ptnmd->nm_addr) + poolofs; + paddr = ptnmd->nm_paddr + poolofs; + + for (i = 0; i < nbuffers; i++) { + ptnmd->buf_lut.lut[i].vaddr = vaddr; + ptnmd->buf_lut.lut[i].paddr = paddr; + vaddr += bufsize; + paddr += bufsize; + } + + ptnmd->buf_lut.objtotal = nbuffers; + ptnmd->buf_lut.objsize = bufsize; + nmd->nm_totalsize = (unsigned int)mem_size; nmd->flags |= NETMAP_MEM_FINALIZED; out: @@ -2248,15 +2200,10 @@ netmap_mem_pt_guest_if_delete(struct net struct mem_pt_if *ptif; NMA_LOCK(na->nm_mem); - ptif = netmap_mem_pt_guest_ifp_lookup(na->nm_mem, na->ifp); if (ptif == NULL) { D("Error: interface %p is not in passthrough", na->ifp); - goto out; } - - ptif->ptctl(na->ifp, PTNETMAP_PTCTL_IFDELETE); -out: NMA_UNLOCK(na->nm_mem); } @@ -2295,7 +2242,6 @@ netmap_mem_pt_guest_rings_create(struct nifp->ring_ofs[i + na->num_tx_rings + 1]); } - //error = ptif->ptctl->nm_ptctl(ifp, PTNETMAP_PTCTL_RINGSCREATE); error = 0; out: NMA_UNLOCK(na->nm_mem); @@ -2331,7 +2277,7 @@ static struct netmap_mem_ops netmap_mem_ /* Called with NMA_LOCK(&nm_mem) held. */ static struct netmap_mem_d * -netmap_mem_pt_guest_find_hostid(nm_memid_t host_id) +netmap_mem_pt_guest_find_memid(nm_memid_t mem_id) { struct netmap_mem_d *mem = NULL; struct netmap_mem_d *scan = netmap_last_mem_d; @@ -2339,7 +2285,7 @@ netmap_mem_pt_guest_find_hostid(nm_memid do { /* find ptnetmap allocator through host ID */ if (scan->ops->nmd_deref == netmap_mem_pt_guest_deref && - ((struct netmap_mem_ptg *)(scan))->nm_host_id == host_id) { + ((struct netmap_mem_ptg *)(scan))->host_mem_id == mem_id) { mem = scan; break; } @@ -2351,7 +2297,7 @@ netmap_mem_pt_guest_find_hostid(nm_memid /* Called with NMA_LOCK(&nm_mem) held. */ static struct netmap_mem_d * -netmap_mem_pt_guest_create(nm_memid_t host_id) +netmap_mem_pt_guest_create(nm_memid_t mem_id) { struct netmap_mem_ptg *ptnmd; int err = 0; @@ -2364,7 +2310,7 @@ netmap_mem_pt_guest_create(nm_memid_t ho } ptnmd->up.ops = &netmap_mem_pt_guest_ops; - ptnmd->nm_host_id = host_id; + ptnmd->host_mem_id = mem_id; ptnmd->pt_ifs = NULL; /* Assign new id in the guest (We have the lock) */ @@ -2388,14 +2334,14 @@ error: * if it is not there */ static struct netmap_mem_d * -netmap_mem_pt_guest_get(nm_memid_t host_id) +netmap_mem_pt_guest_get(nm_memid_t mem_id) { struct netmap_mem_d *nmd; NMA_LOCK(&nm_mem); - nmd = netmap_mem_pt_guest_find_hostid(host_id); + nmd = netmap_mem_pt_guest_find_memid(mem_id); if (nmd == NULL) { - nmd = netmap_mem_pt_guest_create(host_id); + nmd = netmap_mem_pt_guest_create(mem_id); } NMA_UNLOCK(&nm_mem); @@ -2404,7 +2350,7 @@ netmap_mem_pt_guest_get(nm_memid_t host_ /* * The guest allocator can be created by ptnetmap_memdev (during the device - * attach) or by ptnetmap device (e1000/virtio), during the netmap_attach. + * attach) or by ptnetmap device (ptnet), during the netmap_attach. * * The order is not important (we have different order in LINUX and FreeBSD). * The first one, creates the device, and the second one simply attaches it. @@ -2413,12 +2359,12 @@ netmap_mem_pt_guest_get(nm_memid_t host_ /* Called when ptnetmap_memdev is attaching, to attach a new allocator in * the guest */ struct netmap_mem_d * -netmap_mem_pt_guest_attach(struct ptnetmap_memdev *ptn_dev, nm_memid_t host_id) +netmap_mem_pt_guest_attach(struct ptnetmap_memdev *ptn_dev, nm_memid_t mem_id) { struct netmap_mem_d *nmd; struct netmap_mem_ptg *ptnmd; - nmd = netmap_mem_pt_guest_get(host_id); + nmd = netmap_mem_pt_guest_get(mem_id); /* assign this device to the guest allocator */ if (nmd) { @@ -2429,27 +2375,22 @@ netmap_mem_pt_guest_attach(struct ptnetm return nmd; } -/* Called when ptnetmap device (virtio/e1000) is attaching */ +/* Called when ptnet device is attaching */ struct netmap_mem_d * netmap_mem_pt_guest_new(struct ifnet *ifp, unsigned int nifp_offset, - nm_pt_guest_ptctl_t ptctl) + unsigned int memid) { struct netmap_mem_d *nmd; - nm_memid_t host_id; - if (ifp == NULL || ptctl == NULL) { + if (ifp == NULL) { return NULL; } - /* Get the host id allocator. */ - host_id = ptctl(ifp, PTNETMAP_PTCTL_HOSTMEMID); - - nmd = netmap_mem_pt_guest_get(host_id); + nmd = netmap_mem_pt_guest_get((nm_memid_t)memid); if (nmd) { - netmap_mem_pt_guest_ifp_add(nmd, ifp, nifp_offset, - ptctl); + netmap_mem_pt_guest_ifp_add(nmd, ifp, nifp_offset); } return nmd; Modified: head/sys/dev/netmap/netmap_mem2.h ============================================================================== --- head/sys/dev/netmap/netmap_mem2.h Thu Oct 27 09:11:36 2016 (r307999) +++ head/sys/dev/netmap/netmap_mem2.h Thu Oct 27 09:46:22 2016 (r308000) @@ -167,12 +167,14 @@ void netmap_mem_put(struct netmap_mem_d #ifdef WITH_PTNETMAP_GUEST struct netmap_mem_d* netmap_mem_pt_guest_new(struct ifnet *, unsigned int nifp_offset, - nm_pt_guest_ptctl_t); + unsigned int memid); struct ptnetmap_memdev; struct netmap_mem_d* netmap_mem_pt_guest_attach(struct ptnetmap_memdev *, uint16_t); int netmap_mem_pt_guest_ifp_del(struct netmap_mem_d *, struct ifnet *); #endif /* WITH_PTNETMAP_GUEST */ +int netmap_mem_pools_info_get(struct nmreq *, struct netmap_adapter *); + #define NETMAP_MEM_PRIVATE 0x2 /* allocator uses private address space */ #define NETMAP_MEM_IO 0x4 /* the underlying memory is mmapped I/O */ Modified: head/sys/dev/netmap/netmap_pt.c ============================================================================== --- head/sys/dev/netmap/netmap_pt.c Thu Oct 27 09:11:36 2016 (r307999) +++ head/sys/dev/netmap/netmap_pt.c Thu Oct 27 09:46:22 2016 (r308000) @@ -560,13 +560,34 @@ ptnetmap_print_configuration(struct ptne { int k; - D("[PTN] configuration:"); - D(" CSB ptrings @%p, num_rings=%u, features %08x", cfg->ptrings, - cfg->num_rings, cfg->features); + D("ptnetmap configuration:"); + D(" CSB ptrings @%p, num_rings=%u, cfgtype %08x", cfg->ptrings, + cfg->num_rings, cfg->cfgtype); for (k = 0; k < cfg->num_rings; k++) { - D(" ring #%d: iofd=%llu, irqfd=%llu", k, - (unsigned long long)cfg->entries[k].ioeventfd, - (unsigned long long)cfg->entries[k].irqfd); + switch (cfg->cfgtype) { + case PTNETMAP_CFGTYPE_QEMU: { + struct ptnetmap_cfgentry_qemu *e = + (struct ptnetmap_cfgentry_qemu *)(cfg+1) + k; + D(" ring #%d: ioeventfd=%lu, irqfd=%lu", k, + (unsigned long)e->ioeventfd, + (unsigned long)e->irqfd); + break; + } + + case PTNETMAP_CFGTYPE_BHYVE: + { + struct ptnetmap_cfgentry_bhyve *e = + (struct ptnetmap_cfgentry_bhyve *)(cfg+1) + k; + D(" ring #%d: wchan=%lu, ioctl_fd=%lu, " + "ioctl_cmd=%lu, msix_msg_data=%lu, msix_addr=%lu", + k, (unsigned long)e->wchan, + (unsigned long)e->ioctl_fd, + (unsigned long)e->ioctl_cmd, + (unsigned long)e->ioctl_data.msg_data, + (unsigned long)e->ioctl_data.addr); + break; + } + } } } @@ -632,6 +653,7 @@ ptnetmap_create_kthreads(struct netmap_p struct ptnetmap_state *ptns = pth_na->ptns; struct nm_kthread_cfg nmk_cfg; unsigned int num_rings; + uint8_t *cfg_entries = (uint8_t *)(cfg + 1); int k; num_rings = pth_na->up.num_tx_rings + @@ -640,7 +662,6 @@ ptnetmap_create_kthreads(struct netmap_p for (k = 0; k < num_rings; k++) { nmk_cfg.attach_user = 1; /* attach kthread to user process */ nmk_cfg.worker_private = ptnetmap_kring(pth_na, k); - nmk_cfg.event = *(cfg->entries + k); nmk_cfg.type = k; if (k < pth_na->up.num_tx_rings) { nmk_cfg.worker_fn = ptnetmap_tx_handler; @@ -648,7 +669,8 @@ ptnetmap_create_kthreads(struct netmap_p nmk_cfg.worker_fn = ptnetmap_rx_handler; } - ptns->kthreads[k] = nm_os_kthread_create(&nmk_cfg); + ptns->kthreads[k] = nm_os_kthread_create(&nmk_cfg, + cfg->cfgtype, cfg_entries + k * cfg->entry_size); if (ptns->kthreads[k] == NULL) { goto err; } @@ -727,7 +749,7 @@ ptnetmap_read_cfg(struct nmreq *nmr) return NULL; } - cfglen = sizeof(tmp) + tmp.num_rings * sizeof(struct ptnet_ring_cfg); + cfglen = sizeof(tmp) + tmp.num_rings * tmp.entry_size; cfg = malloc(cfglen, M_DEVBUF, M_NOWAIT | M_ZERO); if (!cfg) { return NULL; @@ -750,7 +772,6 @@ static int ptnetmap_create(struct netmap_pt_host_adapter *pth_na, struct ptnetmap_cfg *cfg) { - unsigned ft_mask = (PTNETMAP_CFG_FEAT_CSB | PTNETMAP_CFG_FEAT_EVENTFD); struct ptnetmap_state *ptns; unsigned int num_rings; int ret, i; @@ -761,12 +782,6 @@ ptnetmap_create(struct netmap_pt_host_ad return EINVAL; } - if ((cfg->features & ft_mask) != ft_mask) { - D("ERROR ptnetmap_cfg(%x) does not contain CSB and EVENTFD", - cfg->features); - return EINVAL; - } - num_rings = pth_na->up.num_tx_rings + pth_na->up.num_rx_rings; if (num_rings != cfg->num_rings) { @@ -1240,9 +1255,9 @@ put_out_noputparent: #ifdef WITH_PTNETMAP_GUEST /* - * GUEST ptnetmap generic txsync()/rxsync() used in e1000/virtio-net device - * driver notify is set when we need to send notification to the host *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Oct 27 14:21:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F2F3C23672; Thu, 27 Oct 2016 14:21:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6ECADD76; Thu, 27 Oct 2016 14:21:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9RELs4m013841; Thu, 27 Oct 2016 14:21:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9RELsw3013840; Thu, 27 Oct 2016 14:21:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610271421.u9RELsw3013840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 27 Oct 2016 14:21:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308001 - head/lib/libgcc_eh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 14:21:55 -0000 Author: emaste Date: Thu Oct 27 14:21:54 2016 New Revision: 308001 URL: https://svnweb.freebsd.org/changeset/base/308001 Log: libgcc_eh/libgcc_s: apply hidden visibility only to static libs Modified: head/lib/libgcc_eh/Makefile.inc Modified: head/lib/libgcc_eh/Makefile.inc ============================================================================== --- head/lib/libgcc_eh/Makefile.inc Thu Oct 27 09:46:22 2016 (r308000) +++ head/lib/libgcc_eh/Makefile.inc Thu Oct 27 14:21:54 2016 (r308001) @@ -4,7 +4,7 @@ COMPILERRTDIR= ${SRCTOP}/contrib/compile UNWINDINCDIR= ${SRCTOP}/contrib/llvm/projects/libunwind/include UNWINDSRCDIR= ${SRCTOP}/contrib/llvm/projects/libunwind/src -CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN +STATIC_CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN .PATH: ${COMPILERRTDIR}/lib/builtins .PATH: ${UNWINDSRCDIR} From owner-svn-src-head@freebsd.org Thu Oct 27 16:28:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74A32C23ABB; Thu, 27 Oct 2016 16:28:22 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay103.isp.belgacom.be (mailrelay103.isp.belgacom.be [195.238.20.130]) (using TLSv1.2 with cipher RC4-SHA (128/128 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign Organization Validation CA - SHA256 - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB581E0E; Thu, 27 Oct 2016 16:28:20 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2CsAgCHKhJY/1QiyVBcHAEBBAEBCgEBg?= =?us-ascii?q?yoBAQEBAR1KDn2NN5Z+h16MYYIHKIV7AoIBQBQBAgEBAQEBAQFiKIRjAQEEJxM?= =?us-ascii?q?cIxALDgYECSUPEhgeBhOIOgMbCrxHDYNrAQEBAQEBAQEBAQEBAQEBASGLEoJHh?= =?us-ascii?q?18BBJlhNYYthlKDGXKBB06EH4M6hW+IcYQahAEeNl+FCzw0hikrggsBAQE?= Received: from 84.34-201-80.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([80.201.34.84]) by relay.skynet.be with ESMTP; 27 Oct 2016 18:26:36 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id u9RGQZoI036835; Thu, 27 Oct 2016 18:26:35 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Thu, 27 Oct 2016 18:26:35 +0200 From: Tijl Coosemans To: Konstantin Belousov Cc: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307936 - head/sys/amd64/amd64 Message-ID: <20161027182635.187d5f6d@kalimero.tijl.coosemans.org> In-Reply-To: <20161026132550.GV54029@kib.kiev.ua> References: <201610251713.u9PHDkq2076226@repo.freebsd.org> <20161025212600.36e91455@kalimero.tijl.coosemans.org> <20161026132550.GV54029@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 16:28:22 -0000 On Wed, 26 Oct 2016 16:25:50 +0300 Konstantin Belousov wrote: > On Tue, Oct 25, 2016 at 09:26:00PM +0200, Tijl Coosemans wrote: >> On Tue, 25 Oct 2016 17:13:46 +0000 (UTC) Gleb Smirnoff wrote: >>> Author: glebius >>> Date: Tue Oct 25 17:13:46 2016 >>> New Revision: 307936 >>> URL: https://svnweb.freebsd.org/changeset/base/307936 >>> >>> Log: >>> The argument validation in r296956 was not enough to close all possible >>> overflows in sysarch(2). >>> >>> Submitted by: Kun Yang >>> Patch by: kib >>> Security: SA-16:15 >>> >>> Modified: >>> head/sys/amd64/amd64/sys_machdep.c >> >> This patch and r296956 need to be applied to i386 too, don't they? > I do not think so. The amd64 bug is that I thought that the overflow > checks were not needed, which appeared to be not true. > > i386_set_ldt(), which is the i386 version of amd64_set_ldt(), already > contained the comparisions of largest_ld with pldt->ldt_len etc. > > Still, independend look at the i386 (and amd64 version as well) is more > than welcomed, so please read the code yourself. It looks ok to me. i386 checks kargs.largs.num > MAX_LD early in sysarch so start + num cannot overflow. On amd64 this check was removed in https://svnweb.freebsd.org/base?view=revision&revision=217543 From owner-svn-src-head@freebsd.org Thu Oct 27 18:46:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B0E3C24D9A; Thu, 27 Oct 2016 18:46:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1125164; Thu, 27 Oct 2016 18:46:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9RIkrtt017783; Thu, 27 Oct 2016 18:46:53 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9RIkr1I017780; Thu, 27 Oct 2016 18:46:53 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201610271846.u9RIkr1I017780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 27 Oct 2016 18:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308003 - 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.23 Precedence: list List-Id: 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, 27 Oct 2016 18:46:54 -0000 Author: dim Date: Thu Oct 27 18:46:52 2016 New Revision: 308003 URL: https://svnweb.freebsd.org/changeset/base/308003 Log: Revert r307823 (Use upstream suffixes for LLVM IR) for now. It causes a number of ports to fail, which use bmake, and use .ll file extensions (usually for for C++-based lex input). Reported by: antoine Modified: head/share/mk/bsd.suffixes.mk head/share/mk/sys.mk Modified: head/share/mk/bsd.suffixes.mk ============================================================================== --- head/share/mk/bsd.suffixes.mk Thu Oct 27 15:51:39 2016 (r308002) +++ head/share/mk/bsd.suffixes.mk Thu Oct 27 18:46:52 2016 (r308003) @@ -20,10 +20,10 @@ ${CC} ${STATIC_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} -.c.bc: +.c.bco: ${CC} -emit-llvm ${IR_CFLAGS} -c ${.IMPSRC} -o ${.TARGET} -.c.ll: +.c.llo: ${CC} -emit-llvm ${IR_CFLAGS} -S ${.IMPSRC} -o ${.TARGET} .cc .cpp .cxx .C: @@ -32,10 +32,10 @@ .cc.o .cpp.o .cxx.o .C.o: ${CXX} ${STATIC_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} -.cc.bc .cpp.bc .cxx.bc .C.bc: +.cc.bco .cpp.bco .cxx.bco .C.bco: ${CXX} -emit-llvm ${IR_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} -.cc.ll .cpp.ll .cxx.ll .C.ll: +.cc.llo .cpp.llo .cxx.llo .C.llo: ${CXX} -emit-llvm ${IR_CXXFLAGS} -S ${.IMPSRC} -o ${.TARGET} .m.o: Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Thu Oct 27 15:51:39 2016 (r308002) +++ head/share/mk/sys.mk Thu Oct 27 18:46:52 2016 (r308003) @@ -121,7 +121,7 @@ META_MODE?= normal .if defined(%POSIX) .SUFFIXES: .o .c .y .l .a .sh .f .else -.SUFFIXES: .out .a .ln .o .bc .ll .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .asm .s .cl .p .h .sh +.SUFFIXES: .out .a .ln .o .bco .llo .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .asm .s .cl .p .h .sh .endif AR ?= ar From owner-svn-src-head@freebsd.org Thu Oct 27 21:23:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D4F9C24686; Thu, 27 Oct 2016 21:23:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07B59987; Thu, 27 Oct 2016 21:23:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9RLNF9i079523; Thu, 27 Oct 2016 21:23:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9RLNENb079520; Thu, 27 Oct 2016 21:23:14 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610272123.u9RLNENb079520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 27 Oct 2016 21:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308004 - in head/sys: amd64/amd64 i386/i386 x86/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.23 Precedence: list List-Id: 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, 27 Oct 2016 21:23:16 -0000 Author: jhb Date: Thu Oct 27 21:23:14 2016 New Revision: 308004 URL: https://svnweb.freebsd.org/changeset/base/308004 Log: MFamd64: Add bounds checks on addresses used with /dev/mem. Reject attempts to read from or memory map offsets in /dev/mem that are beyond the maximum-supported physical address of the current CPU. Reviewed by: kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D7408 Modified: head/sys/amd64/amd64/mem.c head/sys/i386/i386/mem.c head/sys/x86/include/x86_var.h Modified: head/sys/amd64/amd64/mem.c ============================================================================== --- head/sys/amd64/amd64/mem.c Thu Oct 27 18:46:52 2016 (r308003) +++ head/sys/amd64/amd64/mem.c Thu Oct 27 21:23:14 2016 (r308004) @@ -140,7 +140,7 @@ memrw(struct cdev *dev, struct uio *uio, error = uiomove((void *)vd, c, uio); break; } - if (v >= (1ULL << cpu_maxphyaddr)) { + if (v > cpu_getmaxphyaddr()) { error = EFAULT; break; } @@ -169,7 +169,7 @@ memmmap(struct cdev *dev, vm_ooffset_t o int prot __unused, vm_memattr_t *memattr __unused) { if (dev2unit(dev) == CDEV_MINOR_MEM) { - if (offset >= (1ULL << cpu_maxphyaddr)) + if (offset > cpu_getmaxphyaddr()) return (-1); *paddr = offset; return (0); Modified: head/sys/i386/i386/mem.c ============================================================================== --- head/sys/i386/i386/mem.c Thu Oct 27 18:46:52 2016 (r308003) +++ head/sys/i386/i386/mem.c Thu Oct 27 21:23:14 2016 (r308004) @@ -108,8 +108,11 @@ memrw(struct cdev *dev, struct uio *uio, continue; } if (dev2unit(dev) == CDEV_MINOR_MEM) { - pa = uio->uio_offset; - pa &= ~PAGE_MASK; + if (uio->uio_offset > cpu_getmaxphyaddr()) { + error = EFAULT; + break; + } + pa = trunc_page(uio->uio_offset); } else { /* * Extract the physical page since the mapping may @@ -162,6 +165,8 @@ memmmap(struct cdev *dev, vm_ooffset_t o int prot __unused, vm_memattr_t *memattr __unused) { if (dev2unit(dev) == CDEV_MINOR_MEM) { + if (offset > cpu_getmaxphyaddr()) + return (-1); *paddr = offset; return (0); } Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Thu Oct 27 18:46:52 2016 (r308003) +++ head/sys/x86/include/x86_var.h Thu Oct 27 21:23:14 2016 (r308004) @@ -94,6 +94,20 @@ struct trapframe; */ typedef void alias_for_inthand_t(void); +/* + * Returns the maximum physical address that can be used with the + * current system. + */ +static __inline vm_paddr_t +cpu_getmaxphyaddr(void) +{ +#if defined(__i386__) && !defined(PAE) + return (0xffffffff); +#else + return ((1ULL << cpu_maxphyaddr) - 1); +#endif +} + void *alloc_fpusave(int flags); void busdma_swi(void); bool cpu_mwait_usable(void); From owner-svn-src-head@freebsd.org Thu Oct 27 21:31:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B2ADC2483D; Thu, 27 Oct 2016 21:31:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2A8CDC1; Thu, 27 Oct 2016 21:31:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9RLVvUb082464; Thu, 27 Oct 2016 21:31:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9RLVvJZ082463; Thu, 27 Oct 2016 21:31:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610272131.u9RLVvJZ082463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 27 Oct 2016 21:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308005 - head/sys/x86/cpufreq X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 27 Oct 2016 21:31:58 -0000 Author: jhb Date: Thu Oct 27 21:31:56 2016 New Revision: 308005 URL: https://svnweb.freebsd.org/changeset/base/308005 Log: Add powerd(8) support for several families of AMD CPUs. Use the same logic to calculate the nominal CPU frequency from the P-state MSRs on family 0x12, 0x15, and 0x16 CPUs as is used for family 0x10. Family 0x14 was included in the original patch in the PR but I left that out as the BIOS writer's guide for family 0x14 CPUs show a different layout for the relevant MSR and include a different formulate for calculating the frequency. While here, simplify a few expressions and print out the family of unsupported CPUs in hex rather than decimal. PR: 212020 Submitted by: Anthony Jenkins MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D7587 Modified: head/sys/x86/cpufreq/hwpstate.c Modified: head/sys/x86/cpufreq/hwpstate.c ============================================================================== --- head/sys/x86/cpufreq/hwpstate.c Thu Oct 27 21:23:14 2016 (r308004) +++ head/sys/x86/cpufreq/hwpstate.c Thu Oct 27 21:31:56 2016 (r308005) @@ -408,25 +408,27 @@ hwpstate_get_info_from_msr(device_t dev) hwpstate_set = sc->hwpstate_settings; for (i = 0; i < sc->cfnum; i++) { msr = rdmsr(MSR_AMD_10H_11H_CONFIG + i); - if ((msr & ((uint64_t)1 << 63)) != ((uint64_t)1 << 63)) { + if ((msr & ((uint64_t)1 << 63)) == 0) { HWPSTATE_DEBUG(dev, "msr is not valid.\n"); return (ENXIO); } did = AMD_10H_11H_CUR_DID(msr); fid = AMD_10H_11H_CUR_FID(msr); + + /* Convert fid/did to frequency. */ switch(family) { case 0x11: - /* fid/did to frequency */ - hwpstate_set[i].freq = 100 * (fid + 0x08) / (1 << did); + hwpstate_set[i].freq = (100 * (fid + 0x08)) >> did; break; case 0x10: - /* fid/did to frequency */ - hwpstate_set[i].freq = 100 * (fid + 0x10) / (1 << did); + case 0x12: + case 0x15: + case 0x16: + hwpstate_set[i].freq = (100 * (fid + 0x10)) >> did; break; default: - HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family %d CPU's are not implemented yet. sorry.\n", family); + HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family 0x%02x CPU's are not implemented yet. sorry.\n", family); return (ENXIO); - break; } hwpstate_set[i].pstate_id = i; /* There was volts calculation, but deleted it. */ From owner-svn-src-head@freebsd.org Fri Oct 28 00:04:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 651F1C249B8; Fri, 28 Oct 2016 00:04:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F28B277; Fri, 28 Oct 2016 00:04:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S045K2040100; Fri, 28 Oct 2016 00:04:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S044wx040090; Fri, 28 Oct 2016 00:04:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610280004.u9S044wx040090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 28 Oct 2016 00:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308006 - in head/contrib/llvm/projects/libunwind: include src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 00:04:06 -0000 Author: emaste Date: Fri Oct 28 00:04:04 2016 New Revision: 308006 URL: https://svnweb.freebsd.org/changeset/base/308006 Log: libunwind: consistently add \n to log and trace messages Previously most messages included a newline in the string, but a few of them were missing. Fix these and simplify by just adding the newline in the _LIBUNWIND_LOG macro itself. While here correct 'libuwind' typo (missing 'n'). Upstream LLVM libunwind commits r280086 and r280103. Modified: head/contrib/llvm/projects/libunwind/include/libunwind.h head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hpp head/contrib/llvm/projects/libunwind/src/EHHeaderParser.hpp head/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp head/contrib/llvm/projects/libunwind/src/Unwind-sjlj.c head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp head/contrib/llvm/projects/libunwind/src/UnwindLevel1-gcc-ext.c head/contrib/llvm/projects/libunwind/src/UnwindLevel1.c head/contrib/llvm/projects/libunwind/src/config.h head/contrib/llvm/projects/libunwind/src/libunwind.cpp Modified: head/contrib/llvm/projects/libunwind/include/libunwind.h ============================================================================== --- head/contrib/llvm/projects/libunwind/include/libunwind.h Thu Oct 27 21:31:56 2016 (r308005) +++ head/contrib/llvm/projects/libunwind/include/libunwind.h Fri Oct 28 00:04:04 2016 (r308006) @@ -6,7 +6,7 @@ // Source Licenses. See LICENSE.TXT for details. // // -// Compatible with libuwind API documented at: +// Compatible with libunwind API documented at: // http://www.nongnu.org/libunwind/man/libunwind(3).html // //===----------------------------------------------------------------------===// @@ -120,7 +120,7 @@ extern int unw_init_remote_thread(unw_cu #endif /* UNW_REMOTE */ /* - * traditional libuwind "remote" API + * traditional libunwind "remote" API * NOT IMPLEMENTED on Mac OS X * * extern int unw_init_remote(unw_cursor_t*, unw_addr_space_t, Modified: head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp Thu Oct 27 21:31:56 2016 (r308005) +++ head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp Fri Oct 28 00:04:04 2016 (r308006) @@ -374,7 +374,7 @@ inline bool LocalAddressSpace::findUnwin (_Unwind_Ptr) targetAddr, &length); info.arm_section_length = (uintptr_t)length; #endif - _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x\n", + _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x", info.arm_section, info.arm_section_length); if (info.arm_section && info.arm_section_length) return true; Modified: head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hpp Thu Oct 27 21:31:56 2016 (r308005) +++ head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hpp Fri Oct 28 00:04:04 2016 (r308006) @@ -105,7 +105,7 @@ int CompactUnwinder_x86::stepWithComp default: (void)functionStart; _LIBUNWIND_DEBUG_LOG("bad register for EBP frame, encoding=%08X for " - "function starting at 0x%X\n", + "function starting at 0x%X", compactEncoding, functionStart); _LIBUNWIND_ABORT("invalid compact unwind encoding"); } @@ -224,7 +224,7 @@ int CompactUnwinder_x86::stepWithComp break; default: _LIBUNWIND_DEBUG_LOG("bad register for frameless, encoding=%08X for " - "function starting at 0x%X\n", + "function starting at 0x%X", encoding, functionStart); _LIBUNWIND_ABORT("invalid compact unwind encoding"); } @@ -336,7 +336,7 @@ int CompactUnwinder_x86_64::stepWithC default: (void)functionStart; _LIBUNWIND_DEBUG_LOG("bad register for RBP frame, encoding=%08X for " - "function starting at 0x%llX\n", + "function starting at 0x%llX", compactEncoding, functionStart); _LIBUNWIND_ABORT("invalid compact unwind encoding"); } @@ -455,7 +455,7 @@ int CompactUnwinder_x86_64::stepWithC break; default: _LIBUNWIND_DEBUG_LOG("bad register for frameless, encoding=%08X for " - "function starting at 0x%llX\n", + "function starting at 0x%llX", encoding, functionStart); _LIBUNWIND_ABORT("invalid compact unwind encoding"); } Modified: head/contrib/llvm/projects/libunwind/src/EHHeaderParser.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/EHHeaderParser.hpp Thu Oct 27 21:31:56 2016 (r308005) +++ head/contrib/llvm/projects/libunwind/src/EHHeaderParser.hpp Fri Oct 28 00:04:04 2016 (r308006) @@ -85,7 +85,7 @@ bool EHHeaderParser::decodeTableEntry const char *message = CFI_Parser::decodeFDE(addressSpace, fde, fdeInfo, cieInfo); if (message != NULL) { - _LIBUNWIND_DEBUG_LOG("EHHeaderParser::decodeTableEntry: bad fde: %s\n", + _LIBUNWIND_DEBUG_LOG("EHHeaderParser::decodeTableEntry: bad fde: %s", message); return false; } Modified: head/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp Thu Oct 27 21:31:56 2016 (r308005) +++ head/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp Fri Oct 28 00:04:04 2016 (r308006) @@ -454,7 +454,7 @@ unwind_phase1(unw_context_t *uc, unw_cur unw_proc_info_t frameInfo; if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info " - "failed => _URC_FATAL_PHASE1_ERROR\n", + "failed => _URC_FATAL_PHASE1_ERROR", static_cast(exception_object)); return _URC_FATAL_PHASE1_ERROR; } @@ -472,7 +472,7 @@ unwind_phase1(unw_context_t *uc, unw_cur unw_get_reg(cursor, UNW_REG_IP, &pc); _LIBUNWIND_TRACE_UNWINDING( "unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, " - "lsda=0x%llX, personality=0x%llX\n", + "lsda=0x%llX, personality=0x%llX", static_cast(exception_object), (long long)pc, (long long)frameInfo.start_ip, functionName, (long long)frameInfo.lsda, (long long)frameInfo.handler); @@ -484,7 +484,7 @@ unwind_phase1(unw_context_t *uc, unw_cur __personality_routine p = (__personality_routine)(long)(frameInfo.handler); _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase1(ex_ojb=%p): calling personality function %p\n", + "unwind_phase1(ex_ojb=%p): calling personality function %p", static_cast(exception_object), reinterpret_cast(reinterpret_cast(p))); struct _Unwind_Context *context = (struct _Unwind_Context *)(cursor); @@ -496,7 +496,7 @@ unwind_phase1(unw_context_t *uc, unw_cur (*p)(_US_VIRTUAL_UNWIND_FRAME, exception_object, context); _LIBUNWIND_TRACE_UNWINDING( "unwind_phase1(ex_ojb=%p): personality result %d start_ip %x ehtp %p " - "additional %x\n", + "additional %x", static_cast(exception_object), personalityResult, exception_object->pr_cache.fnstart, static_cast(exception_object->pr_cache.ehtp), @@ -508,13 +508,13 @@ unwind_phase1(unw_context_t *uc, unw_cur handlerNotFound = false; // p should have initialized barrier_cache. EHABI #7.3.5 _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND \n", + "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND", static_cast(exception_object)); return _URC_NO_REASON; case _URC_CONTINUE_UNWIND: _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase1(ex_ojb=%p): _URC_CONTINUE_UNWIND\n", + "unwind_phase1(ex_ojb=%p): _URC_CONTINUE_UNWIND", static_cast(exception_object)); // continue unwinding break; @@ -526,7 +526,7 @@ unwind_phase1(unw_context_t *uc, unw_cur default: // something went wrong _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR\n", + "unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR", static_cast(exception_object)); return _URC_FATAL_PHASE1_ERROR; } @@ -541,13 +541,13 @@ static _Unwind_Reason_Code unwind_phase2 // See comment at the start of unwind_phase1 regarding VRS integrity. unw_init_local(cursor, uc); - _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n", + _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)", static_cast(exception_object)); int frame_count = 0; // Walk each frame until we reach where search phase said to stop. while (true) { - // Ask libuwind to get next frame (skip over first which is + // Ask libunwind to get next frame (skip over first which is // _Unwind_RaiseException or _Unwind_Resume). // // Resume only ever makes sense for 1 frame. @@ -572,7 +572,7 @@ static _Unwind_Reason_Code unwind_phase2 unw_get_reg(cursor, UNW_REG_SP, &sp); if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info " - "failed => _URC_FATAL_PHASE2_ERROR\n", + "failed => _URC_FATAL_PHASE2_ERROR", static_cast(exception_object)); return _URC_FATAL_PHASE2_ERROR; } @@ -588,7 +588,7 @@ static _Unwind_Reason_Code unwind_phase2 functionName = ".anonymous."; _LIBUNWIND_TRACE_UNWINDING( "unwind_phase2(ex_ojb=%p): start_ip=0x%llX, func=%s, sp=0x%llX, " - "lsda=0x%llX, personality=0x%llX\n", + "lsda=0x%llX, personality=0x%llX", static_cast(exception_object), (long long)frameInfo.start_ip, functionName, (long long)sp, (long long)frameInfo.lsda, (long long)frameInfo.handler); @@ -610,7 +610,7 @@ static _Unwind_Reason_Code unwind_phase2 case _URC_CONTINUE_UNWIND: // Continue unwinding _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND\n", + "unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND", static_cast(exception_object)); // EHABI #7.2 if (sp == exception_object->barrier_cache.sp) { @@ -621,7 +621,7 @@ static _Unwind_Reason_Code unwind_phase2 break; case _URC_INSTALL_CONTEXT: _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase2(ex_ojb=%p): _URC_INSTALL_CONTEXT\n", + "unwind_phase2(ex_ojb=%p): _URC_INSTALL_CONTEXT", static_cast(exception_object)); // Personality routine says to transfer control to landing pad. // We may get control back if landing pad calls _Unwind_Resume(). @@ -630,7 +630,7 @@ static _Unwind_Reason_Code unwind_phase2 unw_get_reg(cursor, UNW_REG_IP, &pc); unw_get_reg(cursor, UNW_REG_SP, &sp); _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering " - "user code with ip=0x%llX, sp=0x%llX\n", + "user code with ip=0x%llX, sp=0x%llX", static_cast(exception_object), (long long)pc, (long long)sp); } @@ -668,7 +668,7 @@ static _Unwind_Reason_Code unwind_phase2 /// Called by __cxa_throw. Only returns if there is a fatal error. _LIBUNWIND_EXPORT _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Exception *exception_object) { - _LIBUNWIND_TRACE_API("_Unwind_RaiseException(ex_obj=%p)\n", + _LIBUNWIND_TRACE_API("_Unwind_RaiseException(ex_obj=%p)", static_cast(exception_object)); unw_context_t uc; unw_cursor_t cursor; @@ -706,7 +706,7 @@ _LIBUNWIND_EXPORT void _Unwind_Complete( /// in turn calls _Unwind_Resume_or_Rethrow(). _LIBUNWIND_EXPORT void _Unwind_Resume(_Unwind_Exception *exception_object) { - _LIBUNWIND_TRACE_API("_Unwind_Resume(ex_obj=%p)\n", + _LIBUNWIND_TRACE_API("_Unwind_Resume(ex_obj=%p)", static_cast(exception_object)); unw_context_t uc; unw_cursor_t cursor; @@ -730,7 +730,7 @@ _Unwind_GetLanguageSpecificData(struct _ if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS) result = (uintptr_t)frameInfo.lsda; _LIBUNWIND_TRACE_API( - "_Unwind_GetLanguageSpecificData(context=%p) => 0x%llx\n", + "_Unwind_GetLanguageSpecificData(context=%p) => 0x%llx", static_cast(context), (long long)result); return result; } @@ -758,7 +758,7 @@ _Unwind_VRS_Set(_Unwind_Context *context uint32_t regno, _Unwind_VRS_DataRepresentation representation, void *valuep) { _LIBUNWIND_TRACE_API("_Unwind_VRS_Set(context=%p, regclass=%d, reg=%d, " - "rep=%d, value=0x%llX)\n", + "rep=%d, value=0x%llX)", static_cast(context), regclass, regno, representation, ValueAsBitPattern(representation, valuep)); @@ -863,7 +863,7 @@ _Unwind_VRS_Result _Unwind_VRS_Get( _Unwind_VRS_Get_Internal(context, regclass, regno, representation, valuep); _LIBUNWIND_TRACE_API("_Unwind_VRS_Get(context=%p, regclass=%d, reg=%d, " - "rep=%d, value=0x%llX, result = %d)\n", + "rep=%d, value=0x%llX, result = %d)", static_cast(context), regclass, regno, representation, ValueAsBitPattern(representation, valuep), result); @@ -875,7 +875,7 @@ _Unwind_VRS_Pop(_Unwind_Context *context uint32_t discriminator, _Unwind_VRS_DataRepresentation representation) { _LIBUNWIND_TRACE_API("_Unwind_VRS_Pop(context=%p, regclass=%d, " - "discriminator=%d, representation=%d)\n", + "discriminator=%d, representation=%d)", static_cast(context), regclass, discriminator, representation); switch (regclass) { @@ -948,7 +948,7 @@ _Unwind_GetRegionStart(struct _Unwind_Co uintptr_t result = 0; if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS) result = (uintptr_t)frameInfo.start_ip; - _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%llX\n", + _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%llX", static_cast(context), (long long)result); return result; } @@ -958,7 +958,7 @@ _Unwind_GetRegionStart(struct _Unwind_Co // is caught. _LIBUNWIND_EXPORT void _Unwind_DeleteException(_Unwind_Exception *exception_object) { - _LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)\n", + _LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)", static_cast(exception_object)); if (exception_object->exception_cleanup != NULL) (*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT, Modified: head/contrib/llvm/projects/libunwind/src/Unwind-sjlj.c ============================================================================== --- head/contrib/llvm/projects/libunwind/src/Unwind-sjlj.c Thu Oct 27 21:31:56 2016 (r308005) +++ head/contrib/llvm/projects/libunwind/src/Unwind-sjlj.c Fri Oct 28 00:04:04 2016 (r308006) @@ -72,7 +72,7 @@ _Unwind_SjLj_Unregister(struct _Unwind_F static _Unwind_Reason_Code unwind_phase1(struct _Unwind_Exception *exception_object) { _Unwind_FunctionContext_t c = __Unwind_SjLj_GetTopOfFunctionStack(); - _LIBUNWIND_TRACE_UNWINDING("unwind_phase1: initial function-context=%p\n", c); + _LIBUNWIND_TRACE_UNWINDING("unwind_phase1: initial function-context=%p", c); // walk each frame looking for a place to stop for (bool handlerNotFound = true; handlerNotFound; c = c->prev) { @@ -80,17 +80,17 @@ unwind_phase1(struct _Unwind_Exception * // check for no more frames if (c == NULL) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): reached " - "bottom => _URC_END_OF_STACK\n", + "bottom => _URC_END_OF_STACK", exception_object); return _URC_END_OF_STACK; } - _LIBUNWIND_TRACE_UNWINDING("unwind_phase1: function-context=%p\n", c); + _LIBUNWIND_TRACE_UNWINDING("unwind_phase1: function-context=%p", c); // if there is a personality routine, ask it if it will want to stop at this // frame if (c->personality != NULL) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): calling " - "personality function %p\n", + "personality function %p", exception_object, c->personality); _Unwind_Reason_Code personalityResult = (*c->personality)( 1, _UA_SEARCH_PHASE, exception_object->exception_class, @@ -102,19 +102,19 @@ unwind_phase1(struct _Unwind_Exception * handlerNotFound = false; exception_object->private_2 = (uintptr_t) c; _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): " - "_URC_HANDLER_FOUND\n", exception_object); + "_URC_HANDLER_FOUND", exception_object); return _URC_NO_REASON; case _URC_CONTINUE_UNWIND: _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): " - "_URC_CONTINUE_UNWIND\n", exception_object); + "_URC_CONTINUE_UNWIND", exception_object); // continue unwinding break; default: // something went wrong _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR\n", + "unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR", exception_object); return _URC_FATAL_PHASE1_ERROR; } @@ -126,18 +126,18 @@ unwind_phase1(struct _Unwind_Exception * static _Unwind_Reason_Code unwind_phase2(struct _Unwind_Exception *exception_object) { - _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n", exception_object); + _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)", exception_object); // walk each frame until we reach where search phase said to stop _Unwind_FunctionContext_t c = __Unwind_SjLj_GetTopOfFunctionStack(); while (true) { - _LIBUNWIND_TRACE_UNWINDING("unwind_phase2s(ex_ojb=%p): context=%p\n", + _LIBUNWIND_TRACE_UNWINDING("unwind_phase2s(ex_ojb=%p): context=%p", exception_object, c); // check for no more frames if (c == NULL) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached " - "bottom => _URC_END_OF_STACK\n", + "bottom => _URC_END_OF_STACK", exception_object); return _URC_END_OF_STACK; } @@ -157,7 +157,7 @@ unwind_phase2(struct _Unwind_Exception * case _URC_CONTINUE_UNWIND: // continue unwinding _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND\n", + "unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND", exception_object); if ((uintptr_t) c == exception_object->private_2) { // phase 1 said we would stop at this frame, but we did not... @@ -168,7 +168,7 @@ unwind_phase2(struct _Unwind_Exception * case _URC_INSTALL_CONTEXT: _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): " "_URC_INSTALL_CONTEXT, will resume at " - "landing pad %p\n", + "landing pad %p", exception_object, c->jbuf[1]); // personality routine says to transfer control to landing pad // we may get control back if landing pad calls _Unwind_Resume() @@ -202,7 +202,7 @@ unwind_phase2_forced(struct _Unwind_Exce // get next frame (skip over first which is _Unwind_RaiseException) if (c == NULL) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached " - "bottom => _URC_END_OF_STACK\n", + "bottom => _URC_END_OF_STACK", exception_object); return _URC_END_OF_STACK; } @@ -214,11 +214,11 @@ unwind_phase2_forced(struct _Unwind_Exce (*stop)(1, action, exception_object->exception_class, exception_object, (struct _Unwind_Context *)c, stop_parameter); _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " - "stop function returned %d\n", + "stop function returned %d", exception_object, stopResult); if (stopResult != _URC_NO_REASON) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " - "stopped by stop function\n", + "stopped by stop function", exception_object); return _URC_FATAL_PHASE2_ERROR; } @@ -227,7 +227,7 @@ unwind_phase2_forced(struct _Unwind_Exce if (c->personality != NULL) { __personality_routine p = (__personality_routine) c->personality; _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " - "calling personality function %p\n", + "calling personality function %p", exception_object, p); _Unwind_Reason_Code personalityResult = (*p)(1, action, exception_object->exception_class, exception_object, @@ -235,13 +235,13 @@ unwind_phase2_forced(struct _Unwind_Exce switch (personalityResult) { case _URC_CONTINUE_UNWIND: _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " - "personality returned _URC_CONTINUE_UNWIND\n", + "personality returned _URC_CONTINUE_UNWIND", exception_object); // destructors called, continue unwinding break; case _URC_INSTALL_CONTEXT: _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " - "personality returned _URC_INSTALL_CONTEXT\n", + "personality returned _URC_INSTALL_CONTEXT", exception_object); // we may get control back if landing pad calls _Unwind_Resume() __Unwind_SjLj_SetTopOfFunctionStack(c); @@ -251,7 +251,7 @@ unwind_phase2_forced(struct _Unwind_Exce // something went wrong _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " "personality returned %d, " - "_URC_FATAL_PHASE2_ERROR\n", + "_URC_FATAL_PHASE2_ERROR", exception_object, personalityResult); return _URC_FATAL_PHASE2_ERROR; } @@ -262,7 +262,7 @@ unwind_phase2_forced(struct _Unwind_Exce // call stop function one last time and tell it we've reached the end of the // stack _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): calling stop " - "function with _UA_END_OF_STACK\n", + "function with _UA_END_OF_STACK", exception_object); _Unwind_Action lastAction = (_Unwind_Action)(_UA_FORCE_UNWIND | _UA_CLEANUP_PHASE | _UA_END_OF_STACK); @@ -278,7 +278,7 @@ unwind_phase2_forced(struct _Unwind_Exce /// Called by __cxa_throw. Only returns if there is a fatal error _LIBUNWIND_EXPORT _Unwind_Reason_Code _Unwind_SjLj_RaiseException(struct _Unwind_Exception *exception_object) { - _LIBUNWIND_TRACE_API("_Unwind_SjLj_RaiseException(ex_obj=%p)\n", exception_object); + _LIBUNWIND_TRACE_API("_Unwind_SjLj_RaiseException(ex_obj=%p)", exception_object); // mark that this is a non-forced unwind, so _Unwind_Resume() can do the right // thing @@ -308,7 +308,7 @@ _Unwind_SjLj_RaiseException(struct _Unwi /// __cxa_rethrow() which in turn calls _Unwind_Resume_or_Rethrow() _LIBUNWIND_EXPORT void _Unwind_SjLj_Resume(struct _Unwind_Exception *exception_object) { - _LIBUNWIND_TRACE_API("_Unwind_SjLj_Resume(ex_obj=%p)\n", exception_object); + _LIBUNWIND_TRACE_API("_Unwind_SjLj_Resume(ex_obj=%p)", exception_object); if (exception_object->private_1 != 0) unwind_phase2_forced(exception_object, @@ -326,7 +326,7 @@ _Unwind_SjLj_Resume(struct _Unwind_Excep _LIBUNWIND_EXPORT _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception *exception_object) { _LIBUNWIND_TRACE_API("__Unwind_SjLj_Resume_or_Rethrow(ex_obj=%p), " - "private_1=%ld\n", + "private_1=%ld", exception_object, exception_object->private_1); // If this is non-forced and a stopping place was found, then this is a // re-throw. @@ -350,7 +350,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) { _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; _LIBUNWIND_TRACE_API("_Unwind_GetLanguageSpecificData(context=%p) " - "=> 0x%0lX\n", context, ufc->lsda); + "=> 0x%0lX", context, ufc->lsda); return ufc->lsda; } @@ -358,7 +358,7 @@ _Unwind_GetLanguageSpecificData(struct _ /// Called by personality handler during phase 2 to get register values. _LIBUNWIND_EXPORT uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index) { - _LIBUNWIND_TRACE_API("_Unwind_GetGR(context=%p, reg=%d)\n", + _LIBUNWIND_TRACE_API("_Unwind_GetGR(context=%p, reg=%d)", context, index); _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; return ufc->resumeParameters[index]; @@ -368,7 +368,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetG /// Called by personality handler during phase 2 to alter register values. _LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int index, uintptr_t new_value) { - _LIBUNWIND_TRACE_API("_Unwind_SetGR(context=%p, reg=%d, value=0x%0lX)\n" + _LIBUNWIND_TRACE_API("_Unwind_SetGR(context=%p, reg=%d, value=0x%0lX)" , context, index, new_value); _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; ufc->resumeParameters[index] = new_value; @@ -378,7 +378,7 @@ _LIBUNWIND_EXPORT void _Unwind_SetGR(str /// Called by personality handler during phase 2 to get instruction pointer. _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) { _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; - _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%lX\n", context, + _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%lX", context, ufc->resumeLocation + 1); return ufc->resumeLocation + 1; } @@ -391,7 +391,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetI int *ipBefore) { _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; *ipBefore = 0; - _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p, %p) => 0x%lX\n", + _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p, %p) => 0x%lX", context, ipBefore, ufc->resumeLocation + 1); return ufc->resumeLocation + 1; } @@ -400,7 +400,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetI /// Called by personality handler during phase 2 to alter instruction pointer. _LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context, uintptr_t new_value) { - _LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%0lX)\n", + _LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%0lX)", context, new_value); _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; ufc->resumeLocation = new_value - 1; @@ -413,7 +413,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context) { // Not supported or needed for sjlj based unwinding (void)context; - _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p)\n", context); + _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p)", context); return 0; } @@ -422,7 +422,7 @@ _Unwind_GetRegionStart(struct _Unwind_Co /// is caught. _LIBUNWIND_EXPORT void _Unwind_DeleteException(struct _Unwind_Exception *exception_object) { - _LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)\n", + _LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)", exception_object); if (exception_object->exception_cleanup != NULL) (*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT, @@ -437,7 +437,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context *context) { // Not supported or needed for sjlj based unwinding (void)context; - _LIBUNWIND_TRACE_API("_Unwind_GetDataRelBase(context=%p)\n", context); + _LIBUNWIND_TRACE_API("_Unwind_GetDataRelBase(context=%p)", context); _LIBUNWIND_ABORT("_Unwind_GetDataRelBase() not implemented"); } @@ -448,14 +448,14 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetTextRelBase(struct _Unwind_Context *context) { // Not supported or needed for sjlj based unwinding (void)context; - _LIBUNWIND_TRACE_API("_Unwind_GetTextRelBase(context=%p)\n", context); + _LIBUNWIND_TRACE_API("_Unwind_GetTextRelBase(context=%p)", context); _LIBUNWIND_ABORT("_Unwind_GetTextRelBase() not implemented"); } /// Called by personality handler to get "Call Frame Area" for current frame. _LIBUNWIND_EXPORT uintptr_t _Unwind_GetCFA(struct _Unwind_Context *context) { - _LIBUNWIND_TRACE_API("_Unwind_GetCFA(context=%p)\n", context); + _LIBUNWIND_TRACE_API("_Unwind_GetCFA(context=%p)", context); if (context != NULL) { _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; // Setjmp/longjmp based exceptions don't have a true CFA. Modified: head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp Thu Oct 27 21:31:56 2016 (r308005) +++ head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp Fri Oct 28 00:04:04 2016 (r308006) @@ -6,7 +6,7 @@ // Source Licenses. See LICENSE.TXT for details. // // -// C++ interface to lower levels of libuwind +// C++ interface to lower levels of libunwind //===----------------------------------------------------------------------===// #ifndef __UNWINDCURSOR_HPP__ @@ -935,7 +935,7 @@ bool UnwindCursor::getInfoFromDwar return true; } } - //_LIBUNWIND_DEBUG_LOG("can't find/use FDE for pc=0x%llX\n", (uint64_t)pc); + //_LIBUNWIND_DEBUG_LOG("can't find/use FDE for pc=0x%llX", (uint64_t)pc); return false; } #endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND @@ -1092,13 +1092,13 @@ bool UnwindCursor::getInfoFromComp funcEnd = firstLevelNextPageFunctionOffset + sects.dso_base; if (pc < funcStart) { _LIBUNWIND_DEBUG_LOG("malformed __unwind_info, pc=0x%llX not in second " - "level compressed unwind table. funcStart=0x%llX\n", + "level compressed unwind table. funcStart=0x%llX", (uint64_t) pc, (uint64_t) funcStart); return false; } if (pc > funcEnd) { _LIBUNWIND_DEBUG_LOG("malformed __unwind_info, pc=0x%llX not in second " - "level compressed unwind table. funcEnd=0x%llX\n", + "level compressed unwind table. funcEnd=0x%llX", (uint64_t) pc, (uint64_t) funcEnd); return false; } @@ -1119,7 +1119,7 @@ bool UnwindCursor::getInfoFromComp } } else { _LIBUNWIND_DEBUG_LOG("malformed __unwind_info at 0x%0llX bad second " - "level page\n", + "level page", (uint64_t) sects.compact_unwind_section); return false; } @@ -1149,7 +1149,7 @@ bool UnwindCursor::getInfoFromComp } if (lsda == 0) { _LIBUNWIND_DEBUG_LOG("found encoding 0x%08X with HAS_LSDA bit set for " - "pc=0x%0llX, but lsda table has no entry\n", + "pc=0x%0llX, but lsda table has no entry", encoding, (uint64_t) pc); return false; } @@ -1162,7 +1162,7 @@ bool UnwindCursor::getInfoFromComp --personalityIndex; // change 1-based to zero-based index if (personalityIndex > sectionHeader.personalityArrayCount()) { _LIBUNWIND_DEBUG_LOG("found encoding 0x%08X with personality index %d, " - "but personality table has only %d entires\n", + "but personality table has only %d entires", encoding, personalityIndex, sectionHeader.personalityArrayCount()); return false; Modified: head/contrib/llvm/projects/libunwind/src/UnwindLevel1-gcc-ext.c ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindLevel1-gcc-ext.c Thu Oct 27 21:31:56 2016 (r308005) +++ head/contrib/llvm/projects/libunwind/src/UnwindLevel1-gcc-ext.c Fri Oct 28 00:04:04 2016 (r308006) @@ -29,11 +29,11 @@ _LIBUNWIND_EXPORT _Unwind_Reason_Code _Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) { #if _LIBUNWIND_ARM_EHABI - _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld\n", + _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld", (void *)exception_object, (long)exception_object->unwinder_cache.reserved1); #else - _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld\n", + _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld", (void *)exception_object, (long)exception_object->private_1); #endif @@ -66,7 +66,7 @@ _Unwind_Resume_or_Rethrow(_Unwind_Except _LIBUNWIND_EXPORT uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context *context) { (void)context; - _LIBUNWIND_TRACE_API("_Unwind_GetDataRelBase(context=%p)\n", (void *)context); + _LIBUNWIND_TRACE_API("_Unwind_GetDataRelBase(context=%p)", (void *)context); _LIBUNWIND_ABORT("_Unwind_GetDataRelBase() not implemented"); } @@ -76,7 +76,7 @@ _Unwind_GetDataRelBase(struct _Unwind_Co _LIBUNWIND_EXPORT uintptr_t _Unwind_GetTextRelBase(struct _Unwind_Context *context) { (void)context; - _LIBUNWIND_TRACE_API("_Unwind_GetTextRelBase(context=%p)\n", (void *)context); + _LIBUNWIND_TRACE_API("_Unwind_GetTextRelBase(context=%p)", (void *)context); _LIBUNWIND_ABORT("_Unwind_GetTextRelBase() not implemented"); } @@ -84,7 +84,7 @@ _Unwind_GetTextRelBase(struct _Unwind_Co /// Scans unwind information to find the function that contains the /// specified code address "pc". _LIBUNWIND_EXPORT void *_Unwind_FindEnclosingFunction(void *pc) { - _LIBUNWIND_TRACE_API("_Unwind_FindEnclosingFunction(pc=%p)\n", pc); + _LIBUNWIND_TRACE_API("_Unwind_FindEnclosingFunction(pc=%p)", pc); // This is slow, but works. // We create an unwind cursor then alter the IP to be pc unw_cursor_t cursor; @@ -108,7 +108,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callb unw_getcontext(&uc); unw_init_local(&cursor, &uc); - _LIBUNWIND_TRACE_API("_Unwind_Backtrace(callback=%p)\n", + _LIBUNWIND_TRACE_API("_Unwind_Backtrace(callback=%p)", (void *)(uintptr_t)callback); #if _LIBUNWIND_ARM_EHABI @@ -123,11 +123,11 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callb _Unwind_Reason_Code result; #if !_LIBUNWIND_ARM_EHABI - // ask libuwind to get next frame (skip over first frame which is + // ask libunwind to get next frame (skip over first frame which is // _Unwind_Backtrace()) if (unw_step(&cursor) <= 0) { _LIBUNWIND_TRACE_UNWINDING(" _backtrace: ended because cursor reached " - "bottom of stack, returning %d\n", + "bottom of stack, returning %d", _URC_END_OF_STACK); return _URC_END_OF_STACK; } @@ -164,7 +164,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callb unw_get_proc_name(&cursor, functionName, 512, &offset); unw_get_proc_info(&cursor, &frame); _LIBUNWIND_TRACE_UNWINDING( - " _backtrace: start_ip=0x%llX, func=%s, lsda=0x%llX, context=%p\n", + " _backtrace: start_ip=0x%llX, func=%s, lsda=0x%llX, context=%p", (long long)frame.start_ip, functionName, (long long)frame.lsda, (void *)&cursor); } @@ -173,7 +173,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callb result = (*callback)((struct _Unwind_Context *)(&cursor), ref); if (result != _URC_NO_REASON) { _LIBUNWIND_TRACE_UNWINDING( - " _backtrace: ended because callback returned %d\n", result); + " _backtrace: ended because callback returned %d", result); return result; } } @@ -195,7 +195,7 @@ _LIBUNWIND_EXPORT const void *_Unwind_Fi bases->tbase = (uintptr_t)info.extra; bases->dbase = 0; // dbase not used on Mac OS X bases->func = (uintptr_t)info.start_ip; - _LIBUNWIND_TRACE_API("_Unwind_Find_FDE(pc=%p) => %p\n", pc, + _LIBUNWIND_TRACE_API("_Unwind_Find_FDE(pc=%p) => %p", pc, (void *)(long) info.unwind_info); return (void *)(long) info.unwind_info; } @@ -206,7 +206,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetC unw_cursor_t *cursor = (unw_cursor_t *)context; unw_word_t result; unw_get_reg(cursor, UNW_REG_SP, &result); - _LIBUNWIND_TRACE_API("_Unwind_GetCFA(context=%p) => 0x%" PRIx64 "\n", + _LIBUNWIND_TRACE_API("_Unwind_GetCFA(context=%p) => 0x%" PRIx64, (void *)context, (uint64_t)result); return (uintptr_t)result; } @@ -217,7 +217,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetC /// site address. Normally IP is the return address. _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context, int *ipBefore) { - _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p)\n", (void *)context); + _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p)", (void *)context); *ipBefore = 0; return _Unwind_GetIP(context); } @@ -229,7 +229,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetI /// This function has existed on Mac OS X since 10.4, but /// was broken until 10.6. _LIBUNWIND_EXPORT void __register_frame(const void *fde) { - _LIBUNWIND_TRACE_API("__register_frame(%p)\n", fde); + _LIBUNWIND_TRACE_API("__register_frame(%p)", fde); _unw_add_dynamic_fde((unw_word_t)(uintptr_t) fde); } @@ -239,7 +239,7 @@ _LIBUNWIND_EXPORT void __register_frame( /// This function has existed on Mac OS X since 10.4, but /// was broken until 10.6. _LIBUNWIND_EXPORT void __deregister_frame(const void *fde) { - _LIBUNWIND_TRACE_API("__deregister_frame(%p)\n", fde); + _LIBUNWIND_TRACE_API("__deregister_frame(%p)", fde); _unw_remove_dynamic_fde((unw_word_t)(uintptr_t) fde); } @@ -259,7 +259,7 @@ _LIBUNWIND_EXPORT void __register_frame_ (void)ob; (void)tb; (void)db; - _LIBUNWIND_TRACE_API("__register_frame_info_bases(%p,%p, %p, %p)\n", + _LIBUNWIND_TRACE_API("__register_frame_info_bases(%p,%p, %p, %p)", fde, ob, tb, db); // do nothing, this function never worked in Mac OS X } @@ -267,7 +267,7 @@ _LIBUNWIND_EXPORT void __register_frame_ _LIBUNWIND_EXPORT void __register_frame_info(const void *fde, void *ob) { (void)fde; (void)ob; - _LIBUNWIND_TRACE_API("__register_frame_info(%p, %p)\n", fde, ob); + _LIBUNWIND_TRACE_API("__register_frame_info(%p, %p)", fde, ob); // do nothing, this function never worked in Mac OS X } @@ -279,33 +279,33 @@ _LIBUNWIND_EXPORT void __register_frame_ (void)tb; (void)db; _LIBUNWIND_TRACE_API("__register_frame_info_table_bases" - "(%p,%p, %p, %p)\n", fde, ob, tb, db); + "(%p,%p, %p, %p)", fde, ob, tb, db); // do nothing, this function never worked in Mac OS X } _LIBUNWIND_EXPORT void __register_frame_info_table(const void *fde, void *ob) { (void)fde; (void)ob; - _LIBUNWIND_TRACE_API("__register_frame_info_table(%p, %p)\n", fde, ob); + _LIBUNWIND_TRACE_API("__register_frame_info_table(%p, %p)", fde, ob); // do nothing, this function never worked in Mac OS X } _LIBUNWIND_EXPORT void __register_frame_table(const void *fde) { (void)fde; - _LIBUNWIND_TRACE_API("__register_frame_table(%p)\n", fde); + _LIBUNWIND_TRACE_API("__register_frame_table(%p)", fde); // do nothing, this function never worked in Mac OS X } _LIBUNWIND_EXPORT void *__deregister_frame_info(const void *fde) { (void)fde; - _LIBUNWIND_TRACE_API("__deregister_frame_info(%p)\n", fde); + _LIBUNWIND_TRACE_API("__deregister_frame_info(%p)", fde); // do nothing, this function never worked in Mac OS X return NULL; } _LIBUNWIND_EXPORT void *__deregister_frame_info_bases(const void *fde) { (void)fde; - _LIBUNWIND_TRACE_API("__deregister_frame_info_bases(%p)\n", fde); + _LIBUNWIND_TRACE_API("__deregister_frame_info_bases(%p)", fde); // do nothing, this function never worked in Mac OS X return NULL; } Modified: head/contrib/llvm/projects/libunwind/src/UnwindLevel1.c ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindLevel1.c Thu Oct 27 21:31:56 2016 (r308005) +++ head/contrib/llvm/projects/libunwind/src/UnwindLevel1.c Fri Oct 28 00:04:04 2016 (r308006) @@ -39,17 +39,17 @@ unwind_phase1(unw_context_t *uc, unw_cur // Walk each frame looking for a place to stop. bool handlerNotFound = true; while (handlerNotFound) { - // Ask libuwind to get next frame (skip over first which is + // Ask libunwind to get next frame (skip over first which is // _Unwind_RaiseException). int stepResult = unw_step(cursor); if (stepResult == 0) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached " - "bottom => _URC_END_OF_STACK\n", + "bottom => _URC_END_OF_STACK", (void *)exception_object); return _URC_END_OF_STACK; } else if (stepResult < 0) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step failed => " - "_URC_FATAL_PHASE1_ERROR\n", + "_URC_FATAL_PHASE1_ERROR", (void *)exception_object); return _URC_FATAL_PHASE1_ERROR; } @@ -59,7 +59,7 @@ unwind_phase1(unw_context_t *uc, unw_cur unw_word_t sp; if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info " - "failed => _URC_FATAL_PHASE1_ERROR\n", + "failed => _URC_FATAL_PHASE1_ERROR", (void *)exception_object); return _URC_FATAL_PHASE1_ERROR; } @@ -77,7 +77,7 @@ unwind_phase1(unw_context_t *uc, unw_cur unw_get_reg(cursor, UNW_REG_IP, &pc); _LIBUNWIND_TRACE_UNWINDING( "unwind_phase1(ex_ojb=%p): pc=0x%" PRIx64 ", start_ip=0x%" PRIx64 - ", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "\n", + ", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "", (void *)exception_object, pc, frameInfo.start_ip, functionName, frameInfo.lsda, frameInfo.handler); } @@ -88,7 +88,7 @@ unwind_phase1(unw_context_t *uc, unw_cur __personality_routine p = (__personality_routine)(long)(frameInfo.handler); _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase1(ex_ojb=%p): calling personality function %p\n", + "unwind_phase1(ex_ojb=%p): calling personality function %p", (void *)exception_object, (void *)(uintptr_t)p); _Unwind_Reason_Code personalityResult = (*p)(1, _UA_SEARCH_PHASE, exception_object->exception_class, @@ -101,13 +101,13 @@ unwind_phase1(unw_context_t *uc, unw_cur unw_get_reg(cursor, UNW_REG_SP, &sp); exception_object->private_2 = (uintptr_t)sp; _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND \n", + "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND", (void *)exception_object); return _URC_NO_REASON; case _URC_CONTINUE_UNWIND: _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase1(ex_ojb=%p): _URC_CONTINUE_UNWIND\n", + "unwind_phase1(ex_ojb=%p): _URC_CONTINUE_UNWIND", (void *)exception_object); // continue unwinding break; @@ -115,7 +115,7 @@ unwind_phase1(unw_context_t *uc, unw_cur default: // something went wrong _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR\n", + "unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR", (void *)exception_object); return _URC_FATAL_PHASE1_ERROR; } @@ -129,23 +129,23 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) { unw_init_local(cursor, uc); - _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n", + _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)", (void *)exception_object); // Walk each frame until we reach where search phase said to stop. while (true) { - // Ask libuwind to get next frame (skip over first which is + // Ask libunwind to get next frame (skip over first which is // _Unwind_RaiseException). int stepResult = unw_step(cursor); if (stepResult == 0) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached " - "bottom => _URC_END_OF_STACK\n", + "bottom => _URC_END_OF_STACK", (void *)exception_object); return _URC_END_OF_STACK; } else if (stepResult < 0) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step failed => " - "_URC_FATAL_PHASE1_ERROR\n", + "_URC_FATAL_PHASE1_ERROR", (void *)exception_object); return _URC_FATAL_PHASE2_ERROR; } @@ -156,7 +156,7 @@ unwind_phase2(unw_context_t *uc, unw_cur unw_get_reg(cursor, UNW_REG_SP, &sp); if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info " - "failed => _URC_FATAL_PHASE1_ERROR\n", + "failed => _URC_FATAL_PHASE1_ERROR", (void *)exception_object); return _URC_FATAL_PHASE2_ERROR; } @@ -172,7 +172,7 @@ unwind_phase2(unw_context_t *uc, unw_cur functionName = ".anonymous."; _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): start_ip=0x%" PRIx64 ", func=%s, sp=0x%" PRIx64 ", lsda=0x%" PRIx64 - ", personality=0x%" PRIx64 "\n", + ", personality=0x%" PRIx64, (void *)exception_object, frameInfo.start_ip, functionName, sp, frameInfo.lsda, frameInfo.handler); @@ -194,7 +194,7 @@ unwind_phase2(unw_context_t *uc, unw_cur case _URC_CONTINUE_UNWIND: // Continue unwinding _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND\n", + "unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND", (void *)exception_object); if (sp == exception_object->private_2) { // Phase 1 said we would stop at this frame, but we did not... @@ -204,7 +204,7 @@ unwind_phase2(unw_context_t *uc, unw_cur break; case _URC_INSTALL_CONTEXT: _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase2(ex_ojb=%p): _URC_INSTALL_CONTEXT\n", + "unwind_phase2(ex_ojb=%p): _URC_INSTALL_CONTEXT", (void *)exception_object); // Personality routine says to transfer control to landing pad. // We may get control back if landing pad calls _Unwind_Resume(). @@ -214,7 +214,7 @@ unwind_phase2(unw_context_t *uc, unw_cur unw_get_reg(cursor, UNW_REG_SP, &sp); _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering " "user code with ip=0x%" PRIx64 - ", sp=0x%" PRIx64 "\n", + ", sp=0x%" PRIx64, (void *)exception_object, pc, sp); } unw_resume(cursor); @@ -247,7 +247,7 @@ unwind_phase2_forced(unw_context_t *uc, unw_proc_info_t frameInfo; if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): unw_step " - "failed => _URC_END_OF_STACK\n", + "failed => _URC_END_OF_STACK", (void *)exception_object); return _URC_FATAL_PHASE2_ERROR; } @@ -263,7 +263,7 @@ unwind_phase2_forced(unw_context_t *uc, functionName = ".anonymous."; _LIBUNWIND_TRACE_UNWINDING( "unwind_phase2_forced(ex_ojb=%p): start_ip=0x%" PRIx64 - ", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "\n", + ", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64, (void *)exception_object, frameInfo.start_ip, functionName, frameInfo.lsda, frameInfo.handler); } @@ -275,11 +275,11 @@ unwind_phase2_forced(unw_context_t *uc, (*stop)(1, action, exception_object->exception_class, exception_object, (struct _Unwind_Context *)(cursor), stop_parameter); _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase2_forced(ex_ojb=%p): stop function returned %d\n", + "unwind_phase2_forced(ex_ojb=%p): stop function returned %d", (void *)exception_object, stopResult); if (stopResult != _URC_NO_REASON) { _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase2_forced(ex_ojb=%p): stopped by stop function\n", + "unwind_phase2_forced(ex_ojb=%p): stopped by stop function", (void *)exception_object); return _URC_FATAL_PHASE2_ERROR; } @@ -289,7 +289,7 @@ unwind_phase2_forced(unw_context_t *uc, __personality_routine p = (__personality_routine)(long)(frameInfo.handler); _LIBUNWIND_TRACE_UNWINDING( - "unwind_phase2_forced(ex_ojb=%p): calling personality function %p\n", + "unwind_phase2_forced(ex_ojb=%p): calling personality function %p", (void *)exception_object, (void *)(uintptr_t)p); _Unwind_Reason_Code personalityResult = (*p)(1, action, exception_object->exception_class, exception_object, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Oct 28 02:09:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F13DC239C8; Fri, 28 Oct 2016 02:09:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D19ECD2C; Fri, 28 Oct 2016 02:09:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S29kx7085858; Fri, 28 Oct 2016 02:09:46 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S29kIp085857; Fri, 28 Oct 2016 02:09:46 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201610280209.u9S29kIp085857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 28 Oct 2016 02:09:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308007 - 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.23 Precedence: list List-Id: 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, 28 Oct 2016 02:09:47 -0000 Author: adrian Date: Fri Oct 28 02:09:45 2016 New Revision: 308007 URL: https://svnweb.freebsd.org/changeset/base/308007 Log: [net80211] don't abort a background scan upon reception of a single packet. Full offload drivers don't need this behaviour - they do it in firmware. Modified: head/sys/net80211/ieee80211_scan_sw.c Modified: head/sys/net80211/ieee80211_scan_sw.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sw.c Fri Oct 28 00:04:04 2016 (r308006) +++ head/sys/net80211/ieee80211_scan_sw.c Fri Oct 28 02:09:45 2016 (r308007) @@ -467,6 +467,11 @@ ieee80211_swscan_cancel_scan(struct ieee static void ieee80211_swscan_cancel_anyscan(struct ieee80211vap *vap) { + + /* XXX for now - just don't do this per packet. */ + if (vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD) + return; + cancel_scan(vap, 1, __func__); } From owner-svn-src-head@freebsd.org Fri Oct 28 02:10:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 751BBC23A3A; Fri, 28 Oct 2016 02:10:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47356E94; Fri, 28 Oct 2016 02:10:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S2A7PC085939; Fri, 28 Oct 2016 02:10:07 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S2A7Z5085938; Fri, 28 Oct 2016 02:10:07 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201610280210.u9S2A7Z5085938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 28 Oct 2016 02:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308008 - 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.23 Precedence: list List-Id: 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, 28 Oct 2016 02:10:08 -0000 Author: adrian Date: Fri Oct 28 02:10:07 2016 New Revision: 308008 URL: https://svnweb.freebsd.org/changeset/base/308008 Log: [net80211] add comments! Modified: head/sys/net80211/ieee80211_scan.c Modified: head/sys/net80211/ieee80211_scan.c ============================================================================== --- head/sys/net80211/ieee80211_scan.c Fri Oct 28 02:09:45 2016 (r308007) +++ head/sys/net80211/ieee80211_scan.c Fri Oct 28 02:10:07 2016 (r308008) @@ -443,6 +443,9 @@ ieee80211_cancel_scan(struct ieee80211va /* * Cancel any scan currently going on. + * + * This is called during normal 802.11 data path to cancel + * a scan so a newly arrived normal data packet can be sent. */ void ieee80211_cancel_anyscan(struct ieee80211vap *vap) From owner-svn-src-head@freebsd.org Fri Oct 28 05:31:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EB0DC23D52; Fri, 28 Oct 2016 05:31:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29E5864A; Fri, 28 Oct 2016 05:31:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S5VYFP064831; Fri, 28 Oct 2016 05:31:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S5VYVd064830; Fri, 28 Oct 2016 05:31:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610280531.u9S5VYVd064830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 28 Oct 2016 05:31:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308010 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 05:31:35 -0000 Author: sephe Date: Fri Oct 28 05:31:34 2016 New Revision: 308010 URL: https://svnweb.freebsd.org/changeset/base/308010 Log: hyperv/hn: Change header guardian; in preparation for the upcoming rename. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8352 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Oct 28 03:54:19 2016 (r308009) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Oct 28 05:31:34 2016 (r308010) @@ -28,8 +28,8 @@ * $FreeBSD$ */ -#ifndef __HV_NET_VSC_H__ -#define __HV_NET_VSC_H__ +#ifndef _HN_NVS_H_ +#define _HN_NVS_H_ struct hn_nvs_sendctx; struct vmbus_channel; @@ -103,4 +103,4 @@ int hn_nvs_send_rndis_ctrl(struct vmbus extern struct hn_nvs_sendctx hn_nvs_sendctx_none; -#endif /* __HV_NET_VSC_H__ */ +#endif /* !_HN_NVS_H_ */ From owner-svn-src-head@freebsd.org Fri Oct 28 05:56:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71FC3C2425D; Fri, 28 Oct 2016 05:56:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B078FFF; Fri, 28 Oct 2016 05:56:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S5uOZm074071; Fri, 28 Oct 2016 05:56:24 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S5uOxL074067; Fri, 28 Oct 2016 05:56:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610280556.u9S5uOxL074067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 28 Oct 2016 05:56:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308011 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 05:56:25 -0000 Author: sephe Date: Fri Oct 28 05:56:23 2016 New Revision: 308011 URL: https://svnweb.freebsd.org/changeset/base/308011 Log: hyperv/hn: Rename cleaned up NVS header file. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8353 Added: head/sys/dev/hyperv/netvsc/hn_nvs.h - copied unchanged from r308010, head/sys/dev/hyperv/netvsc/hv_net_vsc.h Deleted: head/sys/dev/hyperv/netvsc/hv_net_vsc.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Copied: head/sys/dev/hyperv/netvsc/hn_nvs.h (from r308010, head/sys/dev/hyperv/netvsc/hv_net_vsc.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/netvsc/hn_nvs.h Fri Oct 28 05:56:23 2016 (r308011, copy of r308010, head/sys/dev/hyperv/netvsc/hv_net_vsc.h) @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2010-2012 Citrix Inc. + * Copyright (c) 2012 NetApp Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _HN_NVS_H_ +#define _HN_NVS_H_ + +struct hn_nvs_sendctx; +struct vmbus_channel; +struct hn_softc; + +typedef void (*hn_nvs_sent_t) + (struct hn_nvs_sendctx *, struct hn_softc *, + struct vmbus_channel *, const void *, int); + +struct hn_nvs_sendctx { + hn_nvs_sent_t hn_cb; + void *hn_cbarg; +}; + +#define HN_NVS_SENDCTX_INITIALIZER(cb, cbarg) \ +{ \ + .hn_cb = cb, \ + .hn_cbarg = cbarg \ +} + +static __inline void +hn_nvs_sendctx_init(struct hn_nvs_sendctx *sndc, hn_nvs_sent_t cb, void *cbarg) +{ + + sndc->hn_cb = cb; + sndc->hn_cbarg = cbarg; +} + +static __inline int +hn_nvs_send(struct vmbus_channel *chan, uint16_t flags, + void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc) +{ + + return (vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, flags, + nvs_msg, nvs_msglen, (uint64_t)(uintptr_t)sndc)); +} + +static __inline int +hn_nvs_send_sglist(struct vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, + void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc) +{ + + return (vmbus_chan_send_sglist(chan, sg, sglen, nvs_msg, nvs_msglen, + (uint64_t)(uintptr_t)sndc)); +} + +static __inline int +hn_nvs_send_rndis_sglist(struct vmbus_channel *chan, uint32_t rndis_mtype, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + struct hn_nvs_rndis rndis; + + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = rndis_mtype; + rndis.nvs_chim_idx = HN_NVS_CHIM_IDX_INVALID; + rndis.nvs_chim_sz = 0; + + return (hn_nvs_send_sglist(chan, gpa, gpa_cnt, + &rndis, sizeof(rndis), sndc)); +} + +int hn_nvs_attach(struct hn_softc *sc, int mtu); +void hn_nvs_detach(struct hn_softc *sc); +int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch); +void hn_nvs_sent_xact(struct hn_nvs_sendctx *sndc, + struct hn_softc *sc, struct vmbus_channel *chan, + const void *data, int dlen); +int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, + int gpa_cnt); + +extern struct hn_nvs_sendctx hn_nvs_sendctx_none; + +#endif /* !_HN_NVS_H_ */ Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Oct 28 05:31:34 2016 (r308010) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Oct 28 05:56:23 2016 (r308011) @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include static int hn_nvs_conn_chim(struct hn_softc *); static int hn_nvs_conn_rxbuf(struct hn_softc *); Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 05:31:34 2016 (r308010) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 05:56:23 2016 (r308011) @@ -124,7 +124,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include "vmbus_if.h" Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 05:31:34 2016 (r308010) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 05:56:23 2016 (r308011) @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #define HV_RF_RECVINFO_VLAN 0x1 From owner-svn-src-head@freebsd.org Fri Oct 28 07:48:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 969DAC22A07; Fri, 28 Oct 2016 07:48:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56D0BF3F; Fri, 28 Oct 2016 07:48:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S7mH9I015449; Fri, 28 Oct 2016 07:48:17 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S7mHSw015445; Fri, 28 Oct 2016 07:48:17 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610280748.u9S7mHSw015445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 28 Oct 2016 07:48:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308012 - in head/sys: conf dev/hyperv/netvsc modules/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 07:48:18 -0000 Author: sephe Date: Fri Oct 28 07:48:17 2016 New Revision: 308012 URL: https://svnweb.freebsd.org/changeset/base/308012 Log: hyperv/hn: Rename cleaned up NVS source file. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8354 Added: head/sys/dev/hyperv/netvsc/hn_nvs.c - copied unchanged from r308011, head/sys/dev/hyperv/netvsc/hv_net_vsc.c Deleted: head/sys/dev/hyperv/netvsc/hv_net_vsc.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/hyperv/netvsc/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Fri Oct 28 05:56:23 2016 (r308011) +++ head/sys/conf/files.amd64 Fri Oct 28 07:48:17 2016 (r308012) @@ -291,7 +291,7 @@ dev/hwpmc/hwpmc_uncore.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc -dev/hyperv/netvsc/hv_net_vsc.c optional hyperv +dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c optional hyperv dev/hyperv/netvsc/hv_rndis_filter.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Fri Oct 28 05:56:23 2016 (r308011) +++ head/sys/conf/files.i386 Fri Oct 28 07:48:17 2016 (r308012) @@ -248,7 +248,7 @@ dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_ppro.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc -dev/hyperv/netvsc/hv_net_vsc.c optional hyperv +dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c optional hyperv dev/hyperv/netvsc/hv_rndis_filter.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv Copied: head/sys/dev/hyperv/netvsc/hn_nvs.c (from r308011, head/sys/dev/hyperv/netvsc/hv_net_vsc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/netvsc/hn_nvs.c Fri Oct 28 07:48:17 2016 (r308012, copy of r308011, head/sys/dev/hyperv/netvsc/hv_net_vsc.c) @@ -0,0 +1,693 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2010-2012 Citrix Inc. + * Copyright (c) 2012 NetApp Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Network Virtualization Service. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet6.h" +#include "opt_inet.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +static int hn_nvs_conn_chim(struct hn_softc *); +static int hn_nvs_conn_rxbuf(struct hn_softc *); +static int hn_nvs_disconn_chim(struct hn_softc *); +static int hn_nvs_disconn_rxbuf(struct hn_softc *); +static int hn_nvs_conf_ndis(struct hn_softc *, int); +static int hn_nvs_init_ndis(struct hn_softc *); +static int hn_nvs_doinit(struct hn_softc *, uint32_t); +static int hn_nvs_init(struct hn_softc *); +static const void *hn_nvs_xact_execute(struct hn_softc *, + struct vmbus_xact *, void *, int, + size_t *, uint32_t); +static void hn_nvs_sent_none(struct hn_nvs_sendctx *, + struct hn_softc *, struct vmbus_channel *, + const void *, int); + +struct hn_nvs_sendctx hn_nvs_sendctx_none = + HN_NVS_SENDCTX_INITIALIZER(hn_nvs_sent_none, NULL); + +static const uint32_t hn_nvs_version[] = { + HN_NVS_VERSION_5, + HN_NVS_VERSION_4, + HN_NVS_VERSION_2, + HN_NVS_VERSION_1 +}; + +static const void * +hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, + void *req, int reqlen, size_t *resplen0, uint32_t type) +{ + struct hn_nvs_sendctx sndc; + size_t resplen, min_resplen = *resplen0; + const struct hn_nvs_hdr *hdr; + int error; + + KASSERT(min_resplen >= sizeof(*hdr), + ("invalid minimum response len %zu", min_resplen)); + + /* + * Execute the xact setup by the caller. + */ + hn_nvs_sendctx_init(&sndc, hn_nvs_sent_xact, xact); + + vmbus_xact_activate(xact); + error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, + req, reqlen, &sndc); + if (error) { + vmbus_xact_deactivate(xact); + return (NULL); + } + hdr = vmbus_xact_wait(xact, &resplen); + + /* + * Check this NVS response message. + */ + if (resplen < min_resplen) { + if_printf(sc->hn_ifp, "invalid NVS resp len %zu\n", resplen); + return (NULL); + } + if (hdr->nvs_type != type) { + if_printf(sc->hn_ifp, "unexpected NVS resp 0x%08x, " + "expect 0x%08x\n", hdr->nvs_type, type); + return (NULL); + } + /* All pass! */ + *resplen0 = resplen; + return (hdr); +} + +static __inline int +hn_nvs_req_send(struct hn_softc *sc, void *req, int reqlen) +{ + + return (hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, + req, reqlen, &hn_nvs_sendctx_none)); +} + +static int +hn_nvs_conn_rxbuf(struct hn_softc *sc) +{ + struct vmbus_xact *xact = NULL; + struct hn_nvs_rxbuf_conn *conn; + const struct hn_nvs_rxbuf_connresp *resp; + size_t resp_len; + uint32_t status; + int error, rxbuf_size; + + /* + * Limit RXBUF size for old NVS. + */ + if (sc->hn_nvs_ver <= HN_NVS_VERSION_2) + rxbuf_size = HN_RXBUF_SIZE_COMPAT; + else + rxbuf_size = HN_RXBUF_SIZE; + + /* + * Connect the RXBUF GPADL to the primary channel. + * + * NOTE: + * Only primary channel has RXBUF connected to it. Sub-channels + * just share this RXBUF. + */ + error = vmbus_chan_gpadl_connect(sc->hn_prichan, + sc->hn_rxbuf_dma.hv_paddr, rxbuf_size, &sc->hn_rxbuf_gpadl); + if (error) { + if_printf(sc->hn_ifp, "rxbuf gpadl conn failed: %d\n", + error); + goto cleanup; + } + + /* + * Connect RXBUF to NVS. + */ + + xact = vmbus_xact_get(sc->hn_xact, sizeof(*conn)); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for nvs rxbuf conn\n"); + error = ENXIO; + goto cleanup; + } + conn = vmbus_xact_req_data(xact); + conn->nvs_type = HN_NVS_TYPE_RXBUF_CONN; + conn->nvs_gpadl = sc->hn_rxbuf_gpadl; + conn->nvs_sig = HN_NVS_RXBUF_SIG; + + resp_len = sizeof(*resp); + resp = hn_nvs_xact_execute(sc, xact, conn, sizeof(*conn), &resp_len, + HN_NVS_TYPE_RXBUF_CONNRESP); + if (resp == NULL) { + if_printf(sc->hn_ifp, "exec nvs rxbuf conn failed\n"); + error = EIO; + goto cleanup; + } + + status = resp->nvs_status; + vmbus_xact_put(xact); + xact = NULL; + + if (status != HN_NVS_STATUS_OK) { + if_printf(sc->hn_ifp, "nvs rxbuf conn failed: %x\n", status); + error = EIO; + goto cleanup; + } + sc->hn_flags |= HN_FLAG_RXBUF_CONNECTED; + + return (0); + +cleanup: + if (xact != NULL) + vmbus_xact_put(xact); + hn_nvs_disconn_rxbuf(sc); + return (error); +} + +static int +hn_nvs_conn_chim(struct hn_softc *sc) +{ + struct vmbus_xact *xact = NULL; + struct hn_nvs_chim_conn *chim; + const struct hn_nvs_chim_connresp *resp; + size_t resp_len; + uint32_t status, sectsz; + int error; + + /* + * Connect chimney sending buffer GPADL to the primary channel. + * + * NOTE: + * Only primary channel has chimney sending buffer connected to it. + * Sub-channels just share this chimney sending buffer. + */ + error = vmbus_chan_gpadl_connect(sc->hn_prichan, + sc->hn_chim_dma.hv_paddr, HN_CHIM_SIZE, &sc->hn_chim_gpadl); + if (error) { + if_printf(sc->hn_ifp, "chim gpadl conn failed: %d\n", error); + goto cleanup; + } + + /* + * Connect chimney sending buffer to NVS + */ + + xact = vmbus_xact_get(sc->hn_xact, sizeof(*chim)); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for nvs chim conn\n"); + error = ENXIO; + goto cleanup; + } + chim = vmbus_xact_req_data(xact); + chim->nvs_type = HN_NVS_TYPE_CHIM_CONN; + chim->nvs_gpadl = sc->hn_chim_gpadl; + chim->nvs_sig = HN_NVS_CHIM_SIG; + + resp_len = sizeof(*resp); + resp = hn_nvs_xact_execute(sc, xact, chim, sizeof(*chim), &resp_len, + HN_NVS_TYPE_CHIM_CONNRESP); + if (resp == NULL) { + if_printf(sc->hn_ifp, "exec nvs chim conn failed\n"); + error = EIO; + goto cleanup; + } + + status = resp->nvs_status; + sectsz = resp->nvs_sectsz; + vmbus_xact_put(xact); + xact = NULL; + + if (status != HN_NVS_STATUS_OK) { + if_printf(sc->hn_ifp, "nvs chim conn failed: %x\n", status); + error = EIO; + goto cleanup; + } + if (sectsz == 0) { + if_printf(sc->hn_ifp, "zero chimney sending buffer " + "section size\n"); + return (0); + } + + sc->hn_chim_szmax = sectsz; + sc->hn_chim_cnt = HN_CHIM_SIZE / sc->hn_chim_szmax; + if (HN_CHIM_SIZE % sc->hn_chim_szmax != 0) { + if_printf(sc->hn_ifp, "chimney sending sections are " + "not properly aligned\n"); + } + if (sc->hn_chim_cnt % LONG_BIT != 0) { + if_printf(sc->hn_ifp, "discard %d chimney sending sections\n", + sc->hn_chim_cnt % LONG_BIT); + } + + sc->hn_chim_bmap_cnt = sc->hn_chim_cnt / LONG_BIT; + sc->hn_chim_bmap = malloc(sc->hn_chim_bmap_cnt * sizeof(u_long), + M_DEVBUF, M_WAITOK | M_ZERO); + + /* Done! */ + sc->hn_flags |= HN_FLAG_CHIM_CONNECTED; + if (bootverbose) { + if_printf(sc->hn_ifp, "chimney sending buffer %d/%d\n", + sc->hn_chim_szmax, sc->hn_chim_cnt); + } + return (0); + +cleanup: + if (xact != NULL) + vmbus_xact_put(xact); + hn_nvs_disconn_chim(sc); + return (error); +} + +static int +hn_nvs_disconn_rxbuf(struct hn_softc *sc) +{ + int error; + + if (sc->hn_flags & HN_FLAG_RXBUF_CONNECTED) { + struct hn_nvs_rxbuf_disconn disconn; + + /* + * Disconnect RXBUF from NVS. + */ + memset(&disconn, 0, sizeof(disconn)); + disconn.nvs_type = HN_NVS_TYPE_RXBUF_DISCONN; + disconn.nvs_sig = HN_NVS_RXBUF_SIG; + + /* NOTE: No response. */ + error = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); + if (error) { + if_printf(sc->hn_ifp, + "send nvs rxbuf disconn failed: %d\n", error); + return (error); + } + sc->hn_flags &= ~HN_FLAG_RXBUF_CONNECTED; + + /* + * Wait for the hypervisor to receive this NVS request. + */ + while (!vmbus_chan_tx_empty(sc->hn_prichan)) + pause("waittx", 1); + /* + * Linger long enough for NVS to disconnect RXBUF. + */ + pause("lingtx", (200 * hz) / 1000); + } + + if (sc->hn_rxbuf_gpadl != 0) { + /* + * Disconnect RXBUF from primary channel. + */ + error = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + sc->hn_rxbuf_gpadl); + if (error) { + if_printf(sc->hn_ifp, + "rxbuf gpadl disconn failed: %d\n", error); + return (error); + } + sc->hn_rxbuf_gpadl = 0; + } + return (0); +} + +static int +hn_nvs_disconn_chim(struct hn_softc *sc) +{ + int error; + + if (sc->hn_flags & HN_FLAG_CHIM_CONNECTED) { + struct hn_nvs_chim_disconn disconn; + + /* + * Disconnect chimney sending buffer from NVS. + */ + memset(&disconn, 0, sizeof(disconn)); + disconn.nvs_type = HN_NVS_TYPE_CHIM_DISCONN; + disconn.nvs_sig = HN_NVS_CHIM_SIG; + + /* NOTE: No response. */ + error = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); + if (error) { + if_printf(sc->hn_ifp, + "send nvs chim disconn failed: %d\n", error); + return (error); + } + sc->hn_flags &= ~HN_FLAG_CHIM_CONNECTED; + + /* + * Wait for the hypervisor to receive this NVS request. + */ + while (!vmbus_chan_tx_empty(sc->hn_prichan)) + pause("waittx", 1); + /* + * Linger long enough for NVS to disconnect chimney + * sending buffer. + */ + pause("lingtx", (200 * hz) / 1000); + } + + if (sc->hn_chim_gpadl != 0) { + /* + * Disconnect chimney sending buffer from primary channel. + */ + error = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + sc->hn_chim_gpadl); + if (error) { + if_printf(sc->hn_ifp, + "chim gpadl disconn failed: %d\n", error); + return (error); + } + sc->hn_chim_gpadl = 0; + } + + if (sc->hn_chim_bmap != NULL) { + free(sc->hn_chim_bmap, M_DEVBUF); + sc->hn_chim_bmap = NULL; + } + return (0); +} + +static int +hn_nvs_doinit(struct hn_softc *sc, uint32_t nvs_ver) +{ + struct vmbus_xact *xact; + struct hn_nvs_init *init; + const struct hn_nvs_init_resp *resp; + size_t resp_len; + uint32_t status; + + xact = vmbus_xact_get(sc->hn_xact, sizeof(*init)); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for nvs init\n"); + return (ENXIO); + } + init = vmbus_xact_req_data(xact); + init->nvs_type = HN_NVS_TYPE_INIT; + init->nvs_ver_min = nvs_ver; + init->nvs_ver_max = nvs_ver; + + resp_len = sizeof(*resp); + resp = hn_nvs_xact_execute(sc, xact, init, sizeof(*init), &resp_len, + HN_NVS_TYPE_INIT_RESP); + if (resp == NULL) { + if_printf(sc->hn_ifp, "exec init failed\n"); + vmbus_xact_put(xact); + return (EIO); + } + + status = resp->nvs_status; + vmbus_xact_put(xact); + + if (status != HN_NVS_STATUS_OK) { + if (bootverbose) { + /* + * Caller may try another NVS version, and will log + * error if there are no more NVS versions to try, + * so don't bark out loud here. + */ + if_printf(sc->hn_ifp, "nvs init failed for ver 0x%x\n", + nvs_ver); + } + return (EINVAL); + } + return (0); +} + +/* + * Configure MTU and enable VLAN. + */ +static int +hn_nvs_conf_ndis(struct hn_softc *sc, int mtu) +{ + struct hn_nvs_ndis_conf conf; + int error; + + memset(&conf, 0, sizeof(conf)); + conf.nvs_type = HN_NVS_TYPE_NDIS_CONF; + conf.nvs_mtu = mtu; + conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; + + /* NOTE: No response. */ + error = hn_nvs_req_send(sc, &conf, sizeof(conf)); + if (error) { + if_printf(sc->hn_ifp, "send nvs ndis conf failed: %d\n", error); + return (error); + } + + if (bootverbose) + if_printf(sc->hn_ifp, "nvs ndis conf done\n"); + sc->hn_caps |= HN_CAP_MTU | HN_CAP_VLAN; + return (0); +} + +static int +hn_nvs_init_ndis(struct hn_softc *sc) +{ + struct hn_nvs_ndis_init ndis; + int error; + + memset(&ndis, 0, sizeof(ndis)); + ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; + ndis.nvs_ndis_major = HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver); + ndis.nvs_ndis_minor = HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver); + + /* NOTE: No response. */ + error = hn_nvs_req_send(sc, &ndis, sizeof(ndis)); + if (error) + if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", error); + return (error); +} + +static int +hn_nvs_init(struct hn_softc *sc) +{ + int i, error; + + if (device_is_attached(sc->hn_dev)) { + /* + * NVS version and NDIS version MUST NOT be changed. + */ + if (bootverbose) { + if_printf(sc->hn_ifp, "reinit NVS version 0x%x, " + "NDIS version %u.%u\n", sc->hn_nvs_ver, + HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), + HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); + } + + error = hn_nvs_doinit(sc, sc->hn_nvs_ver); + if (error) { + if_printf(sc->hn_ifp, "reinit NVS version 0x%x " + "failed: %d\n", sc->hn_nvs_ver, error); + return (error); + } + goto done; + } + + /* + * Find the supported NVS version and set NDIS version accordingly. + */ + for (i = 0; i < nitems(hn_nvs_version); ++i) { + error = hn_nvs_doinit(sc, hn_nvs_version[i]); + if (!error) { + sc->hn_nvs_ver = hn_nvs_version[i]; + + /* Set NDIS version according to NVS version. */ + sc->hn_ndis_ver = HN_NDIS_VERSION_6_30; + if (sc->hn_nvs_ver <= HN_NVS_VERSION_4) + sc->hn_ndis_ver = HN_NDIS_VERSION_6_1; + + if (bootverbose) { + if_printf(sc->hn_ifp, "NVS version 0x%x, " + "NDIS version %u.%u\n", sc->hn_nvs_ver, + HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), + HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); + } + goto done; + } + } + if_printf(sc->hn_ifp, "no NVS available\n"); + return (ENXIO); + +done: + if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) + sc->hn_caps |= HN_CAP_HASHVAL; + return (0); +} + +int +hn_nvs_attach(struct hn_softc *sc, int mtu) +{ + int error; + + /* + * Initialize NVS. + */ + error = hn_nvs_init(sc); + if (error) + return (error); + + if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) { + /* + * Configure NDIS before initializing it. + */ + error = hn_nvs_conf_ndis(sc, mtu); + if (error) + return (error); + } + + /* + * Initialize NDIS. + */ + error = hn_nvs_init_ndis(sc); + if (error) + return (error); + + /* + * Connect RXBUF. + */ + error = hn_nvs_conn_rxbuf(sc); + if (error) + return (error); + + /* + * Connect chimney sending buffer. + */ + error = hn_nvs_conn_chim(sc); + if (error) + return (error); + return (0); +} + +void +hn_nvs_detach(struct hn_softc *sc) +{ + + /* NOTE: there are no requests to stop the NVS. */ + hn_nvs_disconn_rxbuf(sc); + hn_nvs_disconn_chim(sc); +} + +void +hn_nvs_sent_xact(struct hn_nvs_sendctx *sndc, + struct hn_softc *sc __unused, struct vmbus_channel *chan __unused, + const void *data, int dlen) +{ + + vmbus_xact_wakeup(sndc->hn_cbarg, data, dlen); +} + +static void +hn_nvs_sent_none(struct hn_nvs_sendctx *sndc __unused, + struct hn_softc *sc __unused, struct vmbus_channel *chan __unused, + const void *data __unused, int dlen __unused) +{ + /* EMPTY */ +} + +int +hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch0) +{ + struct vmbus_xact *xact; + struct hn_nvs_subch_req *req; + const struct hn_nvs_subch_resp *resp; + int error, nsubch_req; + uint32_t nsubch; + size_t resp_len; + + nsubch_req = *nsubch0; + KASSERT(nsubch_req > 0, ("invalid # of sub-channels %d", nsubch_req)); + + xact = vmbus_xact_get(sc->hn_xact, sizeof(*req)); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for nvs subch alloc\n"); + return (ENXIO); + } + req = vmbus_xact_req_data(xact); + req->nvs_type = HN_NVS_TYPE_SUBCH_REQ; + req->nvs_op = HN_NVS_SUBCH_OP_ALLOC; + req->nvs_nsubch = nsubch_req; + + resp_len = sizeof(*resp); + resp = hn_nvs_xact_execute(sc, xact, req, sizeof(*req), &resp_len, + HN_NVS_TYPE_SUBCH_RESP); + if (resp == NULL) { + if_printf(sc->hn_ifp, "exec nvs subch alloc failed\n"); + error = EIO; + goto done; + } + if (resp->nvs_status != HN_NVS_STATUS_OK) { + if_printf(sc->hn_ifp, "nvs subch alloc failed: %x\n", + resp->nvs_status); + error = EIO; + goto done; + } + + nsubch = resp->nvs_nsubch; + if (nsubch > nsubch_req) { + if_printf(sc->hn_ifp, "%u subchans are allocated, " + "requested %d\n", nsubch, nsubch_req); + nsubch = nsubch_req; + } + *nsubch0 = nsubch; + error = 0; +done: + vmbus_xact_put(xact); + return (error); +} + +int +hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, + struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) +{ + + return hn_nvs_send_rndis_sglist(chan, HN_NVS_RNDIS_MTYPE_CTRL, + sndc, gpa, gpa_cnt); +} Modified: head/sys/modules/hyperv/netvsc/Makefile ============================================================================== --- head/sys/modules/hyperv/netvsc/Makefile Fri Oct 28 05:56:23 2016 (r308011) +++ head/sys/modules/hyperv/netvsc/Makefile Fri Oct 28 07:48:17 2016 (r308012) @@ -4,7 +4,7 @@ ${.CURDIR}/../../../dev/hyperv/vmbus KMOD= hv_netvsc -SRCS= hv_net_vsc.c \ +SRCS= hn_nvs.c \ hv_netvsc_drv_freebsd.c \ hv_rndis_filter.c SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h vmbus_if.h From owner-svn-src-head@freebsd.org Fri Oct 28 07:59:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FC77C22D9C; Fri, 28 Oct 2016 07:59:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD1ED14EB; Fri, 28 Oct 2016 07:59:03 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S7x3bu019240; Fri, 28 Oct 2016 07:59:03 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S7x2qF019236; Fri, 28 Oct 2016 07:59:02 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610280759.u9S7x2qF019236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 28 Oct 2016 07:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308013 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 07:59:04 -0000 Author: sephe Date: Fri Oct 28 07:59:02 2016 New Revision: 308013 URL: https://svnweb.freebsd.org/changeset/base/308013 Log: hyperv/hn: Nuke unnecessary indirection. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8355 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.h head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 07:48:17 2016 (r308012) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 07:59:02 2016 (r308013) @@ -358,6 +358,7 @@ static void hn_chan_detach(struct hn_sof static int hn_attach_subchans(struct hn_softc *); static void hn_detach_allchans(struct hn_softc *); static void hn_chan_callback(struct vmbus_channel *chan, void *xrxr); +static void hn_chan_rollup(struct hn_rx_ring *, struct hn_tx_ring *); static void hn_set_ring_inuse(struct hn_softc *, int); static int hn_synth_attach(struct hn_softc *, int); static void hn_synth_detach(struct hn_softc *); @@ -1188,7 +1189,7 @@ hn_tx_done(struct hn_nvs_sendctx *sndc, } } -void +static void hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) { #if defined(INET) || defined(INET6) @@ -4213,7 +4214,7 @@ hn_chan_callback(struct vmbus_channel *c if (bufferlen > HN_PKTBUF_LEN) free(buffer, M_DEVBUF); - hv_rf_channel_rollup(rxr, rxr->hn_txr); + hn_chan_rollup(rxr, rxr->hn_txr); } static void Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 07:48:17 2016 (r308012) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 07:59:02 2016 (r308013) @@ -1352,10 +1352,3 @@ hn_rndis_detach(struct hn_softc *sc) /* Halt the RNDIS. */ hn_rndis_halt(sc); } - -void -hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) -{ - - hn_chan_rollup(rxr, txr); -} Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Oct 28 07:48:17 2016 (r308012) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Oct 28 07:59:02 2016 (r308013) @@ -42,7 +42,5 @@ struct hn_rx_ring; void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, const void *data, int dlen); -void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); #endif /* __HV_RNDIS_FILTER_H__ */ - Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 28 07:48:17 2016 (r308012) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 28 07:59:02 2016 (r308013) @@ -258,7 +258,6 @@ int hn_rndis_set_rxfilter(struct hn_sof int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_recvinfo *info); -void hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); void hn_link_status_update(struct hn_softc *sc); void hn_network_change(struct hn_softc *sc); From owner-svn-src-head@freebsd.org Fri Oct 28 08:08:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2F5BC24400; Fri, 28 Oct 2016 08:08:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C49981B5E; Fri, 28 Oct 2016 08:08:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S88lid023120; Fri, 28 Oct 2016 08:08:47 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S88kpv023116; Fri, 28 Oct 2016 08:08:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610280808.u9S88kpv023116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 28 Oct 2016 08:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308014 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 08:08:48 -0000 Author: sephe Date: Fri Oct 28 08:08:46 2016 New Revision: 308014 URL: https://svnweb.freebsd.org/changeset/base/308014 Log: hyperv/hn: Reorganize RX path; mainly pull non-control code path up MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8356 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.h head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 07:59:02 2016 (r308013) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 08:08:46 2016 (r308014) @@ -166,6 +166,16 @@ __FBSDID("$FreeBSD$"); #define HN_EARLY_TXEOF_THRESH 8 +#define HN_RXINFO_VLAN 0x0001 +#define HN_RXINFO_CSUM 0x0002 +#define HN_RXINFO_HASHINF 0x0004 +#define HN_RXINFO_HASHVAL 0x0008 +#define HN_RXINFO_ALL \ + (HN_RXINFO_VLAN | \ + HN_RXINFO_CSUM | \ + HN_RXINFO_HASHINF | \ + HN_RXINFO_HASHVAL) + struct hn_txdesc { #ifndef HN_USE_TXDESC_BUFRING SLIST_ENTRY(hn_txdesc) link; @@ -188,6 +198,17 @@ struct hn_txdesc { #define HN_TXD_FLAG_ONLIST 0x1 #define HN_TXD_FLAG_DMAMAP 0x2 +#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff +#define HN_NDIS_RXCSUM_INFO_INVALID 0 +#define HN_NDIS_HASH_INFO_INVALID 0 + +struct hn_rxinfo { + uint32_t vlan_info; + uint32_t csum_info; + uint32_t hash_info; + uint32_t hash_value; +}; + #define HN_LRO_LENLIM_MULTIRX_DEF (12 * ETHERMTU) #define HN_LRO_LENLIM_DEF (25 * ETHERMTU) /* YYY 2*MTU is a bit rough, but should be good enough. */ @@ -377,12 +398,18 @@ static void hn_link_status(struct hn_sof static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *, struct hn_txdesc *); static int hn_sendpkt_rndis_chim(struct hn_tx_ring *, struct hn_txdesc *); static int hn_set_rxfilter(struct hn_softc *); +static void hn_link_status_update(struct hn_softc *); +static void hn_network_change(struct hn_softc *); + +static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); +static void hn_rndis_rx_data(struct hn_rx_ring *, const void *, int); +static void hn_rndis_rx_status(struct hn_softc *, const void *, int); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); static void hn_nvs_handle_comp(struct hn_softc *sc, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt); -static void hn_nvs_handle_rxbuf(struct hn_softc *sc, struct hn_rx_ring *rxr, +static void hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr); static void hn_nvs_ack_rxbuf(struct vmbus_channel *chan, uint64_t tid); @@ -1006,7 +1033,7 @@ hn_netchg_status_taskfunc(void *xsc, int hn_link_status(sc); } -void +static void hn_link_status_update(struct hn_softc *sc) { @@ -1014,7 +1041,7 @@ hn_link_status_update(struct hn_softc *s taskqueue_enqueue(sc->hn_mgmt_taskq, &sc->hn_link_task); } -void +static void hn_network_change(struct hn_softc *sc) { @@ -1615,15 +1642,9 @@ hn_lro_rx(struct lro_ctrl *lc, struct mb } #endif -/* - * Called when we receive a data packet from the "wire" on the - * specified device - * - * Note: This is no longer used as a callback - */ -int +static int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, - const struct hn_recvinfo *info) + const struct hn_rxinfo *info) { struct ifnet *ifp = rxr->hn_ifp; struct mbuf *m_new; @@ -4025,6 +4046,325 @@ hn_resume(struct hn_softc *sc) hn_resume_mgmt(sc); } +static void +hn_rndis_rx_status(struct hn_softc *sc, const void *data, int dlen) +{ + const struct rndis_status_msg *msg; + int ofs; + + if (dlen < sizeof(*msg)) { + if_printf(sc->hn_ifp, "invalid RNDIS status\n"); + return; + } + msg = data; + + switch (msg->rm_status) { + case RNDIS_STATUS_MEDIA_CONNECT: + case RNDIS_STATUS_MEDIA_DISCONNECT: + hn_link_status_update(sc); + break; + + case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: + /* Not really useful; ignore. */ + break; + + case RNDIS_STATUS_NETWORK_CHANGE: + ofs = RNDIS_STBUFOFFSET_ABS(msg->rm_stbufoffset); + if (dlen < ofs + msg->rm_stbuflen || + msg->rm_stbuflen < sizeof(uint32_t)) { + if_printf(sc->hn_ifp, "network changed\n"); + } else { + uint32_t change; + + memcpy(&change, ((const uint8_t *)msg) + ofs, + sizeof(change)); + if_printf(sc->hn_ifp, "network changed, change %u\n", + change); + } + hn_network_change(sc); + break; + + default: + if_printf(sc->hn_ifp, "unknown RNDIS status 0x%08x\n", + msg->rm_status); + break; + } +} + +static int +hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_rxinfo *info) +{ + const struct rndis_pktinfo *pi = info_data; + uint32_t mask = 0; + + while (info_dlen != 0) { + const void *data; + uint32_t dlen; + + if (__predict_false(info_dlen < sizeof(*pi))) + return (EINVAL); + if (__predict_false(info_dlen < pi->rm_size)) + return (EINVAL); + info_dlen -= pi->rm_size; + + if (__predict_false(pi->rm_size & RNDIS_PKTINFO_SIZE_ALIGNMASK)) + return (EINVAL); + if (__predict_false(pi->rm_size < pi->rm_pktinfooffset)) + return (EINVAL); + dlen = pi->rm_size - pi->rm_pktinfooffset; + data = pi->rm_data; + + switch (pi->rm_type) { + case NDIS_PKTINFO_TYPE_VLAN: + if (__predict_false(dlen < NDIS_VLAN_INFO_SIZE)) + return (EINVAL); + info->vlan_info = *((const uint32_t *)data); + mask |= HN_RXINFO_VLAN; + break; + + case NDIS_PKTINFO_TYPE_CSUM: + if (__predict_false(dlen < NDIS_RXCSUM_INFO_SIZE)) + return (EINVAL); + info->csum_info = *((const uint32_t *)data); + mask |= HN_RXINFO_CSUM; + break; + + case HN_NDIS_PKTINFO_TYPE_HASHVAL: + if (__predict_false(dlen < HN_NDIS_HASH_VALUE_SIZE)) + return (EINVAL); + info->hash_value = *((const uint32_t *)data); + mask |= HN_RXINFO_HASHVAL; + break; + + case HN_NDIS_PKTINFO_TYPE_HASHINF: + if (__predict_false(dlen < HN_NDIS_HASH_INFO_SIZE)) + return (EINVAL); + info->hash_info = *((const uint32_t *)data); + mask |= HN_RXINFO_HASHINF; + break; + + default: + goto next; + } + + if (mask == HN_RXINFO_ALL) { + /* All found; done */ + break; + } +next: + pi = (const struct rndis_pktinfo *) + ((const uint8_t *)pi + pi->rm_size); + } + + /* + * Final fixup. + * - If there is no hash value, invalidate the hash info. + */ + if ((mask & HN_RXINFO_HASHVAL) == 0) + info->hash_info = HN_NDIS_HASH_INFO_INVALID; + return (0); +} + +static __inline bool +hn_rndis_check_overlap(int off, int len, int check_off, int check_len) +{ + + if (off < check_off) { + if (__predict_true(off + len <= check_off)) + return (false); + } else if (off > check_off) { + if (__predict_true(check_off + check_len <= off)) + return (false); + } + return (true); +} + +static void +hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) +{ + const struct rndis_packet_msg *pkt; + struct hn_rxinfo info; + int data_off, pktinfo_off, data_len, pktinfo_len; + + /* + * Check length. + */ + if (__predict_false(dlen < sizeof(*pkt))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg\n"); + return; + } + pkt = data; + + if (__predict_false(dlen < pkt->rm_len)) { + if_printf(rxr->hn_ifp, "truncated RNDIS packet msg, " + "dlen %d, msglen %u\n", dlen, pkt->rm_len); + return; + } + if (__predict_false(pkt->rm_len < + pkt->rm_datalen + pkt->rm_oobdatalen + pkt->rm_pktinfolen)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msglen, " + "msglen %u, data %u, oob %u, pktinfo %u\n", + pkt->rm_len, pkt->rm_datalen, pkt->rm_oobdatalen, + pkt->rm_pktinfolen); + return; + } + if (__predict_false(pkt->rm_datalen == 0)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, no data\n"); + return; + } + + /* + * Check offests. + */ +#define IS_OFFSET_INVALID(ofs) \ + ((ofs) < RNDIS_PACKET_MSG_OFFSET_MIN || \ + ((ofs) & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK)) + + /* XXX Hyper-V does not meet data offset alignment requirement */ + if (__predict_false(pkt->rm_dataoffset < RNDIS_PACKET_MSG_OFFSET_MIN)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "data offset %u\n", pkt->rm_dataoffset); + return; + } + if (__predict_false(pkt->rm_oobdataoffset > 0 && + IS_OFFSET_INVALID(pkt->rm_oobdataoffset))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob offset %u\n", pkt->rm_oobdataoffset); + return; + } + if (__predict_true(pkt->rm_pktinfooffset > 0) && + __predict_false(IS_OFFSET_INVALID(pkt->rm_pktinfooffset))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo offset %u\n", pkt->rm_pktinfooffset); + return; + } + +#undef IS_OFFSET_INVALID + + data_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_dataoffset); + data_len = pkt->rm_datalen; + pktinfo_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_pktinfooffset); + pktinfo_len = pkt->rm_pktinfolen; + + /* + * Check OOB coverage. + */ + if (__predict_false(pkt->rm_oobdatalen != 0)) { + int oob_off, oob_len; + + if_printf(rxr->hn_ifp, "got oobdata\n"); + oob_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_oobdataoffset); + oob_len = pkt->rm_oobdatalen; + + if (__predict_false(oob_off + oob_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overflow, msglen %u, oob abs %d len %d\n", + pkt->rm_len, oob_off, oob_len); + return; + } + + /* + * Check against data. + */ + if (hn_rndis_check_overlap(oob_off, oob_len, + data_off, data_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overlaps data, oob abs %d len %d, " + "data abs %d len %d\n", + oob_off, oob_len, data_off, data_len); + return; + } + + /* + * Check against pktinfo. + */ + if (pktinfo_len != 0 && + hn_rndis_check_overlap(oob_off, oob_len, + pktinfo_off, pktinfo_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overlaps pktinfo, oob abs %d len %d, " + "pktinfo abs %d len %d\n", + oob_off, oob_len, pktinfo_off, pktinfo_len); + return; + } + } + + /* + * Check per-packet-info coverage and find useful per-packet-info. + */ + info.vlan_info = HN_NDIS_VLAN_INFO_INVALID; + info.csum_info = HN_NDIS_RXCSUM_INFO_INVALID; + info.hash_info = HN_NDIS_HASH_INFO_INVALID; + if (__predict_true(pktinfo_len != 0)) { + bool overlap; + int error; + + if (__predict_false(pktinfo_off + pktinfo_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo overflow, msglen %u, " + "pktinfo abs %d len %d\n", + pkt->rm_len, pktinfo_off, pktinfo_len); + return; + } + + /* + * Check packet info coverage. + */ + overlap = hn_rndis_check_overlap(pktinfo_off, pktinfo_len, + data_off, data_len); + if (__predict_false(overlap)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo overlap data, pktinfo abs %d len %d, " + "data abs %d len %d\n", + pktinfo_off, pktinfo_len, data_off, data_len); + return; + } + + /* + * Find useful per-packet-info. + */ + error = hn_rndis_rxinfo(((const uint8_t *)pkt) + pktinfo_off, + pktinfo_len, &info); + if (__predict_false(error)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg " + "pktinfo\n"); + return; + } + } + + if (__predict_false(data_off + data_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "data overflow, msglen %u, data abs %d len %d\n", + pkt->rm_len, data_off, data_len); + return; + } + hn_rxpkt(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); +} + +static __inline void +hn_rndis_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen) +{ + const struct rndis_msghdr *hdr; + + if (__predict_false(dlen < sizeof(*hdr))) { + if_printf(rxr->hn_ifp, "invalid RNDIS msg\n"); + return; + } + hdr = data; + + if (__predict_true(hdr->rm_type == REMOTE_NDIS_PACKET_MSG)) { + /* Hot data path. */ + hn_rndis_rx_data(rxr, data, dlen); + /* Done! */ + return; + } + + if (hdr->rm_type == REMOTE_NDIS_INDICATE_STATUS_MSG) + hn_rndis_rx_status(rxr->hn_ifp->if_softc, data, dlen); + else + hn_rndis_rx_ctrl(rxr->hn_ifp->if_softc, data, dlen); +} + static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) { @@ -4060,8 +4400,8 @@ hn_nvs_handle_comp(struct hn_softc *sc, } static void -hn_nvs_handle_rxbuf(struct hn_softc *sc, struct hn_rx_ring *rxr, - struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) +hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr, struct vmbus_channel *chan, + const struct vmbus_chanpkt_hdr *pkthdr) { const struct vmbus_chanpkt_rxbuf *pkt; const struct hn_nvs_hdr *nvs_hdr; @@ -4111,9 +4451,9 @@ hn_nvs_handle_rxbuf(struct hn_softc *sc, "ofs %d, len %d\n", i, ofs, len); continue; } - hv_rf_on_receive(sc, rxr, rxr->hn_rxbuf + ofs, len); + hn_rndis_rxpkt(rxr, rxr->hn_rxbuf + ofs, len); } - + /* * Moved completion call back here so that all received * messages (not just data messages) will trigger a response @@ -4177,7 +4517,7 @@ hn_chan_callback(struct vmbus_channel *c hn_nvs_handle_comp(sc, chan, pkt); break; case VMBUS_CHANPKT_TYPE_RXBUF: - hn_nvs_handle_rxbuf(sc, rxr, chan, pkt); + hn_nvs_handle_rxbuf(rxr, chan, pkt); break; case VMBUS_CHANPKT_TYPE_INBAND: hn_nvs_handle_notify(sc, pkt); Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 07:59:02 2016 (r308013) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 08:08:46 2016 (r308014) @@ -59,16 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define HV_RF_RECVINFO_VLAN 0x1 -#define HV_RF_RECVINFO_CSUM 0x2 -#define HV_RF_RECVINFO_HASHINF 0x4 -#define HV_RF_RECVINFO_HASHVAL 0x8 -#define HV_RF_RECVINFO_ALL \ - (HV_RF_RECVINFO_VLAN | \ - HV_RF_RECVINFO_CSUM | \ - HV_RF_RECVINFO_HASHINF | \ - HV_RF_RECVINFO_HASHVAL) - #define HN_RNDIS_RID_COMPAT_MASK 0xffff #define HN_RNDIS_RID_COMPAT_MAX HN_RNDIS_RID_COMPAT_MASK @@ -89,11 +79,6 @@ __FBSDID("$FreeBSD$"); /* * Forward declarations */ -static void hv_rf_receive_indicate_status(struct hn_softc *sc, - const void *data, int dlen); -static void hv_rf_receive_data(struct hn_rx_ring *rxr, - const void *data, int dlen); - static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, const void *idata, size_t idlen, void *odata, size_t *odlen0); static int hn_rndis_query2(struct hn_softc *sc, uint32_t oid, @@ -155,335 +140,22 @@ hn_rndis_pktinfo_append(struct rndis_pac return (pi->rm_data); } -/* - * RNDIS filter receive indicate status - */ -static void -hv_rf_receive_indicate_status(struct hn_softc *sc, const void *data, int dlen) -{ - const struct rndis_status_msg *msg; - int ofs; - - if (dlen < sizeof(*msg)) { - if_printf(sc->hn_ifp, "invalid RNDIS status\n"); - return; - } - msg = data; - - switch (msg->rm_status) { - case RNDIS_STATUS_MEDIA_CONNECT: - case RNDIS_STATUS_MEDIA_DISCONNECT: - hn_link_status_update(sc); - break; - - case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: - /* Not really useful; ignore. */ - break; - - case RNDIS_STATUS_NETWORK_CHANGE: - ofs = RNDIS_STBUFOFFSET_ABS(msg->rm_stbufoffset); - if (dlen < ofs + msg->rm_stbuflen || - msg->rm_stbuflen < sizeof(uint32_t)) { - if_printf(sc->hn_ifp, "network changed\n"); - } else { - uint32_t change; - - memcpy(&change, ((const uint8_t *)msg) + ofs, - sizeof(change)); - if_printf(sc->hn_ifp, "network changed, change %u\n", - change); - } - hn_network_change(sc); - break; - - default: - /* TODO: */ - if_printf(sc->hn_ifp, "unknown RNDIS status 0x%08x\n", - msg->rm_status); - break; - } -} - -static int -hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_recvinfo *info) -{ - const struct rndis_pktinfo *pi = info_data; - uint32_t mask = 0; - - while (info_dlen != 0) { - const void *data; - uint32_t dlen; - - if (__predict_false(info_dlen < sizeof(*pi))) - return (EINVAL); - if (__predict_false(info_dlen < pi->rm_size)) - return (EINVAL); - info_dlen -= pi->rm_size; - - if (__predict_false(pi->rm_size & RNDIS_PKTINFO_SIZE_ALIGNMASK)) - return (EINVAL); - if (__predict_false(pi->rm_size < pi->rm_pktinfooffset)) - return (EINVAL); - dlen = pi->rm_size - pi->rm_pktinfooffset; - data = pi->rm_data; - - switch (pi->rm_type) { - case NDIS_PKTINFO_TYPE_VLAN: - if (__predict_false(dlen < NDIS_VLAN_INFO_SIZE)) - return (EINVAL); - info->vlan_info = *((const uint32_t *)data); - mask |= HV_RF_RECVINFO_VLAN; - break; - - case NDIS_PKTINFO_TYPE_CSUM: - if (__predict_false(dlen < NDIS_RXCSUM_INFO_SIZE)) - return (EINVAL); - info->csum_info = *((const uint32_t *)data); - mask |= HV_RF_RECVINFO_CSUM; - break; - - case HN_NDIS_PKTINFO_TYPE_HASHVAL: - if (__predict_false(dlen < HN_NDIS_HASH_VALUE_SIZE)) - return (EINVAL); - info->hash_value = *((const uint32_t *)data); - mask |= HV_RF_RECVINFO_HASHVAL; - break; - - case HN_NDIS_PKTINFO_TYPE_HASHINF: - if (__predict_false(dlen < HN_NDIS_HASH_INFO_SIZE)) - return (EINVAL); - info->hash_info = *((const uint32_t *)data); - mask |= HV_RF_RECVINFO_HASHINF; - break; - - default: - goto next; - } - - if (mask == HV_RF_RECVINFO_ALL) { - /* All found; done */ - break; - } -next: - pi = (const struct rndis_pktinfo *) - ((const uint8_t *)pi + pi->rm_size); - } - - /* - * Final fixup. - * - If there is no hash value, invalidate the hash info. - */ - if ((mask & HV_RF_RECVINFO_HASHVAL) == 0) - info->hash_info = HN_NDIS_HASH_INFO_INVALID; - return (0); -} - -static __inline bool -hn_rndis_check_overlap(int off, int len, int check_off, int check_len) -{ - - if (off < check_off) { - if (__predict_true(off + len <= check_off)) - return (false); - } else if (off > check_off) { - if (__predict_true(check_off + check_len <= off)) - return (false); - } - return (true); -} - -/* - * RNDIS filter receive data - */ -static void -hv_rf_receive_data(struct hn_rx_ring *rxr, const void *data, int dlen) -{ - const struct rndis_packet_msg *pkt; - struct hn_recvinfo info; - int data_off, pktinfo_off, data_len, pktinfo_len; - - /* - * Check length. - */ - if (__predict_false(dlen < sizeof(*pkt))) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg\n"); - return; - } - pkt = data; - - if (__predict_false(dlen < pkt->rm_len)) { - if_printf(rxr->hn_ifp, "truncated RNDIS packet msg, " - "dlen %d, msglen %u\n", dlen, pkt->rm_len); - return; - } - if (__predict_false(pkt->rm_len < - pkt->rm_datalen + pkt->rm_oobdatalen + pkt->rm_pktinfolen)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msglen, " - "msglen %u, data %u, oob %u, pktinfo %u\n", - pkt->rm_len, pkt->rm_datalen, pkt->rm_oobdatalen, - pkt->rm_pktinfolen); - return; - } - if (__predict_false(pkt->rm_datalen == 0)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, no data\n"); - return; - } - - /* - * Check offests. - */ -#define IS_OFFSET_INVALID(ofs) \ - ((ofs) < RNDIS_PACKET_MSG_OFFSET_MIN || \ - ((ofs) & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK)) - - /* XXX Hyper-V does not meet data offset alignment requirement */ - if (__predict_false(pkt->rm_dataoffset < RNDIS_PACKET_MSG_OFFSET_MIN)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "data offset %u\n", pkt->rm_dataoffset); - return; - } - if (__predict_false(pkt->rm_oobdataoffset > 0 && - IS_OFFSET_INVALID(pkt->rm_oobdataoffset))) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "oob offset %u\n", pkt->rm_oobdataoffset); - return; - } - if (__predict_true(pkt->rm_pktinfooffset > 0) && - __predict_false(IS_OFFSET_INVALID(pkt->rm_pktinfooffset))) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "pktinfo offset %u\n", pkt->rm_pktinfooffset); - return; - } - -#undef IS_OFFSET_INVALID - - data_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_dataoffset); - data_len = pkt->rm_datalen; - pktinfo_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_pktinfooffset); - pktinfo_len = pkt->rm_pktinfolen; - - /* - * Check OOB coverage. - */ - if (__predict_false(pkt->rm_oobdatalen != 0)) { - int oob_off, oob_len; - - if_printf(rxr->hn_ifp, "got oobdata\n"); - oob_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_oobdataoffset); - oob_len = pkt->rm_oobdatalen; - - if (__predict_false(oob_off + oob_len > pkt->rm_len)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "oob overflow, msglen %u, oob abs %d len %d\n", - pkt->rm_len, oob_off, oob_len); - return; - } - - /* - * Check against data. - */ - if (hn_rndis_check_overlap(oob_off, oob_len, - data_off, data_len)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "oob overlaps data, oob abs %d len %d, " - "data abs %d len %d\n", - oob_off, oob_len, data_off, data_len); - return; - } - - /* - * Check against pktinfo. - */ - if (pktinfo_len != 0 && - hn_rndis_check_overlap(oob_off, oob_len, - pktinfo_off, pktinfo_len)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "oob overlaps pktinfo, oob abs %d len %d, " - "pktinfo abs %d len %d\n", - oob_off, oob_len, pktinfo_off, pktinfo_len); - return; - } - } - - /* - * Check per-packet-info coverage and find useful per-packet-info. - */ - info.vlan_info = HN_NDIS_VLAN_INFO_INVALID; - info.csum_info = HN_NDIS_RXCSUM_INFO_INVALID; - info.hash_info = HN_NDIS_HASH_INFO_INVALID; - if (__predict_true(pktinfo_len != 0)) { - bool overlap; - int error; - - if (__predict_false(pktinfo_off + pktinfo_len > pkt->rm_len)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "pktinfo overflow, msglen %u, " - "pktinfo abs %d len %d\n", - pkt->rm_len, pktinfo_off, pktinfo_len); - return; - } - - /* - * Check packet info coverage. - */ - overlap = hn_rndis_check_overlap(pktinfo_off, pktinfo_len, - data_off, data_len); - if (__predict_false(overlap)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "pktinfo overlap data, pktinfo abs %d len %d, " - "data abs %d len %d\n", - pktinfo_off, pktinfo_len, data_off, data_len); - return; - } - - /* - * Find useful per-packet-info. - */ - error = hn_rndis_rxinfo(((const uint8_t *)pkt) + pktinfo_off, - pktinfo_len, &info); - if (__predict_false(error)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg " - "pktinfo\n"); - return; - } - } - - if (__predict_false(data_off + data_len > pkt->rm_len)) { - if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " - "data overflow, msglen %u, data abs %d len %d\n", - pkt->rm_len, data_off, data_len); - return; - } - hn_rxpkt(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); -} - -/* - * RNDIS filter on receive - */ void -hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, - const void *data, int dlen) +hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data, int dlen) { const struct rndis_comp_hdr *comp; const struct rndis_msghdr *hdr; - if (__predict_false(dlen < sizeof(*hdr))) { - if_printf(rxr->hn_ifp, "invalid RNDIS msg\n"); - return; - } + KASSERT(dlen >= sizeof(*hdr), ("invalid RNDIS msg\n")); hdr = data; switch (hdr->rm_type) { - case REMOTE_NDIS_PACKET_MSG: - hv_rf_receive_data(rxr, data, dlen); - break; - case REMOTE_NDIS_INITIALIZE_CMPLT: case REMOTE_NDIS_QUERY_CMPLT: case REMOTE_NDIS_SET_CMPLT: case REMOTE_NDIS_KEEPALIVE_CMPLT: /* unused */ if (dlen < sizeof(*comp)) { - if_printf(rxr->hn_ifp, "invalid RNDIS cmplt\n"); + if_printf(sc->hn_ifp, "invalid RNDIS cmplt\n"); return; } comp = data; @@ -493,10 +165,6 @@ hv_rf_on_receive(struct hn_softc *sc, st vmbus_xact_ctx_wakeup(sc->hn_xact, comp, dlen); break; - case REMOTE_NDIS_INDICATE_STATUS_MSG: - hv_rf_receive_indicate_status(sc, data, dlen); - break; - case REMOTE_NDIS_RESET_CMPLT: /* * Reset completed, no rid. @@ -505,11 +173,11 @@ hv_rf_on_receive(struct hn_softc *sc, st * RESET is not issued by hn(4), so this message should * _not_ be observed. */ - if_printf(rxr->hn_ifp, "RESET cmplt received\n"); + if_printf(sc->hn_ifp, "RESET cmplt received\n"); break; default: - if_printf(rxr->hn_ifp, "unknown RNDIS msg 0x%x\n", + if_printf(sc->hn_ifp, "unknown RNDIS msg 0x%x\n", hdr->rm_type); break; } Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Oct 28 07:59:02 2016 (r308013) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Oct 28 08:08:46 2016 (r308014) @@ -31,16 +31,9 @@ #ifndef __HV_RNDIS_FILTER_H__ #define __HV_RNDIS_FILTER_H__ -#include -#include -#include +struct hn_softc; -/* - * Externs - */ -struct hn_rx_ring; - -void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, - const void *data, int dlen); +void hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data, + int dlen); #endif /* __HV_RNDIS_FILTER_H__ */ Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 28 07:59:02 2016 (r308013) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 28 08:08:46 2016 (r308014) @@ -51,17 +51,6 @@ #define HN_GPACNT_MAX 32 -#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff -#define HN_NDIS_RXCSUM_INFO_INVALID 0 -#define HN_NDIS_HASH_INFO_INVALID 0 - -struct hn_recvinfo { - uint32_t vlan_info; - uint32_t csum_info; - uint32_t hash_info; - uint32_t hash_value; -}; - struct hn_txdesc; #ifndef HN_USE_TXDESC_BUFRING SLIST_HEAD(hn_txdesc_list, hn_txdesc); @@ -256,9 +245,4 @@ int hn_rndis_get_linkstatus(struct hn_s /* filter: NDIS_PACKET_TYPE_. */ int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter); -int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, - const struct hn_recvinfo *info); -void hn_link_status_update(struct hn_softc *sc); -void hn_network_change(struct hn_softc *sc); - #endif /* !_IF_HNVAR_H_ */ From owner-svn-src-head@freebsd.org Fri Oct 28 08:18:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AD70C24719; Fri, 28 Oct 2016 08:18:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 452047B; Fri, 28 Oct 2016 08:18:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S8InmO026853; Fri, 28 Oct 2016 08:18:49 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S8InW7026850; Fri, 28 Oct 2016 08:18:49 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610280818.u9S8InW7026850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 28 Oct 2016 08:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308015 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 08:18:50 -0000 Author: sephe Date: Fri Oct 28 08:18:49 2016 New Revision: 308015 URL: https://svnweb.freebsd.org/changeset/base/308015 Log: hyperv/hn: Pull data path code up. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8357 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 08:08:46 2016 (r308014) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 08:18:49 2016 (r308015) @@ -1244,6 +1244,42 @@ hn_rndis_pktmsg_offset(uint32_t ofs) return (ofs - __offsetof(struct rndis_packet_msg, rm_dataoffset)); } +static __inline void * +hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, + size_t pi_dlen, uint32_t pi_type) +{ + const size_t pi_size = HN_RNDIS_PKTINFO_SIZE(pi_dlen); + struct rndis_pktinfo *pi; + + KASSERT((pi_size & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK) == 0, + ("unaligned pktinfo size %zu, pktinfo dlen %zu", pi_size, pi_dlen)); + + /* + * Per-packet-info does not move; it only grows. + * + * NOTE: + * rm_pktinfooffset in this phase counts from the beginning + * of rndis_packet_msg. + */ + KASSERT(pkt->rm_pktinfooffset + pkt->rm_pktinfolen + pi_size <= pktsize, + ("%u pktinfo overflows RNDIS packet msg", pi_type)); + pi = (struct rndis_pktinfo *)((uint8_t *)pkt + pkt->rm_pktinfooffset + + pkt->rm_pktinfolen); + pkt->rm_pktinfolen += pi_size; + + pi->rm_size = pi_size; + pi->rm_type = pi_type; + pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; + + /* Data immediately follow per-packet-info. */ + pkt->rm_dataoffset += pi_size; + + /* Update RNDIS packet msg length */ + pkt->rm_len += pi_size; + + return (pi->rm_data); +} + /* * NOTE: * If this function fails, then both txd and m_head0 will be freed. Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 08:08:46 2016 (r308014) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 08:18:49 2016 (r308015) @@ -104,42 +104,6 @@ again: return ((rid & 0xffff) << 16); } -void * -hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, - size_t pi_dlen, uint32_t pi_type) -{ - const size_t pi_size = HN_RNDIS_PKTINFO_SIZE(pi_dlen); - struct rndis_pktinfo *pi; - - KASSERT((pi_size & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK) == 0, - ("unaligned pktinfo size %zu, pktinfo dlen %zu", pi_size, pi_dlen)); - - /* - * Per-packet-info does not move; it only grows. - * - * NOTE: - * rm_pktinfooffset in this phase counts from the beginning - * of rndis_packet_msg. - */ - KASSERT(pkt->rm_pktinfooffset + pkt->rm_pktinfolen + pi_size <= pktsize, - ("%u pktinfo overflows RNDIS packet msg", pi_type)); - pi = (struct rndis_pktinfo *)((uint8_t *)pkt + pkt->rm_pktinfooffset + - pkt->rm_pktinfolen); - pkt->rm_pktinfolen += pi_size; - - pi->rm_size = pi_size; - pi->rm_type = pi_type; - pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; - - /* Data immediately follow per-packet-info. */ - pkt->rm_dataoffset += pi_size; - - /* Update RNDIS packet msg length */ - pkt->rm_len += pi_size; - - return (pi->rm_data); -} - void hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data, int dlen) { Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 28 08:08:46 2016 (r308014) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 28 08:18:49 2016 (r308015) @@ -231,13 +231,9 @@ struct hn_softc { #define HN_LINK_FLAG_LINKUP 0x0001 #define HN_LINK_FLAG_NETCHG 0x0002 -struct rndis_packet_msg; - int hn_rndis_attach(struct hn_softc *sc, int mtu); void hn_rndis_detach(struct hn_softc *sc); int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); -void *hn_rndis_pktinfo_append(struct rndis_packet_msg *, - size_t pktsize, size_t pi_dlen, uint32_t pi_type); int hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt); int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr); int hn_rndis_get_linkstatus(struct hn_softc *sc, From owner-svn-src-head@freebsd.org Fri Oct 28 08:32:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73D48C24F38; Fri, 28 Oct 2016 08:32:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0B5FEE; Fri, 28 Oct 2016 08:32:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S8WsGu034624; Fri, 28 Oct 2016 08:32:54 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S8WsNC034621; Fri, 28 Oct 2016 08:32:54 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610280832.u9S8WsNC034621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 28 Oct 2016 08:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308016 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 08:32:55 -0000 Author: sephe Date: Fri Oct 28 08:32:54 2016 New Revision: 308016 URL: https://svnweb.freebsd.org/changeset/base/308016 Log: hyperv/hn: Cleanup RNDIS related files. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8358 Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.h head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 08:18:49 2016 (r308015) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 08:32:54 2016 (r308016) @@ -29,11 +29,12 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet6.h" +#include "opt_inet.h" + #include -#include #include -#include -#include +#include #include #include @@ -76,19 +77,23 @@ __FBSDID("$FreeBSD$"); #define HN_NDIS_LSOV2_CAP_IP6 \ (NDIS_LSOV2_CAP_IP6EXT | NDIS_LSOV2_CAP_TCP6OPT) -/* - * Forward declarations - */ -static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, - const void *idata, size_t idlen, void *odata, size_t *odlen0); -static int hn_rndis_query2(struct hn_softc *sc, uint32_t oid, - const void *idata, size_t idlen, void *odata, size_t *odlen0, - size_t min_odlen); -static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, - size_t dlen); -static int hn_rndis_conf_offload(struct hn_softc *sc, int mtu); -static int hn_rndis_query_hwcaps(struct hn_softc *sc, - struct ndis_offload *caps); +static const void *hn_rndis_xact_exec1(struct hn_softc *, + struct vmbus_xact *, size_t, + struct hn_nvs_sendctx *, size_t *); +static const void *hn_rndis_xact_execute(struct hn_softc *, + struct vmbus_xact *, uint32_t, size_t, size_t *, + uint32_t); +static int hn_rndis_query(struct hn_softc *, uint32_t, + const void *, size_t, void *, size_t *); +static int hn_rndis_query2(struct hn_softc *, uint32_t, + const void *, size_t, void *, size_t *, size_t); +static int hn_rndis_set(struct hn_softc *, uint32_t, + const void *, size_t); +static int hn_rndis_init(struct hn_softc *); +static int hn_rndis_halt(struct hn_softc *); +static int hn_rndis_conf_offload(struct hn_softc *, int); +static int hn_rndis_query_hwcaps(struct hn_softc *, + struct ndis_offload *); static __inline uint32_t hn_rndis_rid(struct hn_softc *sc) Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Oct 28 08:18:49 2016 (r308015) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Oct 28 08:32:54 2016 (r308016) @@ -33,6 +33,16 @@ struct hn_softc; +int hn_rndis_attach(struct hn_softc *sc, int mtu); +void hn_rndis_detach(struct hn_softc *sc); +int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); +int hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt); +int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr); +/* link_status: NDIS_MEDIA_STATE_ */ +int hn_rndis_get_linkstatus(struct hn_softc *sc, + uint32_t *link_status); +/* filter: NDIS_PACKET_TYPE_. */ +int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter); void hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data, int dlen); Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 28 08:18:49 2016 (r308015) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 28 08:32:54 2016 (r308016) @@ -231,14 +231,4 @@ struct hn_softc { #define HN_LINK_FLAG_LINKUP 0x0001 #define HN_LINK_FLAG_NETCHG 0x0002 -int hn_rndis_attach(struct hn_softc *sc, int mtu); -void hn_rndis_detach(struct hn_softc *sc); -int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); -int hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt); -int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr); -int hn_rndis_get_linkstatus(struct hn_softc *sc, - uint32_t *link_status); -/* filter: NDIS_PACKET_TYPE_. */ -int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter); - #endif /* !_IF_HNVAR_H_ */ From owner-svn-src-head@freebsd.org Fri Oct 28 08:41:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45EDBC241B9; Fri, 28 Oct 2016 08:41:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1297F7EA; Fri, 28 Oct 2016 08:41:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S8fVxW035694; Fri, 28 Oct 2016 08:41:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S8fV5M035693; Fri, 28 Oct 2016 08:41:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610280841.u9S8fV5M035693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 28 Oct 2016 08:41:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308017 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 08:41:32 -0000 Author: sephe Date: Fri Oct 28 08:41:30 2016 New Revision: 308017 URL: https://svnweb.freebsd.org/changeset/base/308017 Log: hyperv/hn: Change header guardian; in preparation for the upcoming rename. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8359 Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Oct 28 08:32:54 2016 (r308016) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Oct 28 08:41:30 2016 (r308017) @@ -28,8 +28,8 @@ * $FreeBSD$ */ -#ifndef __HV_RNDIS_FILTER_H__ -#define __HV_RNDIS_FILTER_H__ +#ifndef _HN_RNDIS_H_ +#define _HN_RNDIS_H_ struct hn_softc; @@ -46,4 +46,4 @@ int hn_rndis_set_rxfilter(struct hn_sof void hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data, int dlen); -#endif /* __HV_RNDIS_FILTER_H__ */ +#endif /* !_HN_RNDIS_H_ */ From owner-svn-src-head@freebsd.org Fri Oct 28 08:53:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66D14C24654; Fri, 28 Oct 2016 08:53:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E240E25; Fri, 28 Oct 2016 08:53:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9S8rJuo042112; Fri, 28 Oct 2016 08:53:19 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9S8rJv3042108; Fri, 28 Oct 2016 08:53:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610280853.u9S8rJv3042108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 28 Oct 2016 08:53:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308018 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 08:53:20 -0000 Author: sephe Date: Fri Oct 28 08:53:18 2016 New Revision: 308018 URL: https://svnweb.freebsd.org/changeset/base/308018 Log: hyeprv/hn: Rename cleaned up RNDIS header file. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8360 Added: head/sys/dev/hyperv/netvsc/hn_rndis.h - copied unchanged from r308017, head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Deleted: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Copied: head/sys/dev/hyperv/netvsc/hn_rndis.h (from r308017, head/sys/dev/hyperv/netvsc/hv_rndis_filter.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/netvsc/hn_rndis.h Fri Oct 28 08:53:18 2016 (r308018, copy of r308017, head/sys/dev/hyperv/netvsc/hv_rndis_filter.h) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2010-2012 Citrix Inc. + * Copyright (c) 2012 NetApp Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _HN_RNDIS_H_ +#define _HN_RNDIS_H_ + +struct hn_softc; + +int hn_rndis_attach(struct hn_softc *sc, int mtu); +void hn_rndis_detach(struct hn_softc *sc); +int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); +int hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt); +int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr); +/* link_status: NDIS_MEDIA_STATE_ */ +int hn_rndis_get_linkstatus(struct hn_softc *sc, + uint32_t *link_status); +/* filter: NDIS_PACKET_TYPE_. */ +int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter); +void hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data, + int dlen); + +#endif /* !_HN_RNDIS_H_ */ Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 08:41:30 2016 (r308017) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 28 08:53:18 2016 (r308018) @@ -125,7 +125,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include "vmbus_if.h" Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 08:41:30 2016 (r308017) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 28 08:53:18 2016 (r308018) @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #define HN_RNDIS_RID_COMPAT_MASK 0xffff #define HN_RNDIS_RID_COMPAT_MAX HN_RNDIS_RID_COMPAT_MASK From owner-svn-src-head@freebsd.org Fri Oct 28 10:57:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20930C24368; Fri, 28 Oct 2016 10:57:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6AC0A6B; Fri, 28 Oct 2016 10:57:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SAvgga088920; Fri, 28 Oct 2016 10:57:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SAvgfn088919; Fri, 28 Oct 2016 10:57:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281057.u9SAvgfn088919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 10:57:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308019 - head/sys/fs/msdosfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 10:57:43 -0000 Author: kib Date: Fri Oct 28 10:57:41 2016 New Revision: 308019 URL: https://svnweb.freebsd.org/changeset/base/308019 Log: Remove useless NULL check. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vfsops.c Fri Oct 28 08:53:18 2016 (r308018) +++ head/sys/fs/msdosfs/msdosfs_vfsops.c Fri Oct 28 10:57:41 2016 (r308019) @@ -760,8 +760,7 @@ error_exit: } if (pmp) { lockdestroy(&pmp->pm_fatlock); - if (pmp->pm_inusemap) - free(pmp->pm_inusemap, M_MSDOSFSFAT); + free(pmp->pm_inusemap, M_MSDOSFSFAT); free(pmp, M_MSDOSFSMNT); mp->mnt_data = NULL; } From owner-svn-src-head@freebsd.org Fri Oct 28 10:59:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DBEBC24421; Fri, 28 Oct 2016 10:59:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D236C48; Fri, 28 Oct 2016 10:59:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SAxY0E089028; Fri, 28 Oct 2016 10:59:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SAxYfp089027; Fri, 28 Oct 2016 10:59:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281059.u9SAxYfp089027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 10:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308020 - head/sys/fs/msdosfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 10:59:35 -0000 Author: kib Date: Fri Oct 28 10:59:34 2016 New Revision: 308020 URL: https://svnweb.freebsd.org/changeset/base/308020 Log: Fix comment formatting. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/fs/msdosfs/msdosfs_fat.c Modified: head/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 28 10:57:41 2016 (r308019) +++ head/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 28 10:59:34 2016 (r308020) @@ -972,12 +972,14 @@ extendfile(struct denode *dep, u_long co while (count > 0) { /* * Allocate a new cluster chain and cat onto the end of the - * file. * If the file is empty we make de_StartCluster point - * to the new block. Note that de_StartCluster being 0 is - * sufficient to be sure the file is empty since we exclude - * attempts to extend the root directory above, and the root - * dir is the only file with a startcluster of 0 that has - * blocks allocated (sort of). + * file. + * If the file is empty we make de_StartCluster point + * to the new block. Note that de_StartCluster being + * 0 is sufficient to be sure the file is empty since + * we exclude attempts to extend the root directory + * above, and the root dir is the only file with a + * startcluster of 0 that has blocks allocated (sort + * of). */ if (dep->de_StartCluster == 0) cn = 0; From owner-svn-src-head@freebsd.org Fri Oct 28 11:01:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A130C2465B; Fri, 28 Oct 2016 11:01:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16E74F55; Fri, 28 Oct 2016 11:01:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SB1nFC091888; Fri, 28 Oct 2016 11:01:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SB1nKJ091887; Fri, 28 Oct 2016 11:01:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281101.u9SB1nKJ091887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 11:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308021 - head/sys/fs/msdosfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 11:01:50 -0000 Author: kib Date: Fri Oct 28 11:01:49 2016 New Revision: 308021 URL: https://svnweb.freebsd.org/changeset/base/308021 Log: Use symbolic name for the free cluster number. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/fs/msdosfs/msdosfs_fat.c Modified: head/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 28 10:59:34 2016 (r308020) +++ head/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 28 11:01:49 2016 (r308021) @@ -908,7 +908,7 @@ fillinusemap(struct msdosfsmount *pmp) readcn >>= 4; readcn &= pmp->pm_fatmask; - if (readcn == 0) + if (readcn == CLUST_FREE) usemap_free(pmp, cn); } if (bp != NULL) From owner-svn-src-head@freebsd.org Fri Oct 28 11:23:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8630C24DBD; Fri, 28 Oct 2016 11:23:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90893DB7; Fri, 28 Oct 2016 11:23:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SBNamC000496; Fri, 28 Oct 2016 11:23:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SBNa9c000495; Fri, 28 Oct 2016 11:23:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281123.u9SBNa9c000495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 11:23:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308022 - head/sys/fs/msdosfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 11:23:37 -0000 Author: kib Date: Fri Oct 28 11:23:36 2016 New Revision: 308022 URL: https://svnweb.freebsd.org/changeset/base/308022 Log: Use symbolic name for the value of fully free word in pm_inusemap. Explicitely mention every bit in the value. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/fs/msdosfs/msdosfs_fat.c Modified: head/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 28 11:01:49 2016 (r308021) +++ head/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 28 11:23:36 2016 (r308022) @@ -60,6 +60,8 @@ #include #include +#define FULL_RUN ((u_int)0xffffffff) + static int chainalloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith, u_long *retcluster, u_long *got); @@ -752,8 +754,8 @@ clusteralloc1(struct msdosfsmount *pmp, idx = cn / N_INUSEBITS; map = pmp->pm_inusemap[idx]; map |= (1 << (cn % N_INUSEBITS)) - 1; - if (map != (u_int)-1) { - cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1; + if (map != FULL_RUN) { + cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1; if ((l = chainlength(pmp, cn, count)) >= count) return (chainalloc(pmp, cn, count, fillwith, retcluster, got)); if (l > foundl) { @@ -769,8 +771,8 @@ clusteralloc1(struct msdosfsmount *pmp, idx = cn / N_INUSEBITS; map = pmp->pm_inusemap[idx]; map |= (1 << (cn % N_INUSEBITS)) - 1; - if (map != (u_int)-1) { - cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1; + if (map != FULL_RUN) { + cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1; if ((l = chainlength(pmp, cn, count)) >= count) return (chainalloc(pmp, cn, count, fillwith, retcluster, got)); if (l > foundl) { @@ -878,7 +880,7 @@ fillinusemap(struct msdosfsmount *pmp) * loop further down. */ for (cn = 0; cn < (pmp->pm_maxcluster + N_INUSEBITS) / N_INUSEBITS; cn++) - pmp->pm_inusemap[cn] = (u_int)-1; + pmp->pm_inusemap[cn] = FULL_RUN; /* * Figure how many free clusters are in the filesystem by ripping From owner-svn-src-head@freebsd.org Fri Oct 28 11:26:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C72FC24E5E; Fri, 28 Oct 2016 11:26:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C617F86; Fri, 28 Oct 2016 11:26:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SBQi86000640; Fri, 28 Oct 2016 11:26:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SBQiOS000639; Fri, 28 Oct 2016 11:26:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281126.u9SBQiOS000639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 11:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308023 - head/sys/fs/msdosfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 11:26:45 -0000 Author: kib Date: Fri Oct 28 11:26:44 2016 New Revision: 308023 URL: https://svnweb.freebsd.org/changeset/base/308023 Log: If the fatchain() call in chainalloc() returned an error, revert marking the cluster run as in-use. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/fs/msdosfs/msdosfs_fat.c Modified: head/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 28 11:23:36 2016 (r308022) +++ head/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 28 11:26:44 2016 (r308023) @@ -691,8 +691,11 @@ chainalloc(struct msdosfsmount *pmp, u_l pmp->pm_nxtfree = CLUST_FIRST; pmp->pm_flags |= MSDOSFS_FSIMOD; error = fatchain(pmp, start, count, fillwith); - if (error != 0) + if (error != 0) { + for (cl = start, n = count; n-- > 0;) + usemap_free(pmp, cl++); return (error); + } #ifdef MSDOSFS_DEBUG printf("clusteralloc(): allocated cluster chain at %lu (%lu clusters)\n", start, count); From owner-svn-src-head@freebsd.org Fri Oct 28 11:34:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8940AC2514D; Fri, 28 Oct 2016 11:34:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C7B096F; Fri, 28 Oct 2016 11:34:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SBYW4O004571; Fri, 28 Oct 2016 11:34:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SBYWjh004570; Fri, 28 Oct 2016 11:34:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281134.u9SBYWjh004570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 11:34:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308024 - head/sys/fs/msdosfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 11:34:33 -0000 Author: kib Date: Fri Oct 28 11:34:32 2016 New Revision: 308024 URL: https://svnweb.freebsd.org/changeset/base/308024 Log: Ensure that cluster allocations never allocate clusters outside the volume limits. In particular: - Assert that usemap_alloc() and usemap_free() cluster number argument is valid. - In chainlength(), return 0 if cluster start is after the max cluster. - In chainlength(), cut the calculated cluster chain length at the max cluster. - For true paranoia, after the pm_inusemap is calculated in fillinusemap(), reset all bits in the array for clusters after the max cluster, as in-use. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/fs/msdosfs/msdosfs_fat.c Modified: head/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 28 11:26:44 2016 (r308023) +++ head/sys/fs/msdosfs/msdosfs_fat.c Fri Oct 28 11:34:32 2016 (r308024) @@ -382,6 +382,8 @@ usemap_alloc(struct msdosfsmount *pmp, u MSDOSFS_ASSERT_MP_LOCKED(pmp); + KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn, + pmp->pm_maxcluster)); KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, ("usemap_alloc on ro msdosfs mount")); KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) @@ -398,6 +400,9 @@ usemap_free(struct msdosfsmount *pmp, u_ { MSDOSFS_ASSERT_MP_LOCKED(pmp); + + KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn, + pmp->pm_maxcluster)); KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, ("usemap_free on ro msdosfs mount")); pmp->pm_freeclustercount++; @@ -637,6 +642,8 @@ chainlength(struct msdosfsmount *pmp, u_ MSDOSFS_ASSERT_MP_LOCKED(pmp); + if (start > pmp->pm_maxcluster) + return (0); max_idx = pmp->pm_maxcluster / N_INUSEBITS; idx = start / N_INUSEBITS; start %= N_INUSEBITS; @@ -644,11 +651,18 @@ chainlength(struct msdosfsmount *pmp, u_ map &= ~((1 << start) - 1); if (map) { len = ffs(map) - 1 - start; - return (len > count ? count : len); + len = MIN(len, count); + if (start + len > pmp->pm_maxcluster) + len = pmp->pm_maxcluster - start + 1; + return (len); } len = N_INUSEBITS - start; - if (len >= count) - return (count); + if (len >= count) { + len = count; + if (start + len > pmp->pm_maxcluster) + len = pmp->pm_maxcluster - start + 1; + return (len); + } while (++idx <= max_idx) { if (len >= count) break; @@ -659,7 +673,10 @@ chainlength(struct msdosfsmount *pmp, u_ } len += N_INUSEBITS; } - return (len > count ? count : len); + len = MIN(len, count); + if (start + len > pmp->pm_maxcluster) + len = pmp->pm_maxcluster - start + 1; + return (len); } /* @@ -918,6 +935,11 @@ fillinusemap(struct msdosfsmount *pmp) } if (bp != NULL) brelse(bp); + + for (cn = pmp->pm_maxcluster + 1; cn < (pmp->pm_maxcluster + + N_INUSEBITS) / N_INUSEBITS; cn++) + pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS); + return (0); } From owner-svn-src-head@freebsd.org Fri Oct 28 11:35:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40D46C25190; Fri, 28 Oct 2016 11:35:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED20CAE4; Fri, 28 Oct 2016 11:35:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SBZ7E1004642; Fri, 28 Oct 2016 11:35:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SBZ7Kk004640; Fri, 28 Oct 2016 11:35:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281135.u9SBZ7Kk004640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 11:35:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308025 - head/sys/fs/msdosfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 11:35:08 -0000 Author: kib Date: Fri Oct 28 11:35:06 2016 New Revision: 308025 URL: https://svnweb.freebsd.org/changeset/base/308025 Log: Enable vn_io_fault() deadlock avoidance for msdosfs. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c head/sys/fs/msdosfs/msdosfs_vnops.c Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vfsops.c Fri Oct 28 11:34:32 2016 (r308024) +++ head/sys/fs/msdosfs/msdosfs_vfsops.c Fri Oct 28 11:35:06 2016 (r308025) @@ -742,7 +742,7 @@ mountmsdosfs(struct vnode *devvp, struct mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_USES_BCACHE; + mp->mnt_kern_flag |= MNTK_USES_BCACHE | MNTK_NO_IOPF; MNT_IUNLOCK(mp); if (pmp->pm_flags & MSDOSFS_LARGEFS) Modified: head/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vnops.c Fri Oct 28 11:34:32 2016 (r308024) +++ head/sys/fs/msdosfs/msdosfs_vnops.c Fri Oct 28 11:35:06 2016 (r308025) @@ -593,7 +593,7 @@ msdosfs_read(struct vop_read_args *ap) diff = blsize - bp->b_resid; if (diff < n) n = diff; - error = uiomove(bp->b_data + on, (int) n, uio); + error = vn_io_fault_uiomove(bp->b_data + on, (int) n, uio); brelse(bp); } while (error == 0 && uio->uio_resid > 0 && n != 0); if (!isadir && (error == 0 || uio->uio_resid != orig_resid) && @@ -723,6 +723,12 @@ msdosfs_write(struct vop_write_args *ap) * then no need to read data from disk. */ bp = getblk(thisvp, bn, pmp->pm_bpcluster, 0, 0, 0); + /* + * This call to vfs_bio_clrbuf() ensures that + * even if vn_io_fault_uiomove() below faults, + * garbage from the newly instantiated buffer + * is not exposed to the userspace via mmap(). + */ vfs_bio_clrbuf(bp); /* * Do the bmap now, since pcbmap needs buffers @@ -760,7 +766,7 @@ msdosfs_write(struct vop_write_args *ap) /* * Copy the data from user space into the buf header. */ - error = uiomove(bp->b_data + croffset, n, uio); + error = vn_io_fault_uiomove(bp->b_data + croffset, n, uio); if (error) { brelse(bp); break; From owner-svn-src-head@freebsd.org Fri Oct 28 11:44:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5490C25487; Fri, 28 Oct 2016 11:44:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0D5A12F; Fri, 28 Oct 2016 11:44:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SBhx4F008550; Fri, 28 Oct 2016 11:43:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SBhxrN008547; Fri, 28 Oct 2016 11:43:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281143.u9SBhxrN008547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 11:43:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308026 - in head/sys: kern sys ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 11:44:00 -0000 Author: kib Date: Fri Oct 28 11:43:59 2016 New Revision: 308026 URL: https://svnweb.freebsd.org/changeset/base/308026 Log: Generalize UFS buffer pager to allow it serving other filesystems which also use buffer cache. Most important addition to the code is the handling of filesystems where the block size is less than the machine page size, which might require reading several buffers to validate single page. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/vfs_bio.c head/sys/sys/buf.h head/sys/ufs/ffs/ffs_vnops.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Fri Oct 28 11:35:06 2016 (r308025) +++ head/sys/kern/vfs_bio.c Fri Oct 28 11:43:59 2016 (r308026) @@ -75,9 +75,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include +#include +#include +#include #include #include #include @@ -4636,6 +4637,161 @@ bdata2bio(struct buf *bp, struct bio *bi } } +static int buf_pager_relbuf; +SYSCTL_INT(_vfs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN, + &buf_pager_relbuf, 0, + "Make buffer pager release buffers after reading"); + +/* + * The buffer pager. It uses buffer reads to validate pages. + * + * In contrast to the generic local pager from vm/vnode_pager.c, this + * pager correctly and easily handles volumes where the underlying + * device block size is greater than the machine page size. The + * buffer cache transparently extends the requested page run to be + * aligned at the block boundary, and does the necessary bogus page + * replacements in the addends to avoid obliterating already valid + * pages. + * + * The only non-trivial issue is that the exclusive busy state for + * pages, which is assumed by the vm_pager_getpages() interface, is + * incompatible with the VMIO buffer cache's desire to share-busy the + * pages. This function performs a trivial downgrade of the pages' + * state before reading buffers, and a less trivial upgrade from the + * shared-busy to excl-busy state after the read. + */ +int +vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int count, + int *rbehind, int *rahead, vbg_get_lblkno_t get_lblkno, + vbg_get_blksize_t get_blksize) +{ + vm_page_t m; + vm_object_t object; + struct buf *bp; + daddr_t lbn, lbnp; + vm_ooffset_t la, lb, poff, poffe; + long bsize; + int bo_bs, error, i; + bool redo, lpart; + + object = vp->v_object; + la = IDX_TO_OFF(ma[count - 1]->pindex); + if (la >= object->un_pager.vnp.vnp_size) + return (VM_PAGER_BAD); + lpart = la + PAGE_SIZE > object->un_pager.vnp.vnp_size; + bo_bs = get_blksize(vp, get_lblkno(vp, IDX_TO_OFF(ma[0]->pindex))); + if (rbehind != NULL) { + lb = IDX_TO_OFF(ma[0]->pindex); + *rbehind = OFF_TO_IDX(lb - rounddown2(lb, bo_bs)); + } + if (rahead != NULL) { + *rahead = OFF_TO_IDX(roundup2(la, bo_bs) - la); + if (la + IDX_TO_OFF(*rahead) >= object->un_pager.vnp.vnp_size) { + *rahead = OFF_TO_IDX(roundup2(object->un_pager. + vnp.vnp_size, PAGE_SIZE) - la); + } + } + VM_OBJECT_WLOCK(object); +again: + for (i = 0; i < count; i++) + vm_page_busy_downgrade(ma[i]); + VM_OBJECT_WUNLOCK(object); + + lbnp = -1; + for (i = 0; i < count; i++) { + m = ma[i]; + + /* + * Pages are shared busy and the object lock is not + * owned, which together allow for the pages' + * invalidation. The racy test for validity avoids + * useless creation of the buffer for the most typical + * case when invalidation is not used in redo or for + * parallel read. The shared->excl upgrade loop at + * the end of the function catches the race in a + * reliable way (protected by the object lock). + */ + if (m->valid == VM_PAGE_BITS_ALL) + continue; + + poff = IDX_TO_OFF(m->pindex); + poffe = MIN(poff + PAGE_SIZE, object->un_pager.vnp.vnp_size); + for (; poff < poffe; poff += bsize) { + lbn = get_lblkno(vp, poff); + if (lbn == lbnp) + goto next_page; + lbnp = lbn; + + bsize = get_blksize(vp, lbn); + error = bread_gb(vp, lbn, bsize, NOCRED, GB_UNMAPPED, + &bp); + if (error != 0) + goto end_pages; + if (LIST_EMPTY(&bp->b_dep)) { + /* + * Invalidation clears m->valid, but + * may leave B_CACHE flag if the + * buffer existed at the invalidation + * time. In this case, recycle the + * buffer to do real read on next + * bread() after redo. + * + * Otherwise B_RELBUF is not strictly + * necessary, enable to reduce buf + * cache pressure. + */ + if (buf_pager_relbuf || + m->valid != VM_PAGE_BITS_ALL) + bp->b_flags |= B_RELBUF; + + bp->b_flags &= ~B_NOCACHE; + brelse(bp); + } else { + bqrelse(bp); + } + } + KASSERT(1 /* racy, enable for debugging */ || + m->valid == VM_PAGE_BITS_ALL || i == count - 1, + ("buf %d %p invalid", i, m)); + if (i == count - 1 && lpart) { + VM_OBJECT_WLOCK(object); + if (m->valid != 0 && + m->valid != VM_PAGE_BITS_ALL) + vm_page_zero_invalid(m, TRUE); + VM_OBJECT_WUNLOCK(object); + } +next_page:; + } +end_pages: + + VM_OBJECT_WLOCK(object); + redo = false; + for (i = 0; i < count; i++) { + vm_page_sunbusy(ma[i]); + ma[i] = vm_page_grab(object, ma[i]->pindex, VM_ALLOC_NORMAL); + + /* + * Since the pages were only sbusy while neither the + * buffer nor the object lock was held by us, or + * reallocated while vm_page_grab() slept for busy + * relinguish, they could have been invalidated. + * Recheck the valid bits and re-read as needed. + * + * Note that the last page is made fully valid in the + * read loop, and partial validity for the page at + * index count - 1 could mean that the page was + * invalidated or removed, so we must restart for + * safety as well. + */ + if (ma[i]->valid != VM_PAGE_BITS_ALL) + redo = true; + } + if (redo && error == 0) + goto again; + VM_OBJECT_WUNLOCK(object); + return (error != 0 ? VM_PAGER_ERROR : VM_PAGER_OK); +} + #include "opt_ddb.h" #ifdef DDB #include Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Fri Oct 28 11:35:06 2016 (r308025) +++ head/sys/sys/buf.h Fri Oct 28 11:43:59 2016 (r308026) @@ -68,6 +68,7 @@ extern struct bio_ops { } bioops; struct vm_object; +struct vm_page; typedef unsigned char b_xflags_t; @@ -537,6 +538,12 @@ struct buf *trypbuf(int *); void bwait(struct buf *, u_char, const char *); void bdone(struct buf *); +typedef daddr_t (vbg_get_lblkno_t)(struct vnode *, vm_ooffset_t); +typedef int (vbg_get_blksize_t)(struct vnode *, daddr_t); +int vfs_bio_getpages(struct vnode *vp, struct vm_page **ma, int count, + int *rbehind, int *rahead, vbg_get_lblkno_t get_lblkno, + vbg_get_blksize_t get_blksize); + #endif /* _KERNEL */ #endif /* !_SYS_BUF_H_ */ Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Fri Oct 28 11:35:06 2016 (r308025) +++ head/sys/ufs/ffs/ffs_vnops.c Fri Oct 28 11:43:59 2016 (r308026) @@ -87,7 +87,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -1791,160 +1790,33 @@ SYSCTL_DECL(_vfs_ffs); static int use_buf_pager = 1; SYSCTL_INT(_vfs_ffs, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN, &use_buf_pager, 0, "Always use buffer pager instead of bmap"); -static int buf_pager_relbuf; -SYSCTL_INT(_vfs_ffs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN, - &buf_pager_relbuf, 0, - "Make buffer pager release buffers after reading"); -/* - * The FFS pager. It uses buffer reads to validate pages. - * - * In contrast to the generic local pager from vm/vnode_pager.c, this - * pager correctly and easily handles volumes where the underlying - * device block size is greater than the machine page size. The - * buffer cache transparently extends the requested page run to be - * aligned at the block boundary, and does the necessary bogus page - * replacements in the addends to avoid obliterating already valid - * pages. - * - * The only non-trivial issue is that the exclusive busy state for - * pages, which is assumed by the vm_pager_getpages() interface, is - * incompatible with the VMIO buffer cache's desire to share-busy the - * pages. This function performs a trivial downgrade of the pages' - * state before reading buffers, and a less trivial upgrade from the - * shared-busy to excl-busy state after the read. - */ +static daddr_t +ffs_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) +{ + + return (lblkno(VFSTOUFS(vp->v_mount)->um_fs, off)); +} + +static int +ffs_gbp_getblksz(struct vnode *vp, daddr_t lbn) +{ + + return (blksize(VFSTOUFS(vp->v_mount)->um_fs, VTOI(vp), lbn)); +} + static int ffs_getpages(struct vop_getpages_args *ap) { struct vnode *vp; - vm_page_t *ma, m; - vm_object_t object; - struct buf *bp; struct ufsmount *um; - ufs_lbn_t lbn, lbnp; - vm_ooffset_t la, lb; - long bsize; - int bo_bs, count, error, i; - bool redo, lpart; vp = ap->a_vp; - ma = ap->a_m; - count = ap->a_count; + um = VFSTOUFS(vp->v_mount); - um = VFSTOUFS(ap->a_vp->v_mount); - bo_bs = um->um_devvp->v_bufobj.bo_bsize; - if (!use_buf_pager && bo_bs <= PAGE_SIZE) - return (vnode_pager_generic_getpages(vp, ma, count, + if (!use_buf_pager && um->um_devvp->v_bufobj.bo_bsize <= PAGE_SIZE) + return (vnode_pager_generic_getpages(vp, ap->a_m, ap->a_count, ap->a_rbehind, ap->a_rahead, NULL, NULL)); - - object = vp->v_object; - la = IDX_TO_OFF(ma[count - 1]->pindex); - if (la >= object->un_pager.vnp.vnp_size) - return (VM_PAGER_BAD); - lpart = la + PAGE_SIZE > object->un_pager.vnp.vnp_size; - if (ap->a_rbehind != NULL) { - lb = IDX_TO_OFF(ma[0]->pindex); - *ap->a_rbehind = OFF_TO_IDX(lb - rounddown2(lb, bo_bs)); - } - if (ap->a_rahead != NULL) { - *ap->a_rahead = OFF_TO_IDX(roundup2(la, bo_bs) - la); - if (la + IDX_TO_OFF(*ap->a_rahead) >= - object->un_pager.vnp.vnp_size) { - *ap->a_rahead = OFF_TO_IDX(roundup2(object->un_pager. - vnp.vnp_size, PAGE_SIZE) - la); - } - } - VM_OBJECT_WLOCK(object); -again: - for (i = 0; i < count; i++) - vm_page_busy_downgrade(ma[i]); - VM_OBJECT_WUNLOCK(object); - - lbnp = -1; - for (i = 0; i < count; i++) { - m = ma[i]; - - /* - * Pages are shared busy and the object lock is not - * owned, which together allow for the pages' - * invalidation. The racy test for validity avoids - * useless creation of the buffer for the most typical - * case when invalidation is not used in redo or for - * parallel read. The shared->excl upgrade loop at - * the end of the function catches the race in a - * reliable way (protected by the object lock). - */ - if (m->valid == VM_PAGE_BITS_ALL) - continue; - - lbn = lblkno(um->um_fs, IDX_TO_OFF(m->pindex)); - if (lbn != lbnp) { - bsize = blksize(um->um_fs, VTOI(vp), lbn); - error = bread_gb(vp, lbn, bsize, NOCRED, GB_UNMAPPED, - &bp); - if (error != 0) - break; - KASSERT(1 /* racy, enable for debugging */ || - m->valid == VM_PAGE_BITS_ALL || i == count - 1, - ("buf %d %p invalid", i, m)); - if (i == count - 1 && lpart) { - VM_OBJECT_WLOCK(object); - if (m->valid != 0 && - m->valid != VM_PAGE_BITS_ALL) - vm_page_zero_invalid(m, TRUE); - VM_OBJECT_WUNLOCK(object); - } - if (LIST_EMPTY(&bp->b_dep)) { - /* - * Invalidation clears m->valid, but - * may leave B_CACHE flag if the - * buffer existed at the invalidation - * time. In this case, recycle the - * buffer to do real read on next - * bread() after redo. - * - * Otherwise B_RELBUF is not strictly - * necessary, enable to reduce buf - * cache pressure. - */ - if (buf_pager_relbuf || - m->valid != VM_PAGE_BITS_ALL) - bp->b_flags |= B_RELBUF; - - bp->b_flags &= ~B_NOCACHE; - brelse(bp); - } else { - bqrelse(bp); - } - lbnp = lbn; - } - } - - VM_OBJECT_WLOCK(object); - redo = false; - for (i = 0; i < count; i++) { - vm_page_sunbusy(ma[i]); - ma[i] = vm_page_grab(object, ma[i]->pindex, VM_ALLOC_NORMAL); - - /* - * Since the pages were only sbusy while neither the - * buffer nor the object lock was held by us, or - * reallocated while vm_page_grab() slept for busy - * relinguish, they could have been invalidated. - * Recheck the valid bits and re-read as needed. - * - * Note that the last page is made fully valid in the - * read loop, and partial validity for the page at - * index count - 1 could mean that the page was - * invalidated or removed, so we must restart for - * safety as well. - */ - if (ma[i]->valid != VM_PAGE_BITS_ALL) - redo = true; - } - if (redo && error == 0) - goto again; - VM_OBJECT_WUNLOCK(object); - return (error != 0 ? VM_PAGER_ERROR : VM_PAGER_OK); + return (vfs_bio_getpages(vp, ap->a_m, ap->a_count, ap->a_rbehind, + ap->a_rahead, ffs_gbp_getblkno, ffs_gbp_getblksz)); } From owner-svn-src-head@freebsd.org Fri Oct 28 11:46:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30E74C25507; Fri, 28 Oct 2016 11:46:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAA842F1; Fri, 28 Oct 2016 11:46:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SBkGii008689; Fri, 28 Oct 2016 11:46:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SBkGXu008688; Fri, 28 Oct 2016 11:46:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281146.u9SBkGXu008688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 11:46:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308027 - head/sys/fs/msdosfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 11:46:17 -0000 Author: kib Date: Fri Oct 28 11:46:15 2016 New Revision: 308027 URL: https://svnweb.freebsd.org/changeset/base/308027 Log: Use buffer pager for msdosfs. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/fs/msdosfs/msdosfs_vnops.c Modified: head/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vnops.c Fri Oct 28 11:43:59 2016 (r308026) +++ head/sys/fs/msdosfs/msdosfs_vnops.c Fri Oct 28 11:46:15 2016 (r308027) @@ -62,11 +62,13 @@ #include #include #include +#include #include #include #include #include +#include #include #include @@ -97,6 +99,7 @@ static vop_rmdir_t msdosfs_rmdir; static vop_symlink_t msdosfs_symlink; static vop_readdir_t msdosfs_readdir; static vop_bmap_t msdosfs_bmap; +static vop_getpages_t msdosfs_getpages; static vop_strategy_t msdosfs_strategy; static vop_print_t msdosfs_print; static vop_pathconf_t msdosfs_pathconf; @@ -1798,6 +1801,38 @@ msdosfs_bmap(struct vop_bmap_args *ap) return (0); } +SYSCTL_NODE(_vfs, OID_AUTO, msdosfs, CTLFLAG_RW, 0, "msdos filesystem"); +static int use_buf_pager = 1; +SYSCTL_INT(_vfs_msdosfs, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN, + &use_buf_pager, 0, + "Use buffer pager instead of bmap"); + +static daddr_t +msdosfs_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) +{ + + return (de_cluster(VTODE(vp)->de_pmp, off)); +} + +static int +msdosfs_gbp_getblksz(struct vnode *vp, daddr_t lbn) +{ + + return (VTODE(vp)->de_pmp->pm_bpcluster); +} + +static int +msdosfs_getpages(struct vop_getpages_args *ap) +{ + + if (use_buf_pager) + return (vfs_bio_getpages(ap->a_vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, msdosfs_gbp_getblkno, + msdosfs_gbp_getblksz)); + return (vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, NULL, NULL)); +} + static int msdosfs_strategy(struct vop_strategy_args *ap) { @@ -1898,6 +1933,7 @@ struct vop_vector msdosfs_vnodeops = { .vop_access = msdosfs_access, .vop_bmap = msdosfs_bmap, + .vop_getpages = msdosfs_getpages, .vop_cachedlookup = msdosfs_lookup, .vop_open = msdosfs_open, .vop_close = msdosfs_close, From owner-svn-src-head@freebsd.org Fri Oct 28 11:46:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66242C2555F; Fri, 28 Oct 2016 11:46:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1EF1669D; Fri, 28 Oct 2016 11:46:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SBkdJe008745; Fri, 28 Oct 2016 11:46:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SBkdlD008744; Fri, 28 Oct 2016 11:46:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281146.u9SBkdlD008744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 11:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308028 - head/sys/fs/cd9660 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 11:46:40 -0000 Author: kib Date: Fri Oct 28 11:46:39 2016 New Revision: 308028 URL: https://svnweb.freebsd.org/changeset/base/308028 Log: Use buffer pager for cd9660. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/fs/cd9660/cd9660_vnops.c Modified: head/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vnops.c Fri Oct 28 11:46:15 2016 (r308027) +++ head/sys/fs/cd9660/cd9660_vnops.c Fri Oct 28 11:46:39 2016 (r308028) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -74,6 +75,7 @@ static vop_readdir_t cd9660_readdir; static vop_readlink_t cd9660_readlink; static vop_strategy_t cd9660_strategy; static vop_vptofh_t cd9660_vptofh; +static vop_getpages_t cd9660_getpages; /* * Setattr call. Only allowed for block and character special devices. @@ -836,6 +838,45 @@ cd9660_vptofh(ap) return (0); } +SYSCTL_NODE(_vfs, OID_AUTO, cd9660, CTLFLAG_RW, 0, "cd9660 filesystem"); +static int use_buf_pager = 1; +SYSCTL_INT(_vfs_cd9660, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN, + &use_buf_pager, 0, + "Use buffer pager instead of bmap"); + +static daddr_t +cd9660_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) +{ + + return (lblkno(VTOI(vp)->i_mnt, off)); +} + +static int +cd9660_gbp_getblksz(struct vnode *vp, daddr_t lbn) +{ + struct iso_node *ip; + + ip = VTOI(vp); + return (blksize(ip->i_mnt, ip, lbn)); +} + +static int +cd9660_getpages(struct vop_getpages_args *ap) +{ + struct vnode *vp; + + vp = ap->a_vp; + if (vp->v_type == VCHR || vp->v_type == VBLK) + return (EOPNOTSUPP); + + if (use_buf_pager) + return (vfs_bio_getpages(vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, cd9660_gbp_getblkno, + cd9660_gbp_getblksz)); + return (vnode_pager_generic_getpages(vp, ap->a_m, ap->a_count, + ap->a_rbehind, ap->a_rahead, NULL, NULL)); +} + /* * Global vfs data structures for cd9660 */ @@ -857,6 +898,7 @@ struct vop_vector cd9660_vnodeops = { .vop_setattr = cd9660_setattr, .vop_strategy = cd9660_strategy, .vop_vptofh = cd9660_vptofh, + .vop_getpages = cd9660_getpages, }; /* From owner-svn-src-head@freebsd.org Fri Oct 28 11:53:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C86C9C25751; Fri, 28 Oct 2016 11:53:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B5E2BB1; Fri, 28 Oct 2016 11:53:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SBrM8f012343; Fri, 28 Oct 2016 11:53:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SBrMJk012342; Fri, 28 Oct 2016 11:53:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281153.u9SBrMJk012342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 11:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308029 - head/sys/i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 11:53:23 -0000 Author: kib Date: Fri Oct 28 11:53:22 2016 New Revision: 308029 URL: https://svnweb.freebsd.org/changeset/base/308029 Log: Handle pmap_enter() over an existing 4/2M page in KVA on i386. The userspace case was already handled by pmap_allocpte(). For kernel VA, page table page must exist, and demote cannot fail, so we need to just call pmap_demote_pde(). Also note that due to the machine AS layout, promotions in the KVA on i386 are highly unlikely, so this change is mostly for completeness. Reviewed by: alc, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D8323 Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Fri Oct 28 11:46:39 2016 (r308028) +++ head/sys/i386/i386/pmap.c Fri Oct 28 11:53:22 2016 (r308029) @@ -3466,11 +3466,14 @@ pmap_enter(pmap_t pmap, vm_offset_t va, PMAP_LOCK(pmap); sched_pin(); - /* - * In the case that a page table page is not - * resident, we are creating it here. - */ + pde = pmap_pde(pmap, va); if (va < VM_MAXUSER_ADDRESS) { + /* + * va is for UVA. + * In the case that a page table page is not resident, + * we are creating it here. pmap_allocpte() handles + * demotion. + */ mpte = pmap_allocpte(pmap, va, flags); if (mpte == NULL) { KASSERT((flags & PMAP_ENTER_NOSLEEP) != 0, @@ -3480,19 +3483,28 @@ pmap_enter(pmap_t pmap, vm_offset_t va, PMAP_UNLOCK(pmap); return (KERN_RESOURCE_SHORTAGE); } + } else { + /* + * va is for KVA, so pmap_demote_pde() will never fail + * to install a page table page. PG_V is also + * asserted by pmap_demote_pde(). + */ + KASSERT(pde != NULL && (*pde & PG_V) != 0, + ("KVA %#x invalid pde pdir %#jx", va, + (uintmax_t)pmap->pm_pdir[PTDPTDI])); + if ((*pde & PG_PS) != 0) + pmap_demote_pde(pmap, pde, va); } - - pde = pmap_pde(pmap, va); - if ((*pde & PG_PS) != 0) - panic("pmap_enter: attempted pmap_enter on 4MB page"); pte = pmap_pte_quick(pmap, va); /* - * Page Directory table entry not valid, we need a new PT page + * Page Directory table entry is not valid, which should not + * happen. We should have either allocated the page table + * page or demoted the existing mapping above. */ if (pte == NULL) { panic("pmap_enter: invalid page directory pdir=%#jx, va=%#x", - (uintmax_t)pmap->pm_pdir[PTDPTDI], va); + (uintmax_t)pmap->pm_pdir[PTDPTDI], va); } pa = VM_PAGE_TO_PHYS(m); From owner-svn-src-head@freebsd.org Fri Oct 28 12:27:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C29CFC21BFF; Fri, 28 Oct 2016 12:27:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BE826B2; Fri, 28 Oct 2016 12:27:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SCR5Fu024132; Fri, 28 Oct 2016 12:27:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SCR5d8024131; Fri, 28 Oct 2016 12:27:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610281227.u9SCR5d8024131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 28 Oct 2016 12:27:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308030 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 12:27:06 -0000 Author: kib Date: Fri Oct 28 12:27:05 2016 New Revision: 308030 URL: https://svnweb.freebsd.org/changeset/base/308030 Log: Use correct cpu id in the banner. Fix style. Noted by: avg Sponsored by: The FreeBSD Foundation MFC after: 9 days Modified: head/sys/x86/x86/cpu_machdep.c Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Fri Oct 28 11:53:22 2016 (r308029) +++ head/sys/x86/x86/cpu_machdep.c Fri Oct 28 12:27:05 2016 (r308030) @@ -551,7 +551,7 @@ nmi_call_kdb(u_int cpu, u_int type, stru * NMI can be hooked up to a pushbutton for debugging. */ if (kdb_on_nmi) { - printf ("NMI/cpu%d ... going to debugger\n", cpu); + printf("NMI/cpu%d ... going to debugger\n", cpu); kdb_trap(type, 0, frame); } #endif /* KDB */ @@ -572,6 +572,6 @@ nmi_handle_intr(u_int type, struct trapf return; } #endif - nmi_call_kdb(0, type, frame); + nmi_call_kdb(PCPU_GET(cpuid), type, frame); #endif } From owner-svn-src-head@freebsd.org Fri Oct 28 12:37:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDEB4C21FD6; Fri, 28 Oct 2016 12:37:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F911D41; Fri, 28 Oct 2016 12:37:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SCaxXO027815; Fri, 28 Oct 2016 12:36:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SCaxiv027814; Fri, 28 Oct 2016 12:36:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201610281236.u9SCaxiv027814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 28 Oct 2016 12:36:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308031 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 12:37:00 -0000 Author: hselasky Date: Fri Oct 28 12:36:59 2016 New Revision: 308031 URL: https://svnweb.freebsd.org/changeset/base/308031 Log: Fix indentation and remove duplicate queue stopped stats increment. Found by: Ryan Stone Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Fri Oct 28 12:27:05 2016 (r308030) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Fri Oct 28 12:36:59 2016 (r308031) @@ -707,20 +707,19 @@ static int mlx4_en_xmit(struct mlx4_en_p /* check if TX ring is full */ if (unlikely(mlx4_en_tx_ring_is_full(ring))) { - /* every full native Tx ring stops queue */ - if (ring->blocked == 0) - atomic_add_int(&priv->blocked, 1); - /* Set HW-queue-is-full flag */ - atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); - priv->port_stats.queue_stopped++; - ring->blocked = 1; + /* every full native Tx ring stops queue */ + if (ring->blocked == 0) + atomic_add_int(&priv->blocked, 1); + /* Set HW-queue-is-full flag */ + atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); priv->port_stats.queue_stopped++; + ring->blocked = 1; ring->queue_stopped++; /* Use interrupts to find out when queue opened */ mlx4_en_arm_cq(priv, priv->tx_cq[tx_ind]); return (ENOBUFS); - } + } /* sanity check we are not wrapping around */ KASSERT(((~ring->prod) & ring->size_mask) >= From owner-svn-src-head@freebsd.org Fri Oct 28 13:37:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77DB4C24FBA; Fri, 28 Oct 2016 13:37:59 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44561EFE; Fri, 28 Oct 2016 13:37:59 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SDbwn4051927; Fri, 28 Oct 2016 13:37:58 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SDbwNA051926; Fri, 28 Oct 2016 13:37:58 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201610281337.u9SDbwNA051926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Fri, 28 Oct 2016 13:37:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308038 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 13:37:59 -0000 Author: sbruno Date: Fri Oct 28 13:37:58 2016 New Revision: 308038 URL: https://svnweb.freebsd.org/changeset/base/308038 Log: The buffer address is always overwritten in the extended descriptor format, we have to refresh it ... always. This fixes problems reported in NetMap with em(4) devices after conversion to extended descriptor format in svn r293331. Submitted by: luigi@ Reported by: franco@opnsense.org MFC after: 2 days Modified: head/sys/dev/netmap/if_em_netmap.h Modified: head/sys/dev/netmap/if_em_netmap.h ============================================================================== --- head/sys/dev/netmap/if_em_netmap.h Fri Oct 28 12:59:21 2016 (r308037) +++ head/sys/dev/netmap/if_em_netmap.h Fri Oct 28 13:37:58 2016 (r308038) @@ -277,9 +277,9 @@ em_netmap_rxsync(struct netmap_kring *kr if (addr == NETMAP_BUF_BASE(na)) /* bad buf */ goto ring_reset; + curr->read.buffer_addr = htole64(paddr); if (slot->flags & NS_BUF_CHANGED) { /* buffer has changed, reload map */ - curr->read.buffer_addr = htole64(paddr); netmap_reload_map(na, rxr->rxtag, rxbuf->map, addr); slot->flags &= ~NS_BUF_CHANGED; } From owner-svn-src-head@freebsd.org Fri Oct 28 14:38:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF96BC2497E; Fri, 28 Oct 2016 14:38:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B06C4630; Fri, 28 Oct 2016 14:38:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SEc178076871; Fri, 28 Oct 2016 14:38:01 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SEc1bU076870; Fri, 28 Oct 2016 14:38:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201610281438.u9SEc1bU076870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Oct 2016 14:38:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308039 - head/sys/amd64/vmm/amd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 14:38:03 -0000 Author: avg Date: Fri Oct 28 14:38:01 2016 New Revision: 308039 URL: https://svnweb.freebsd.org/changeset/base/308039 Log: vmm: another take at maximmum address passed to contigmalloc Just using vm_paddr_t value with all bits set. That should work as long as the type is unsigned. While there, fix a couple of whitespace issues nearby. MFC after: 1 week X-MFC with: r307903 Modified: head/sys/amd64/vmm/amd/svm.c Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Fri Oct 28 13:37:58 2016 (r308038) +++ head/sys/amd64/vmm/amd/svm.c Fri Oct 28 14:38:01 2016 (r308039) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include "vmm_lapic.h" #include "vmm_stat.h" @@ -515,11 +514,11 @@ svm_vminit(struct vm *vm, pmap_t pmap) { struct svm_softc *svm_sc; struct svm_vcpu *vcpu; - vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; + vm_paddr_t msrpm_pa, iopm_pa, pml4_pa int i; svm_sc = contigmalloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO, - 0, VM_MAX_ADDRESS, PAGE_SIZE, 0); + 0, ~(vm_paddr_t)0, PAGE_SIZE, 0); svm_sc->vm = vm; svm_sc->nptp = (vm_offset_t)vtophys(pmap->pm_pml4); @@ -536,7 +535,7 @@ svm_vminit(struct vm *vm, pmap_t pmap) svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_GSBASE); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_FSBASE); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_KGSBASE); - + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_STAR); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_LSTAR); svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_CSTAR); From owner-svn-src-head@freebsd.org Fri Oct 28 14:49:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A710C24F4E; Fri, 28 Oct 2016 14:49:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE903F3B; Fri, 28 Oct 2016 14:49:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SEntlN080700; Fri, 28 Oct 2016 14:49:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SEntSp080699; Fri, 28 Oct 2016 14:49:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201610281449.u9SEntSp080699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Oct 2016 14:49:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308040 - head/usr.sbin/watchdogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 14:49:56 -0000 Author: avg Date: Fri Oct 28 14:49:54 2016 New Revision: 308040 URL: https://svnweb.freebsd.org/changeset/base/308040 Log: nap time between pats is forced to be at most half of the timeout Previously, if the timeout was less than 10 seconds, for example, about 8 seconds, then the watchdog timer would be let to expire before patting the watchdog. MFC after: 2 weeks Modified: head/usr.sbin/watchdogd/watchdogd.c Modified: head/usr.sbin/watchdogd/watchdogd.c ============================================================================== --- head/usr.sbin/watchdogd/watchdogd.c Fri Oct 28 14:38:01 2016 (r308039) +++ head/usr.sbin/watchdogd/watchdogd.c Fri Oct 28 14:49:54 2016 (r308040) @@ -80,7 +80,8 @@ static u_int timeout = WD_TO_128SEC; static u_int exit_timeout = WD_TO_NEVER; static u_int pretimeout = 0; static u_int timeout_sec; -static u_int passive = 0; +static u_int nap = 10; +static int passive = 0; static int is_daemon = 0; static int is_dry_run = 0; /* do not arm the watchdog, only report on timing of the watch @@ -88,7 +89,6 @@ static int is_dry_run = 0; /* do not ar static int do_timedog = 0; static int do_syslog = 1; static int fd = -1; -static int nap = 10; static int carp_thresh_seconds = -1; static char *test_cmd = NULL; @@ -771,6 +771,9 @@ parseargs(int argc, char *argv[]) } } + if (nap > timeout_sec / 2) + nap = timeout_sec / 2; + if (carp_thresh_seconds == -1) carp_thresh_seconds = nap; From owner-svn-src-head@freebsd.org Fri Oct 28 15:15:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C789FC248D6; Fri, 28 Oct 2016 15:15:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6F2D36F; Fri, 28 Oct 2016 15:15:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 97A3710AF8B; Fri, 28 Oct 2016 11:15:15 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307971 - head/sys/mips/include Date: Thu, 27 Oct 2016 15:08:01 -0700 Message-ID: <11698910.Akp5I7OyZ5@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201610261737.u9QHb8Ps036831@repo.freebsd.org> References: <201610261737.u9QHb8Ps036831@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 28 Oct 2016 11:15:15 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 15:15:16 -0000 On Wednesday, October 26, 2016 05:37:08 PM John Baldwin wrote: > Author: jhb > Date: Wed Oct 26 17:37:08 2016 > New Revision: 307971 > URL: https://svnweb.freebsd.org/changeset/base/307971 > > Log: > Correct definition of 'struct sigcontext' on MIPS. > > Add missing fields ('sr' and 'mc_tls') to 'struct sigcontext'. > > The kernel doesn't use 'struct sigcontext' but instead uses 'ucontext_t' > which includes 'mcontext_t' in 'struct sigframe' to build the signal frame. > As a result, this change is not an ABI change but simply making > 'struct sigcontext' correct. Note that 'struct sigcontext' is only used > for "Traditional BSD style" signal handlers. > > While here, rename the 'xxx' field to '__spare__' to match 'mcontext_t'. > > Sponsored by: DARPA, AFRL We should perhaps a static assertion somewhere that sizeof(sigset_t) + sizeof(ucontext_t) == sizeof(struct sigcontext) if that is really true of all of our architectures. Alternatively, we might consider retiring 'struct sigcontext' altogether. It's purpose has been superseded by SA_SIGINFO (which is more portable) which has been around for quite a while now. As a first step I guess we could try an exp-run with 'struct sigcontext' removed. (We should have ditched this in 5.0 since we have a separate sendsig/sigreturn path for FreeBSD 4.x already. Oh well.) -- John Baldwin From owner-svn-src-head@freebsd.org Fri Oct 28 15:30:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07DC3C25156; Fri, 28 Oct 2016 15:30:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDC2ABB9; Fri, 28 Oct 2016 15:30:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SFUBOp096833; Fri, 28 Oct 2016 15:30:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SFUBER096832; Fri, 28 Oct 2016 15:30:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610281530.u9SFUBER096832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 28 Oct 2016 15:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308049 - 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.23 Precedence: list List-Id: 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, 28 Oct 2016 15:30:12 -0000 Author: mav Date: Fri Oct 28 15:30:10 2016 New Revision: 308049 URL: https://svnweb.freebsd.org/changeset/base/308049 Log: Improve few debugging log messages. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c 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 Fri Oct 28 15:20:53 2016 (r308048) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Oct 28 15:30:10 2016 (r308049) @@ -223,7 +223,7 @@ vdev_geom_attach(struct g_provider *pp, } error = g_access(cp, 1, 0, 1); if (error != 0) { - ZFS_LOG(1, "%s(%d): g_access failed: %d\n", __func__, + ZFS_LOG(1, "%s(%d): g_access failed: %d", __func__, __LINE__, error); vdev_geom_detach(cp, B_FALSE); return (NULL); @@ -293,7 +293,7 @@ vdev_geom_detach(struct g_consumer *cp, g_topology_assert(); - ZFS_LOG(1, "Detaching consumer. Provider %s.", + ZFS_LOG(1, "Detaching from %s.", cp->provider && cp->provider->name ? cp->provider->name : "NULL"); vd = cp->private; @@ -307,7 +307,7 @@ vdev_geom_detach(struct g_consumer *cp, if (cp->acw > 0) g_access(cp, 0, -cp->acw, 0); if (cp->provider != NULL) { - ZFS_LOG(1, "Destroying consumer to %s.", + ZFS_LOG(1, "Destroying consumer for %s.", cp->provider->name ? cp->provider->name : "NULL"); g_detach(cp); } From owner-svn-src-head@freebsd.org Fri Oct 28 15:32:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E7DFC2534F; Fri, 28 Oct 2016 15:32:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4174FC3; Fri, 28 Oct 2016 15:32:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u9SFVxgH053357 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 28 Oct 2016 18:31:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u9SFVxgH053357 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u9SFVwt1053356; Fri, 28 Oct 2016 18:31:58 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 28 Oct 2016 18:31:58 +0300 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307971 - head/sys/mips/include Message-ID: <20161028153158.GD54029@kib.kiev.ua> References: <201610261737.u9QHb8Ps036831@repo.freebsd.org> <11698910.Akp5I7OyZ5@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11698910.Akp5I7OyZ5@ralph.baldwin.cx> User-Agent: Mutt/1.7.1 (2016-10-04) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 15:32:06 -0000 On Thu, Oct 27, 2016 at 03:08:01PM -0700, John Baldwin wrote: > On Wednesday, October 26, 2016 05:37:08 PM John Baldwin wrote: > > Author: jhb > > Date: Wed Oct 26 17:37:08 2016 > > New Revision: 307971 > > URL: https://svnweb.freebsd.org/changeset/base/307971 > > > > Log: > > Correct definition of 'struct sigcontext' on MIPS. > > > > Add missing fields ('sr' and 'mc_tls') to 'struct sigcontext'. > > > > The kernel doesn't use 'struct sigcontext' but instead uses 'ucontext_t' > > which includes 'mcontext_t' in 'struct sigframe' to build the signal frame. > > As a result, this change is not an ABI change but simply making > > 'struct sigcontext' correct. Note that 'struct sigcontext' is only used > > for "Traditional BSD style" signal handlers. > > > > While here, rename the 'xxx' field to '__spare__' to match 'mcontext_t'. > > > > Sponsored by: DARPA, AFRL > > We should perhaps a static assertion somewhere that > sizeof(sigset_t) + sizeof(ucontext_t) == sizeof(struct sigcontext) if > that is really true of all of our architectures. This should be mcontext_t instead of ucontext_t. > > Alternatively, we might consider retiring 'struct sigcontext' altogether. > It's purpose has been superseded by SA_SIGINFO (which is more portable) > which has been around for quite a while now. As a first step I guess > we could try an exp-run with 'struct sigcontext' removed. (We should > have ditched this in 5.0 since we have a separate sendsig/sigreturn path > for FreeBSD 4.x already. Oh well.) I do not think that this is a practical option. I know that struct sigcontext is used by nongnu libunwind. Quick search identifies mono and go as consumers as well. From owner-svn-src-head@freebsd.org Fri Oct 28 15:57:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F31D4C25A78; Fri, 28 Oct 2016 15:57:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFBE419E; Fri, 28 Oct 2016 15:57:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SFvttX008257; Fri, 28 Oct 2016 15:57:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SFvtiX008256; Fri, 28 Oct 2016 15:57:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201610281557.u9SFvtiX008256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Oct 2016 15:57:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308050 - head/sys/amd64/vmm/amd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 15:57:57 -0000 Author: avg Date: Fri Oct 28 15:57:55 2016 New Revision: 308050 URL: https://svnweb.freebsd.org/changeset/base/308050 Log: fix a syntax error in r308039 ... that I somehow introduced between testing the change iand committing it. MFC after: 1 week X-MFC with: r307903 Modified: head/sys/amd64/vmm/amd/svm.c Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Fri Oct 28 15:30:10 2016 (r308049) +++ head/sys/amd64/vmm/amd/svm.c Fri Oct 28 15:57:55 2016 (r308050) @@ -514,7 +514,7 @@ svm_vminit(struct vm *vm, pmap_t pmap) { struct svm_softc *svm_sc; struct svm_vcpu *vcpu; - vm_paddr_t msrpm_pa, iopm_pa, pml4_pa + vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; int i; svm_sc = contigmalloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO, From owner-svn-src-head@freebsd.org Fri Oct 28 16:21:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EF13C2414B; Fri, 28 Oct 2016 16:21:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16157A08; Fri, 28 Oct 2016 16:21:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SGLVxi017261; Fri, 28 Oct 2016 16:21:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SGLVed017260; Fri, 28 Oct 2016 16:21:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610281621.u9SGLVed017260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 28 Oct 2016 16:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308051 - 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.23 Precedence: list List-Id: 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, 28 Oct 2016 16:21:32 -0000 Author: mav Date: Fri Oct 28 16:21:31 2016 New Revision: 308051 URL: https://svnweb.freebsd.org/changeset/base/308051 Log: Matching GUIDs, handle possible race on vdev detach. In case of vdev detach, causing top level mirror vdev destruction, leaf vdev changes its GUID to one of the destroyed mirror, that creates race condition when GUID in vdev label may not match one in the pool config. This change replicates logic nuance of vdev_validate() by adding special exception, matching the vdev GUID against the top level vdev GUID. Since this exception is not completely reliable (may give false positives if we fail to erase label on detached vdev), use it only as last resort. Quick way to reproduce this scenario now is detach vdev from a pool with enabled autoextend. During vdev detach autoextend logic tries to reopen remaining vdev, that always fails now since in-memory configuration is already updated, while on-disk labels are not yet. MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c 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 Fri Oct 28 15:57:55 2016 (r308050) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Oct 28 16:21:31 2016 (r308051) @@ -338,14 +338,6 @@ vdev_geom_close_locked(vdev_t *vd) vdev_geom_detach(cp, B_TRUE); } -static void -nvlist_get_guids(nvlist_t *list, uint64_t *pguid, uint64_t *vguid) -{ - - (void) nvlist_lookup_uint64(list, ZPOOL_CONFIG_GUID, vguid); - (void) nvlist_lookup_uint64(list, ZPOOL_CONFIG_POOL_GUID, pguid); -} - /* * Issue one or more bios to the vdev in parallel * cmds, datas, offsets, errors, and sizes are arrays of length ncmds. Each IO @@ -606,58 +598,69 @@ vdev_geom_read_pool_label(const char *na return (*count > 0 ? 0 : ENOENT); } -static void -vdev_geom_read_guids(struct g_consumer *cp, uint64_t *pguid, uint64_t *vguid) -{ - nvlist_t *config; - - g_topology_assert_not(); - - *pguid = 0; - *vguid = 0; - if (vdev_geom_read_config(cp, &config) == 0) { - nvlist_get_guids(config, pguid, vguid); - nvlist_free(config); - } -} +enum match { + NO_MATCH, + TOP_MATCH, + FULL_MATCH +}; -static boolean_t +static enum match vdev_attach_ok(vdev_t *vd, struct g_provider *pp) { - uint64_t pool_guid; - uint64_t vdev_guid; - struct g_consumer *zcp; - boolean_t pool_ok; - boolean_t vdev_ok; + nvlist_t *config; + uint64_t pool_guid, top_guid, vdev_guid; + struct g_consumer *cp; - zcp = vdev_geom_attach(pp, NULL); - if (zcp == NULL) { + cp = vdev_geom_attach(pp, NULL); + if (cp == NULL) { ZFS_LOG(1, "Unable to attach tasting instance to %s.", pp->name); - return (B_FALSE); + return (NO_MATCH); } g_topology_unlock(); - vdev_geom_read_guids(zcp, &pool_guid, &vdev_guid); + if (vdev_geom_read_config(cp, &config) != 0) { + g_topology_lock(); + vdev_geom_detach(cp, B_TRUE); + ZFS_LOG(1, "Unable to read config from %s.", pp->name); + return (NO_MATCH); + } g_topology_lock(); - vdev_geom_detach(zcp, B_TRUE); + vdev_geom_detach(cp, B_TRUE); - /* - * Check that the label's vdev guid matches the desired guid. If the - * label has a pool guid, check that it matches too. (Inactive spares - * and L2ARCs do not have any pool guid in the label.) + pool_guid = 0; + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid); + top_guid = 0; + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_TOP_GUID, &top_guid); + vdev_guid = 0; + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_GUID, &vdev_guid); + nvlist_free(config); + + /* + * Check that the label's pool guid matches the desired guid. + * Inactive spares and L2ARCs do not have any pool guid in the label. */ - if ((pool_guid == 0 || pool_guid == spa_guid(vd->vdev_spa)) && - vdev_guid == vd->vdev_guid) { - ZFS_LOG(1, "guids match for provider %s.", vd->vdev_path); - return (B_TRUE); - } else { - ZFS_LOG(1, "guid mismatch for provider %s: " - "%ju:%ju != %ju:%ju.", vd->vdev_path, - (uintmax_t)spa_guid(vd->vdev_spa), - (uintmax_t)vd->vdev_guid, - (uintmax_t)pool_guid, (uintmax_t)vdev_guid); - return (B_FALSE); + if (pool_guid != 0 && pool_guid != spa_guid(vd->vdev_spa)) { + ZFS_LOG(1, "pool guid mismatch for provider %s: %ju != %ju.", + pp->name, + (uintmax_t)spa_guid(vd->vdev_spa), (uintmax_t)pool_guid); + return (NO_MATCH); } + + /* + * Check that the label's vdev guid matches the desired guid. + * The second condition handles possible race on vdev detach, when + * remaining vdev receives GUID of destroyed top level mirror vdev. + */ + if (vdev_guid == vd->vdev_guid) { + ZFS_LOG(1, "guids match for provider %s.", pp->name); + return (FULL_MATCH); + } else if (top_guid == vd->vdev_guid && vd == vd->vdev_top) { + ZFS_LOG(1, "top vdev guid match for provider %s.", pp->name); + return (TOP_MATCH); + } + ZFS_LOG(1, "vdev guid mismatch for provider %s: %ju != %ju.", + pp->name, (uintmax_t)vd->vdev_guid, (uintmax_t)vdev_guid); + return (NO_MATCH); } static struct g_consumer * @@ -667,6 +670,7 @@ vdev_geom_attach_by_guids(vdev_t *vd) struct g_geom *gp; struct g_provider *pp; struct g_consumer *cp; + enum match m; g_topology_assert(); @@ -678,23 +682,26 @@ vdev_geom_attach_by_guids(vdev_t *vd) if (gp->flags & G_GEOM_WITHER) continue; LIST_FOREACH(pp, &gp->provider, provider) { - if (!vdev_attach_ok(vd, pp)) + m = vdev_attach_ok(vd, pp); + if (m == NO_MATCH) continue; + if (cp != NULL) { + if (m == FULL_MATCH) + vdev_geom_detach(cp, B_TRUE); + else + continue; + } cp = vdev_geom_attach(pp, vd); if (cp == NULL) { printf("ZFS WARNING: Unable to " "attach to %s.\n", pp->name); continue; } - break; + if (m == FULL_MATCH) + return (cp); } - if (cp != NULL) - break; } - if (cp != NULL) - break; } -end: return (cp); } @@ -742,7 +749,7 @@ vdev_geom_open_by_path(vdev_t *vd, int c pp = g_provider_by_name(vd->vdev_path + sizeof("/dev/") - 1); if (pp != NULL) { ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); - if (!check_guid || vdev_attach_ok(vd, pp)) + if (!check_guid || vdev_attach_ok(vd, pp) == FULL_MATCH) cp = vdev_geom_attach(pp, vd); } From owner-svn-src-head@freebsd.org Fri Oct 28 17:05:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44E9EC25464; Fri, 28 Oct 2016 17:05:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1411ADEE; Fri, 28 Oct 2016 17:05:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SH5EtS035973; Fri, 28 Oct 2016 17:05:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SH5Etq035972; Fri, 28 Oct 2016 17:05:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610281705.u9SH5Etq035972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 28 Oct 2016 17:05:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308055 - 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.23 Precedence: list List-Id: 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, 28 Oct 2016 17:05:15 -0000 Author: mav Date: Fri Oct 28 17:05:14 2016 New Revision: 308055 URL: https://svnweb.freebsd.org/changeset/base/308055 Log: Add vdev_reopening support to vdev_geom. It allows to avoid extra GEOM providers flapping without significant need. Since GEOM got resize support, we don't need to reopen provider to get new size. If provider was orphaned and no longer valid, ZFS should already know that, and in such case reopen should be done in full as expected. MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c 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 Fri Oct 28 16:31:58 2016 (r308054) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Oct 28 17:05:14 2016 (r308055) @@ -776,7 +776,14 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi return (EINVAL); } - vd->vdev_tsd = NULL; + /* + * Reopen the device if it's not currently open. Otherwise, + * just update the physical size of the device. + */ + if ((cp = vd->vdev_tsd) != NULL) { + ASSERT(vd->vdev_reopening); + goto skip_open; + } DROP_GIANT(); g_topology_lock(); @@ -861,6 +868,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; return (error); } +skip_open: pp = cp->provider; /* @@ -896,6 +904,9 @@ static void vdev_geom_close(vdev_t *vd) { + if (vd->vdev_reopening) + return; + DROP_GIANT(); g_topology_lock(); vdev_geom_close_locked(vd); From owner-svn-src-head@freebsd.org Fri Oct 28 17:05:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C90DAC254B0; Fri, 28 Oct 2016 17:05:40 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4C40F52; Fri, 28 Oct 2016 17:05:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id B76CF10AF93; Fri, 28 Oct 2016 13:05:38 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307971 - head/sys/mips/include Date: Fri, 28 Oct 2016 09:59:26 -0700 Message-ID: <4639059.6gemL8B1hY@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <20161028153158.GD54029@kib.kiev.ua> References: <201610261737.u9QHb8Ps036831@repo.freebsd.org> <11698910.Akp5I7OyZ5@ralph.baldwin.cx> <20161028153158.GD54029@kib.kiev.ua> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 28 Oct 2016 13:05:38 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 17:05:40 -0000 On Friday, October 28, 2016 06:31:58 PM Konstantin Belousov wrote: > On Thu, Oct 27, 2016 at 03:08:01PM -0700, John Baldwin wrote: > > On Wednesday, October 26, 2016 05:37:08 PM John Baldwin wrote: > > > Author: jhb > > > Date: Wed Oct 26 17:37:08 2016 > > > New Revision: 307971 > > > URL: https://svnweb.freebsd.org/changeset/base/307971 > > > > > > Log: > > > Correct definition of 'struct sigcontext' on MIPS. > > > > > > Add missing fields ('sr' and 'mc_tls') to 'struct sigcontext'. > > > > > > The kernel doesn't use 'struct sigcontext' but instead uses 'ucontext_t' > > > which includes 'mcontext_t' in 'struct sigframe' to build the signal frame. > > > As a result, this change is not an ABI change but simply making > > > 'struct sigcontext' correct. Note that 'struct sigcontext' is only used > > > for "Traditional BSD style" signal handlers. > > > > > > While here, rename the 'xxx' field to '__spare__' to match 'mcontext_t'. > > > > > > Sponsored by: DARPA, AFRL > > > > We should perhaps a static assertion somewhere that > > sizeof(sigset_t) + sizeof(ucontext_t) == sizeof(struct sigcontext) if > > that is really true of all of our architectures. > This should be mcontext_t instead of ucontext_t. Yes. I will try adding that static assert to sys/kern/kern_sig.c and seeing if it survives a universe build. > > Alternatively, we might consider retiring 'struct sigcontext' altogether. > > It's purpose has been superseded by SA_SIGINFO (which is more portable) > > which has been around for quite a while now. As a first step I guess > > we could try an exp-run with 'struct sigcontext' removed. (We should > > have ditched this in 5.0 since we have a separate sendsig/sigreturn path > > for FreeBSD 4.x already. Oh well.) > > I do not think that this is a practical option. I know that struct > sigcontext is used by nongnu libunwind. Quick search identifies mono and > go as consumers as well. Well, we could perhaps patch those to use SA_SIGINFO instead, but if it's a non-trivial amount of effort I'm not going to bother. I'm surprised that some of those would use sigcontext. Both mono and go post-date SA_SIGINFO being standardized and supported on FreeBSD AFAIK. Supporting sigcontext just means extra BSD-specific code in those applications compared to using SA_SIGINFO. :-/ -- John Baldwin From owner-svn-src-head@freebsd.org Fri Oct 28 17:54:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5969AC2428D; Fri, 28 Oct 2016 17:54:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC46A15E; Fri, 28 Oct 2016 17:54:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u9SHsolI087641 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 28 Oct 2016 20:54:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u9SHsolI087641 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u9SHsoV8087640; Fri, 28 Oct 2016 20:54:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 28 Oct 2016 20:54:50 +0300 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307971 - head/sys/mips/include Message-ID: <20161028175450.GE54029@kib.kiev.ua> References: <201610261737.u9QHb8Ps036831@repo.freebsd.org> <11698910.Akp5I7OyZ5@ralph.baldwin.cx> <20161028153158.GD54029@kib.kiev.ua> <4639059.6gemL8B1hY@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4639059.6gemL8B1hY@ralph.baldwin.cx> User-Agent: Mutt/1.7.1 (2016-10-04) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 17:54:56 -0000 On Fri, Oct 28, 2016 at 09:59:26AM -0700, John Baldwin wrote: > Well, we could perhaps patch those to use SA_SIGINFO instead, but if it's > a non-trivial amount of effort I'm not going to bother. I'm surprised that > some of those would use sigcontext. Both mono and go post-date SA_SIGINFO > being standardized and supported on FreeBSD AFAIK. Supporting sigcontext > just means extra BSD-specific code in those applications compared to using > SA_SIGINFO. :-/ For libunwind, I can see a rationale for struct sigcontext use. It seems that on Linux, rt_sigreturn(2) syscall takes struct sigcontext *, and not struct ucontext *, as the argument. This is not unreasonable, because the additional ucontext fields make no sense for sigreturn, for us they are copied into kernel AS but are also unused. So my FreeBSD port followed the existing Linux code. And I started wondering should we change our sigreturn(2) to take sigcontext * instead of ucontext *. From owner-svn-src-head@freebsd.org Fri Oct 28 18:09:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C3C4C245F0; Fri, 28 Oct 2016 18:09:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A5AA9D9; Fri, 28 Oct 2016 18:09:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SI98jI060622; Fri, 28 Oct 2016 18:09:08 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SI988m060621; Fri, 28 Oct 2016 18:09:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610281809.u9SI988m060621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 28 Oct 2016 18:09:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308056 - 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.23 Precedence: list List-Id: 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, 28 Oct 2016 18:09:09 -0000 Author: jhb Date: Fri Oct 28 18:09:08 2016 New Revision: 308056 URL: https://svnweb.freebsd.org/changeset/base/308056 Log: Fix formatting of tables. Specifically, use .Ta instead of tabs to separate column entries. While here fix a few other things: - Use .Sy for all column headers (previously only the first column header was bold) - Use .Dv to markup constants used for MIB names. - Use "1234" and "4321" for the byte order descriptions without thousands separators. - Mark up header files in the first table with .In. MFC after: 2 weeks Modified: head/lib/libc/gen/sysctl.3 Modified: head/lib/libc/gen/sysctl.3 ============================================================================== --- head/lib/libc/gen/sysctl.3 Fri Oct 28 17:05:14 2016 (r308055) +++ head/lib/libc/gen/sysctl.3 Fri Oct 28 18:09:08 2016 (r308056) @@ -183,16 +183,16 @@ The top level names are defined with a C and are as follows. The next and subsequent levels down are found in the include files listed here, and described in separate sections below. -.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent -.It Sy "Name Next level names Description" -.It "CTL_DEBUG sys/sysctl.h Debugging" -.It "CTL_VFS sys/mount.h File system" -.It "CTL_HW sys/sysctl.h Generic CPU, I/O" -.It "CTL_KERN sys/sysctl.h High kernel limits" -.It "CTL_MACHDEP sys/sysctl.h Machine dependent" -.It "CTL_NET sys/socket.h Networking" -.It "CTL_USER sys/sysctl.h User-level" -.It "CTL_VM vm/vm_param.h Virtual memory" +.Bl -column CTLXMACHDEPXXX "Next Level NamesXXXXXX" -offset indent +.It Sy Name Ta Sy Next Level Names Ta Sy Description +.It Dv CTL_DEBUG Ta In sys/sysctl.h Ta Debugging +.It Dv CTL_VFS Ta In sys/mount.h Ta File system +.It Dv CTL_HW Ta In sys/sysctl.h Ta Generic CPU, I/O +.It Dv CTL_KERN Ta In sys/sysctl.h Ta High kernel limits +.It Dv CTL_MACHDEP Ta In sys/sysctl.h Ta Machine dependent +.It Dv CTL_NET Ta In sys/socket.h Ta Networking +.It Dv CTL_USER Ta In sys/sysctl.h Ta User-level +.It Dv CTL_VM Ta In vm/vm_param.h Ta Virtual memory .El .Pp For example, the following retrieves the maximum number of processes allowed @@ -270,20 +270,20 @@ The string and integer information avail is detailed below. The changeable column shows whether a process with appropriate privilege may change the value. -.Bl -column "Second level nameXXXXXX" integerXXX -offset indent -.It Sy "Second level name Type Changeable" -.It "HW_MACHINE string no" -.It "HW_MODEL string no" -.It "HW_NCPU integer no" -.It "HW_BYTEORDER integer no" -.It "HW_PHYSMEM integer no" -.It "HW_USERMEM integer no" -.It "HW_PAGESIZE integer no" -.\".It "HW_DISKNAMES integer no" -.\".It "HW_DISKSTATS integer no" -.It "HW_FLOATINGPT integer no" -.It "HW_MACHINE_ARCH string no" -.It "HW_REALMEM integer no" +.Bl -column "Second Level Name" integerXXX Changeable -offset indent +.It Sy Second Level Name Ta Sy Type Ta Sy Changeable +.It Dv HW_MACHINE Ta string Ta no +.It Dv HW_MODEL Ta string Ta no +.It Dv HW_NCPU Ta integer Ta no +.It Dv HW_BYTEORDER Ta integer Ta no +.It Dv HW_PHYSMEM Ta integer Ta no +.It Dv HW_USERMEM Ta integer Ta no +.It Dv HW_PAGESIZE Ta integer Ta no +.\".It Dv HW_DISKNAMES Ta integer Ta no +.\".It Dv HW_DISKSTATS Ta integer Ta no +.It Dv HW_FLOATINGPT Ta integer Ta no +.It Dv HW_MACHINE_ARCH Ta string Ta no +.It Dv HW_REALMEM Ta integer Ta no .El .Bl -tag -width 6n .It Li HW_MACHINE @@ -293,7 +293,7 @@ The machine model .It Li HW_NCPU The number of cpus. .It Li HW_BYTEORDER -The byteorder (4,321, or 1,234). +The byteorder (4321 or 1234). .It Li HW_PHYSMEM The bytes of physical memory. .It Li HW_USERMEM @@ -319,36 +319,36 @@ system vnodes, the open file entries, ro virtual memory statistics, load average history, and clock rate information. .Bl -column "KERNXMAXFILESPERPROCXXX" "struct clockrateXXX" -offset indent -.It Sy "Second level name Type Changeable" -.It "KERN_ARGMAX integer no" -.It "KERN_BOOTFILE string yes" -.It "KERN_BOOTTIME struct timeval no" -.It "KERN_CLOCKRATE struct clockinfo no" -.It "KERN_FILE struct xfile no" -.It "KERN_HOSTID integer yes" -.It "KERN_HOSTUUID string yes" -.It "KERN_HOSTNAME string yes" -.It "KERN_JOB_CONTROL integer no" -.It "KERN_MAXFILES integer yes" -.It "KERN_MAXFILESPERPROC integer yes" -.It "KERN_MAXPROC integer no" -.It "KERN_MAXPROCPERUID integer yes" -.It "KERN_MAXVNODES integer yes" -.It "KERN_NGROUPS integer no" -.It "KERN_NISDOMAINNAME string yes" -.It "KERN_OSRELDATE integer no" -.It "KERN_OSRELEASE string no" -.It "KERN_OSREV integer no" -.It "KERN_OSTYPE string no" -.It "KERN_POSIX1 integer no" -.It "KERN_PROC node not applicable" -.It "KERN_PROF node not applicable" -.It "KERN_QUANTUM integer yes" -.It "KERN_SAVED_IDS integer no" -.It "KERN_SECURELVL integer raise only" -.It "KERN_UPDATEINTERVAL integer no" -.It "KERN_VERSION string no" -.It "KERN_VNODE struct xvnode no" +.It Sy Second Level Name Ta Sy Type Ta Sy Changeable +.It Dv KERN_ARGMAX Ta integer Ta no +.It Dv KERN_BOOTFILE Ta string Ta yes +.It Dv KERN_BOOTTIME Ta struct timeval Ta no +.It Dv KERN_CLOCKRATE Ta struct clockinfo Ta no +.It Dv KERN_FILE Ta struct xfile Ta no +.It Dv KERN_HOSTID Ta integer Ta yes +.It Dv KERN_HOSTUUID Ta string Ta yes +.It Dv KERN_HOSTNAME Ta string Ta yes +.It Dv KERN_JOB_CONTROL Ta integer Ta no +.It Dv KERN_MAXFILES Ta integer Ta yes +.It Dv KERN_MAXFILESPERPROC Ta integer Ta yes +.It Dv KERN_MAXPROC Ta integer Ta no +.It Dv KERN_MAXPROCPERUID Ta integer Ta yes +.It Dv KERN_MAXVNODES Ta integer Ta yes +.It Dv KERN_NGROUPS Ta integer Ta no +.It Dv KERN_NISDOMAINNAME Ta string Ta yes +.It Dv KERN_OSRELDATE Ta integer Ta no +.It Dv KERN_OSRELEASE Ta string Ta no +.It Dv KERN_OSREV Ta integer Ta no +.It Dv KERN_OSTYPE Ta string Ta no +.It Dv KERN_POSIX1 Ta integer Ta no +.It Dv KERN_PROC Ta node Ta not applicable +.It Dv KERN_PROF Ta node Ta not applicable +.It Dv KERN_QUANTUM Ta integer Ta yes +.It Dv KERN_SAVED_IDS Ta integer Ta no +.It Dv KERN_SECURELVL Ta integer Ta raise only +.It Dv KERN_UPDATEINTERVAL Ta integer Ta no +.It Dv KERN_VERSION Ta string Ta no +.It Dv KERN_VNODE Ta struct xvnode Ta no .El .Bl -tag -width 6n .It Li KERN_ARGMAX @@ -439,14 +439,14 @@ For the following names, an array of .Va struct kinfo_proc structures is returned, whose size depends on the current number of such objects in the system. -.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent -.It "Third level name Fourth level is:" -.It "KERN_PROC_ALL None" -.It "KERN_PROC_PID A process ID" -.It "KERN_PROC_PGRP A process group" -.It "KERN_PROC_TTY A tty device" -.It "KERN_PROC_UID A user ID" -.It "KERN_PROC_RUID A real user ID" +.Bl -column "Third Level NameXXXXXX" "Fourth LevelXXXXXX" -offset indent +.It Sy Third Level Name Ta Sy Fourth Level +.It Dv KERN_PROC_ALL Ta None +.It Dv KERN_PROC_PID Ta A process ID +.It Dv KERN_PROC_PGRP Ta A process group +.It Dv KERN_PROC_TTY Ta A tty device +.It Dv KERN_PROC_UID Ta A user ID +.It Dv KERN_PROC_RUID Ta A real user ID .El .Pp If the third level name is @@ -465,8 +465,8 @@ For a process ID of .Li \-1 implies the current process. -.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent -.It Sy "Third level name Fourth level is:" +.Bl -column "Third Level NameXXXXXX" "Fourth LevelXXXXXX" -offset indent +.It Sy Third Level Name Ta Sy Fourth Level .It Dv KERN_PROC_ARGS Ta "A process ID" .It Dv KERN_PROC_PATHNAME Ta "A process ID" .El @@ -481,12 +481,12 @@ is detailed below. The changeable column shows whether a process with appropriate privilege may change the value. .Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent -.It Sy "Third level name Type Changeable" -.It "GPROF_STATE integer yes" -.It "GPROF_COUNT u_short[\|] yes" -.It "GPROF_FROMS u_short[\|] yes" -.It "GPROF_TOS struct tostruct yes" -.It "GPROF_GMONPARAM struct gmonparam no" +.It Sy Third Level Name Ta Sy Type Ta Sy Changeable +.It Dv GPROF_STATE Ta integer Ta yes +.It Dv GPROF_COUNT Ta u_short[\|] Ta yes +.It Dv GPROF_FROMS Ta u_short[\|] Ta yes +.It Dv GPROF_TOS Ta struct tostruct Ta yes +.It Dv GPROF_GMONPARAM Ta struct gmonparam Ta no .El .Pp The variables are as follows: @@ -530,11 +530,11 @@ The string and integer information avail is detailed below. The changeable column shows whether a process with appropriate privilege may change the value. -.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent -.It Sy "Second level name Type Changeable" -.It "PF_ROUTE routing messages no" -.It "PF_INET IPv4 values yes" -.It "PF_INET6 IPv6 values yes" +.Bl -column "Second Level NameXXXXXX" "routing messagesXXX" -offset indent +.It Sy Second Level Name Ta Sy Type Ta Sy Changeable +.It Dv PF_ROUTE Ta routing messages Ta no +.It Dv PF_INET Ta IPv4 values Ta yes +.It Dv PF_INET6 Ta IPv6 values Ta yes .El .Bl -tag -width 6n .It Li PF_ROUTE @@ -548,13 +548,13 @@ The third level name is a protocol numbe The fourth level name is an address family, which may be set to 0 to select all address families. The fifth, sixth, and seventh level names are as follows: -.Bl -column -offset indent "Fifth level Sixth level" "Seventh level" -.It Sy "Fifth level Sixth level" Ta Sy "Seventh level" -.It "NET_RT_FLAGS rtflags" Ta "None" -.It "NET_RT_DUMP None" Ta "None or fib number" -.It "NET_RT_IFLIST 0 or if_index" Ta None -.It "NET_RT_IFMALIST 0 or if_index" Ta None -.It "NET_RT_IFLISTL 0 or if_index" Ta None +.Bl -column -offset indent "Fifth Level" "Sixth Level" "Seventh Level" +.It Sy Fifth level Ta Sy Sixth Level Ta Sy Seventh Level +.It Dv NET_RT_FLAGS Ta rtflags Ta None +.It Dv NET_RT_DUMP Ta None Ta None or fib number +.It Dv NET_RT_IFLIST Ta 0 or if_index Ta None +.It Dv NET_RT_IFMALIST Ta 0 or if_index Ta None +.It Dv NET_RT_IFLISTL Ta 0 or if_index Ta None .El .Pp The @@ -582,13 +582,13 @@ The third level name is the protocol. The fourth level name is the variable name. The currently defined protocols and names are: .Bl -column ProtocolXX VariableXX TypeXX ChangeableXX -.It Sy "Protocol Variable Type Changeable" -.It "icmp bmcastecho integer yes" -.It "icmp maskrepl integer yes" -.It "ip forwarding integer yes" -.It "ip redirect integer yes" -.It "ip ttl integer yes" -.It "udp checksum integer yes" +.It Sy Protocol Ta Sy Variable Ta Sy Type Ta Sy Changeable +.It icmp Ta bmcastecho Ta integer Ta yes +.It icmp Ta maskrepl Ta integer Ta yes +.It ip Ta forwarding Ta integer Ta yes +.It ip Ta redirect Ta integer Ta yes +.It ip Ta ttl Ta integer Ta yes +.It udp Ta checksum Ta integer Ta yes .El .Pp The variables are as follows: @@ -633,27 +633,27 @@ is detailed below. The changeable column shows whether a process with appropriate privilege may change the value. .Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent -.It Sy "Second level name Type Changeable" -.It "USER_BC_BASE_MAX integer no" -.It "USER_BC_DIM_MAX integer no" -.It "USER_BC_SCALE_MAX integer no" -.It "USER_BC_STRING_MAX integer no" -.It "USER_COLL_WEIGHTS_MAX integer no" -.It "USER_CS_PATH string no" -.It "USER_EXPR_NEST_MAX integer no" -.It "USER_LINE_MAX integer no" -.It "USER_POSIX2_CHAR_TERM integer no" -.It "USER_POSIX2_C_BIND integer no" -.It "USER_POSIX2_C_DEV integer no" -.It "USER_POSIX2_FORT_DEV integer no" -.It "USER_POSIX2_FORT_RUN integer no" -.It "USER_POSIX2_LOCALEDEF integer no" -.It "USER_POSIX2_SW_DEV integer no" -.It "USER_POSIX2_UPE integer no" -.It "USER_POSIX2_VERSION integer no" -.It "USER_RE_DUP_MAX integer no" -.It "USER_STREAM_MAX integer no" -.It "USER_TZNAME_MAX integer no" +.It Sy Second Level Name Ta Sy Type Ta Sy Changeable +.It Dv USER_BC_BASE_MAX Ta integer Ta no +.It Dv USER_BC_DIM_MAX Ta integer Ta no +.It Dv USER_BC_SCALE_MAX Ta integer Ta no +.It Dv USER_BC_STRING_MAX Ta integer Ta no +.It Dv USER_COLL_WEIGHTS_MAX Ta integer Ta no +.It Dv USER_CS_PATH Ta string Ta no +.It Dv USER_EXPR_NEST_MAX Ta integer Ta no +.It Dv USER_LINE_MAX Ta integer Ta no +.It Dv USER_POSIX2_CHAR_TERM Ta integer Ta no +.It Dv USER_POSIX2_C_BIND Ta integer Ta no +.It Dv USER_POSIX2_C_DEV Ta integer Ta no +.It Dv USER_POSIX2_FORT_DEV Ta integer Ta no +.It Dv USER_POSIX2_FORT_RUN Ta integer Ta no +.It Dv USER_POSIX2_LOCALEDEF Ta integer Ta no +.It Dv USER_POSIX2_SW_DEV Ta integer Ta no +.It Dv USER_POSIX2_UPE Ta integer Ta no +.It Dv USER_POSIX2_VERSION Ta integer Ta no +.It Dv USER_RE_DUP_MAX Ta integer Ta no +.It Dv USER_STREAM_MAX Ta integer Ta no +.It Dv USER_TZNAME_MAX Ta integer Ta no .El .Bl -tag -width 6n .It Li USER_BC_BASE_MAX @@ -731,16 +731,16 @@ The string and integer information avail is detailed below. The changeable column shows whether a process with appropriate privilege may change the value. -.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent -.It Sy "Second level name Type Changeable" -.It "VM_LOADAVG struct loadavg no" -.It "VM_TOTAL struct vmtotal no" -.It "VM_SWAPPING_ENABLED integer maybe" -.It "VM_V_FREE_MIN integer yes" -.It "VM_V_FREE_RESERVED integer yes" -.It "VM_V_FREE_TARGET integer yes" -.It "VM_V_INACTIVE_TARGET integer yes" -.It "VM_V_PAGEOUT_FREE_MIN integer yes" +.Bl -column "Second Level NameXXXXXX" "struct loadavgXXX" -offset indent +.It Sy Second Level Name Ta Sy Type Ta Sy Changeable +.It Dv VM_LOADAVG Ta struct loadavg Ta no +.It Dv VM_TOTAL Ta struct vmtotal Ta no +.It Dv VM_SWAPPING_ENABLED Ta integer Ta maybe +.It Dv VM_V_FREE_MIN Ta integer Ta yes +.It Dv VM_V_FREE_RESERVED Ta integer Ta yes +.It Dv VM_V_FREE_TARGET Ta integer Ta yes +.It Dv VM_V_INACTIVE_TARGET Ta integer Ta yes +.It Dv VM_V_PAGEOUT_FREE_MIN Ta integer Ta yes .El .Bl -tag -width 6n .It Li VM_LOADAVG From owner-svn-src-head@freebsd.org Fri Oct 28 20:15:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F8E3C25D7B; Fri, 28 Oct 2016 20:15:20 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2EFC0E; Fri, 28 Oct 2016 20:15:20 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SKFJ2j010174; Fri, 28 Oct 2016 20:15:19 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SKFJdY010173; Fri, 28 Oct 2016 20:15:19 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201610282015.u9SKFJdY010173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 28 Oct 2016 20:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308064 - head/sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 20:15:20 -0000 Author: mckusick Date: Fri Oct 28 20:15:19 2016 New Revision: 308064 URL: https://svnweb.freebsd.org/changeset/base/308064 Log: Avoid possible overflow when calclating malloc size for auxillary data structure sizes when mounting and reloading UFS/FFS filesystems by using a u_long rather than an int for the size. Reported by: Mariusz Zaborski MFC after: 1 week Modified: head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Fri Oct 28 19:46:08 2016 (r308063) +++ head/sys/ufs/ffs/ffs_vfsops.c Fri Oct 28 20:15:19 2016 (r308064) @@ -588,7 +588,8 @@ ffs_reload(struct mount *mp, struct thre struct fs *fs, *newfs; struct ufsmount *ump; ufs2_daddr_t sblockloc; - int i, blks, size, error; + int i, blks, error; + u_long size; int32_t *lp; ump = VFSTOUFS(mp); @@ -658,7 +659,7 @@ ffs_reload(struct mount *mp, struct thre size += fs->fs_ncg * sizeof(int32_t); size += fs->fs_ncg * sizeof(u_int8_t); free(fs->fs_csp, M_UFSMNT); - space = malloc((u_long)size, M_UFSMNT, M_WAITOK); + space = malloc(size, M_UFSMNT, M_WAITOK); fs->fs_csp = space; for (i = 0; i < blks; i += fs->fs_frag) { size = fs->fs_bsize; @@ -751,7 +752,8 @@ ffs_mountfs(devvp, mp, td) struct cdev *dev; void *space; ufs2_daddr_t sblockloc; - int error, i, blks, size, ronly; + int error, i, blks, len, ronly; + u_long size; int32_t *lp; struct ucred *cred; struct g_consumer *cp; @@ -856,11 +858,11 @@ ffs_mountfs(devvp, mp, td) /* * Get journal provider name. */ - size = 1024; - mp->mnt_gjprovider = malloc(size, M_UFSMNT, M_WAITOK); - if (g_io_getattr("GJOURNAL::provider", cp, &size, + len = 1024; + mp->mnt_gjprovider = malloc((u_long)len, M_UFSMNT, M_WAITOK); + if (g_io_getattr("GJOURNAL::provider", cp, &len, mp->mnt_gjprovider) == 0) { - mp->mnt_gjprovider = realloc(mp->mnt_gjprovider, size, + mp->mnt_gjprovider = realloc(mp->mnt_gjprovider, len, M_UFSMNT, M_WAITOK); MNT_ILOCK(mp); mp->mnt_flag |= MNT_GJOURNAL; @@ -912,7 +914,7 @@ ffs_mountfs(devvp, mp, td) if (fs->fs_contigsumsize > 0) size += fs->fs_ncg * sizeof(int32_t); size += fs->fs_ncg * sizeof(u_int8_t); - space = malloc((u_long)size, M_UFSMNT, M_WAITOK); + space = malloc(size, M_UFSMNT, M_WAITOK); fs->fs_csp = space; for (i = 0; i < blks; i += fs->fs_frag) { size = fs->fs_bsize; @@ -997,8 +999,8 @@ ffs_mountfs(devvp, mp, td) #endif } if ((fs->fs_flags & FS_TRIM) != 0) { - size = sizeof(int); - if (g_io_getattr("GEOM::candelete", cp, &size, + len = sizeof(int); + if (g_io_getattr("GEOM::candelete", cp, &len, &ump->um_candelete) == 0) { if (!ump->um_candelete) printf("WARNING: %s: TRIM flag on fs but disk " From owner-svn-src-head@freebsd.org Fri Oct 28 20:23:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70036C25002; Fri, 28 Oct 2016 20:23:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AF6F382; Fri, 28 Oct 2016 20:23:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SKNc8E014309; Fri, 28 Oct 2016 20:23:38 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SKNca4014308; Fri, 28 Oct 2016 20:23:38 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610282023.u9SKNca4014308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 28 Oct 2016 20:23:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308065 - head/sys/dev/aacraid X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 20:23:39 -0000 Author: imp Date: Fri Oct 28 20:23:38 2016 New Revision: 308065 URL: https://svnweb.freebsd.org/changeset/base/308065 Log: Remove a PCI ID for a raid controller from Adaptec that was planned, but never released. Since no real hardware was released with this ID, just drop it from the aacraid driver. This paves the path for future drivers for hardware that actually has this ID. Submitted by: Scott Benesh from Microsemi. Differential Revision: https://reviews.freebsd.org/D8377 MFC After: 3 days Modified: head/sys/dev/aacraid/aacraid_pci.c Modified: head/sys/dev/aacraid/aacraid_pci.c ============================================================================== --- head/sys/dev/aacraid/aacraid_pci.c Fri Oct 28 20:15:19 2016 (r308064) +++ head/sys/dev/aacraid/aacraid_pci.c Fri Oct 28 20:23:38 2016 (r308065) @@ -102,8 +102,6 @@ struct aac_ident "Adaptec RAID Controller"}, {0x9005, 0x028d, 0, 0, AAC_HWIF_SRCV, 0, "Adaptec RAID Controller"}, - {0x9005, 0x028f, 0, 0, AAC_HWIF_SRCV, 0, - "Adaptec RAID Controller"}, {0, 0, 0, 0, 0, 0, 0} }; From owner-svn-src-head@freebsd.org Fri Oct 28 21:47:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4EF1C25490; Fri, 28 Oct 2016 21:47:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A73F51D37; Fri, 28 Oct 2016 21:47:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 54A1C10AF88; Fri, 28 Oct 2016 17:47:25 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307971 - head/sys/mips/include Date: Fri, 28 Oct 2016 14:46:48 -0700 Message-ID: <1929988.EGVZnnWLNP@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <20161028175450.GE54029@kib.kiev.ua> References: <201610261737.u9QHb8Ps036831@repo.freebsd.org> <4639059.6gemL8B1hY@ralph.baldwin.cx> <20161028175450.GE54029@kib.kiev.ua> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 28 Oct 2016 17:47:25 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 21:47:32 -0000 On Friday, October 28, 2016 08:54:50 PM Konstantin Belousov wrote: > On Fri, Oct 28, 2016 at 09:59:26AM -0700, John Baldwin wrote: > > Well, we could perhaps patch those to use SA_SIGINFO instead, but if it's > > a non-trivial amount of effort I'm not going to bother. I'm surprised that > > some of those would use sigcontext. Both mono and go post-date SA_SIGINFO > > being standardized and supported on FreeBSD AFAIK. Supporting sigcontext > > just means extra BSD-specific code in those applications compared to using > > SA_SIGINFO. :-/ > > For libunwind, I can see a rationale for struct sigcontext use. It seems > that on Linux, rt_sigreturn(2) syscall takes struct sigcontext *, and not > struct ucontext *, as the argument. This is not unreasonable, because > the additional ucontext fields make no sense for sigreturn, for us they > are copied into kernel AS but are also unused. > > So my FreeBSD port followed the existing Linux code. And I started wondering > should we change our sigreturn(2) to take sigcontext * instead of ucontext *. Hmm, that's an interesting thought (and it seems 'struct sigcontext' isn't BSD-only). We would definitely want to ensure that the initial bit of ucontext_t matches a sigcontext if we were to go that route. -- John Baldwin From owner-svn-src-head@freebsd.org Fri Oct 28 23:01:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF764C25FD8; Fri, 28 Oct 2016 23:01:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8122DA17; Fri, 28 Oct 2016 23:01:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SN1Bts073699; Fri, 28 Oct 2016 23:01:11 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SN1BXT073698; Fri, 28 Oct 2016 23:01:11 GMT (envelope-from np@FreeBSD.org) Message-Id: <201610282301.u9SN1BXT073698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 28 Oct 2016 23:01:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308066 - head/sys/dev/cxgbe/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.23 Precedence: list List-Id: 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, 28 Oct 2016 23:01:12 -0000 Author: np Date: Fri Oct 28 23:01:11 2016 New Revision: 308066 URL: https://svnweb.freebsd.org/changeset/base/308066 Log: cxgbe(4): Accurate statistics for all chip settings. There are 4 independent knobs in T5+ chips to include or exclude PAUSE frames from the "total frames" and "multicast frames" counters in either direction. This change lets the driver deal with any combination of these settings. Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Fri Oct 28 20:23:38 2016 (r308065) +++ head/sys/dev/cxgbe/common/t4_hw.c Fri Oct 28 23:01:11 2016 (r308066) @@ -5870,10 +5870,13 @@ void t4_get_port_stats(struct adapter *a p->tx_ppp6 = GET_STAT(TX_PORT_PPP6); p->tx_ppp7 = GET_STAT(TX_PORT_PPP7); - if (stat_ctl & F_COUNTPAUSESTATTX) { - p->tx_frames -= p->tx_pause; - p->tx_octets -= p->tx_pause * 64; - p->tx_mcast_frames -= p->tx_pause; + if (chip_id(adap) >= CHELSIO_T5) { + if (stat_ctl & F_COUNTPAUSESTATTX) { + p->tx_frames -= p->tx_pause; + p->tx_octets -= p->tx_pause * 64; + } + if (stat_ctl & F_COUNTPAUSEMCTX) + p->tx_mcast_frames -= p->tx_pause; } p->rx_pause = GET_STAT(RX_PORT_PAUSE); @@ -5904,10 +5907,13 @@ void t4_get_port_stats(struct adapter *a p->rx_ppp6 = GET_STAT(RX_PORT_PPP6); p->rx_ppp7 = GET_STAT(RX_PORT_PPP7); - if (stat_ctl & F_COUNTPAUSESTATRX) { - p->rx_frames -= p->rx_pause; - p->rx_octets -= p->rx_pause * 64; - p->rx_mcast_frames -= p->rx_pause; + if (chip_id(adap) >= CHELSIO_T5) { + if (stat_ctl & F_COUNTPAUSESTATRX) { + p->rx_frames -= p->rx_pause; + p->rx_octets -= p->rx_pause * 64; + } + if (stat_ctl & F_COUNTPAUSEMCRX) + p->rx_mcast_frames -= p->rx_pause; } p->rx_ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_MAC_DROP_FRAME) : 0; From owner-svn-src-head@freebsd.org Fri Oct 28 23:53:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D700EC25D5E; Fri, 28 Oct 2016 23:53:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE7C6325; Fri, 28 Oct 2016 23:53:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SNrX7K094267; Fri, 28 Oct 2016 23:53:33 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SNrX2j094266; Fri, 28 Oct 2016 23:53:33 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201610282353.u9SNrX2j094266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Fri, 28 Oct 2016 23:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308067 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 23:53:34 -0000 Author: cem Date: Fri Oct 28 23:53:33 2016 New Revision: 308067 URL: https://svnweb.freebsd.org/changeset/base/308067 Log: ioat(4): Add additional tracing These probes help track down driver bugs. Sponsored by: Dell EMC Isilon Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Fri Oct 28 23:01:11 2016 (r308066) +++ head/sys/dev/ioat/ioat.c Fri Oct 28 23:53:33 2016 (r308067) @@ -693,8 +693,8 @@ ioat_process_events(struct ioat_softc *i while (desc->hw_desc_bus_addr != status && ioat_get_active(ioat) > 0) { desc = ioat_get_ring_entry(ioat, ioat->tail); dmadesc = &desc->bus_dmadesc; - CTR4(KTR_IOAT, "channel=%u completing desc %u ok cb %p(%p)", - ioat->chan_idx, ioat->tail, dmadesc->callback_fn, + CTR5(KTR_IOAT, "channel=%u completing desc idx %u (%p) ok cb %p(%p)", + ioat->chan_idx, ioat->tail, dmadesc, dmadesc->callback_fn, dmadesc->callback_arg); if (dmadesc->callback_fn != NULL) @@ -703,6 +703,8 @@ ioat_process_events(struct ioat_softc *i completed++; ioat->tail++; } + CTR5(KTR_IOAT, "%s channel=%u head=%u tail=%u active=%u", __func__, + ioat->chan_idx, ioat->head, ioat->tail, ioat_get_active(ioat)); if (completed != 0) { ioat->last_seen = desc->hw_desc_bus_addr; @@ -760,8 +762,8 @@ out: while (ioat_get_active(ioat) > 0) { desc = ioat_get_ring_entry(ioat, ioat->tail); dmadesc = &desc->bus_dmadesc; - CTR4(KTR_IOAT, "channel=%u completing desc %u err cb %p(%p)", - ioat->chan_idx, ioat->tail, dmadesc->callback_fn, + CTR5(KTR_IOAT, "channel=%u completing desc idx %u (%p) err cb %p(%p)", + ioat->chan_idx, ioat->tail, dmadesc, dmadesc->callback_fn, dmadesc->callback_arg); if (dmadesc->callback_fn != NULL) @@ -773,6 +775,8 @@ out: ioat->stats.descriptors_processed++; ioat->stats.descriptors_error++; } + CTR5(KTR_IOAT, "%s channel=%u head=%u tail=%u active=%u", __func__, + ioat->chan_idx, ioat->head, ioat->tail, ioat_get_active(ioat)); if (ioat->is_completion_pending) { ioat->is_completion_pending = FALSE; @@ -947,7 +951,8 @@ ioat_release(bus_dmaengine_t dmaengine) struct ioat_softc *ioat; ioat = to_ioat_softc(dmaengine); - CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); + CTR3(KTR_IOAT, "%s channel=%u dispatch hw_head=%u", __func__, + ioat->chan_idx, ioat->hw_head & UINT16_MAX); ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, (uint16_t)ioat->hw_head); if (!ioat->is_completion_pending) { @@ -1040,7 +1045,6 @@ ioat_copy(bus_dmaengine_t dmaengine, bus struct ioat_softc *ioat; ioat = to_ioat_softc(dmaengine); - CTR2(KTR_IOAT, "%s channel=%u", __func__, ioat->chan_idx); if (((src | dst) & (0xffffull << 48)) != 0) { ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n", @@ -1058,6 +1062,8 @@ ioat_copy(bus_dmaengine_t dmaengine, bus dump_descriptor(hw_desc); ioat_submit_single(ioat); + CTR6(KTR_IOAT, "%s channel=%u desc=%p dest=%lx src=%lx len=%lx", + __func__, ioat->chan_idx, &desc->bus_dmadesc, dst, src, len); return (&desc->bus_dmadesc); } @@ -1414,11 +1420,16 @@ ioat_reserve_space(struct ioat_softc *io if (ioat_get_ring_space(ioat) >= num_descs) goto out; + CTR3(KTR_IOAT, "%s channel=%u starved (%u)", __func__, + ioat->chan_idx, num_descs); + if (!dug && !ioat->is_submitter_processing && (1 << ioat->ring_size_order) > num_descs) { ioat->is_submitter_processing = TRUE; mtx_unlock(&ioat->submit_lock); + CTR2(KTR_IOAT, "%s channel=%u attempting to process events", + __func__, ioat->chan_idx); ioat_process_events(ioat); mtx_lock(&ioat->submit_lock); @@ -1433,6 +1444,8 @@ ioat_reserve_space(struct ioat_softc *io order = ioat->ring_size_order; if (ioat->is_resize_pending || order == IOAT_MAX_ORDER) { if ((mflags & M_WAITOK) != 0) { + CTR2(KTR_IOAT, "%s channel=%u blocking on completions", + __func__, ioat->chan_idx); msleep(&ioat->tail, &ioat->submit_lock, 0, "ioat_rsz", 0); continue; @@ -1794,6 +1807,9 @@ ioat_submit_single(struct ioat_softc *io ioat_get(ioat, IOAT_ACTIVE_DESCR_REF); atomic_add_rel_int(&ioat->head, 1); atomic_add_rel_int(&ioat->hw_head, 1); + CTR5(KTR_IOAT, "%s channel=%u head=%u hw_head=%u tail=%u", __func__, + ioat->chan_idx, ioat->head, ioat->hw_head & UINT16_MAX, + ioat->tail); ioat->stats.descriptors_submitted++; } From owner-svn-src-head@freebsd.org Fri Oct 28 23:53:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0A59C25D88; Fri, 28 Oct 2016 23:53:37 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CF62359; Fri, 28 Oct 2016 23:53:37 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SNra0q094355; Fri, 28 Oct 2016 23:53:36 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SNra0I094354; Fri, 28 Oct 2016 23:53:36 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201610282353.u9SNra0I094354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Fri, 28 Oct 2016 23:53:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308069 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 23:53:37 -0000 Author: cem Date: Fri Oct 28 23:53:36 2016 New Revision: 308069 URL: https://svnweb.freebsd.org/changeset/base/308069 Log: ioat(4): Add failpoint for delay() in ioat_release Sponsored by: Dell EMC Isilon Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Fri Oct 28 23:53:35 2016 (r308068) +++ head/sys/dev/ioat/ioat.c Fri Oct 28 23:53:36 2016 (r308069) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -951,8 +952,12 @@ ioat_release(bus_dmaengine_t dmaengine) struct ioat_softc *ioat; ioat = to_ioat_softc(dmaengine); - CTR3(KTR_IOAT, "%s channel=%u dispatch hw_head=%u", __func__, - ioat->chan_idx, ioat->hw_head & UINT16_MAX); + CTR4(KTR_IOAT, "%s channel=%u dispatch1 hw_head=%u head=%u", __func__, + ioat->chan_idx, ioat->hw_head & UINT16_MAX, ioat->head); + KFAIL_POINT_CODE(DEBUG_FP, ioat_release, /* do nothing */); + CTR4(KTR_IOAT, "%s channel=%u dispatch2 hw_head=%u head=%u", __func__, + ioat->chan_idx, ioat->hw_head & UINT16_MAX, ioat->head); + ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, (uint16_t)ioat->hw_head); if (!ioat->is_completion_pending) { From owner-svn-src-head@freebsd.org Fri Oct 28 23:53:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75B04C25D8F; Fri, 28 Oct 2016 23:53:39 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1ECD13CA; Fri, 28 Oct 2016 23:53:39 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SNrc2Z094401; Fri, 28 Oct 2016 23:53:38 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SNrcwP094399; Fri, 28 Oct 2016 23:53:38 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201610282353.u9SNrcwP094399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Fri, 28 Oct 2016 23:53:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308070 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 23:53:39 -0000 Author: cem Date: Fri Oct 28 23:53:37 2016 New Revision: 308070 URL: https://svnweb.freebsd.org/changeset/base/308070 Log: ioat(4): Use memory completion rather than device register The CHANSTS register is a split 64-bit register on CBDMA units before hardware v3.3. If a torn read happens during ioat_process_events(), software cannot know when to stop completing descriptors correctly. So, just use the device-pushed main memory channel status instead. Remove the ioat_get_active() seatbelt as well. It does nothing if the completion address is valid. Sponsored by: Dell EMC Isilon Modified: head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat_internal.h Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Fri Oct 28 23:53:36 2016 (r308069) +++ head/sys/dev/ioat/ioat.c Fri Oct 28 23:53:37 2016 (r308070) @@ -677,7 +677,7 @@ ioat_process_events(struct ioat_softc *i } completed = 0; - comp_update = ioat_get_chansts(ioat); + comp_update = *ioat->comp_update; status = comp_update & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_MASK; if (status == ioat->last_seen) { @@ -691,7 +691,7 @@ ioat_process_events(struct ioat_softc *i __func__, ioat->chan_idx, comp_update, ioat->last_seen); desc = ioat_get_ring_entry(ioat, ioat->tail - 1); - while (desc->hw_desc_bus_addr != status && ioat_get_active(ioat) > 0) { + while (desc->hw_desc_bus_addr != status) { desc = ioat_get_ring_entry(ioat, ioat->tail); dmadesc = &desc->bus_dmadesc; CTR5(KTR_IOAT, "channel=%u completing desc idx %u (%p) ok cb %p(%p)", Modified: head/sys/dev/ioat/ioat_internal.h ============================================================================== --- head/sys/dev/ioat/ioat_internal.h Fri Oct 28 23:53:36 2016 (r308069) +++ head/sys/dev/ioat/ioat_internal.h Fri Oct 28 23:53:37 2016 (r308070) @@ -523,6 +523,15 @@ struct ioat_softc { void ioat_test_attach(void); void ioat_test_detach(void); +/* + * XXX DO NOT USE this routine for obtaining the current completed descriptor. + * + * The double_4 read on ioat<3.3 appears to result in torn reads. And v3.2 + * hardware is still commonplace (Broadwell Xeon has it). Instead, use the + * device-pushed *comp_update. + * + * It is safe to use ioat_get_chansts() for the low status bits. + */ static inline uint64_t ioat_get_chansts(struct ioat_softc *ioat) { From owner-svn-src-head@freebsd.org Fri Oct 28 23:53:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4545DC25D63; Fri, 28 Oct 2016 23:53:36 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15CAF328; Fri, 28 Oct 2016 23:53:36 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SNrZBw094311; Fri, 28 Oct 2016 23:53:35 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SNrZ9q094310; Fri, 28 Oct 2016 23:53:35 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201610282353.u9SNrZ9q094310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Fri, 28 Oct 2016 23:53:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308068 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 28 Oct 2016 23:53:36 -0000 Author: cem Date: Fri Oct 28 23:53:35 2016 New Revision: 308068 URL: https://svnweb.freebsd.org/changeset/base/308068 Log: ioat(4): Assert the submit lock in ioat_submit_single Sponsored by: Dell EMC Isilon Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Fri Oct 28 23:53:33 2016 (r308067) +++ head/sys/dev/ioat/ioat.c Fri Oct 28 23:53:35 2016 (r308068) @@ -1804,6 +1804,8 @@ static void ioat_submit_single(struct ioat_softc *ioat) { + mtx_assert(&ioat->submit_lock, MA_OWNED); + ioat_get(ioat, IOAT_ACTIVE_DESCR_REF); atomic_add_rel_int(&ioat->head, 1); atomic_add_rel_int(&ioat->hw_head, 1); From owner-svn-src-head@freebsd.org Sat Oct 29 01:22:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23167C25502; Sat, 29 Oct 2016 01:22:57 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F19ADC6; Sat, 29 Oct 2016 01:22:56 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9T1Mur0028734; Sat, 29 Oct 2016 01:22:56 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9T1MuJK028732; Sat, 29 Oct 2016 01:22:56 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610290122.u9T1MuJK028732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 29 Oct 2016 01:22:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308072 - head/lib/libc/powerpcspe/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.23 Precedence: list List-Id: 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, 29 Oct 2016 01:22:57 -0000 Author: jhibbits Date: Sat Oct 29 01:22:55 2016 New Revision: 308072 URL: https://svnweb.freebsd.org/changeset/base/308072 Log: Fix a copy&paste-o causing a segfault with sigsetjmp. I'm not sure how this passed my code inspection and initial testing, it's obviously wrong. Found when debugging csh. Modified: head/lib/libc/powerpcspe/gen/setjmp.S head/lib/libc/powerpcspe/gen/sigsetjmp.S Modified: head/lib/libc/powerpcspe/gen/setjmp.S ============================================================================== --- head/lib/libc/powerpcspe/gen/setjmp.S Sat Oct 29 00:16:43 2016 (r308071) +++ head/lib/libc/powerpcspe/gen/setjmp.S Sat Oct 29 01:22:55 2016 (r308072) @@ -95,29 +95,29 @@ END(setjmp) WEAK_REFERENCE(CNAME(__longjmp), longjmp) ENTRY(__longjmp) - evldd %r9,24+0*8(%r6) - evldd %r10,24+1*8(%r6) - evldd %r11,24+2*8(%r6) - evldd %r12,24+3*8(%r6) - evldd %r13,24+4*8(%r6) - evldd %r14,24+5*8(%r6) - evldd %r15,24+6*8(%r6) - evldd %r16,24+7*8(%r6) - evldd %r17,24+8*8(%r6) - evldd %r18,24+9*8(%r6) - evldd %r19,24+10*8(%r6) - evldd %r20,24+11*8(%r6) - evldd %r21,24+12*8(%r6) - evldd %r22,24+13*8(%r6) - evldd %r23,24+14*8(%r6) - evldd %r24,24+15*8(%r6) - evldd %r25,24+16*8(%r6) - evldd %r26,24+17*8(%r6) - evldd %r27,24+18*8(%r6) - evldd %r28,24+19*8(%r6) - evldd %r29,24+20*8(%r6) - evldd %r30,24+21*8(%r6) - evldd %r31,24+22*8(%r6) + evldd %r9,24+0*8(%r3) + evldd %r10,24+1*8(%r3) + evldd %r11,24+2*8(%r3) + evldd %r12,24+3*8(%r3) + evldd %r13,24+4*8(%r3) + evldd %r14,24+5*8(%r3) + evldd %r15,24+6*8(%r3) + evldd %r16,24+7*8(%r3) + evldd %r17,24+8*8(%r3) + evldd %r18,24+9*8(%r3) + evldd %r19,24+10*8(%r3) + evldd %r20,24+11*8(%r3) + evldd %r21,24+12*8(%r3) + evldd %r22,24+13*8(%r3) + evldd %r23,24+14*8(%r3) + evldd %r24,24+15*8(%r3) + evldd %r25,24+16*8(%r3) + evldd %r26,24+17*8(%r3) + evldd %r27,24+18*8(%r3) + evldd %r28,24+19*8(%r3) + evldd %r29,24+20*8(%r3) + evldd %r30,24+21*8(%r3) + evldd %r31,24+22*8(%r3) mr %r6,%r4 /* save val param */ mtlr %r11 /* r11 -> link reg */ Modified: head/lib/libc/powerpcspe/gen/sigsetjmp.S ============================================================================== --- head/lib/libc/powerpcspe/gen/sigsetjmp.S Sat Oct 29 00:16:43 2016 (r308071) +++ head/lib/libc/powerpcspe/gen/sigsetjmp.S Sat Oct 29 01:22:55 2016 (r308072) @@ -103,29 +103,29 @@ END(sigsetjmp) ENTRY(siglongjmp) /* FPRs */ - evldd %r9,24+0*8(%r6) - evldd %r10,24+1*8(%r6) - evldd %r11,24+2*8(%r6) - evldd %r12,24+3*8(%r6) - evldd %r13,24+4*8(%r6) - evldd %r14,24+5*8(%r6) - evldd %r15,24+6*8(%r6) - evldd %r16,24+7*8(%r6) - evldd %r17,24+8*8(%r6) - evldd %r18,24+9*8(%r6) - evldd %r19,24+10*8(%r6) - evldd %r20,24+11*8(%r6) - evldd %r21,24+12*8(%r6) - evldd %r22,24+13*8(%r6) - evldd %r23,24+14*8(%r6) - evldd %r24,24+15*8(%r6) - evldd %r25,24+16*8(%r6) - evldd %r26,24+17*8(%r6) - evldd %r27,24+18*8(%r6) - evldd %r28,24+19*8(%r6) - evldd %r29,24+20*8(%r6) - evldd %r30,24+21*8(%r6) - evldd %r31,24+22*8(%r6) + evldd %r9,24+0*8(%r3) + evldd %r10,24+1*8(%r3) + evldd %r11,24+2*8(%r3) + evldd %r12,24+3*8(%r3) + evldd %r13,24+4*8(%r3) + evldd %r14,24+5*8(%r3) + evldd %r15,24+6*8(%r3) + evldd %r16,24+7*8(%r3) + evldd %r17,24+8*8(%r3) + evldd %r18,24+9*8(%r3) + evldd %r19,24+10*8(%r3) + evldd %r20,24+11*8(%r3) + evldd %r21,24+12*8(%r3) + evldd %r22,24+13*8(%r3) + evldd %r23,24+14*8(%r3) + evldd %r24,24+15*8(%r3) + evldd %r25,24+16*8(%r3) + evldd %r26,24+17*8(%r3) + evldd %r27,24+18*8(%r3) + evldd %r28,24+19*8(%r3) + evldd %r29,24+20*8(%r3) + evldd %r30,24+21*8(%r3) + evldd %r31,24+22*8(%r3) lwz %r7,0(%r3) mr %r6,%r4 From owner-svn-src-head@freebsd.org Sat Oct 29 01:24:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8536BC255C1; Sat, 29 Oct 2016 01:24:31 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D07C250; Sat, 29 Oct 2016 01:24:31 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9T1OU1m028828; Sat, 29 Oct 2016 01:24:30 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9T1OU0G028826; Sat, 29 Oct 2016 01:24:30 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610290124.u9T1OU0G028826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 29 Oct 2016 01:24:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308073 - in head/sys/powerpc: include 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.23 Precedence: list List-Id: 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, 29 Oct 2016 01:24:31 -0000 Author: jhibbits Date: Sat Oct 29 01:24:30 2016 New Revision: 308073 URL: https://svnweb.freebsd.org/changeset/base/308073 Log: Add the SPE feature mask for e500v1 and e500v2 On e500v2 SoCs it will now print: cpu0: Features 84e08000 at bootup. Modified: head/sys/powerpc/include/cpu.h head/sys/powerpc/powerpc/cpu.c Modified: head/sys/powerpc/include/cpu.h ============================================================================== --- head/sys/powerpc/include/cpu.h Sat Oct 29 01:22:55 2016 (r308072) +++ head/sys/powerpc/include/cpu.h Sat Oct 29 01:24:30 2016 (r308073) @@ -56,6 +56,9 @@ extern int cpu_features2; #define PPC_FEATURE_HAS_FPU 0x08000000 #define PPC_FEATURE_HAS_MMU 0x04000000 #define PPC_FEATURE_UNIFIED_CACHE 0x01000000 +#define PPC_FEATURE_HAS_SPE 0x00800000 +#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000 +#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000 #define PPC_FEATURE_BOOKE 0x00008000 #define PPC_FEATURE_SMT 0x00004000 #define PPC_FEATURE_ARCH_2_05 0x00001000 @@ -70,7 +73,8 @@ extern int cpu_features2; #define PPC_FEATURE_BITMASK \ "\20" \ "\040PPC32\037PPC64\035ALTIVEC\034FPU\033MMU\031UNIFIEDCACHE" \ - "\020BOOKE\017SMT\015ARCH205\013DFP\011ARCH206\010VSX" + "\030SPE\027SPESFP\026DPESFP\020BOOKE\017SMT\015ARCH205\013DFP" \ + "\011ARCH206\010VSX" #define PPC_FEATURE2_BITMASK \ "\20" \ "\040ARCH207\037HTM\032VCRYPTO" Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Sat Oct 29 01:22:55 2016 (r308072) +++ head/sys/powerpc/powerpc/cpu.c Sat Oct 29 01:24:30 2016 (r308073) @@ -180,9 +180,12 @@ static const struct cputab models[] = { { "Motorola PowerPC 8245", MPC8245, REVFMT_MAJMIN, PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup }, { "Freescale e500v1 core", FSL_E500v1, REVFMT_MAJMIN, - PPC_FEATURE_BOOKE, 0, cpu_booke_setup }, + PPC_FEATURE_BOOKE | PPC_FEATURE_HAS_SPE | PPC_FEATURE_HAS_EFP_SINGLE, + 0, cpu_booke_setup }, { "Freescale e500v2 core", FSL_E500v2, REVFMT_MAJMIN, - PPC_FEATURE_BOOKE, 0, cpu_booke_setup }, + PPC_FEATURE_BOOKE | PPC_FEATURE_HAS_SPE | + PPC_FEATURE_HAS_EFP_SINGLE | PPC_FEATURE_HAS_EFP_DOUBLE, 0, + cpu_booke_setup }, { "Freescale e500mc core", FSL_E500mc, REVFMT_MAJMIN, PPC_FEATURE_BOOKE | PPC_FEATURE_HAS_FPU, 0, cpu_booke_setup }, { "Freescale e5500 core", FSL_E5500, REVFMT_MAJMIN, From owner-svn-src-head@freebsd.org Sat Oct 29 12:38:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F7F4C26CD1; Sat, 29 Oct 2016 12:38:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E97C1F8; Sat, 29 Oct 2016 12:38:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9TCcUfG086750; Sat, 29 Oct 2016 12:38:30 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9TCcUSU086749; Sat, 29 Oct 2016 12:38:30 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201610291238.u9TCcUSU086749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Oct 2016 12:38:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308088 - 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.23 Precedence: list List-Id: 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, 29 Oct 2016 12:38:31 -0000 Author: trasz Date: Sat Oct 29 12:38:30 2016 New Revision: 308088 URL: https://svnweb.freebsd.org/changeset/base/308088 Log: Fix getfsstat(2) handling of flags. The 'flags' argument is an enum, not a bitfield. For the intended usage - being passed either MNT_WAIT, or MNT_NOWAIT - this shouldn't introduce any changes in behaviour. Reviewed by: jhb@ MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8373 Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sat Oct 29 08:57:35 2016 (r308087) +++ head/sys/kern/vfs_syscalls.c Sat Oct 29 12:38:30 2016 (r308088) @@ -495,16 +495,16 @@ kern_getfsstat(struct thread *td, struct sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; /* * If MNT_NOWAIT or MNT_LAZY is specified, do not - * refresh the fsstat cache. MNT_NOWAIT or MNT_LAZY - * overrides MNT_WAIT. + * refresh the fsstat cache. */ - if (((flags & (MNT_LAZY|MNT_NOWAIT)) == 0 || - (flags & MNT_WAIT)) && - (error = VFS_STATFS(mp, sp))) { - mtx_lock(&mountlist_mtx); - nmp = TAILQ_NEXT(mp, mnt_list); - vfs_unbusy(mp); - continue; + if (flags != MNT_LAZY && flags != MNT_NOWAIT) { + error = VFS_STATFS(mp, sp); + if (error != 0) { + mtx_lock(&mountlist_mtx); + nmp = TAILQ_NEXT(mp, mnt_list); + vfs_unbusy(mp); + continue; + } } if (priv_check(td, PRIV_VFS_GENERATION)) { bcopy(sp, &sb, sizeof(sb)); From owner-svn-src-head@freebsd.org Sat Oct 29 14:09:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F0E7C262AC; Sat, 29 Oct 2016 14:09:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05542122; Sat, 29 Oct 2016 14:09:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9TE9Y5f020666; Sat, 29 Oct 2016 14:09:34 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9TE9WXJ020650; Sat, 29 Oct 2016 14:09:32 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201610291409.u9TE9WXJ020650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 29 Oct 2016 14:09:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308089 - in head: cddl/contrib/opensolaris/lib/libzfs/common sbin sbin/zfsbootcfg sys/boot/i386/common sys/boot/i386/gptzfsboot sys/boot/i386/zfsboot sys/cddl/contrib/opensolaris/uts/c... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Oct 2016 14:09:35 -0000 Author: avg Date: Sat Oct 29 14:09:32 2016 New Revision: 308089 URL: https://svnweb.freebsd.org/changeset/base/308089 Log: zfsbootcfg: a simple tool to set next boot (one time) options for zfsboot (gpt)zfsboot will read one-time boot directives from a special ZFS pool area. The area was previously described as "Boot Block Header", but currently it is know as Pad2, marked as reserved and is zeroed out on pool creation. The new code interprets data in this area, if any, using the same format as boot.config. The area is immediately wiped out. Failure to parse the directives results in a reboot right after the cleanup. Otherwise the boot sequence proceeds as usual. zfsbootcfg writes zfsboot arguments specified on its command line to the Pad2 area of a disk identified by vfs.zfs.boot.primary_pool and vfs.zfs.boot.primary_vdev kenv variables that are set by loader during boot. Please see the manual page for more. Thanks to all who reviewed, contributed and made suggestions! There are many potential improvements to the feature, please see the review for details. Reviewed by: wblock (docs) Discussed with: jhb, tsoome MFC after: 3 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D7612 Added: head/sbin/zfsbootcfg/ head/sbin/zfsbootcfg/Makefile (contents, props changed) head/sbin/zfsbootcfg/zfsbootcfg.8 (contents, props changed) head/sbin/zfsbootcfg/zfsbootcfg.c (contents, props changed) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/sbin/Makefile head/sys/boot/i386/common/drv.c head/sys/boot/i386/common/drv.h head/sys/boot/i386/gptzfsboot/Makefile head/sys/boot/i386/zfsboot/Makefile head/sys/boot/i386/zfsboot/zfsboot.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 29 12:38:30 2016 (r308088) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 29 14:09:32 2016 (r308089) @@ -213,6 +213,7 @@ extern int zpool_get_state(zpool_handle_ extern const char *zpool_state_to_name(vdev_state_t, vdev_aux_t); extern const char *zpool_pool_state_to_name(pool_state_t); extern void zpool_free_handles(libzfs_handle_t *); +extern int zpool_nextboot(libzfs_handle_t *, uint64_t, uint64_t, const char *); /* * Iterate over all active pools in the system. Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sat Oct 29 12:38:30 2016 (r308088) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sat Oct 29 14:09:32 2016 (r308089) @@ -4126,3 +4126,25 @@ out: libzfs_fini(hdl); return (ret); } + +int +zpool_nextboot(libzfs_handle_t *hdl, uint64_t pool_guid, uint64_t dev_guid, + const char *command) +{ + zfs_cmd_t zc = { 0 }; + nvlist_t *args; + char *packed; + size_t size; + int error; + + args = fnvlist_alloc(); + fnvlist_add_uint64(args, ZPOOL_CONFIG_POOL_GUID, pool_guid); + fnvlist_add_uint64(args, ZPOOL_CONFIG_GUID, dev_guid); + fnvlist_add_string(args, "command", command); + error = zcmd_write_src_nvlist(hdl, &zc, args); + if (error == 0) + error = ioctl(hdl->libzfs_fd, ZFS_IOC_NEXTBOOT, &zc); + zcmd_free_nvlists(&zc); + nvlist_free(args); + return (error); +} Modified: head/sbin/Makefile ============================================================================== --- head/sbin/Makefile Sat Oct 29 12:38:30 2016 (r308088) +++ head/sbin/Makefile Sat Oct 29 14:09:32 2016 (r308089) @@ -87,6 +87,7 @@ SUBDIR.${MK_PF}+= pfctl SUBDIR.${MK_PF}+= pflogd SUBDIR.${MK_QUOTAS}+= quotacheck SUBDIR.${MK_ROUTED}+= routed +SUBDIR.${MK_ZFS}+= zfsbootcfg SUBDIR.${MK_TESTS}+= tests Added: head/sbin/zfsbootcfg/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/zfsbootcfg/Makefile Sat Oct 29 14:09:32 2016 (r308089) @@ -0,0 +1,27 @@ +# @(#)Makefile 8.4 (Berkeley) 6/22/95 +# $FreeBSD$ + +PROG= zfsbootcfg +WARNS?= 1 +MAN= zfsbootcfg.8 + +LIBADD+=zfs +LIBADD+=nvpair +LIBADD+=umem +LIBADD+=uutil +LIBADD+=geom + +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair +CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris +CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs +CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head + +CFLAGS+= -DNEED_SOLARIS_BOOLEAN + +.include Added: head/sbin/zfsbootcfg/zfsbootcfg.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/zfsbootcfg/zfsbootcfg.8 Sat Oct 29 14:09:32 2016 (r308089) @@ -0,0 +1,112 @@ +.\" Copyright (c) 2016 Andriy Gapon +.\" 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. +.\" +.\" $FreeBSD$ +.\" +.Dd October 12, 2016 +.Dt ZFSBOOTCFG 8 +.Os +.Sh NAME +.Nm zfsbootcfg +.Nd "specify zfsboot options for the next boot" +.Sh SYNOPSIS +.Nm +.Ao Ar options Ac +.Sh DESCRIPTION +.Nm +is used to set +.Xr boot.config 5 Ns -style +options to be used by +.Xr zfsboot 8 +or +.Xr gptzfsboot 8 +the next time the machine is booted. +Once +.Xr zfsboot 8 +or +.Xr gptzfsboot 8 +reads the information, it is deleted. +If booting fails, the machine automatically reverts to the previous +boot configuration. +The information is stored in a special reserved area of a ZFS pool. +.Xr zfsboot 8 +or +.Xr gptzfsboot 8 +read the boot option information from the first disk found in the first +ZFS pool found. +.Sh ENVIRONMENT +.Bl -tag -width vfs.zfs.boot.primary_pool -compact +.It Ev vfs.zfs.boot.primary_pool +The +.Xr kenv 1 +variable that identifies a pool for which the options are written. +.It Ev vfs.zfs.boot.primary_vdev +The +.Xr kenv 1 +variable that identifies a disk within the pool where the options +are written. +.El +.Sh EXAMPLES +Try to boot to a new +.Em boot environment +without changing the +.Cm bootfs +property of a pool: +.Pp +.Dl "zfsbootcfg ""zfs:tank/ROOT/newbe:"" +.Pp +To clear the boot options: +.Pp +.Dl "zfsbootcfg """" +.Sh SEE ALSO +.Xr boot.config 5 , +.Xr gptzfsboot 8 , +.Xr zfsboot 8 +.Sh HISTORY +.Nm +appeared in +.Fx 12.0 . +.Sh AUTHORS +This manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . +.Sh CAVEATS +At the moment, +.Nm +uses the +.Ev vfs.zfs.boot.primary_pool +and +.Ev vfs.zfs.boot.primary_vdev +.Xr kenv 1 +variables to determine a ZFS pool and a disk in it where the options +are to be stored. +The variables are set by the ZFS boot chain, so there is an assumption +that the same boot disk is going to be used for the next reboot. +There is no +.Nm +option to specify a different pool or a different disk. +.Pp +.Nm +should be extended to install new +.Xr zfsboot 8 +blocks in a ZFS pool. Added: head/sbin/zfsbootcfg/zfsbootcfg.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/zfsbootcfg/zfsbootcfg.c Sat Oct 29 14:09:32 2016 (r308089) @@ -0,0 +1,98 @@ +/*- + * Copyright (c) 2016 Andriy Gapon + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* Keep in sync with zfsboot.c. */ +#define MAX_COMMAND_LEN 512 + +int main(int argc, const char * const *argv) +{ + char buf[32]; + libzfs_handle_t *hdl; + uint64_t pool_guid; + uint64_t vdev_guid; + int zfs_fd; + int len; + + if (argc != 2) { + fprintf(stderr, "usage: zfsbootcfg \n"); + return (1); + } + + len = strlen(argv[1]); + if (len >= MAX_COMMAND_LEN) { + fprintf(stderr, "options string is too long\n"); + return (1); + } + + if (kenv(KENV_GET, "vfs.zfs.boot.primary_pool", buf, sizeof(buf)) <= 0) { + perror("can't get vfs.zfs.boot.primary_pool"); + return (1); + } + pool_guid = strtoumax(buf, NULL, 10); + if (pool_guid == 0) { + perror("can't parse vfs.zfs.boot.primary_pool"); + return (1); + } + + if (kenv(KENV_GET, "vfs.zfs.boot.primary_vdev", buf, sizeof(buf)) <= 0) { + perror("can't get vfs.zfs.boot.primary_vdev"); + return (1); + } + vdev_guid = strtoumax(buf, NULL, 10); + if (vdev_guid == 0) { + perror("can't parse vfs.zfs.boot.primary_vdev"); + return (1); + } + + if ((hdl = libzfs_init()) == NULL) { + (void) fprintf(stderr, "internal error: failed to " + "initialize ZFS library\n"); + return (1); + } + + if (zpool_nextboot(hdl, pool_guid, vdev_guid, argv[1]) != 0) { + perror("ZFS_IOC_NEXTBOOT failed"); + libzfs_fini(hdl); + return (1); + } + + libzfs_fini(hdl); + printf("zfs next boot options are successfully written\n"); + return (0); +} Modified: head/sys/boot/i386/common/drv.c ============================================================================== --- head/sys/boot/i386/common/drv.c Sat Oct 29 12:38:30 2016 (r308088) +++ head/sys/boot/i386/common/drv.c Sat Oct 29 14:09:32 2016 (r308089) @@ -91,7 +91,7 @@ drvread(struct dsk *dskp, void *buf, dad return (0); } -#ifdef GPT +#if defined(GPT) || defined(ZFS) int drvwrite(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) { @@ -114,4 +114,4 @@ drvwrite(struct dsk *dskp, void *buf, da } return (0); } -#endif /* GPT */ +#endif /* GPT || ZFS */ Modified: head/sys/boot/i386/common/drv.h ============================================================================== --- head/sys/boot/i386/common/drv.h Sat Oct 29 12:38:30 2016 (r308088) +++ head/sys/boot/i386/common/drv.h Sat Oct 29 14:09:32 2016 (r308089) @@ -40,9 +40,9 @@ struct dsk { }; int drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk); -#ifdef GPT +#if defined(GPT) || defined(ZFS) int drvwrite(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk); -#endif /* GPT */ +#endif /* GPT || ZFS */ uint64_t drvsize(struct dsk *dskp); #endif /* !_DRV_H_ */ Modified: head/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- head/sys/boot/i386/gptzfsboot/Makefile Sat Oct 29 12:38:30 2016 (r308088) +++ head/sys/boot/i386/gptzfsboot/Makefile Sat Oct 29 14:09:32 2016 (r308089) @@ -19,7 +19,7 @@ ORG2= 0x0 CFLAGS= -DBOOTPROG=\"gptzfsboot\" \ -O1 \ - -DGPT -DBOOT2 \ + -DGPT -DZFS -DBOOT2 \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ -DSIOFMT=${B2SIOFMT} \ -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ Modified: head/sys/boot/i386/zfsboot/Makefile ============================================================================== --- head/sys/boot/i386/zfsboot/Makefile Sat Oct 29 12:38:30 2016 (r308088) +++ head/sys/boot/i386/zfsboot/Makefile Sat Oct 29 14:09:32 2016 (r308089) @@ -18,7 +18,7 @@ ORG2= 0x2000 CFLAGS= -DBOOTPROG=\"zfsboot\" \ -O1 \ - -DBOOT2 \ + -DZFS -DBOOT2 \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ -DSIOFMT=${B2SIOFMT} \ -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ Modified: head/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- head/sys/boot/i386/zfsboot/zfsboot.c Sat Oct 29 12:38:30 2016 (r308088) +++ head/sys/boot/i386/zfsboot/zfsboot.c Sat Oct 29 14:09:32 2016 (r308089) @@ -119,6 +119,7 @@ struct dmadat { static struct dmadat *dmadat; void exit(int); +void reboot(void); static void load(void); static int parse(void); static void bios_getmem(void); @@ -175,7 +176,7 @@ zfs_read(spa_t *spa, const dnode_phys_t n = size; if (*offp + n > zp->zp_size) n = zp->zp_size - *offp; - + rc = dnode_read(spa, dnode, *offp, start, n); if (rc) return (-1); @@ -260,6 +261,35 @@ vdev_read(vdev_t *vdev, void *priv, off_ } static int +vdev_write(vdev_t *vdev, void *priv, off_t off, void *buf, size_t bytes) +{ + char *p; + daddr_t lba; + unsigned int nb; + struct dsk *dsk = (struct dsk *) priv; + + if ((off & (DEV_BSIZE - 1)) || (bytes & (DEV_BSIZE - 1))) + return -1; + + p = buf; + lba = off / DEV_BSIZE; + lba += dsk->start; + while (bytes > 0) { + nb = bytes / DEV_BSIZE; + if (nb > READ_BUF_SIZE / DEV_BSIZE) + nb = READ_BUF_SIZE / DEV_BSIZE; + memcpy(dmadat->rdbuf, p, nb * DEV_BSIZE); + if (drvwrite(dsk, dmadat->rdbuf, lba, nb)) + return -1; + p += nb * DEV_BSIZE; + lba += nb; + bytes -= nb * DEV_BSIZE; + } + + return 0; +} + +static int xfsread(const dnode_phys_t *dnode, off_t *offp, void *buf, size_t nbyte) { if ((size_t)zfs_read(spa, dnode, offp, buf, nbyte) != nbyte) { @@ -269,6 +299,52 @@ xfsread(const dnode_phys_t *dnode, off_t return 0; } +/* + * Read Pad2 (formerly "Boot Block Header") area of the first + * vdev label of the given vdev. + */ +static int +vdev_read_pad2(vdev_t *vdev, char *buf, size_t size) +{ + blkptr_t bp; + char *tmp = zap_scratch; + off_t off = offsetof(vdev_label_t, vl_pad2); + + if (size > VDEV_PAD_SIZE) + size = VDEV_PAD_SIZE; + + BP_ZERO(&bp); + BP_SET_LSIZE(&bp, VDEV_PAD_SIZE); + BP_SET_PSIZE(&bp, VDEV_PAD_SIZE); + BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); + BP_SET_COMPRESS(&bp, ZIO_COMPRESS_OFF); + DVA_SET_OFFSET(BP_IDENTITY(&bp), off); + if (vdev_read_phys(vdev, &bp, tmp, off, 0)) + return (EIO); + memcpy(buf, tmp, size); + return (0); +} + +static int +vdev_clear_pad2(vdev_t *vdev) +{ + char *zeroes = zap_scratch; + uint64_t *end; + off_t off = offsetof(vdev_label_t, vl_pad2); + + memset(zeroes, 0, VDEV_PAD_SIZE); + end = (uint64_t *)(zeroes + VDEV_PAD_SIZE); + /* ZIO_CHECKSUM_LABEL magic and pre-calcualted checksum for all zeros */ + end[-5] = 0x0210da7ab10c7a11; + end[-4] = 0x97f48f807f6e2a3f; + end[-3] = 0xaf909f1658aacefc; + end[-2] = 0xcbd1ea57ff6db48b; + end[-1] = 0x6ec692db0d465fab; + if (vdev_write(vdev, vdev->v_read_priv, off, zeroes, VDEV_PAD_SIZE)) + return (EIO); + return (0); +} + static void bios_getmem(void) { @@ -542,10 +618,12 @@ trymbr: int main(void) { - int autoboot, i; dnode_phys_t dn; off_t off; struct dsk *dsk; + int autoboot, i; + int nextboot; + int rc; dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); @@ -634,7 +712,39 @@ main(void) primary_spa = spa; primary_vdev = spa_get_primary_vdev(spa); - if (zfs_spa_init(spa) != 0 || zfs_mount(spa, 0, &zfsmount) != 0) { + nextboot = 0; + rc = vdev_read_pad2(primary_vdev, cmd, sizeof(cmd)); + if (vdev_clear_pad2(primary_vdev)) + printf("failed to clear pad2 area of primary vdev\n"); + if (rc == 0) { + if (*cmd) { + /* + * We could find an old-style ZFS Boot Block header here. + * Simply ignore it. + */ + if (*(uint64_t *)cmd != 0x2f5b007b10c) { + /* + * Note that parse() is destructive to cmd[] and we also want + * to honor RBX_QUIET option that could be present in cmd[]. + */ + nextboot = 1; + memcpy(cmddup, cmd, sizeof(cmd)); + if (parse()) { + printf("failed to parse pad2 area of primary vdev\n"); + reboot(); + } + if (!OPT_CHECK(RBX_QUIET)) + printf("zfs nextboot: %s\n", cmddup); + } + /* Do not process this command twice */ + *cmd = 0; + } + } else + printf("failed to read pad2 area of primary vdev\n"); + + /* Mount ZFS only if it's not already mounted via nextboot parsing. */ + if (zfsmount.spa == NULL && + (zfs_spa_init(spa) != 0 || zfs_mount(spa, 0, &zfsmount) != 0)) { printf("%s: failed to mount default pool %s\n", BOOTPROG, spa->spa_name); autoboot = 0; @@ -658,6 +768,10 @@ main(void) *cmd = 0; } + /* Do not risk waiting at the prompt forever. */ + if (nextboot && !autoboot) + reboot(); + /* * Try to exec /boot/loader. If interrupted by a keypress, * or in case of failure, try to load a kernel directly instead. @@ -707,6 +821,13 @@ main(void) void exit(int x) { + __exit(x); +} + +void +reboot(void) +{ + __exit(0); } static void 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 Sat Oct 29 12:38:30 2016 (r308088) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Sat Oct 29 14:09:32 2016 (r308089) @@ -167,6 +167,8 @@ typedef enum { extern int vdev_label_init(vdev_t *vd, uint64_t txg, vdev_labeltype_t reason); +extern int vdev_label_write_pad2(vdev_t *vd, const char *buf, size_t size); + #ifdef __cplusplus } #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Sat Oct 29 12:38:30 2016 (r308088) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Sat Oct 29 14:09:32 2016 (r308089) @@ -871,6 +871,44 @@ retry: return (error); } +int +vdev_label_write_pad2(vdev_t *vd, const char *buf, size_t size) +{ + spa_t *spa = vd->vdev_spa; + zio_t *zio; + char *pad2; + int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL; + int error; + + if (size > VDEV_PAD_SIZE) + return (EINVAL); + + if (!vd->vdev_ops->vdev_op_leaf) + return (ENODEV); + if (vdev_is_dead(vd)) + return (ENXIO); + + ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL); + + pad2 = zio_buf_alloc(VDEV_PAD_SIZE); + bzero(pad2, VDEV_PAD_SIZE); + memcpy(pad2, buf, size); + +retry: + zio = zio_root(spa, NULL, NULL, flags); + vdev_label_write(zio, vd, 0, pad2, + offsetof(vdev_label_t, vl_pad2), + VDEV_PAD_SIZE, NULL, NULL, flags); + error = zio_wait(zio); + if (error != 0 && !(flags & ZIO_FLAG_TRYHARD)) { + flags |= ZIO_FLAG_TRYHARD; + goto retry; + } + + zio_buf_free(pad2, VDEV_PAD_SIZE); + return (error); +} + /* * ========================================================================== * uberblock load/sync 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 Sat Oct 29 12:38:30 2016 (r308088) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 29 14:09:32 2016 (r308089) @@ -3472,6 +3472,53 @@ zfs_ioc_log_history(const char *unused, return (error); } +#ifdef __FreeBSD__ +static int +zfs_ioc_nextboot(const char *unused, nvlist_t *innvl, nvlist_t *outnvl) +{ + char name[MAXNAMELEN]; + spa_t *spa; + vdev_t *vd; + char *command; + uint64_t pool_guid; + uint64_t vdev_guid; + int error; + + if (nvlist_lookup_uint64(innvl, + ZPOOL_CONFIG_POOL_GUID, &pool_guid) != 0) + return (EINVAL); + if (nvlist_lookup_uint64(innvl, + ZPOOL_CONFIG_GUID, &vdev_guid) != 0) + return (EINVAL); + if (nvlist_lookup_string(innvl, + "command", &command) != 0) + return (EINVAL); + + mutex_enter(&spa_namespace_lock); + spa = spa_by_guid(pool_guid, vdev_guid); + if (spa != NULL) + strcpy(name, spa_name(spa)); + mutex_exit(&spa_namespace_lock); + if (spa == NULL) + return (ENOENT); + + if ((error = spa_open(name, &spa, FTAG)) != 0) + return (error); + spa_vdev_state_enter(spa, SCL_ALL); + vd = spa_lookup_by_guid(spa, vdev_guid, B_TRUE); + if (vd == NULL) { + (void) spa_vdev_state_exit(spa, NULL, ENXIO); + spa_close(spa, FTAG); + return (ENODEV); + } + error = vdev_label_write_pad2(vd, command, strlen(command)); + (void) spa_vdev_state_exit(spa, NULL, 0); + txg_wait_synced(spa->spa_dsl_pool, 0); + spa_close(spa, FTAG); + return (error); +} +#endif + /* * The dp_config_rwlock must not be held when calling this, because the * unmount may need to write out data. @@ -6024,6 +6071,9 @@ zfs_ioctl_init(void) zfs_secpolicy_config, POOL_CHECK_NONE); zfs_ioctl_register_dataset_nolog(ZFS_IOC_UNJAIL, zfs_ioc_unjail, zfs_secpolicy_config, POOL_CHECK_NONE); + zfs_ioctl_register("fbsd_nextboot", ZFS_IOC_NEXTBOOT, + zfs_ioc_nextboot, zfs_secpolicy_config, NO_NAME, + POOL_CHECK_NONE, B_FALSE, B_FALSE); #endif } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Oct 29 12:38:30 2016 (r308088) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Oct 29 14:09:32 2016 (r308089) @@ -891,6 +891,7 @@ typedef enum zfs_ioc { ZFS_IOC_BOOKMARK, ZFS_IOC_GET_BOOKMARKS, ZFS_IOC_DESTROY_BOOKMARKS, + ZFS_IOC_NEXTBOOT, ZFS_IOC_LAST } zfs_ioc_t; From owner-svn-src-head@freebsd.org Sat Oct 29 16:44:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85DF9C26C1D; Sat, 29 Oct 2016 16:44:59 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 528AF665; Sat, 29 Oct 2016 16:44:59 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 913001FE022; Sat, 29 Oct 2016 18:44:57 +0200 (CEST) Subject: Re: svn commit: r306577 - head/sys/netinet To: Eric van Gyzen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201610020142.u921gjsJ016528@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <661a719c-39c8-7a3b-e300-9184475ac2c7@selasky.org> Date: Sat, 29 Oct 2016 18:50:01 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <201610020142.u921gjsJ016528@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Oct 2016 16:44:59 -0000 On 10/02/16 03:42, Eric van Gyzen wrote: > + if (callout_reset(&ia->ia_garp_timer, (1 << ia->ia_garp_count) * hz, > + garp_rexmit, ia) == 0) { > + ifa_ref(ifa); > + } Hi, Be careful when you MFC this, because the return values of callout_reset() and callout_stop() are not the same in FreeBSD-9, -10 and 11/12. --HPS From owner-svn-src-head@freebsd.org Sat Oct 29 18:03:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30CB5C26073; Sat, 29 Oct 2016 18:03:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F14C2B61; Sat, 29 Oct 2016 18:03:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9TI3Tmu013038; Sat, 29 Oct 2016 18:03:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9TI3Ti0013037; Sat, 29 Oct 2016 18:03:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610291803.u9TI3Ti0013037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 29 Oct 2016 18:03:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308094 - 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.23 Precedence: list List-Id: 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, 29 Oct 2016 18:03:30 -0000 Author: kib Date: Sat Oct 29 18:03:29 2016 New Revision: 308094 URL: https://svnweb.freebsd.org/changeset/base/308094 Log: Add unlock_vp() helper. Trim space. Discussed with: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sat Oct 29 16:31:16 2016 (r308093) +++ head/sys/vm/vm_fault.c Sat Oct 29 18:03:29 2016 (r308094) @@ -153,6 +153,16 @@ unlock_map(struct faultstate *fs) } static void +unlock_vp(struct faultstate *fs) +{ + + if (fs->vp != NULL) { + vput(fs->vp); + fs->vp = NULL; + } +} + +static void unlock_and_deallocate(struct faultstate *fs) { @@ -168,11 +178,8 @@ unlock_and_deallocate(struct faultstate fs->first_m = NULL; } vm_object_deallocate(fs->first_object); - unlock_map(fs); - if (fs->vp != NULL) { - vput(fs->vp); - fs->vp = NULL; - } + unlock_map(fs); + unlock_vp(fs); } static void @@ -339,10 +346,7 @@ RetryFault:; vm_map_lock(fs.map); if (vm_map_lookup_entry(fs.map, vaddr, &fs.entry) && (fs.entry->eflags & MAP_ENTRY_IN_TRANSITION)) { - if (fs.vp != NULL) { - vput(fs.vp); - fs.vp = NULL; - } + unlock_vp(&fs); fs.entry->eflags |= MAP_ENTRY_NEEDS_WAKEUP; vm_map_unlock_and_wait(fs.map, 0); } else @@ -642,10 +646,7 @@ readrest: vp = fs.object->handle; if (vp == fs.vp) goto vnode_locked; - else if (fs.vp != NULL) { - vput(fs.vp); - fs.vp = NULL; - } + unlock_vp(&fs); locked = VOP_ISLOCKED(vp); if (locked != LK_EXCLUSIVE) From owner-svn-src-head@freebsd.org Sat Oct 29 18:47:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50217C26C8B; Sat, 29 Oct 2016 18:47:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22497E57; Sat, 29 Oct 2016 18:47:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9TIlS08028316; Sat, 29 Oct 2016 18:47:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9TIlSUt028315; Sat, 29 Oct 2016 18:47:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610291847.u9TIlSUt028315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 29 Oct 2016 18:47:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308095 - 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.23 Precedence: list List-Id: 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, 29 Oct 2016 18:47:29 -0000 Author: markj Date: Sat Oct 29 18:47:28 2016 New Revision: 308095 URL: https://svnweb.freebsd.org/changeset/base/308095 Log: Add one more use of unlock_vp(). Discussed with: kib X-MFC With: r308094 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sat Oct 29 18:03:29 2016 (r308094) +++ head/sys/vm/vm_fault.c Sat Oct 29 18:47:28 2016 (r308095) @@ -328,8 +328,7 @@ RetryFault:; growstack = FALSE; goto RetryFault; } - if (fs.vp != NULL) - vput(fs.vp); + unlock_vp(&fs); return (result); } From owner-svn-src-head@freebsd.org Sat Oct 29 19:16:27 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89481C262C2; Sat, 29 Oct 2016 19:16:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id 73AA6B75; Sat, 29 Oct 2016 19:16:24 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from ford.home.vangyzen.net (unknown [76.164.15.242]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 297F15648E; Sat, 29 Oct 2016 14:16:23 -0500 (CDT) Subject: Re: svn commit: r306577 - head/sys/netinet To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, David Bright References: <201610020142.u921gjsJ016528@repo.freebsd.org> <661a719c-39c8-7a3b-e300-9184475ac2c7@selasky.org> From: Eric van Gyzen Message-ID: <0952149f-97f0-23e9-e39c-28eef3ddeb00@FreeBSD.org> Date: Sat, 29 Oct 2016 14:16:20 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <661a719c-39c8-7a3b-e300-9184475ac2c7@selasky.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: 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, 29 Oct 2016 19:16:27 -0000 On 10/29/2016 11:50, Hans Petter Selasky wrote: > On 10/02/16 03:42, Eric van Gyzen wrote: >> + if (callout_reset(&ia->ia_garp_timer, (1 << ia->ia_garp_count) * hz, >> + garp_rexmit, ia) == 0) { >> + ifa_ref(ifa); >> + } > > Hi, > > Be careful when you MFC this, because the return values of callout_reset() and > callout_stop() are not the same in FreeBSD-9, -10 and 11/12. Thanks for your keen eye, Hans. Indeed, the submitter (David Bright) discovered this The Hard Way when porting this forward from 10 to head. Luckily, though, that means we already have a version of this patch for 10. Thanks again, Eric (and David) From owner-svn-src-head@freebsd.org Sat Oct 29 19:22:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0D7BC2678D; Sat, 29 Oct 2016 19:22:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9FB8F9E; Sat, 29 Oct 2016 19:22:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9TJMcY8043312; Sat, 29 Oct 2016 19:22:38 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9TJMcDA043311; Sat, 29 Oct 2016 19:22:38 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201610291922.u9TJMcDA043311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 29 Oct 2016 19:22:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308096 - 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.23 Precedence: list List-Id: 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, 29 Oct 2016 19:22:39 -0000 Author: alc Date: Sat Oct 29 19:22:38 2016 New Revision: 308096 URL: https://svnweb.freebsd.org/changeset/base/308096 Log: With one exception, "hardfault" is used like a "bool". Change that exception and make it a "bool". Reviewed by: kib MFC after: 7 days Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sat Oct 29 18:47:28 2016 (r308095) +++ head/sys/vm/vm_fault.c Sat Oct 29 19:22:38 2016 (r308096) @@ -295,20 +295,20 @@ vm_fault_hold(vm_map_t map, vm_offset_t boolean_t dead, growstack, is_first_object_locked, wired; int map_generation; vm_object_t next_object; - int hardfault; struct faultstate fs; struct vnode *vp; vm_offset_t e_end, e_start; vm_page_t m; int ahead, behind, cluster_offset, error, locked, rv; u_char behavior; + bool hardfault; - hardfault = 0; growstack = TRUE; PCPU_INC(cnt.v_vm_faults); fs.vp = NULL; faultcount = 0; nera = -1; + hardfault = false; RetryFault:; @@ -708,7 +708,7 @@ vnode_locked: &behind, &ahead); if (rv == VM_PAGER_OK) { faultcount = behind + 1 + ahead; - hardfault++; + hardfault = true; break; /* break to PAGE HAS BEEN FOUND */ } if (rv == VM_PAGER_ERROR) From owner-svn-src-head@freebsd.org Sat Oct 29 20:01:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C973C2531E; Sat, 29 Oct 2016 20:01:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19964216; Sat, 29 Oct 2016 20:01:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9TK1mxU058256; Sat, 29 Oct 2016 20:01:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9TK1mLw058255; Sat, 29 Oct 2016 20:01:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610292001.u9TK1mLw058255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 29 Oct 2016 20:01:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308097 - 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.23 Precedence: list List-Id: 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, 29 Oct 2016 20:01:49 -0000 Author: markj Date: Sat Oct 29 20:01:48 2016 New Revision: 308097 URL: https://svnweb.freebsd.org/changeset/base/308097 Log: Fix WITNESS hints for pagequeue locks. MFC after: 1 week Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Sat Oct 29 19:22:38 2016 (r308096) +++ head/sys/kern/subr_witness.c Sat Oct 29 20:01:48 2016 (r308097) @@ -599,7 +599,7 @@ static struct witness_order_list_entry o * CDEV */ { "vm map (system)", &lock_class_mtx_sleep }, - { "vm page queue", &lock_class_mtx_sleep }, + { "vm pagequeue", &lock_class_mtx_sleep }, { "vnode interlock", &lock_class_mtx_sleep }, { "cdev", &lock_class_mtx_sleep }, { NULL, NULL }, @@ -609,7 +609,7 @@ static struct witness_order_list_entry o { "vm map (user)", &lock_class_sx }, { "vm object", &lock_class_rw }, { "vm page", &lock_class_mtx_sleep }, - { "vm page queue", &lock_class_mtx_sleep }, + { "vm pagequeue", &lock_class_mtx_sleep }, { "pmap pv global", &lock_class_rw }, { "pmap", &lock_class_mtx_sleep }, { "pmap pv list", &lock_class_rw }, From owner-svn-src-head@freebsd.org Sat Oct 29 21:01:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAAEDC26424; Sat, 29 Oct 2016 21:01:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A35C2202; Sat, 29 Oct 2016 21:01:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9TL1n4A080354; Sat, 29 Oct 2016 21:01:49 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9TL1nKP080353; Sat, 29 Oct 2016 21:01:49 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201610292101.u9TL1nKP080353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 29 Oct 2016 21:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308098 - 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.23 Precedence: list List-Id: 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, 29 Oct 2016 21:01:51 -0000 Author: alc Date: Sat Oct 29 21:01:49 2016 New Revision: 308098 URL: https://svnweb.freebsd.org/changeset/base/308098 Log: The "lookup_is_valid" field is used as a "bool". Make it one. Convert vm_fault_hold()'s Boolean variables that are only used internally to "bool". Add a comment describing why the one remaining "boolean_t" was not converted. Reviewed by: kib MFC after: 8 days Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sat Oct 29 20:01:48 2016 (r308097) +++ head/sys/vm/vm_fault.c Sat Oct 29 21:01:49 2016 (r308098) @@ -122,7 +122,7 @@ struct faultstate { vm_pindex_t first_pindex; vm_map_t map; vm_map_entry_t entry; - int lookup_still_valid; + bool lookup_still_valid; struct vnode *vp; }; @@ -148,7 +148,7 @@ unlock_map(struct faultstate *fs) if (fs->lookup_still_valid) { vm_map_lookup_done(fs->map, fs->entry); - fs->lookup_still_valid = FALSE; + fs->lookup_still_valid = false; } } @@ -292,7 +292,6 @@ vm_fault_hold(vm_map_t map, vm_offset_t { vm_prot_t prot; int alloc_req, era, faultcount, nera, result; - boolean_t dead, growstack, is_first_object_locked, wired; int map_generation; vm_object_t next_object; struct faultstate fs; @@ -301,13 +300,14 @@ vm_fault_hold(vm_map_t map, vm_offset_t vm_page_t m; int ahead, behind, cluster_offset, error, locked, rv; u_char behavior; - bool hardfault; + boolean_t wired; /* Passed by reference. */ + bool dead, growstack, hardfault, is_first_object_locked; - growstack = TRUE; PCPU_INC(cnt.v_vm_faults); fs.vp = NULL; faultcount = 0; nera = -1; + growstack = true; hardfault = false; RetryFault:; @@ -325,7 +325,7 @@ RetryFault:; result = vm_map_growstack(curproc, vaddr); if (result != KERN_SUCCESS) return (KERN_FAILURE); - growstack = FALSE; + growstack = false; goto RetryFault; } unlock_vp(&fs); @@ -427,7 +427,7 @@ fast_failed: vm_object_reference_locked(fs.first_object); vm_object_pip_add(fs.first_object, 1); - fs.lookup_still_valid = TRUE; + fs.lookup_still_valid = true; fs.first_m = NULL; @@ -836,7 +836,7 @@ vnode_locked: * dirty in the first object so that it will go out * to swap when needed. */ - is_first_object_locked = FALSE; + is_first_object_locked = false; if ( /* * Only one shadow object @@ -941,7 +941,7 @@ vnode_locked: unlock_and_deallocate(&fs); goto RetryFault; } - fs.lookup_still_valid = TRUE; + fs.lookup_still_valid = true; if (fs.map->timestamp != map_generation) { result = vm_map_lookup_locked(&fs.map, vaddr, fault_type, &fs.entry, &retry_object, &retry_pindex, &retry_prot, &wired); From owner-svn-src-head@freebsd.org Sat Oct 29 23:25:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 909D2C22578; Sat, 29 Oct 2016 23:25:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54445D8E; Sat, 29 Oct 2016 23:25:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9TNPCMc033404; Sat, 29 Oct 2016 23:25:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9TNPC5x033402; Sat, 29 Oct 2016 23:25:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610292325.u9TNPC5x033402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 29 Oct 2016 23:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308099 - 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.23 Precedence: list List-Id: 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, 29 Oct 2016 23:25:13 -0000 Author: mav Date: Sat Oct 29 23:25:12 2016 New Revision: 308099 URL: https://svnweb.freebsd.org/changeset/base/308099 Log: Add sysctls for zfs_immediate_write_sz and zvol_immediate_write_sz. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Sat Oct 29 21:01:49 2016 (r308098) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Sat Oct 29 23:25:12 2016 (r308099) @@ -454,6 +454,11 @@ zfs_log_rename(zilog_t *zilog, dmu_tx_t * Handles TX_WRITE transactions. */ ssize_t zfs_immediate_write_sz = 32768; +#ifdef _KERNEL +SYSCTL_DECL(_vfs_zfs); +SYSCTL_LONG(_vfs_zfs, OID_AUTO, immediate_write_sz, CTLFLAG_RWTUN, + &zfs_immediate_write_sz, 0, "Minimal size for indirect log write"); +#endif void zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Oct 29 21:01:49 2016 (r308098) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Oct 29 23:25:12 2016 (r308099) @@ -1375,6 +1375,10 @@ zvol_get_data(void *arg, lr_write_t *lr, * Otherwise we will later flush the data out via dmu_sync(). */ ssize_t zvol_immediate_write_sz = 32768; +#ifdef _KERNEL +SYSCTL_LONG(_vfs_zfs_vol, OID_AUTO, immediate_write_sz, CTLFLAG_RWTUN, + &zvol_immediate_write_sz, 0, "Minimal size for indirect log write"); +#endif static void zvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, offset_t off, ssize_t resid,