From owner-svn-src-head@freebsd.org Sun Dec 29 02:11:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C79A1D04E4; Sun, 29 Dec 2019 02:11:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lkb26f3Wz40Xp; Sun, 29 Dec 2019 02:11:58 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF6BCA7D8; Sun, 29 Dec 2019 02:11:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBT2BwRa018156; Sun, 29 Dec 2019 02:11:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBT2Bw63018154; Sun, 29 Dec 2019 02:11:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912290211.xBT2Bw63018154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 29 Dec 2019 02:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356164 - head/tools/build/options X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/tools/build/options X-SVN-Commit-Revision: 356164 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 02:11:59 -0000 Author: kevans Date: Sun Dec 29 02:11:58 2019 New Revision: 356164 URL: https://svnweb.freebsd.org/changeset/base/356164 Log: Change reference in HTTPD descriptions to 'simple_httpd' This should help people examining src.conf(5) draw the connection between the HTTPD knobs and the particular implementation we're installing, simple_httpd. Reported by: saken658 via GitHub Modified: head/tools/build/options/WITHOUT_HTTPD head/tools/build/options/WITH_HTTPD Modified: head/tools/build/options/WITHOUT_HTTPD ============================================================================== --- head/tools/build/options/WITHOUT_HTTPD Sat Dec 28 23:40:32 2019 (r356163) +++ head/tools/build/options/WITHOUT_HTTPD Sun Dec 29 02:11:58 2019 (r356164) @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to neither build nor install httpd +Set to neither build nor install simple_httpd Modified: head/tools/build/options/WITH_HTTPD ============================================================================== --- head/tools/build/options/WITH_HTTPD Sat Dec 28 23:40:32 2019 (r356163) +++ head/tools/build/options/WITH_HTTPD Sun Dec 29 02:11:58 2019 (r356164) @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to build and install httpd +Set to build and install simple_httpd From owner-svn-src-head@freebsd.org Sun Dec 29 02:12:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A00751D0543; Sun, 29 Dec 2019 02:12:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lkbQ3NPMz40gn; Sun, 29 Dec 2019 02:12:18 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F6D5A7F2; Sun, 29 Dec 2019 02:12:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBT2CIpq018219; Sun, 29 Dec 2019 02:12:18 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBT2CIVC018218; Sun, 29 Dec 2019 02:12:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912290212.xBT2CIVC018218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 29 Dec 2019 02:12:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356165 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 356165 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 02:12:18 -0000 Author: kevans Date: Sun Dec 29 02:12:18 2019 New Revision: 356165 URL: https://svnweb.freebsd.org/changeset/base/356165 Log: Regenerate src.conf(5) after r356164 Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Sun Dec 29 02:11:58 2019 (r356164) +++ head/share/man/man5/src.conf.5 Sun Dec 29 02:12:18 2019 (r356165) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd December 27, 2019 +.Dd December 28, 2019 .Dt SRC.CONF 5 .Os .Sh NAME @@ -836,7 +836,7 @@ Set to build Hesiod support. .It Va WITHOUT_HTML Set to not build HTML docs. .It Va WITH_HTTPD -Set to build and install httpd +Set to build and install simple_httpd .It Va WITHOUT_HYPERV Set to not build or install HyperV utilities. .Pp From owner-svn-src-head@freebsd.org Sun Dec 29 02:39:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0CC11D1347; Sun, 29 Dec 2019 02:39:57 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47llCK5wfVz41Zr; Sun, 29 Dec 2019 02:39:57 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-yb1-xb36.google.com with SMTP id l7so4935986ybp.1; Sat, 28 Dec 2019 18:39:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=H90bfWHMBeVax0Vjy9/D+lg4IOGe7FX8xVSA1yT1NqU=; b=PpR8TuSHNdC0DnuXeWGLpDl1ugwn06aIXciMXEC3q14UoX488L6Fa91Gc3huWaZFd4 aJ5LXf1KkTeRQ4Ct0XAOKniDAQYfgeGHbSGHggduJal495lT/tcemZe6ia1N5GmZUyPZ cIyKedVqDWcEG54R852nozHXx+aHXa6OE3K15mkoAN2OVM94ygeSparflwSGnSGMnJ8k /FAGnPpgVOB5mWpKGFtskgr69YbqBF2dxzM7LcWjygxwlqVpW2uDoc+IGQqKTgkv+0d2 eHXuJjfO8P83g52GJ22ZUE8aNAzZhT1o8UStpIP6dBF13PogmacJilKWOwZVCTlA9++I EBnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=H90bfWHMBeVax0Vjy9/D+lg4IOGe7FX8xVSA1yT1NqU=; b=DHI48wPZhQ95ZFg1TGjK8YXtk7NGXHM4Tn6w3TsDm4+ChBe7gA7mpU3er/Lc6W9nuI fEuSXHsjfJK+/Z5cSL8wLMee2bL/TPZUKfbj35QKUHTxY/3CzN8Q8gF7sgxgWs+//q3a iTR9R1w8VCyk7s/MyM8e+hPgR3/a1GpPKogZfkXIe5XB2A5qgcUAsxB1GEJLGh2OzlN5 6tuQWj0Y+f0vtKpgutDWZVewSXZ26HLlCP6Yb8qFFdja2X1eTv+1vxhc56XO78ob4mOh jPK7kRpKprCl3E43ys/pb9rSkhPh6273dFIV3rA0OuesTJzk7Sfl0p7snJXIhmldDUS2 V63g== X-Gm-Message-State: APjAAAUHIupFDH/lbuJCLFmw/5vzfT4cw49XWZUxrfJU8S5x0NR7+0R+ p+M5WwaExywweNO8WAyMUTToxswM8F2/aTSVeKJ89Q== X-Google-Smtp-Source: APXvYqxwU3cKnwqx6DmbN4aOaFvzWsPnJCMwpCLPNouM51Y3TaOH85A/KJA+geeStkq1XmfHaci4rf2V1r3sX4rfrwk= X-Received: by 2002:a25:3fc3:: with SMTP id m186mr40834931yba.314.1577587196040; Sat, 28 Dec 2019 18:39:56 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:3816:0:0:0:0:0 with HTTP; Sat, 28 Dec 2019 18:39:55 -0800 (PST) In-Reply-To: <201912281904.xBSJ4T19064948@repo.freebsd.org> References: <201912281904.xBSJ4T19064948@repo.freebsd.org> From: Oliver Pinter Date: Sun, 29 Dec 2019 03:39:55 +0100 Message-ID: Subject: Re: svn commit: r356159 - head/sys/vm To: Mark Johnston Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 47llCK5wfVz41Zr X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 02:39:57 -0000 Is there any performance measurement from before and after. It would be nice to see them. On Saturday, December 28, 2019, Mark Johnston wrote: > Author: markj > Date: Sat Dec 28 19:04:29 2019 > New Revision: 356159 > URL: https://svnweb.freebsd.org/changeset/base/356159 > > Log: > Remove some unused functions. > > The previous series of patches orphaned some vm_page functions, so > remove them. > > Reviewed by: dougm, kib > Sponsored by: Netflix, Intel > Differential Revision: https://reviews.freebsd.org/D22886 > > Modified: > head/sys/vm/vm_page.c > head/sys/vm/vm_page.h > > Modified: head/sys/vm/vm_page.c > ============================================================ > ================== > --- head/sys/vm/vm_page.c Sat Dec 28 19:04:15 2019 (r356158) > +++ head/sys/vm/vm_page.c Sat Dec 28 19:04:29 2019 (r356159) > @@ -3662,52 +3662,6 @@ vm_page_enqueue(vm_page_t m, uint8_t queue) > } > > /* > - * vm_page_requeue: [ internal use only ] > - * > - * Schedule a requeue of the given page. > - * > - * The page must be locked. > - */ > -void > -vm_page_requeue(vm_page_t m) > -{ > - > - vm_page_assert_locked(m); > - KASSERT(vm_page_queue(m) != PQ_NONE, > - ("%s: page %p is not logically enqueued", __func__, m)); > - KASSERT(m->ref_count > 0, > - ("%s: page %p does not carry any references", __func__, m)); > - > - if ((m->a.flags & PGA_REQUEUE) == 0) > - vm_page_aflag_set(m, PGA_REQUEUE); > - vm_page_pqbatch_submit(m, atomic_load_8(&m->a.queue)); > -} > - > -/* > - * vm_page_swapqueue: [ internal use only ] > - * > - * Move the page from one queue to another, or to the tail of its > - * current queue, in the face of a possible concurrent free of the > - * page. > - */ > -void > -vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq) > -{ > - vm_page_astate_t new, old; > - > - old = vm_page_astate_load(m); > - do { > - if (old.queue != oldq || (old.flags & PGA_DEQUEUE) != 0) > - return; > - new = old; > - new.flags |= PGA_REQUEUE; > - new.queue = newq; > - } while (!vm_page_pqstate_commit_dequeue(m, &old, new)); > - > - vm_page_pqbatch_submit(m, newq); > -} > - > -/* > * vm_page_free_prep: > * > * Prepares the given page to be put on the free list, > > Modified: head/sys/vm/vm_page.h > ============================================================ > ================== > --- head/sys/vm/vm_page.h Sat Dec 28 19:04:15 2019 (r356158) > +++ head/sys/vm/vm_page.h Sat Dec 28 19:04:29 2019 (r356159) > @@ -649,7 +649,6 @@ bool vm_page_remove_xbusy(vm_page_t); > int vm_page_rename(vm_page_t, vm_object_t, vm_pindex_t); > void vm_page_replace(vm_page_t mnew, vm_object_t object, > vm_pindex_t pindex, vm_page_t mold); > -void vm_page_requeue(vm_page_t m); > int vm_page_sbusied(vm_page_t m); > vm_page_t vm_page_scan_contig(u_long npages, vm_page_t m_start, > vm_page_t m_end, u_long alignment, vm_paddr_t boundary, int options); > @@ -659,7 +658,6 @@ int vm_page_sleep_if_busy(vm_page_t m, const char *msg > int vm_page_sleep_if_xbusy(vm_page_t m, const char *msg); > vm_offset_t vm_page_startup(vm_offset_t vaddr); > void vm_page_sunbusy(vm_page_t m); > -void vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq); > bool vm_page_try_remove_all(vm_page_t m); > bool vm_page_try_remove_write(vm_page_t m); > int vm_page_trysbusy(vm_page_t m); > @@ -833,31 +831,6 @@ vm_page_aflag_set(vm_page_t m, uint16_t bits) > addr = (void *)&m->a; > val = bits << VM_PAGE_AFLAG_SHIFT; > atomic_set_32(addr, val); > -} > - > -/* > - * Atomically update the queue state of the page. The operation > fails if > - * any of the queue flags in "fflags" are set or if the "queue" field > of > - * the page does not match the expected value; if the operation is > - * successful, the flags in "nflags" are set and all other queue state > - * flags are cleared. > - */ > -static inline bool > -vm_page_pqstate_cmpset(vm_page_t m, uint32_t oldq, uint32_t newq, > - uint32_t fflags, uint32_t nflags) > -{ > - vm_page_astate_t new, old; > - > - old = vm_page_astate_load(m); > - do { > - if ((old.flags & fflags) != 0 || old.queue != oldq) > - return (false); > - new = old; > - new.flags = (new.flags & ~PGA_QUEUE_OP_MASK) | nflags; > - new.queue = newq; > - } while (!vm_page_astate_fcmpset(m, &old, new)); > - > - return (true); > } > > /* > _______________________________________________ > 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 Sun Dec 29 04:26:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D534C1D3D68; Sun, 29 Dec 2019 04:26:10 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lnYt4GxFz461v; Sun, 29 Dec 2019 04:26:10 +0000 (UTC) (envelope-from philip@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DF89C1E8; Sun, 29 Dec 2019 04:26:10 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBT4QAKW097524; Sun, 29 Dec 2019 04:26:10 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBT4QAp0097523; Sun, 29 Dec 2019 04:26:10 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201912290426.xBT4QAp0097523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sun, 29 Dec 2019 04:26:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356166 - head/sys/riscv/sifive X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/sys/riscv/sifive X-SVN-Commit-Revision: 356166 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 04:26:10 -0000 Author: philip Date: Sun Dec 29 04:26:10 2019 New Revision: 356166 URL: https://svnweb.freebsd.org/changeset/base/356166 Log: fuspi: Fix 'sleepable after non-sleepable' lock With WITNESS enabled we see the following warning: lock order reversal: (sleepable after non-sleepable) 1st 0xffffffd0847c7210 fu540spi0 (fu540spi0) @ /usr/home/kp/axiado/hornet-freebsd/src/sys/riscv/sifive/fu540_spi.c:297 2nd 0xffffffc00372bb30 Clock topology lock (Clock topology lock) @ /usr/home/kp/axiado/hornet-freebsd/src/sys/dev/extres/clk/clk.c:1137 stack backtrace: #0 0xffffffc0002a579e at witness_checkorder+0xb72 #1 0xffffffc0002a5556 at witness_checkorder+0x92a #2 0xffffffc000254c7a at _sx_slock_int+0x66 #3 0xffffffc00025537a at _sx_slock+0x8 #4 0xffffffc000123022 at clk_get_freq+0x38 #5 0xffffffc0005463e4 at __clzdi2+0x2bb8 #6 0xffffffc00014af58 at randomdev_getkey+0x76e #7 0xffffffc0001278b0 at simplebus_add_device+0x7ee #8 0xffffffc00027c9a8 at device_attach+0x2e6 #9 0xffffffc00027c634 at device_probe_and_attach+0x7a #10 0xffffffc00027d76a at bus_generic_attach+0x10 #11 0xffffffc00014aab0 at randomdev_getkey+0x2c6 #12 0xffffffc00027c9a8 at device_attach+0x2e6 #13 0xffffffc00027c634 at device_probe_and_attach+0x7a #14 0xffffffc00027d76a at bus_generic_attach+0x10 #15 0xffffffc000278bd2 at config_intrhook_oneshot+0x52 #16 0xffffffc000278b3e at config_intrhook_establish+0x146 #17 0xffffffc000278cf2 at config_intrhook_disestablish+0xfe The clock topology lock can sleep, which means we cannot attempt to acquire it while holding the non-sleepable mutex. Fix that by retrieving the clock speed once, during attach and not every time during SPI transaction setup. Submitted by: kp Sponsored by: Axiado Modified: head/sys/riscv/sifive/fu540_spi.c Modified: head/sys/riscv/sifive/fu540_spi.c ============================================================================== --- head/sys/riscv/sifive/fu540_spi.c Sun Dec 29 02:12:18 2019 (r356165) +++ head/sys/riscv/sifive/fu540_spi.c Sun Dec 29 04:26:10 2019 (r356166) @@ -80,6 +80,7 @@ struct fuspi_softc { void *ih; clk_t clk; + uint64_t freq; uint32_t cs_max; }; @@ -207,22 +208,14 @@ fuspi_setup(struct fuspi_softc *sc, uint32_t cs, uint3 uint32_t freq) { uint32_t csmode, fmt, sckdiv, sckmode; - uint64_t clock; - int ret; FUSPI_ASSERT_LOCKED(sc); - ret = clk_get_freq(sc->clk, &clock); - if (ret) { - device_printf(sc->dev, "Cannot get clock frequency: %d\n", ret); - return (ret); - } - /* * Fsck = Fin / 2 * (div + 1) * -> div = Fin / (2 * Fsck) - 1 */ - sckdiv = (howmany(clock >> 1, freq) - 1) & FUSPI_SCKDIV_MASK; + sckdiv = (howmany(sc->freq >> 1, freq) - 1) & FUSPI_SCKDIV_MASK; FUSPI_WRITE(sc, FUSPI_REG_SCKDIV, sckdiv); switch (mode) { @@ -328,6 +321,12 @@ fuspi_attach(device_t dev) error = clk_enable(sc->clk); if (error) { device_printf(dev, "Couldn't enable clock: %d\n", error); + goto fail; + } + + error = clk_get_freq(sc->clk, &sc->freq); + if (error) { + device_printf(sc->dev, "Couldn't get frequency: %d\n", error); goto fail; } From owner-svn-src-head@freebsd.org Sun Dec 29 05:36:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53E221D4DFC; Sun, 29 Dec 2019 05:36:02 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lq6T6nhKz48SN; Sun, 29 Dec 2019 05:36:01 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E40B9CE17; Sun, 29 Dec 2019 05:36:01 +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 xBT5a1Es038385; Sun, 29 Dec 2019 05:36:01 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBT5a1pc038384; Sun, 29 Dec 2019 05:36:01 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201912290536.xBT5a1pc038384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 29 Dec 2019 05:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356168 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 356168 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 05:36:02 -0000 Author: alc Date: Sun Dec 29 05:36:01 2019 New Revision: 356168 URL: https://svnweb.freebsd.org/changeset/base/356168 Log: Correctly implement PMAP_ENTER_NOREPLACE in pmap_enter_{l2,pde}() on kernel mappings. Reduce code duplication by defining a function, pmap_abort_ptp(), for handling a common error case. Simplify error handling in pmap_enter_quick_locked(). Reviewed by: kib Tested by: pho MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22890 Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sun Dec 29 04:58:27 2019 (r356167) +++ head/sys/i386/i386/pmap.c Sun Dec 29 05:36:01 2019 (r356168) @@ -314,6 +314,7 @@ static pv_entry_t pmap_pvh_remove(struct md_page *pvh, vm_offset_t va); static int pmap_pvh_wired_mappings(struct md_page *pvh, int count); +static void pmap_abort_ptp(pmap_t pmap, vm_offset_t va, vm_page_t mpte); static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); static bool pmap_enter_4mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot); @@ -2008,6 +2009,27 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t va, struct spgl } /* + * Release a page table page reference after a failed attempt to create a + * mapping. + */ +static void +pmap_abort_ptp(pmap_t pmap, vm_offset_t va, vm_page_t mpte) +{ + struct spglist free; + + SLIST_INIT(&free); + if (pmap_unwire_ptp(pmap, mpte, &free)) { + /* + * Although "va" was never mapped, paging-structure caches + * could nonetheless have entries that refer to the freed + * page table pages. Invalidate those entries. + */ + pmap_invalidate_page_int(pmap, va); + vm_page_free_pages_toq(&free, true); + } +} + +/* * Initialize the pmap for the swapper process. */ static void @@ -3895,6 +3917,24 @@ pmap_enter_4mpage(pmap_t pmap, vm_offset_t va, vm_page } /* + * Returns true if every page table entry in the page table page that maps + * the specified kernel virtual address is zero. + */ +static bool +pmap_every_pte_zero(vm_offset_t va) +{ + pt_entry_t *pt_end, *pte; + + KASSERT((va & PDRMASK) == 0, ("va is misaligned")); + pte = vtopte(va); + for (pt_end = pte + NPTEPG; pte < pt_end; pte++) { + if (*pte != 0) + return (false); + } + return (true); +} + +/* * Tries to create the specified 2 or 4 MB page mapping. Returns KERN_SUCCESS * if the mapping was created, and either KERN_FAILURE or * KERN_RESOURCE_SHORTAGE otherwise. Returns KERN_FAILURE if @@ -3921,7 +3961,9 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t pde = pmap_pde(pmap, va); oldpde = *pde; if ((oldpde & PG_V) != 0) { - if ((flags & PMAP_ENTER_NOREPLACE) != 0) { + if ((flags & PMAP_ENTER_NOREPLACE) != 0 && (pmap != + kernel_pmap || (oldpde & PG_PS) != 0 || + !pmap_every_pte_zero(va))) { CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx" " in pmap %p", va, pmap); return (KERN_FAILURE); @@ -3940,8 +3982,14 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t if (pmap_remove_ptes(pmap, va, va + NBPDR, &free)) pmap_invalidate_all_int(pmap); } - vm_page_free_pages_toq(&free, true); - if (pmap == kernel_pmap) { + if (pmap != kernel_pmap) { + vm_page_free_pages_toq(&free, true); + KASSERT(*pde == 0, ("pmap_enter_pde: non-zero pde %p", + pde)); + } else { + KASSERT(SLIST_EMPTY(&free), + ("pmap_enter_pde: freed kernel page table page")); + /* * Both pmap_remove_pde() and pmap_remove_ptes() will * leave the kernel page table page zero filled. @@ -3949,9 +3997,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t mt = PHYS_TO_VM_PAGE(*pde & PG_FRAME); if (pmap_insert_pt_page(pmap, mt, false)) panic("pmap_enter_pde: trie insert failed"); - } else - KASSERT(*pde == 0, ("pmap_enter_pde: non-zero pde %p", - pde)); + } } if ((newpde & PG_MANAGED) != 0) { /* @@ -3982,8 +4028,8 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t pde_store(pde, newpde); pmap_pde_mappings++; - CTR2(KTR_PMAP, "pmap_enter_pde: success for va %#lx" - " in pmap %p", va, pmap); + CTR2(KTR_PMAP, "pmap_enter_pde: success for va %#lx in pmap %p", + va, pmap); return (KERN_SUCCESS); } @@ -4055,7 +4101,6 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v vm_prot_t prot, vm_page_t mpte) { pt_entry_t newpte, *pte; - struct spglist free; KASSERT(pmap != kernel_pmap || va < kmi.clean_sva || va >= kmi.clean_eva || (m->oflags & VPO_UNMANAGED) != 0, @@ -4106,12 +4151,10 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v sched_pin(); pte = pmap_pte_quick(pmap, va); if (*pte) { - if (mpte != NULL) { + if (mpte != NULL) mpte->ref_count--; - mpte = NULL; - } sched_unpin(); - return (mpte); + return (NULL); } /* @@ -4119,17 +4162,10 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v */ if ((m->oflags & VPO_UNMANAGED) == 0 && !pmap_try_insert_pv_entry(pmap, va, m)) { - if (mpte != NULL) { - SLIST_INIT(&free); - if (pmap_unwire_ptp(pmap, mpte, &free)) { - pmap_invalidate_page_int(pmap, va); - vm_page_free_pages_toq(&free, true); - } - - mpte = NULL; - } + if (mpte != NULL) + pmap_abort_ptp(pmap, va, mpte); sched_unpin(); - return (mpte); + return (NULL); } /* @@ -4351,7 +4387,6 @@ static void __CONCAT(PMTYPE, copy)(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { - struct spglist free; pt_entry_t *src_pte, *dst_pte, ptetemp; pd_entry_t srcptepaddr; vm_page_t dstmpte, srcmpte; @@ -4432,14 +4467,7 @@ __CONCAT(PMTYPE, copy)(pmap_t dst_pmap, pmap_t src_pma PG_A); dst_pmap->pm_stats.resident_count++; } else { - SLIST_INIT(&free); - if (pmap_unwire_ptp(dst_pmap, dstmpte, - &free)) { - pmap_invalidate_page_int( - dst_pmap, addr); - vm_page_free_pages_toq(&free, - true); - } + pmap_abort_ptp(dst_pmap, addr, dstmpte); goto out; } if (dstmpte->ref_count >= srcmpte->ref_count) From owner-svn-src-head@freebsd.org Sun Dec 29 06:59:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC3A11D6BC7; Sun, 29 Dec 2019 06:59:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47lryP4yLNz4Cr6; Sun, 29 Dec 2019 06:59:09 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5777DC29; Sun, 29 Dec 2019 06:59:09 +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 xBT6x9c0085820; Sun, 29 Dec 2019 06:59:09 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBT6x9qW085819; Sun, 29 Dec 2019 06:59:09 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201912290659.xBT6x9qW085819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 29 Dec 2019 06:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356169 - head/usr.sbin/fstyp X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/usr.sbin/fstyp X-SVN-Commit-Revision: 356169 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 06:59:09 -0000 Author: adrian Date: Sun Dec 29 06:59:09 2019 New Revision: 356169 URL: https://svnweb.freebsd.org/changeset/base/356169 Log: Make this compile under external gcc toolchain if WITH_ICONV isn't defined. This quietens a bunch of unused variable warnings that are treated as errors. Modified: head/usr.sbin/fstyp/ntfs.c Modified: head/usr.sbin/fstyp/ntfs.c ============================================================================== --- head/usr.sbin/fstyp/ntfs.c Sun Dec 29 05:36:01 2019 (r356168) +++ head/usr.sbin/fstyp/ntfs.c Sun Dec 29 06:59:09 2019 (r356169) @@ -134,12 +134,15 @@ int fstyp_ntfs(FILE *fp, char *label, size_t size) { struct ntfs_bootfile *bf; + char *filerecp; +#ifdef WITH_ICONV struct ntfs_filerec *fr; struct ntfs_attr *atr; off_t voloff; - char *filerecp, *ap; + char *ap; int8_t mftrecsz; int recsize; +#endif /* WITH_ICONV */ filerecp = NULL; From owner-svn-src-head@freebsd.org Sun Dec 29 12:22:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 456371DDA00; Sun, 29 Dec 2019 12:22:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m07816Nbz4RZR; Sun, 29 Dec 2019 12:22:12 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2184A196B6; Sun, 29 Dec 2019 12:22:12 +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 xBTCMC2K079411; Sun, 29 Dec 2019 12:22:12 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTCMBXW079409; Sun, 29 Dec 2019 12:22:11 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912291222.xBTCMBXW079409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 29 Dec 2019 12:22:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356170 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 356170 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 12:22:12 -0000 Author: trasz Date: Sun Dec 29 12:22:11 2019 New Revision: 356170 URL: https://svnweb.freebsd.org/changeset/base/356170 Log: Implement Linux BLKGETSIZE64 ioctl. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_ioctl.h Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Sun Dec 29 06:59:09 2019 (r356169) +++ head/sys/compat/linux/linux_ioctl.c Sun Dec 29 12:22:11 2019 (r356170) @@ -278,6 +278,7 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl struct file *fp; int error; u_int sectorsize; + uint64_t blksize64; off_t mediasize; error = fget(td, args->fd, &cap_ioctl_rights, &fp); @@ -300,6 +301,15 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl return (copyout(§orsize, (void *)args->arg, sizeof(sectorsize))); break; + case LINUX_BLKGETSIZE64: + error = fo_ioctl(fp, DIOCGMEDIASIZE, + (caddr_t)&mediasize, td->td_ucred, td); + fdrop(fp, td); + if (error) + return (error); + blksize64 = mediasize;; + return (copyout(&blksize64, (void *)args->arg, + sizeof(blksize64))); case LINUX_BLKSSZGET: error = fo_ioctl(fp, DIOCGSECTORSIZE, (caddr_t)§orsize, td->td_ucred, td); Modified: head/sys/compat/linux/linux_ioctl.h ============================================================================== --- head/sys/compat/linux/linux_ioctl.h Sun Dec 29 06:59:09 2019 (r356169) +++ head/sys/compat/linux/linux_ioctl.h Sun Dec 29 12:22:11 2019 (r356170) @@ -57,9 +57,10 @@ #define LINUX_BLKSECTSET 0x1266 #define LINUX_BLKSECTGET 0x1267 #define LINUX_BLKSSZGET 0x1268 +#define LINUX_BLKGETSIZE64 0x1272 #define LINUX_IOCTL_DISK_MIN LINUX_BLKROSET -#define LINUX_IOCTL_DISK_MAX LINUX_BLKSSZGET +#define LINUX_IOCTL_DISK_MAX LINUX_BLKGETSIZE64 /* * hdio From owner-svn-src-head@freebsd.org Sun Dec 29 12:24:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7B2A1DDDA9; Sun, 29 Dec 2019 12:24:41 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m0B143NQz4RvS; Sun, 29 Dec 2019 12:24:41 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86771196F9; Sun, 29 Dec 2019 12:24:41 +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 xBTCOfGx082157; Sun, 29 Dec 2019 12:24:41 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTCOf5k082156; Sun, 29 Dec 2019 12:24:41 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912291224.xBTCOf5k082156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 29 Dec 2019 12:24:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356171 - head/usr.bin/vmstat X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.bin/vmstat X-SVN-Commit-Revision: 356171 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 12:24:41 -0000 Author: trasz Date: Sun Dec 29 12:24:41 2019 New Revision: 356171 URL: https://svnweb.freebsd.org/changeset/base/356171 Log: Move type casts into a single place. No functional changes. MFC after: 2 weeks Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Sun Dec 29 12:22:11 2019 (r356170) +++ head/usr.bin/vmstat/vmstat.c Sun Dec 29 12:24:41 2019 (r356171) @@ -789,15 +789,14 @@ dovmstat(unsigned int interval, int reps) xo_close_container("processes"); xo_open_container("memory"); #define vmstat_pgtok(a) ((uintmax_t)(a) * (sum.v_page_size >> 10)) -#define rate(x) (((x) * rate_adj + halfuptime) / uptime) /* round */ +#define rate(x) (unsigned long)(((x) * rate_adj + halfuptime) / uptime) if (hflag) { prthuman("available-memory", total.t_avm * (uint64_t)sum.v_page_size, 5, HN_B); prthuman("free-memory", total.t_free * (uint64_t)sum.v_page_size, 5, HN_B); prthuman("total-page-faults", - (unsigned long)rate(sum.v_vm_faults - - osum.v_vm_faults), 5, 0); + rate(sum.v_vm_faults - osum.v_vm_faults), 5, 0); xo_emit(" "); } else { xo_emit(" "); @@ -808,55 +807,48 @@ dovmstat(unsigned int interval, int reps) vmstat_pgtok(total.t_free)); xo_emit(" "); xo_emit("{:total-page-faults/%5lu} ", - (unsigned long)rate(sum.v_vm_faults - - osum.v_vm_faults)); + rate(sum.v_vm_faults - osum.v_vm_faults)); } xo_close_container("memory"); xo_open_container("paging-rates"); xo_emit("{:page-reactivated/%3lu} ", - (unsigned long)rate(sum.v_reactivated - - osum.v_reactivated)); + rate(sum.v_reactivated - osum.v_reactivated)); xo_emit("{:paged-in/%3lu} ", - (unsigned long)rate(sum.v_swapin + sum.v_vnodein - + rate(sum.v_swapin + sum.v_vnodein - (osum.v_swapin + osum.v_vnodein))); xo_emit("{:paged-out/%3lu}", - (unsigned long)rate(sum.v_swapout + sum.v_vnodeout - + rate(sum.v_swapout + sum.v_vnodeout - (osum.v_swapout + osum.v_vnodeout))); if (hflag) { prthuman("freed", - (unsigned long)rate(sum.v_tfree - osum.v_tfree), - 5, 0); + rate(sum.v_tfree - osum.v_tfree), 5, 0); prthuman("scanned", - (unsigned long)rate(sum.v_pdpages - osum.v_pdpages), - 5, 0); + rate(sum.v_pdpages - osum.v_pdpages), 5, 0); xo_emit(" "); } else { xo_emit(" "); xo_emit("{:freed/%5lu} ", - (unsigned long)rate(sum.v_tfree - osum.v_tfree)); + rate(sum.v_tfree - osum.v_tfree)); xo_emit("{:scanned/%4lu} ", - (unsigned long)rate(sum.v_pdpages - osum.v_pdpages)); + rate(sum.v_pdpages - osum.v_pdpages)); } xo_close_container("paging-rates"); devstats(); xo_open_container("fault-rates"); - xo_emit("{:interrupts/%4lu}", - (unsigned long)rate(sum.v_intr - osum.v_intr)); + xo_emit("{:interrupts/%4lu}", rate(sum.v_intr - osum.v_intr)); if (hflag) { prthuman("system-calls", - (unsigned long)rate(sum.v_syscall - osum.v_syscall), - 5, 0); + rate(sum.v_syscall - osum.v_syscall), 5, 0); prthuman("context-switches", - (unsigned long)rate(sum.v_swtch - osum.v_swtch), - 5, 0); + rate(sum.v_swtch - osum.v_swtch), 5, 0); } else { xo_emit(" "); xo_emit("{:system-calls/%5lu} " "{:context-switches/%5lu}", - (unsigned long)rate(sum.v_syscall - osum.v_syscall), - (unsigned long)rate(sum.v_swtch - osum.v_swtch)); + rate(sum.v_syscall - osum.v_syscall), + rate(sum.v_swtch - osum.v_swtch)); } xo_close_container("fault-rates"); if (Pflag) From owner-svn-src-head@freebsd.org Sun Dec 29 13:54:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6831D1E08AC; Sun, 29 Dec 2019 13:54:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m2971tpCz4dZx; Sun, 29 Dec 2019 13:54:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3427A1A759; Sun, 29 Dec 2019 13:54:03 +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 xBTDs3VR044973; Sun, 29 Dec 2019 13:54:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTDs3Oa044972; Sun, 29 Dec 2019 13:54:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912291354.xBTDs3Oa044972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 29 Dec 2019 13:54:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356172 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 356172 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 13:54:03 -0000 Author: trasz Date: Sun Dec 29 13:54:02 2019 New Revision: 356172 URL: https://svnweb.freebsd.org/changeset/base/356172 Log: Make Linux stat(2) et al distinguish between block and character devices. It's required for LTP, among other things. It's not complete, but good enough for now. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22950 Modified: head/sys/compat/linux/linux_stats.c Modified: head/sys/compat/linux/linux_stats.c ============================================================================== --- head/sys/compat/linux/linux_stats.c Sun Dec 29 12:24:41 2019 (r356171) +++ head/sys/compat/linux/linux_stats.c Sun Dec 29 13:54:02 2019 (r356172) @@ -65,6 +65,11 @@ translate_vnhook_major_minor(struct vnode *vp, struct { int major, minor; + if (vn_isdisk(vp, NULL)) { + sb->st_mode &= ~S_IFMT; + sb->st_mode |= S_IFBLK; + } + if (vp->v_type == VCHR && vp->v_rdev != NULL && linux_driver_get_major_minor(devtoname(vp->v_rdev), &major, &minor) == 0) { @@ -114,6 +119,10 @@ translate_fd_major_minor(struct thread *td, int fd, st fget(td, fd, &cap_no_rights, &fp) != 0) return; vp = fp->f_vnode; + if (vp != NULL && vn_isdisk(vp, NULL)) { + buf->st_mode &= ~S_IFMT; + buf->st_mode |= S_IFBLK; + } if (vp != NULL && vp->v_rdev != NULL && linux_driver_get_major_minor(devtoname(vp->v_rdev), &major, &minor) == 0) { From owner-svn-src-head@freebsd.org Sun Dec 29 15:39:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C98F1E1FED; Sun, 29 Dec 2019 15:39:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m4W41mDCz3DRb; Sun, 29 Dec 2019 15:39:44 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 337021B97F; Sun, 29 Dec 2019 15:39:44 +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 xBTFdhdm004105; Sun, 29 Dec 2019 15:39:43 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTFdh2F004104; Sun, 29 Dec 2019 15:39:43 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912291539.xBTFdh2F004104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 29 Dec 2019 15:39:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356173 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356173 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 15:39:44 -0000 Author: markj Date: Sun Dec 29 15:39:43 2019 New Revision: 356173 URL: https://svnweb.freebsd.org/changeset/base/356173 Log: Clear queue op flags in vm_page_mvqueue(). This fixes a regression in r356155, introduced at the last minute. In particular, we must clear PGA_REQUEUE_HEAD before inserting into any queue besides PQ_INACTIVE since that operation is implemented only for PQ_INACTIVE. Reported by: pho, Jenkins via lwhsu Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Dec 29 13:54:02 2019 (r356172) +++ head/sys/vm/vm_page.c Sun Dec 29 15:39:43 2019 (r356173) @@ -4018,6 +4018,7 @@ vm_page_mvqueue(vm_page_t m, const uint8_t nqueue, con if ((old.flags & PGA_DEQUEUE) != 0) break; new = old; + new.flags &= ~PGA_QUEUE_OP_MASK; if (nqueue == PQ_ACTIVE) new.act_count = max(old.act_count, ACT_INIT); if (old.queue == nqueue) { From owner-svn-src-head@freebsd.org Sun Dec 29 15:40:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 385C81E2054; Sun, 29 Dec 2019 15:40:04 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m4WR5bCzz3DZ1; Sun, 29 Dec 2019 15:40:03 +0000 (UTC) (envelope-from oshogbo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB3B51B983; Sun, 29 Dec 2019 15:40:03 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBTFe3YZ004208; Sun, 29 Dec 2019 15:40:03 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTFe39b004205; Sun, 29 Dec 2019 15:40:03 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201912291540.xBTFe39b004205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 29 Dec 2019 15:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356174 - in head: lib/geom/nop sys/geom/nop X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head: lib/geom/nop sys/geom/nop X-SVN-Commit-Revision: 356174 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 15:40:04 -0000 Author: oshogbo Date: Sun Dec 29 15:40:02 2019 New Revision: 356174 URL: https://svnweb.freebsd.org/changeset/base/356174 Log: gnop: allow to change the name of created device Thanks to this option we can create more then one gnop provider from single provider. This may be useful for temporary labeling some data on the disk. Reviewed by: markj, allanjude, bcr Differential Revision: https://reviews.freebsd.org/D22304 Modified: head/lib/geom/nop/geom_nop.c head/lib/geom/nop/gnop.8 head/sys/geom/nop/g_nop.c Modified: head/lib/geom/nop/geom_nop.c ============================================================================== --- head/lib/geom/nop/geom_nop.c Sun Dec 29 15:39:43 2019 (r356173) +++ head/lib/geom/nop/geom_nop.c Sun Dec 29 15:40:02 2019 (r356174) @@ -56,12 +56,13 @@ struct g_command class_commands[] = { { 'w', "wfailprob", "-1", G_TYPE_NUMBER }, { 'x', "wdelayprob", "-1", G_TYPE_NUMBER }, { 'z', "physpath", G_NOP_PHYSPATH_PASSTHROUGH, G_TYPE_STRING }, + { 'Z', "gnopname", G_VAL_OPTIONAL, G_TYPE_STRING }, G_OPT_SENTINEL }, "[-v] [-c count_until_fail] [-d delaymsec] [-e error] [-o offset] " "[-p stripesize] [-P stripeoffset] [-q rdelayprob] [-r rfailprob] " "[-s size] [-S secsize] [-w wfailprob] [-x wdelayprob] " - "[-z physpath] dev ..." + "[-z physpath] [-Z gnopname] dev ..." }, { "configure", G_FLAG_VERBOSE, NULL, { Modified: head/lib/geom/nop/gnop.8 ============================================================================== --- head/lib/geom/nop/gnop.8 Sun Dec 29 15:39:43 2019 (r356173) +++ head/lib/geom/nop/gnop.8 Sun Dec 29 15:40:02 2019 (r356174) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 13, 2019 +.Dd December 29, 2019 .Dt GNOP 8 .Os .Sh NAME @@ -47,6 +47,7 @@ .Op Fl w Ar wfailprob .Op Fl x Ar wdelayprob .Op Fl z Ar physpath +.Op Fl Z Ar gnopname .Ar dev ... .Nm .Cm configure @@ -153,6 +154,11 @@ Be more verbose. Specifies write delay probability in percent. .It Fl z Ar physpath Physical path of the transparent provider. +.It Fl Z Ar gnopname +The name of the new provider. +The suffix +.Dq .nop +will be appended to the provider name. .El .Sh SYSCTL VARIABLES The following Modified: head/sys/geom/nop/g_nop.c ============================================================================== --- head/sys/geom/nop/g_nop.c Sun Dec 29 15:39:43 2019 (r356173) +++ head/sys/geom/nop/g_nop.c Sun Dec 29 15:40:02 2019 (r356174) @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2004-2006 Pawel Jakub Dawidek + * Copyright (c) 2019 Mariusz Zaborski * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -81,6 +83,20 @@ struct g_nop_delay { TAILQ_ENTRY(g_nop_delay) dl_next; }; +static bool +g_nop_verify_nprefix(const char *name) +{ + int i; + + for (i = 0; i < strlen(name); i++) { + if (isalpha(name[i]) == 0 && isdigit(name[i]) == 0) { + return (false); + } + } + + return (true); +} + static void g_nop_orphan(struct g_consumer *cp) { @@ -312,17 +328,17 @@ g_nop_access(struct g_provider *pp, int dr, int dw, in static int g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp, - int ioerror, u_int count_until_fail, u_int rfailprob, u_int wfailprob, - u_int delaymsec, u_int rdelayprob, u_int wdelayprob, off_t offset, - off_t size, u_int secsize, off_t stripesize, off_t stripeoffset, - const char *physpath) + const char *gnopname, int ioerror, u_int count_until_fail, + u_int rfailprob, u_int wfailprob, u_int delaymsec, u_int rdelayprob, + u_int wdelayprob, off_t offset, off_t size, u_int secsize, off_t stripesize, + off_t stripeoffset, const char *physpath) { struct g_nop_softc *sc; struct g_geom *gp; struct g_provider *newpp; struct g_consumer *cp; char name[64]; - int error; + int error, n; off_t explicitsize; g_topology_assert(); @@ -373,7 +389,22 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, gctl_error(req, "stripeoffset is too big."); return (EINVAL); } - snprintf(name, sizeof(name), "%s%s", pp->name, G_NOP_SUFFIX); + if (gnopname != NULL && !g_nop_verify_nprefix(gnopname)) { + gctl_error(req, "Name %s is invalid.", gnopname); + return (EINVAL); + } + + if (gnopname != NULL) { + n = snprintf(name, sizeof(name), "%s%s", gnopname, + G_NOP_SUFFIX); + } else { + n = snprintf(name, sizeof(name), "%s%s", pp->name, + G_NOP_SUFFIX); + } + if (n <= 0 || n >= sizeof(name)) { + gctl_error(req, "Invalid provider name."); + return (EINVAL); + } LIST_FOREACH(gp, &mp->geom, geom) { if (strcmp(gp->name, name) == 0) { gctl_error(req, "Provider %s already exists.", name); @@ -500,7 +531,7 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class intmax_t *val, error, rfailprob, wfailprob, count_until_fail, offset, secsize, size, stripesize, stripeoffset, delaymsec, rdelayprob, wdelayprob; - const char *name, *physpath; + const char *name, *physpath, *gnopname; char param[16]; int i, *nargs; @@ -623,6 +654,7 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class } } physpath = gctl_get_asciiparam(req, "physpath"); + gnopname = gctl_get_asciiparam(req, "gnopname"); for (i = 0; i < *nargs; i++) { snprintf(param, sizeof(param), "arg%d", i); @@ -640,6 +672,7 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class return; } if (g_nop_create(req, mp, pp, + gnopname, error == -1 ? EIO : (int)error, count_until_fail == -1 ? 0 : (u_int)count_until_fail, rfailprob == -1 ? 0 : (u_int)rfailprob, From owner-svn-src-head@freebsd.org Sun Dec 29 15:47:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AB2E1E22AC; Sun, 29 Dec 2019 15:47:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m4gS1Fz8z3Dxv; Sun, 29 Dec 2019 15:47:00 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 266C31BB6D; Sun, 29 Dec 2019 15:47:00 +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 xBTFl0U6009898; Sun, 29 Dec 2019 15:47:00 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTFl0U7009893; Sun, 29 Dec 2019 15:47:00 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912291547.xBTFl0U7009893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 29 Dec 2019 15:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356175 - head/sys/compat/linprocfs X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linprocfs X-SVN-Commit-Revision: 356175 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 15:47:00 -0000 Author: trasz Date: Sun Dec 29 15:46:59 2019 New Revision: 356175 URL: https://svnweb.freebsd.org/changeset/base/356175 Log: Make linprocfs(5) provide an empty /proc/modules. This should silence some warnings. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sun Dec 29 15:40:02 2019 (r356174) +++ head/sys/compat/linprocfs/linprocfs.c Sun Dec 29 15:46:59 2019 (r356175) @@ -1504,22 +1504,22 @@ linprocfs_dofilesystems(PFS_FILL_ARGS) return(0); } -#if 0 /* * Filler function for proc/modules */ static int linprocfs_domodules(PFS_FILL_ARGS) { +#if 0 struct linker_file *lf; TAILQ_FOREACH(lf, &linker_files, link) { sbuf_printf(sb, "%-20s%8lu%4d\n", lf->filename, (unsigned long)lf->size, lf->refs); } +#endif return (0); } -#endif /* * Filler function for proc/pid/fd @@ -1713,10 +1713,8 @@ linprocfs_init(PFS_INIT_ARGS) NULL, NULL, NULL, PFS_RD); pfs_create_file(root, "meminfo", &linprocfs_domeminfo, NULL, NULL, NULL, PFS_RD); -#if 0 pfs_create_file(root, "modules", &linprocfs_domodules, NULL, NULL, NULL, PFS_RD); -#endif pfs_create_file(root, "mounts", &linprocfs_domtab, NULL, NULL, NULL, PFS_RD); pfs_create_file(root, "mtab", &linprocfs_domtab, From owner-svn-src-head@freebsd.org Sun Dec 29 15:47:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6C941E2326; Sun, 29 Dec 2019 15:47:38 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m4hB3zSfz3F5N; Sun, 29 Dec 2019 15:47:38 +0000 (UTC) (envelope-from oshogbo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83C451BB6E; Sun, 29 Dec 2019 15:47:38 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBTFlcnl009974; Sun, 29 Dec 2019 15:47:38 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTFlcM4009972; Sun, 29 Dec 2019 15:47:38 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201912291547.xBTFlcM4009972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 29 Dec 2019 15:47:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356176 - in head: lib/geom/nop sys/geom/nop X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head: lib/geom/nop sys/geom/nop X-SVN-Commit-Revision: 356176 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 15:47:38 -0000 Author: oshogbo Date: Sun Dec 29 15:47:37 2019 New Revision: 356176 URL: https://svnweb.freebsd.org/changeset/base/356176 Log: gnop: change the "count until fail" option Change the "count_until_fail" option of gnop, now it enables the failing rating instead of setting them to 100%. The original patch introduced the new flag, which sets the fail/rate to 100% after N requests. In some cases, we don't want to have 100% of failure probabilities. We want to start failing at some point. For example, on the early stage, we may like to allow some read/writes requests before having some requests delayed - when we try to mount the partition, or when we are trying to import the pool. Another case may be to check how scrub in ZFS will behave on different stages. This allows us to cover more cases. The previous behavior still may be configured. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D22632 Modified: head/lib/geom/nop/gnop.8 head/sys/geom/nop/g_nop.c Modified: head/lib/geom/nop/gnop.8 ============================================================================== --- head/lib/geom/nop/gnop.8 Sun Dec 29 15:46:59 2019 (r356175) +++ head/lib/geom/nop/gnop.8 Sun Dec 29 15:47:37 2019 (r356176) @@ -123,8 +123,8 @@ See Additional options: .Bl -tag -width "-c count_until_fail" .It Fl c Ar count_until_fail -Specifies the number of I/O requests to allow before setting the read and write -failure probabilities to 100%. +Specifies the number of I/O requests to allow before setting the read, write and +delay failure probabilities. .It Fl d Ar delaymsec Specifies the delay of the requests in milliseconds. Note that requests will be delayed before they are sent to the backing device. Modified: head/sys/geom/nop/g_nop.c ============================================================================== --- head/sys/geom/nop/g_nop.c Sun Dec 29 15:46:59 2019 (r356175) +++ head/sys/geom/nop/g_nop.c Sun Dec 29 15:47:37 2019 (r356176) @@ -204,31 +204,35 @@ g_nop_start(struct bio *bp) struct bio *cbp; u_int failprob, delayprob, delaytime; - failprob = delayprob = 0; + failprob = delayprob = delaytime = 0; gp = bp->bio_to->geom; sc = gp->softc; G_NOP_LOGREQ(bp, "Request received."); mtx_lock(&sc->sc_lock); - if (sc->sc_count_until_fail != 0 && --sc->sc_count_until_fail == 0) { - sc->sc_rfailprob = 100; - sc->sc_wfailprob = 100; - } switch (bp->bio_cmd) { case BIO_READ: sc->sc_reads++; sc->sc_readbytes += bp->bio_length; - failprob = sc->sc_rfailprob; - delayprob = sc->sc_rdelayprob; - delaytime = sc->sc_delaymsec; + if (sc->sc_count_until_fail != 0) { + sc->sc_count_until_fail -= 1; + } else { + failprob = sc->sc_rfailprob; + delayprob = sc->sc_rdelayprob; + delaytime = sc->sc_delaymsec; + } break; case BIO_WRITE: sc->sc_writes++; sc->sc_wrotebytes += bp->bio_length; - failprob = sc->sc_wfailprob; - delayprob = sc->sc_wdelayprob; - delaytime = sc->sc_delaymsec; + if (sc->sc_count_until_fail != 0) { + sc->sc_count_until_fail -= 1; + } else { + failprob = sc->sc_wfailprob; + delayprob = sc->sc_wdelayprob; + delaytime = sc->sc_delaymsec; + } break; case BIO_DELETE: sc->sc_deletes++; @@ -262,6 +266,7 @@ g_nop_start(struct bio *bp) break; } mtx_unlock(&sc->sc_lock); + if (failprob > 0) { u_int rval; From owner-svn-src-head@freebsd.org Sun Dec 29 15:53:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DD7D1E26D4; Sun, 29 Dec 2019 15:53:57 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m4qT0NY4z3FZR; Sun, 29 Dec 2019 15:53:57 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 087271BD3E; Sun, 29 Dec 2019 15:53:57 +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 xBTFru9D015933; Sun, 29 Dec 2019 15:53:56 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTFrtwm015927; Sun, 29 Dec 2019 15:53:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912291553.xBTFrtwm015927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 29 Dec 2019 15:53:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356177 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Commit-Revision: 356177 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 15:53:57 -0000 Author: trasz Date: Sun Dec 29 15:53:55 2019 New Revision: 356177 URL: https://svnweb.freebsd.org/changeset/base/356177 Log: Implement Linux syslog(2) syscall; just enough to make Linux dmesg(8) utility work. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22465 Modified: head/sys/amd64/linux/linux_dummy.c head/sys/amd64/linux32/linux32_dummy.c head/sys/arm64/linux/linux_dummy.c head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h head/sys/i386/linux/linux_dummy.c Modified: head/sys/amd64/linux/linux_dummy.c ============================================================================== --- head/sys/amd64/linux/linux_dummy.c Sun Dec 29 15:47:37 2019 (r356176) +++ head/sys/amd64/linux/linux_dummy.c Sun Dec 29 15:53:55 2019 (r356177) @@ -60,7 +60,6 @@ UNIMPLEMENTED(uselib); UNIMPLEMENTED(vserver); DUMMY(sendfile); -DUMMY(syslog); DUMMY(setfsuid); DUMMY(setfsgid); DUMMY(sysfs); Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Sun Dec 29 15:47:37 2019 (r356176) +++ head/sys/amd64/linux32/linux32_dummy.c Sun Dec 29 15:53:55 2019 (r356177) @@ -63,7 +63,6 @@ UNIMPLEMENTED(vserver); DUMMY(stime); DUMMY(olduname); -DUMMY(syslog); DUMMY(uname); DUMMY(vhangup); DUMMY(swapoff); Modified: head/sys/arm64/linux/linux_dummy.c ============================================================================== --- head/sys/arm64/linux/linux_dummy.c Sun Dec 29 15:47:37 2019 (r356176) +++ head/sys/arm64/linux/linux_dummy.c Sun Dec 29 15:53:55 2019 (r356177) @@ -65,7 +65,6 @@ UNIMPLEMENTED(uselib); UNIMPLEMENTED(vserver); DUMMY(sendfile); -DUMMY(syslog); DUMMY(setfsuid); DUMMY(setfsgid); DUMMY(vhangup); Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun Dec 29 15:47:37 2019 (r356176) +++ head/sys/compat/linux/linux_misc.c Sun Dec 29 15:53:55 2019 (r356177) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2288,4 +2289,67 @@ linux_mincore(struct thread *td, struct linux_mincore_ if (args->start & PAGE_MASK) return (EINVAL); return (kern_mincore(td, args->start, args->len, args->vec)); +} + +#define SYSLOG_TAG "<6>" + +int +linux_syslog(struct thread *td, struct linux_syslog_args *args) +{ + char buf[128], *src, *dst; + u_int seq; + int buflen, error; + + if (args->type != LINUX_SYSLOG_ACTION_READ_ALL) { + linux_msg(td, "syslog unsupported type 0x%x", args->type); + return (EINVAL); + } + + if (args->len < 6) { + td->td_retval[0] = 0; + return (0); + } + + error = priv_check(td, PRIV_MSGBUF); + if (error) + return (error); + + mtx_lock(&msgbuf_lock); + msgbuf_peekbytes(msgbufp, NULL, 0, &seq); + mtx_unlock(&msgbuf_lock); + + dst = args->buf; + error = copyout(&SYSLOG_TAG, dst, sizeof(SYSLOG_TAG)); + /* The -1 is to skip the trailing '\0'. */ + dst += sizeof(SYSLOG_TAG) - 1; + + while (error == 0) { + mtx_lock(&msgbuf_lock); + buflen = msgbuf_peekbytes(msgbufp, buf, sizeof(buf), &seq); + mtx_unlock(&msgbuf_lock); + + if (buflen == 0) + break; + + for (src = buf; src < buf + buflen && error == 0; src++) { + if (*src == '\0') + continue; + + if (dst >= args->buf + args->len) + goto out; + + error = copyout(src, dst, 1); + dst++; + + if (*src == '\n' && *(src + 1) != '<' && + dst + sizeof(SYSLOG_TAG) < args->buf + args->len) { + error = copyout(&SYSLOG_TAG, + dst, sizeof(SYSLOG_TAG)); + dst += sizeof(SYSLOG_TAG) - 1; + } + } + } +out: + td->td_retval[0] = dst - args->buf; + return (error); } Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Sun Dec 29 15:47:37 2019 (r356176) +++ head/sys/compat/linux/linux_misc.h Sun Dec 29 15:53:55 2019 (r356177) @@ -149,6 +149,9 @@ extern int stclohz; #define LINUX_GRND_NONBLOCK 0x0001 #define LINUX_GRND_RANDOM 0x0002 +/* Linux syslog flags */ +#define LINUX_SYSLOG_ACTION_READ_ALL 3 + #if defined(__amd64__) && !defined(COMPAT_LINUX32) int linux_ptrace_status(struct thread *td, int pid, int status); #endif Modified: head/sys/i386/linux/linux_dummy.c ============================================================================== --- head/sys/i386/linux/linux_dummy.c Sun Dec 29 15:47:37 2019 (r356176) +++ head/sys/i386/linux/linux_dummy.c Sun Dec 29 15:53:55 2019 (r356177) @@ -64,7 +64,6 @@ UNIMPLEMENTED(vserver); DUMMY(stime); DUMMY(fstat); DUMMY(olduname); -DUMMY(syslog); DUMMY(uname); DUMMY(vhangup); DUMMY(vm86old); From owner-svn-src-head@freebsd.org Sun Dec 29 16:50:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71FFF1E3726; Sun, 29 Dec 2019 16:50:38 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m64s1xQrz3HcZ; Sun, 29 Dec 2019 16:50:37 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x72e.google.com with SMTP id z76so25229276qka.2; Sun, 29 Dec 2019 08:50:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SzBTXu6QUJiCPlyP4X5viqBsZnArLb4gWktlLb2BJZI=; b=YIx2CiNxLLK9e5xiBGOmEhiZOyHONGbCl2lkEZBGX+itAEaloh4ILkfYW4JuRn50ls 04QmNbSgO0/zW+YX46xsHde9n8hUWdGHWBZKNlL9aDqwheC9TGWCIQraJvj09vuDUnI9 sMO21Gx/VI+iIsyT3PKmxbplgFHSskCUdttgZPgvdGFfh7/bEuFTBTILs+KOMOLXr2Ra Q7kErzQYCMZu/2e1BlqKz4pB59JKGJnvxctuBB5qcEAS0VQDAdZEeCsutfHhb3hbpZyU tfegdlN5IEwgwIXiij/Vxz69/nn3D0ROs8ESUt2TfH6pT9k7CzCStg50m+RNmI62h8yS fTPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=SzBTXu6QUJiCPlyP4X5viqBsZnArLb4gWktlLb2BJZI=; b=tA1pPFC4wIG6ohyQe0IBJaiHGS8+gSc6NrF7hLzYA2aT8Ga4h6FBmS6MhHgo/o19PP GbDPF+GOeEoadBkH0Yi9WIbRvX1GuJ0Qsw5UEprMQ7TH7kvzMzs+uHYCJAQkKfXCWyZh LCF7HvR/wymJ3EvJEIOwjWkEkb9n/ZTJRNKZQ9mfwyFU5Rb+78IJ9agGtoyP8ZisJBIi xqEKTc8rnhMlUHtV79cMu4byIGHInossRCGROgbAS0FBrCp/uIJOgF7fnFm7pR0Osuwk cDmi/2/TRQyC1kDMlbBipFaTkMw809z1bzFtRJ4CO2p+IRgBa9W4C6OU0ulTNIQGz8S0 OniQ== X-Gm-Message-State: APjAAAXyB+XCY6dB+dp7Uyl+QegmZrQq/2baWrzpcv14ASWApueDpqGS dyyuMfiq9lnCPDYeUdxDvl8= X-Google-Smtp-Source: APXvYqxCfDssAv2Bh/72KKDtaYsVIWyYcDtj6OcuaMb3oVC9LfRvV+qMI7GXBmC+otuLG6S9V02NcA== X-Received: by 2002:a37:e317:: with SMTP id y23mr51413557qki.431.1577638236104; Sun, 29 Dec 2019 08:50:36 -0800 (PST) Received: from raichu (toroon0560w-lp130-05-69-158-183-252.dsl.bell.ca. [69.158.183.252]) by smtp.gmail.com with ESMTPSA id j15sm4542106qki.47.2019.12.29.08.50.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 08:50:35 -0800 (PST) Sender: Mark Johnston Date: Sun, 29 Dec 2019 11:50:32 -0500 From: Mark Johnston To: Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r356159 - head/sys/vm Message-ID: <20191229165032.GC30375@raichu> References: <201912281904.xBSJ4T19064948@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 47m64s1xQrz3HcZ X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=YIx2CiNx; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::72e as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-2.86 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; IP_SCORE(-2.66)[ip: (-9.23), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.88), country: US(-0.05)]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[e.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 16:50:38 -0000 On Sun, Dec 29, 2019 at 03:39:55AM +0100, Oliver Pinter wrote: > Is there any performance measurement from before and after. It would be > nice to see them. I did not do extensive benchmarking. The aim of the patch set was simply to remove the use of the hashed page lock, since it shows up prominently in lock profiles of some workloads. The problem is that we acquire these locks any time a page's LRU state is updated, and the use of the hash lock means that we get false sharing. The solution is to implement these state updates using atomic operations on the page structure itself, making data contention much less likely. Another option was to embed a mutex into the vm_page structure, but this would bloat a structure which is already too large. A secondary goal was to reduce the number of locks held during page queue scans. Such scans frequently call pmap_ts_referenced() to collect info about recent references to the page. This operation can be expensive since it may require a TLB shootdown, and it can block for a long time on the pmap lock, for example if the lock holder is copying the page tables as part of a fork(). Now, the active queue scan body is executed without any locks held, so a page daemon thread blocked on a pmap lock no longer has the potential to block other threads by holding on to a shared page lock. Before, the page daemon could block faulting threads for a long time, hurting latency. I don't have any benchmarks that capture this, but it's something that I've observed in production workloads. I used some microbenchmarks to verify that the change did not penalize the single-threaded case. Here are some results on a 64-core arm64 system I have been playing with: https://people.freebsd.org/~markj/arm64_page_lock/ The benchmark from will-it-scale simply maps 128MB of anonymous memory, faults on each page, and unmaps it, in a loop. In the fault handler we allocate a page and insert it into the active queue, and the unmap operation removes all of those pages from the queue. I collected the throughput for 1, 2, 4, 8, 16 and 32 concurrent processes. With my patches we see some modest gains at low concurrency. At higher levels of concurrency we actually get lower throughput than before as contention moves from the page locks and the page queue lock to just the page queue lock. I don't believe this is a real regression: first, the benchmark is quite extreme relative to any useful workload, and second, arm64 suffers from using a much smaller batch size than amd64 for batched page queue operations. Changing that pushes the results out somewhat. Some earlier testing on a 2-socket Xeon system showed a similar pattern with smaller differences. From owner-svn-src-head@freebsd.org Sun Dec 29 17:10:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 568F91E3EA1; Sun, 29 Dec 2019 17:10:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m6Wf1gkwz3JT8; Sun, 29 Dec 2019 17:10:22 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 333971C9ED; Sun, 29 Dec 2019 17:10:22 +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 xBTHAMwC057122; Sun, 29 Dec 2019 17:10:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTHAMbl057121; Sun, 29 Dec 2019 17:10:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912291710.xBTHAMbl057121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 29 Dec 2019 17:10:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356178 - head/sys/geom/mountver X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom/mountver X-SVN-Commit-Revision: 356178 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 17:10:22 -0000 Author: mav Date: Sun Dec 29 17:10:21 2019 New Revision: 356178 URL: https://svnweb.freebsd.org/changeset/base/356178 Log: Fix GEOM_MOUNTVER orphanization. Previous code closed and detached consumer even with I/O still in progress. This patch adds locking and request counting to postpone the close till the last of running requests completes. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/mountver/g_mountver.c Modified: head/sys/geom/mountver/g_mountver.c ============================================================================== --- head/sys/geom/mountver/g_mountver.c Sun Dec 29 15:53:55 2019 (r356177) +++ head/sys/geom/mountver/g_mountver.c Sun Dec 29 17:10:21 2019 (r356178) @@ -85,14 +85,29 @@ struct g_class g_mountver_class = { }; static void +g_mountver_detach(void *arg, int flags __unused) +{ + struct g_consumer *cp = arg; + + g_topology_assert(); + if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) + g_access(cp, -cp->acr, -cp->acw, -cp->ace); + g_detach(cp); +} + +static void g_mountver_done(struct bio *bp) { + struct g_mountver_softc *sc; struct g_geom *gp; + struct g_consumer *cp; struct bio *pbp; + cp = bp->bio_from; + gp = cp->geom; if (bp->bio_error != ENXIO) { g_std_done(bp); - return; + goto done; } /* @@ -101,32 +116,45 @@ g_mountver_done(struct bio *bp) * gets called. To work around that, we have to queue requests * that failed with ENXIO, in order to send them later. */ - gp = bp->bio_from->geom; - pbp = bp->bio_parent; KASSERT(pbp->bio_to == LIST_FIRST(&gp->provider), ("parent request was for someone else")); g_destroy_bio(bp); pbp->bio_inbed++; g_mountver_queue(pbp); + +done: + sc = gp->softc; + mtx_lock(&sc->sc_mtx); + if (--cp->index == 0 && sc->sc_orphaned) + g_post_event(g_mountver_detach, cp, M_NOWAIT, NULL); + mtx_unlock(&sc->sc_mtx); } +/* + * Send the BIO down. The function is called with sc_mtx held to cover + * the race with orphan, but drops it before external calls. + */ static void -g_mountver_send(struct bio *bp) +g_mountver_send(struct g_geom *gp, struct bio *bp) { - struct g_geom *gp; + struct g_mountver_softc *sc = gp->softc; + struct g_consumer *cp; struct bio *cbp; - gp = bp->bio_to->geom; - + mtx_assert(&sc->sc_mtx, MA_OWNED); cbp = g_clone_bio(bp); if (cbp == NULL) { + mtx_unlock(&sc->sc_mtx); g_io_deliver(bp, ENOMEM); return; } + cp = LIST_FIRST(&gp->consumer); + cp->index++; + mtx_unlock(&sc->sc_mtx); cbp->bio_done = g_mountver_done; - g_io_request(cbp, LIST_FIRST(&gp->consumer)); + g_io_request(cbp, cp); } static void @@ -152,10 +180,12 @@ g_mountver_send_queued(struct g_geom *gp) sc = gp->softc; mtx_lock(&sc->sc_mtx); - while ((bp = TAILQ_FIRST(&sc->sc_queue)) != NULL) { + while ((bp = TAILQ_FIRST(&sc->sc_queue)) != NULL && !sc->sc_orphaned) { TAILQ_REMOVE(&sc->sc_queue, bp, bio_queue); G_MOUNTVER_LOGREQ(bp, "Sending queued request."); - g_mountver_send(bp); + /* sc_mtx is dropped inside */ + g_mountver_send(gp, bp); + mtx_lock(&sc->sc_mtx); } mtx_unlock(&sc->sc_mtx); } @@ -171,8 +201,10 @@ g_mountver_discard_queued(struct g_geom *gp) mtx_lock(&sc->sc_mtx); while ((bp = TAILQ_FIRST(&sc->sc_queue)) != NULL) { TAILQ_REMOVE(&sc->sc_queue, bp, bio_queue); + mtx_unlock(&sc->sc_mtx); G_MOUNTVER_LOGREQ(bp, "Discarding queued request."); g_io_deliver(bp, ENXIO); + mtx_lock(&sc->sc_mtx); } mtx_unlock(&sc->sc_mtx); } @@ -192,7 +224,9 @@ g_mountver_start(struct bio *bp) * orphaning didn't happen yet. In that case, queue all subsequent * requests in order to maintain ordering. */ + mtx_lock(&sc->sc_mtx); if (sc->sc_orphaned || !TAILQ_EMPTY(&sc->sc_queue)) { + mtx_unlock(&sc->sc_mtx); if (sc->sc_shutting_down) { G_MOUNTVER_LOGREQ(bp, "Discarding request due to shutdown."); g_io_deliver(bp, ENXIO); @@ -204,7 +238,8 @@ g_mountver_start(struct bio *bp) g_mountver_send_queued(gp); } else { G_MOUNTVER_LOGREQ(bp, "Sending request."); - g_mountver_send(bp); + /* sc_mtx is dropped inside */ + g_mountver_send(gp, bp); } } @@ -466,14 +501,17 @@ static void g_mountver_orphan(struct g_consumer *cp) { struct g_mountver_softc *sc; + int done; g_topology_assert(); sc = cp->geom->softc; + mtx_lock(&sc->sc_mtx); sc->sc_orphaned = 1; - if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) - g_access(cp, -cp->acr, -cp->acw, -cp->ace); - g_detach(cp); + done = (cp->index == 0); + mtx_unlock(&sc->sc_mtx); + if (done) + g_mountver_detach(cp, 0); G_MOUNTVER_DEBUG(0, "%s is offline. Mount verification in progress.", sc->sc_provider_name); } @@ -571,8 +609,8 @@ g_mountver_taste(struct g_class *mp, struct g_provider return (NULL); } } - g_mountver_send_queued(gp); sc->sc_orphaned = 0; + g_mountver_send_queued(gp); G_MOUNTVER_DEBUG(0, "%s has completed mount verification.", sc->sc_provider_name); return (gp); From owner-svn-src-head@freebsd.org Sun Dec 29 17:19:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F2DF1E41D9; Sun, 29 Dec 2019 17:19:58 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m6kk13Xfz3Jth; Sun, 29 Dec 2019 17:19:58 +0000 (UTC) (envelope-from kaktus@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F6D31CBA7; Sun, 29 Dec 2019 17:19:58 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBTHJvXF062687; Sun, 29 Dec 2019 17:19:57 GMT (envelope-from kaktus@FreeBSD.org) Received: (from kaktus@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTHJvCf062686; Sun, 29 Dec 2019 17:19:57 GMT (envelope-from kaktus@FreeBSD.org) Message-Id: <201912291719.xBTHJvCf062686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kaktus set sender to kaktus@FreeBSD.org using -f From: Pawel Biernacki Date: Sun, 29 Dec 2019 17:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356179 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: kaktus X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 356179 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 17:19:58 -0000 Author: kaktus Date: Sun Dec 29 17:19:57 2019 New Revision: 356179 URL: https://svnweb.freebsd.org/changeset/base/356179 Log: sysctlbyname(2): Remove temporary compatibility layer Remove temporary compatibility layer introduced in r351729. More that 3 months should be enough for everybody who runs HEAD to upgrade to the new kernel already. Reviewed by: imp, mjg (mentor) Approved by: mjg (mentor) Differential Revision: https://reviews.freebsd.org/D22958 Modified: head/lib/libc/gen/sysctlbyname.c Modified: head/lib/libc/gen/sysctlbyname.c ============================================================================== --- head/lib/libc/gen/sysctlbyname.c Sun Dec 29 17:10:21 2019 (r356178) +++ head/lib/libc/gen/sysctlbyname.c Sun Dec 29 17:19:57 2019 (r356179) @@ -33,10 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "libc_private.h" - -#define SYSCTLBYNAME_OSREL 1300045 - extern int __sysctlbyname(const char *name, size_t namelen, void *oldp, size_t *oldlenp, const void *newp, size_t newlen); @@ -44,16 +40,9 @@ int sysctlbyname(const char *name, void *oldp, size_t *oldlenp, const void *newp, size_t newlen) { - int oid[CTL_MAXNAME]; size_t len; - if (__getosreldate() >= SYSCTLBYNAME_OSREL) { - len = strlen(name); - return (__sysctlbyname(name, len, oldp, oldlenp, newp, - newlen)); - } - len = nitems(oid); - if (sysctlnametomib(name, oid, &len) == -1) - return (-1); - return (sysctl(oid, len, oldp, oldlenp, newp, newlen)); + len = strlen(name); + return (__sysctlbyname(name, len, oldp, oldlenp, newp, + newlen)); } From owner-svn-src-head@freebsd.org Sun Dec 29 18:17:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CBF71E5D70; Sun, 29 Dec 2019 18:17:13 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m80n3hxbz3wn7; Sun, 29 Dec 2019 18:17:13 +0000 (UTC) (envelope-from ian@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A3FC1D69D; Sun, 29 Dec 2019 18:17:13 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBTIHDJd003926; Sun, 29 Dec 2019 18:17:13 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTIHCda003923; Sun, 29 Dec 2019 18:17:12 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912291817.xBTIHCda003923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 29 Dec 2019 18:17:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356180 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 356180 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 18:17:13 -0000 Author: ian Date: Sun Dec 29 18:17:12 2019 New Revision: 356180 URL: https://svnweb.freebsd.org/changeset/base/356180 Log: Eliminate the generated ldscript for arm and arm64, and strip $a/$d marker symbols from the linked kernel. The main thrust of this change is to generate a kernel that has the arm "marker" symbols stripped. Marker symbols start with $a, $d, $t or $x, and are emitted by the compiler to tell other toolchain components about the locations of data embedded in the instruction stream (literal-pool stuff). They are used for generating mixed-endian binaries (which we don't support). The linked kernel has approximately 21,000 such symbols in it, wasting space (500K in kernel.full, 190K in the final linked kernel), and sometimes obscuring function names in stack tracebacks. This change also simplifies the way the kernel is linked. Instead of using sed to generate two different ldscript files to generate both an elf kernel and a binary (elf headers stripped) kernel, we now use a single ldscript that refers to a "text_start" symbol, and we provide the value for that symbol using --defsym on the linker command line. Modified: head/sys/conf/Makefile.arm head/sys/conf/Makefile.arm64 head/sys/conf/ldscript.arm head/sys/conf/ldscript.arm64 Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Sun Dec 29 17:19:57 2019 (r356179) +++ head/sys/conf/Makefile.arm Sun Dec 29 18:17:12 2019 (r356180) @@ -32,9 +32,6 @@ S= ../../.. INCLUDES+= -I$S/contrib/libfdt -I$S/gnu/dts/include -SYSTEM_LD:= ${SYSTEM_LD:$S/conf/ldscript.$M=ldscript.$M} -SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscript.$M=ldscript.$M} - .if !defined(DEBUG) && !defined(PROFLEVEL) STRIP_FLAGS = -S .endif @@ -58,20 +55,41 @@ CFLAGS += -mllvm -arm-enable-ehabi KERNVIRTADDR= 0xc0000000 .endif +# Use a custom SYSTEM_LD command to generate the elf kernel, so we can +# set the text segment start address, and also strip the "arm mapping +# symbols" which have names like $a.0 and $d.2; see the document +# "ELF for the ARM architecture" for more info on the mapping symbols. +SYSTEM_LD= \ + ${SYSTEM_LD_BASECMD} \ + --defsym='text_start=${KERNVIRTADDR} + SIZEOF_HEADERS' \ + -o ${.TARGET} ${SYSTEM_OBJS} vers.o; \ + $(OBJCOPY) \ + --wildcard \ + --strip-symbol='$$[adt]*' \ + ${.TARGET} + +# Generate the .bin (no elf headers) kernel as an extra build output. +# We must relink to generate the .bin kernel, because without headers the +# location of everything changes. We also strip the ARM marker symbols. +KERNEL_EXTRA+= ${KERNEL_KO}.bin +KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin + +${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o + @echo "linking ${.TARGET}" + @${SYSTEM_LD_BASECMD} \ + --defsym='text_start=${KERNVIRTADDR}' \ + -o ${.TARGET} ${SYSTEM_OBJS} vers.o + ${SIZE} ${.TARGET} + @${OBJCOPY} \ + --wildcard \ + --strip-symbol='$$[adt]*' \ + --output-target=binary \ + ${.TARGET} + @chmod 755 ${.TARGET} + # hack because genassym.c includes sys/bus.h which includes these. genassym.o: bus_if.h device_if.h -SYSTEM_LD_ = ${LD} -m ${LD_EMULATION} -Bdynamic -T ldscript.$M.noheader \ - ${_LDFLAGS} --no-warn-mismatch --warn-common --export-dynamic \ - --dynamic-linker /red/herring \ - -o ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o -SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript.$M \ - >ldscript.$M.noheader; \ - ${SYSTEM_LD_}; \ - ${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \ - ${KERNEL_KO}.bin; \ - rm ${FULLKERNEL}.noheader - %BEFORE_DEPEND %OBJS @@ -84,10 +102,7 @@ SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript %CLEAN -CLEAN+= ldscript.$M ${KERNEL_KO}.bin ldscript.$M.noheader - -ldscript.$M: $S/conf/ldscript.$M - sed s/KERNVIRTADDR/${KERNVIRTADDR}/g > ldscript.$M < $S/conf/ldscript.$M +CLEAN+= ${KERNEL_KO}.bin %RULES Modified: head/sys/conf/Makefile.arm64 ============================================================================== --- head/sys/conf/Makefile.arm64 Sun Dec 29 17:19:57 2019 (r356179) +++ head/sys/conf/Makefile.arm64 Sun Dec 29 18:17:12 2019 (r356180) @@ -27,24 +27,42 @@ S= ../../.. INCLUDES+= -I$S/contrib/libfdt -#SYSTEM_LD:= ${SYSTEM_LD:$S/conf/ldscript.$M=ldscript.$M} -#SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscript.$M=ldscript.$M} +# Use a custom SYSTEM_LD command to generate the elf kernel, so we can +# set the text segment start address, and also strip the "arm mapping +# symbols" which have names like $a.0 and $d.2; see the document +# "ELF for the ARM architecture" for more info on the mapping symbols. +SYSTEM_LD= \ + ${SYSTEM_LD_BASECMD} \ + --defsym='text_start=kernbase + SIZEOF_HEADERS' \ + -o ${.TARGET} ${SYSTEM_OBJS} vers.o; \ + $(OBJCOPY) \ + --wildcard \ + --strip-symbol='$$[adtx]*' \ + ${.TARGET} +# Generate the .bin (no elf headers) kernel as an extra build output. +# We must relink to generate the .bin kernel, because without headers the +# location of everything changes. We also strip the ARM marker symbols. +KERNEL_EXTRA+= ${KERNEL_KO}.bin +KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin + +${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o + @echo "linking ${.TARGET}" + @${SYSTEM_LD_BASECMD} \ + --defsym='text_start=kernbase' \ + -o ${.TARGET} ${SYSTEM_OBJS} vers.o + ${SIZE} ${.TARGET} + @${OBJCOPY} \ + --wildcard \ + --strip-symbol='$$[adtx]*' \ + --output-target=binary \ + ${.TARGET} + @chmod 755 ${.TARGET} + .if !empty(DDB_ENABLED) CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer .endif -SYSTEM_LD_ = ${LD} -m ${LD_EMULATION} -Bdynamic -T ldscript.$M.noheader \ - ${_LDFLAGS} --no-warn-mismatch --warn-common --export-dynamic \ - --dynamic-linker /red/herring \ - -o ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o -SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// $(LDSCRIPT)\ - >ldscript.$M.noheader;\ - ${SYSTEM_LD_}; \ - ${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \ - ${KERNEL_KO}.bin; \ - rm ${FULLKERNEL}.noheader - %BEFORE_DEPEND %OBJS @@ -56,7 +74,7 @@ SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// $(LDSCRI %FILES.m %CLEAN -CLEAN+= ldscript.$M ${KERNEL_KO}.bin ldscript.$M.noheader +CLEAN+= ${KERNEL_KO}.bin %RULES Modified: head/sys/conf/ldscript.arm ============================================================================== --- head/sys/conf/ldscript.arm Sun Dec 29 17:19:57 2019 (r356179) +++ head/sys/conf/ldscript.arm Sun Dec 29 18:17:12 2019 (r356180) @@ -6,7 +6,7 @@ SEARCH_DIR(/usr/lib); SECTIONS { /* Read-only sections, merged into text segment: */ - . = KERNVIRTADDR + SIZEOF_HEADERS; + . = text_start; /* This is set using --defsym= on the command line. */ .text : { *(.text) Modified: head/sys/conf/ldscript.arm64 ============================================================================== --- head/sys/conf/ldscript.arm64 Sun Dec 29 17:19:57 2019 (r356179) +++ head/sys/conf/ldscript.arm64 Sun Dec 29 18:17:12 2019 (r356180) @@ -6,7 +6,7 @@ SEARCH_DIR(/usr/lib); SECTIONS { /* Read-only sections, merged into text segment: */ - . = kernbase + SIZEOF_HEADERS; + . = text_start; /* This is set using --defsym= on the command line. */ .text : { *(.text) From owner-svn-src-head@freebsd.org Sun Dec 29 18:20:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BC0D1E5E8B for ; Sun, 29 Dec 2019 18:20:27 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47m84V5R11z3wx6 for ; Sun, 29 Dec 2019 18:20:26 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1577643625; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=n+1/UZZVm3UwwSgl1PB2bZshTPs06v8pnD0D2zyTT1sDlCqg5nv+fjNT2ArP6vEtNz3xvfXh+eFDz xiahk3YDHED5LWkG5Z4fTJSh75HWF0aiW5CDAUaVHCaXDxzINrtxPx1+doJJ6ig8XESFWOKWnm+aP8 OQL8Eb1M8o/qV09ep5jON5mAcvmMauiomiyYSbViJF22d0CwAe+pOmnUn/vz3PByyzpEBWdGUqnsNJ hCjJjAvOj39H6AAUTDLz1MSvvSSCAR9gOMhEzIsi5pIi+dMUI7MeK9TUoTUp7Xfvfq9exI1ZvBxtGL yP6ypeAETYQfZ1N8FqlQCAMPDKbugxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=dStzFAHkojz29cfrU0S+vw+RMomjdsWUw8VuV0v8JPw=; b=AcGpme/FkyhbSREMbDgZS0CE74ObqTxstf6g9TOip+j7VfgYG7gSJ4tUuSU/2XnmgmOe9X+LYmG6a F/J0cPoUi6KyG2Bsgr929NN5MLzjWLFceXy4QdEmm8B4XZB8w6IitKTxhsNeECqLDWA6bxLWWIW4yK DFb3XaP4YFEDwy9WFQkQepSf47TQgb5hVBkzDfF+l2Hs+0jK+KN76k/ajSThCwFRdKvoZlZoxOQydT J+vz4UPl03LAVhiAO67TVAkiFAO9ElwD/1NEbEnu/Mg6d3J+gGX49vyXi3W9uZXjpzEyJmezRcsNgl BB2tl1ClQ8rbHzdeCIMIdjG+vkkMEHQ== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=dStzFAHkojz29cfrU0S+vw+RMomjdsWUw8VuV0v8JPw=; b=B4OdSDURfnbbkTpzI9D190C6aDn0nB9j3n+fT/1QjQ5HsRilvu6qczn2Ha5PiDCHsO8m5P+rDcQvn 6HAHcc3JUKLPbK3vVqAIcWn0xx3wxzVFhX3HNOd+IwV2TSNIu4nlD7zaDV+JbNc89d0psU8ZMuMR20 gEibo4xG8o8hlqF2AFst4YprznPdRLkZEA5wYoWG+qA7w9zP5CohAOZ7m4jppiUYY9CbcsOFyrzk+i eA89A/rToFXNudzTgInEL5xVXhDQ5AXywOa9M/ntJzsd8S1yyDMEdtonjKpiD0cHXf9p7riaWgiFVJ DdmA+ZdiRh0EtQHxg2i7bIanlT0FX2w== X-MHO-RoutePath: aGlwcGll X-MHO-User: e0f19d56-2a67-11ea-b80d-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id e0f19d56-2a67-11ea-b80d-052b4a66b6b2; Sun, 29 Dec 2019 18:20:24 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xBTIKNb0098240; Sun, 29 Dec 2019 11:20:23 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r356180 - head/sys/conf From: Ian Lepore To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 29 Dec 2019 11:20:23 -0700 In-Reply-To: <201912291817.xBTIHCda003923@repo.freebsd.org> References: <201912291817.xBTIHCda003923@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47m84V5R11z3wx6 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.97 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-0.996,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 18:20:27 -0000 On Sun, 2019-12-29 at 18:17 +0000, Ian Lepore wrote: > Author: ian > Date: Sun Dec 29 18:17:12 2019 > New Revision: 356180 > URL: https://svnweb.freebsd.org/changeset/base/356180 > > Log: > Eliminate the generated ldscript for arm and arm64, and strip $a/$d marker > symbols from the linked kernel. > > The main thrust of this change is to generate a kernel that has the arm > "marker" symbols stripped. Marker symbols start with $a, $d, $t or $x, and > are emitted by the compiler to tell other toolchain components about the > locations of data embedded in the instruction stream (literal-pool > stuff). They are used for generating mixed-endian binaries (which we don't > support). The linked kernel has approximately 21,000 such symbols in it, > wasting space (500K in kernel.full, 190K in the final linked kernel), and > sometimes obscuring function names in stack tracebacks. > > This change also simplifies the way the kernel is linked. Instead of using > sed to generate two different ldscript files to generate both an elf kernel > and a binary (elf headers stripped) kernel, we now use a single ldscript > that refers to a "text_start" symbol, and we provide the value for that > symbol using --defsym on the linker command line. > Doh! Differential Revision: https://reviews.freebsd.org/D22922 -- Ian From owner-svn-src-head@freebsd.org Sun Dec 29 19:21:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 306F01E73FD; Sun, 29 Dec 2019 19:21:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m9Qy0bQpz41PM; Sun, 29 Dec 2019 19:21:30 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F9B61E2BA; Sun, 29 Dec 2019 19:21:30 +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 xBTJLTAs044888; Sun, 29 Dec 2019 19:21:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTJLTkQ044887; Sun, 29 Dec 2019 19:21:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912291921.xBTJLTkQ044887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 29 Dec 2019 19:21:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356181 - head/sys/geom/virstor X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom/virstor X-SVN-Commit-Revision: 356181 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 19:21:30 -0000 Author: mav Date: Sun Dec 29 19:21:29 2019 New Revision: 356181 URL: https://svnweb.freebsd.org/changeset/base/356181 Log: Fix GEOM_VIRSTOR orphanization. Previous code closed and destroyed consumer even with I/O in progress. This patch postpones the destruction till the last close. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/virstor/g_virstor.c Modified: head/sys/geom/virstor/g_virstor.c ============================================================================== --- head/sys/geom/virstor/g_virstor.c Sun Dec 29 18:17:12 2019 (r356180) +++ head/sys/geom/virstor/g_virstor.c Sun Dec 29 19:21:29 2019 (r356181) @@ -909,7 +909,7 @@ remove_component(struct g_virstor_softc *sc, struct g_ } if (c->acr > 0 || c->acw > 0 || c->ace > 0) - g_access(c, -c->acr, -c->acw, -c->ace); + return; if (delay) { /* Destroy consumer after it's tasted */ g_post_event(delay_destroy_consumer, c, M_WAITOK, NULL); @@ -1400,7 +1400,7 @@ g_virstor_orphan(struct g_consumer *cp) KASSERT(comp != NULL, ("%s: No component in private part of consumer", __func__)); remove_component(sc, comp, FALSE); - if (virstor_valid_components(sc) == 0) + if (LIST_EMPTY(&gp->consumer)) virstor_geom_destroy(sc, TRUE, FALSE); } @@ -1410,7 +1410,7 @@ g_virstor_orphan(struct g_consumer *cp) static int g_virstor_access(struct g_provider *pp, int dr, int dw, int de) { - struct g_consumer *c; + struct g_consumer *c, *c2, *tmp; struct g_virstor_softc *sc; struct g_geom *gp; int error; @@ -1420,46 +1420,40 @@ g_virstor_access(struct g_provider *pp, int dr, int dw KASSERT(gp != NULL, ("%s: NULL geom", __func__)); sc = gp->softc; - if (sc == NULL) { - /* It seems that .access can be called with negative dr,dw,dx - * in this case but I want to check for myself */ - LOG_MSG(LVL_WARNING, "access(%d, %d, %d) for %s", - dr, dw, de, pp->name); - /* This should only happen when geom is withered so - * allow only negative requests */ - KASSERT(dr <= 0 && dw <= 0 && de <= 0, - ("%s: Positive access for %s", __func__, pp->name)); - if (pp->acr + dr == 0 && pp->acw + dw == 0 && pp->ace + de == 0) - LOG_MSG(LVL_DEBUG, "Device %s definitely destroyed", - pp->name); - return (0); - } - /* Grab an exclusive bit to propagate on our consumers on first open */ if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) de++; /* ... drop it on close */ if (pp->acr + dr == 0 && pp->acw + dw == 0 && pp->ace + de == 0) { de--; - update_metadata(sc); /* Writes statistical information */ + if (sc != NULL) + update_metadata(sc); } error = ENXIO; - LIST_FOREACH(c, &gp->consumer, consumer) { - KASSERT(c != NULL, ("%s: consumer is NULL", __func__)); + LIST_FOREACH_SAFE(c, &gp->consumer, consumer, tmp) { error = g_access(c, dr, dw, de); - if (error != 0) { - struct g_consumer *c2; - - /* Backout earlier changes */ - LIST_FOREACH(c2, &gp->consumer, consumer) { - if (c2 == c) /* all eariler components fixed */ - return (error); - g_access(c2, -dr, -dw, -de); - } + if (error != 0) + goto fail; + if (c->acr == 0 && c->acw == 0 && c->ace == 0 && + c->flags & G_CF_ORPHAN) { + g_detach(c); + g_destroy_consumer(c); } } + if (sc != NULL && LIST_EMPTY(&gp->consumer)) + virstor_geom_destroy(sc, TRUE, FALSE); + + return (error); + +fail: + /* Backout earlier changes */ + LIST_FOREACH(c2, &gp->consumer, consumer) { + if (c2 == c) + break; + g_access(c2, -dr, -dw, -de); + } return (error); } From owner-svn-src-head@freebsd.org Sun Dec 29 19:33:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47F611E77D5; Sun, 29 Dec 2019 19:33:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m9j21C48z427V; Sun, 29 Dec 2019 19:33:42 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 249FC1E4DC; Sun, 29 Dec 2019 19:33:42 +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 xBTJXg8h052696; Sun, 29 Dec 2019 19:33:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTJXglQ052695; Sun, 29 Dec 2019 19:33:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912291933.xBTJXglQ052695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 29 Dec 2019 19:33:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356182 - head/sys/geom/shsec X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom/shsec X-SVN-Commit-Revision: 356182 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 19:33:42 -0000 Author: mav Date: Sun Dec 29 19:33:41 2019 New Revision: 356182 URL: https://svnweb.freebsd.org/changeset/base/356182 Log: Missed part of r356162. If we postpone consumer destruction till close, then the close calls should not be ignored. Delay geom withering till the last close too. MFC after: 2 weeks X-MFC-with: r356162 Sponsored by: iXsystems, Inc. Modified: head/sys/geom/shsec/g_shsec.c Modified: head/sys/geom/shsec/g_shsec.c ============================================================================== --- head/sys/geom/shsec/g_shsec.c Sun Dec 29 19:21:29 2019 (r356181) +++ head/sys/geom/shsec/g_shsec.c Sun Dec 29 19:33:41 2019 (r356182) @@ -184,7 +184,7 @@ g_shsec_orphan(struct g_consumer *cp) g_shsec_remove_disk(cp); /* If there are no valid disks anymore, remove device. */ - if (g_shsec_nvalid(sc) == 0) + if (LIST_EMPTY(&gp->consumer)) g_shsec_destroy(sc, 1); } @@ -199,21 +199,6 @@ g_shsec_access(struct g_provider *pp, int dr, int dw, gp = pp->geom; sc = gp->softc; - if (sc == NULL) { - /* - * It looks like geom is being withered. - * In that case we allow only negative requests. - */ - KASSERT(dr <= 0 && dw <= 0 && de <= 0, - ("Positive access request (device=%s).", pp->name)); - if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 && - (pp->ace + de) == 0) { - G_SHSEC_DEBUG(0, "Device %s definitely destroyed.", - gp->name); - } - return (0); - } - /* On first open, grab an extra "exclusive" bit */ if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) de++; @@ -232,6 +217,11 @@ g_shsec_access(struct g_provider *pp, int dr, int dw, g_destroy_consumer(cp1); } } + + /* If there are no valid disks anymore, remove device. */ + if (LIST_EMPTY(&gp->consumer)) + g_shsec_destroy(sc, 1); + return (error); fail: From owner-svn-src-head@freebsd.org Sun Dec 29 20:01:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCF7D1E8074; Sun, 29 Dec 2019 20:01:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mBJb4cq7z436J; Sun, 29 Dec 2019 20:01:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99EE21E8C8; Sun, 29 Dec 2019 20:01:03 +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 xBTK13Wl065398; Sun, 29 Dec 2019 20:01:03 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTK13jq065397; Sun, 29 Dec 2019 20:01:03 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912292001.xBTK13jq065397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 29 Dec 2019 20:01:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356183 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356183 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 20:01:03 -0000 Author: markj Date: Sun Dec 29 20:01:03 2019 New Revision: 356183 URL: https://svnweb.freebsd.org/changeset/base/356183 Log: Restore a vm_page_wired() check in vm_page_mvqueue() after r356156. We now set PGA_DEQUEUE on a managed page when it is wired after allocation, and vm_page_mvqueue() ignores pages with this flag set, ensuring that they do not end up in the page queues. However, this is not sufficient for managed fictitious pages or pages managed by the TTM. In particular, the TTM makes use of the plinks.q queue linkage fields for its own purposes. PR: 242961 Reported and tested by: Greg V Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Dec 29 19:33:41 2019 (r356182) +++ head/sys/vm/vm_page.c Sun Dec 29 20:01:03 2019 (r356183) @@ -4010,7 +4010,7 @@ vm_page_mvqueue(vm_page_t m, const uint8_t nqueue, con KASSERT(nflag == PGA_REQUEUE || nflag == PGA_REQUEUE_HEAD, ("%s: invalid flags %x", __func__, nflag)); - if ((m->oflags & VPO_UNMANAGED) != 0) + if ((m->oflags & VPO_UNMANAGED) != 0 || vm_page_wired(m)) return; old = vm_page_astate_load(m); From owner-svn-src-head@freebsd.org Sun Dec 29 20:57:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2F661E9465; Sun, 29 Dec 2019 20:57:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mCZ569tqz45b0; Sun, 29 Dec 2019 20:57: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF2AB1F321; Sun, 29 Dec 2019 20:57: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 xBTKvnXZ000711; Sun, 29 Dec 2019 20:57:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTKvnvM000710; Sun, 29 Dec 2019 20:57:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912292057.xBTKvnvM000710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 29 Dec 2019 20:57:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356184 - head/usr.sbin/powerd X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.sbin/powerd X-SVN-Commit-Revision: 356184 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 20:57:50 -0000 Author: markj Date: Sun Dec 29 20:57:49 2019 New Revision: 356184 URL: https://svnweb.freebsd.org/changeset/base/356184 Log: powerd(8): Fix a memory leak when we fail to read frequency levels. PR: 242967 Submitted by: Hans Christian Woithe MFC after: 3 days Modified: head/usr.sbin/powerd/powerd.c Modified: head/usr.sbin/powerd/powerd.c ============================================================================== --- head/usr.sbin/powerd/powerd.c Sun Dec 29 20:01:03 2019 (r356183) +++ head/usr.sbin/powerd/powerd.c Sun Dec 29 20:57:49 2019 (r356184) @@ -196,8 +196,10 @@ read_freqs(int *numfreqs, int **freqs, int **power, in return (-1); if ((freqstr = malloc(len)) == NULL) return (-1); - if (sysctl(levels_mib, 4, freqstr, &len, NULL, 0)) + if (sysctl(levels_mib, 4, freqstr, &len, NULL, 0)) { + free(freqstr); return (-1); + } *numfreqs = 1; for (p = freqstr; *p != '\0'; p++) From owner-svn-src-head@freebsd.org Sun Dec 29 21:16:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E84E21EA904; Sun, 29 Dec 2019 21:16:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mCz95cjRz47fb; Sun, 29 Dec 2019 21:16:05 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7D271F7E7; Sun, 29 Dec 2019 21:16:05 +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 xBTLG5jb012815; Sun, 29 Dec 2019 21:16:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTLG4kV012809; Sun, 29 Dec 2019 21:16:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912292116.xBTLG4kV012809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 29 Dec 2019 21:16:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356185 - in head: lib/geom lib/geom/sched sys/geom sys/geom/sched sys/modules/geom sys/modules/geom/geom_sched sys/sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: lib/geom lib/geom/sched sys/geom sys/geom/sched sys/modules/geom sys/modules/geom/geom_sched sys/sys X-SVN-Commit-Revision: 356185 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 21:16:06 -0000 Author: mav Date: Sun Dec 29 21:16:03 2019 New Revision: 356185 URL: https://svnweb.freebsd.org/changeset/base/356185 Log: Remove GEOM_SCHED class and gsched tool. This code was not actively maintained since it was introduced 10 years ago. It lacks support for many later GEOM features, such as direct dispatch, unmapped I/O, stripesize/stripeoffset, resize, etc. Plus it is the only remaining use of GEOM nstart/nend request counters, used there to implement live insertion/removal, questionable by itself. Plus, as number of people commented, GEOM is not the best place for I/O scheduler, since it has limited information about layers both above and below it, required for efficient scheduling. Plus with the modern shift to SSDs there is just no more significant need for this kind of scheduling. Approved by: imp, phk, luigi Relnotes: yes Deleted: head/lib/geom/sched/ head/sys/geom/sched/ head/sys/modules/geom/geom_sched/ Modified: head/lib/geom/Makefile.classes head/sys/geom/geom.h head/sys/geom/geom_io.c head/sys/modules/geom/Makefile head/sys/sys/bio.h head/sys/sys/ktr_class.h head/sys/sys/param.h Modified: head/lib/geom/Makefile.classes ============================================================================== --- head/lib/geom/Makefile.classes Sun Dec 29 20:57:49 2019 (r356184) +++ head/lib/geom/Makefile.classes Sun Dec 29 21:16:03 2019 (r356185) @@ -20,7 +20,6 @@ GEOM_CLASSES+= nop GEOM_CLASSES+= part GEOM_CLASSES+= raid GEOM_CLASSES+= raid3 -GEOM_CLASSES+= sched GEOM_CLASSES+= shsec GEOM_CLASSES+= stripe GEOM_CLASSES+= virstor Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Sun Dec 29 20:57:49 2019 (r356184) +++ head/sys/geom/geom.h Sun Dec 29 21:16:03 2019 (r356185) @@ -231,17 +231,6 @@ struct g_provider { u_int index; }; -/* - * Descriptor of a classifier. We can register a function and - * an argument, which is called by g_io_request() on bio's - * that are not previously classified. - */ -struct g_classifier_hook { - TAILQ_ENTRY(g_classifier_hook) link; - int (*func)(void *arg, struct bio *bp); - void *arg; -}; - /* BIO_GETATTR("GEOM::setstate") argument values. */ #define G_STATE_FAILED 0 #define G_STATE_REBUILD 1 @@ -344,8 +333,6 @@ int g_io_getattr(const char *attr, struct g_consumer * int g_io_zonecmd(struct disk_zone_args *zone_args, struct g_consumer *cp); int g_io_flush(struct g_consumer *cp); int g_io_speedup(size_t shortage, u_int flags, size_t *resid, struct g_consumer *cp); -int g_register_classifier(struct g_classifier_hook *hook); -void g_unregister_classifier(struct g_classifier_hook *hook); void g_io_request(struct bio *bp, struct g_consumer *cp); struct bio *g_new_bio(void); struct bio *g_alloc_bio(void); Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Sun Dec 29 20:57:49 2019 (r356184) +++ head/sys/geom/geom_io.c Sun Dec 29 21:16:03 2019 (r356185) @@ -87,15 +87,6 @@ static volatile u_int __read_mostly pace; static uma_zone_t __read_mostly biozone; -/* - * The head of the list of classifiers used in g_io_request. - * Use g_register_classifier() and g_unregister_classifier() - * to add/remove entries to the list. - * Classifiers are invoked in registration order. - */ -static TAILQ_HEAD(, g_classifier_hook) g_classifier_tailq __read_mostly = - TAILQ_HEAD_INITIALIZER(g_classifier_tailq); - #include static void @@ -224,9 +215,6 @@ g_clone_bio(struct bio *bp) if (bp->bio_cmd == BIO_ZONE) bcopy(&bp->bio_zone, &bp2->bio_zone, sizeof(bp->bio_zone)); - /* Inherit classification info from the parent */ - bp2->bio_classifier1 = bp->bio_classifier1; - bp2->bio_classifier2 = bp->bio_classifier2; #if defined(BUF_TRACKING) || defined(FULL_BUF_TRACKING) bp2->bio_track_bp = bp->bio_track_bp; #endif @@ -498,66 +486,7 @@ g_io_check(struct bio *bp) return (EJUSTRETURN); } -/* - * bio classification support. - * - * g_register_classifier() and g_unregister_classifier() - * are used to add/remove a classifier from the list. - * The list is protected using the g_bio_run_down lock, - * because the classifiers are called in this path. - * - * g_io_request() passes bio's that are not already classified - * (i.e. those with bio_classifier1 == NULL) to g_run_classifiers(). - * Classifiers can store their result in the two fields - * bio_classifier1 and bio_classifier2. - * A classifier that updates one of the fields should - * return a non-zero value. - * If no classifier updates the field, g_run_classifiers() sets - * bio_classifier1 = BIO_NOTCLASSIFIED to avoid further calls. - */ - -int -g_register_classifier(struct g_classifier_hook *hook) -{ - - g_bioq_lock(&g_bio_run_down); - TAILQ_INSERT_TAIL(&g_classifier_tailq, hook, link); - g_bioq_unlock(&g_bio_run_down); - - return (0); -} - void -g_unregister_classifier(struct g_classifier_hook *hook) -{ - struct g_classifier_hook *entry; - - g_bioq_lock(&g_bio_run_down); - TAILQ_FOREACH(entry, &g_classifier_tailq, link) { - if (entry == hook) { - TAILQ_REMOVE(&g_classifier_tailq, hook, link); - break; - } - } - g_bioq_unlock(&g_bio_run_down); -} - -static void -g_run_classifiers(struct bio *bp) -{ - struct g_classifier_hook *hook; - int classified = 0; - - biotrack(bp, __func__); - - TAILQ_FOREACH(hook, &g_classifier_tailq, link) - classified |= hook->func(hook->arg, bp); - - if (!classified) - bp->bio_classifier1 = BIO_NOTCLASSIFIED; -} - -void g_io_request(struct bio *bp, struct g_consumer *cp) { struct g_provider *pp; @@ -639,12 +568,6 @@ g_io_request(struct bio *bp, struct g_consumer *cp) #else direct = 0; #endif - - if (!TAILQ_EMPTY(&g_classifier_tailq) && !bp->bio_classifier1) { - g_bioq_lock(&g_bio_run_down); - g_run_classifiers(bp); - g_bioq_unlock(&g_bio_run_down); - } /* * The statistics collection is lockless, as such, but we Modified: head/sys/modules/geom/Makefile ============================================================================== --- head/sys/modules/geom/Makefile Sun Dec 29 20:57:49 2019 (r356184) +++ head/sys/modules/geom/Makefile Sun Dec 29 21:16:03 2019 (r356185) @@ -19,7 +19,6 @@ SUBDIR= geom_bde \ geom_part \ geom_raid \ geom_raid3 \ - geom_sched \ geom_shsec \ geom_stripe \ geom_uzip \ Modified: head/sys/sys/bio.h ============================================================================== --- head/sys/sys/bio.h Sun Dec 29 20:57:49 2019 (r356184) +++ head/sys/sys/bio.h Sun Dec 29 21:16:03 2019 (r356185) @@ -79,9 +79,6 @@ struct disk; struct bio; struct vm_map; -/* Empty classifier tag, to prevent further classification. */ -#define BIO_NOTCLASSIFIED (void *)(~0UL) - typedef void bio_task_t(void *); /* @@ -122,8 +119,8 @@ struct bio { bio_task_t *bio_task; /* Task_queue handler */ void *bio_task_arg; /* Argument to above */ - void *bio_classifier1; /* Classifier tag. */ - void *bio_classifier2; /* Classifier tag. */ + void *bio_spare1; + void *bio_spare2; #ifdef DIAGNOSTIC void *_bio_caller1; Modified: head/sys/sys/ktr_class.h ============================================================================== --- head/sys/sys/ktr_class.h Sun Dec 29 20:57:49 2019 (r356184) +++ head/sys/sys/ktr_class.h Sun Dec 29 21:16:03 2019 (r356185) @@ -58,7 +58,7 @@ #define KTR_SYSC 0x00002000 /* System call */ #define KTR_INIT 0x00004000 /* System initialization */ #define KTR_SPARE3 0x00008000 /* cxgb, drm2, ioat, ntb */ -#define KTR_SPARE4 0x00010000 /* geom_sched */ +#define KTR_SPARE4 0x00010000 #define KTR_EVH 0x00020000 /* Eventhandler */ #define KTR_VFS 0x00040000 /* VFS events */ #define KTR_VOP 0x00080000 /* Auto-generated vop events */ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sun Dec 29 20:57:49 2019 (r356184) +++ head/sys/sys/param.h Sun Dec 29 21:16:03 2019 (r356185) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300071 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300072 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Sun Dec 29 21:46:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0825A1EB324; Sun, 29 Dec 2019 21:46:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mDdh6SjVz48kD; Sun, 29 Dec 2019 21:46:00 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D92771FD3F; Sun, 29 Dec 2019 21:46:00 +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 xBTLk07D030145; Sun, 29 Dec 2019 21:46:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTLk0do030144; Sun, 29 Dec 2019 21:46:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912292146.xBTLk0do030144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 29 Dec 2019 21:46:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356186 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 356186 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 21:46:01 -0000 Author: markj Date: Sun Dec 29 21:46:00 2019 New Revision: 356186 URL: https://svnweb.freebsd.org/changeset/base/356186 Log: Add ARMv8 static relocation types used for control flow instructions. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Sun Dec 29 21:16:03 2019 (r356185) +++ head/sys/sys/elf_common.h Sun Dec 29 21:46:00 2019 (r356186) @@ -999,6 +999,10 @@ typedef struct { #define R_AARCH64_PREL64 260 /* PC relative */ #define R_AARCH64_PREL32 261 /* PC relative, 32-bit overflow check */ #define R_AARCH64_PREL16 262 /* PC relative, 16-bit overflow check */ +#define R_AARCH64_TSTBR14 279 /* TBZ/TBNZ immediate */ +#define R_AARCH64_CONDBR19 280 /* Conditional branch immediate */ +#define R_AARCH64_JUMP26 282 /* Branch immediate */ +#define R_AARCH64_CALL26 283 /* Call immediate */ #define R_AARCH64_COPY 1024 /* Copy data from shared object */ #define R_AARCH64_GLOB_DAT 1025 /* Set GOT entry to data address */ #define R_AARCH64_JUMP_SLOT 1026 /* Set GOT entry to code address */ From owner-svn-src-head@freebsd.org Sun Dec 29 21:46:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D7AE1EB3DA; Sun, 29 Dec 2019 21:46:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mDfg0yMMz48rn; Sun, 29 Dec 2019 21:46:51 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C24B1FD40; Sun, 29 Dec 2019 21:46:51 +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 xBTLkodD030217; Sun, 29 Dec 2019 21:46:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTLkolx030216; Sun, 29 Dec 2019 21:46:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912292146.xBTLkolx030216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 29 Dec 2019 21:46:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356187 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 356187 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 21:46:51 -0000 Author: markj Date: Sun Dec 29 21:46:50 2019 New Revision: 356187 URL: https://svnweb.freebsd.org/changeset/base/356187 Log: Add libdtrace support for arm64 USDT probes. arm64 is still lacking a fasttrap implementation, which is required to actually enable userland probes, but this at least allows USDT probes to be linked into userland applications. Submitted by: Klaus Küchemann (original) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22360 Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Sun Dec 29 21:46:00 2019 (r356186) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Sun Dec 29 21:46:50 2019 (r356187) @@ -229,9 +229,10 @@ prepare_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, for (j = 0; j < nrel; j++) { #if defined(__aarch64__) -/* XXX */ - printf("%s:%s(%d): aarch64 not implemented\n", - __FUNCTION__, __FILE__, __LINE__); + rel->r_offset = s->dofs_offset + + dofr[j].dofr_offset; + rel->r_info = ELF32_R_INFO(count + dep->de_global, + R_ARM_REL32); #elif defined(__arm__) /* XXX */ printf("%s:%s(%d): arm not implemented\n", @@ -425,7 +426,10 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, for (j = 0; j < nrel; j++) { #if defined(__aarch64__) -/* XXX */ + rel->r_offset = s->dofs_offset + + dofr[j].dofr_offset; + rel->r_info = ELF64_R_INFO(count + dep->de_global, + R_AARCH64_PREL64); #elif defined(__arm__) /* XXX */ #elif defined(__mips__) @@ -541,6 +545,8 @@ dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in elf_file.ehdr.e_machine = EM_SPARC; #elif defined(__i386) || defined(__amd64) elf_file.ehdr.e_machine = EM_386; +#elif defined(__aarch64__) + elf_file.ehdr.e_machine = EM_AARCH64; #endif elf_file.ehdr.e_version = EV_CURRENT; elf_file.ehdr.e_shoff = sizeof (Elf32_Ehdr); @@ -687,6 +693,8 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in elf_file.ehdr.e_machine = EM_SPARCV9; #elif defined(__i386) || defined(__amd64) elf_file.ehdr.e_machine = EM_AMD64; +#elif defined(__aarch64__) + elf_file.ehdr.e_machine = EM_AARCH64; #endif elf_file.ehdr.e_version = EV_CURRENT; elf_file.ehdr.e_shoff = sizeof (Elf64_Ehdr); @@ -802,14 +810,66 @@ dt_symtab_lookup(Elf_Data *data_sym, int start, int en } #if defined(__aarch64__) -/* XXX */ +#define DT_OP_NOP 0xd503201f +#define DT_OP_RET 0xd65f03c0 +#define DT_OP_CALL26 0x94000000 +#define DT_OP_JUMP26 0x14000000 + static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, uint32_t *off) { - printf("%s:%s(%d): aarch64 not implemented\n", __FUNCTION__, __FILE__, - __LINE__); - return (-1); + uint32_t *ip; + + /* + * Ensure that the offset is aligned on an instruction boundary. + */ + if ((rela->r_offset & (sizeof (uint32_t) - 1)) != 0) + return (-1); + + /* + * We only know about some specific relocation types. + * We also recognize relocation type NONE, since that gets used for + * relocations of USDT probes, and we might be re-processing a file. + */ + if (GELF_R_TYPE(rela->r_info) != R_AARCH64_CALL26 && + GELF_R_TYPE(rela->r_info) != R_AARCH64_JUMP26 && + GELF_R_TYPE(rela->r_info) != R_AARCH64_NONE) + return (-1); + + ip = (uint32_t *)(p + rela->r_offset); + + /* + * We may have already processed this object file in an earlier linker + * invocation. Check to see if the present instruction sequence matches + * the one we would install below. + */ + if (ip[0] == DT_OP_NOP || ip[0] == DT_OP_RET) + return (0); + + /* + * We only expect call instructions with a displacement of 0, or a jump + * instruction acting as a tail call. + */ + if (ip[0] != DT_OP_CALL26 && ip[0] != DT_OP_JUMP26) { + dt_dprintf("found %x instead of a call or jmp instruction at " + "%llx\n", ip[0], (u_longlong_t)rela->r_offset); + return (-1); + } + + /* + * On arm64, we do not have to differentiate between regular probes and + * is-enabled probes. Both cases are encoded as a regular branch for + * non-tail call locations, and a jump for tail call locations. Calls + * are to be converted into a no-op whereas jumps should become a + * return. + */ + if (ip[0] == DT_OP_CALL26) + ip[0] = DT_OP_NOP; + else + ip[0] = DT_OP_RET; + + return (0); } #elif defined(__arm__) /* XXX */ @@ -1254,6 +1314,8 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e emachine1 = emachine2 = EM_SPARCV9; #elif defined(__i386) || defined(__amd64) emachine1 = emachine2 = EM_AMD64; +#elif defined(__aarch64__) + emachine1 = emachine2 = EM_AARCH64; #endif symsize = sizeof (Elf64_Sym); } else { From owner-svn-src-head@freebsd.org Sun Dec 29 22:18:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A0081EC918; Sun, 29 Dec 2019 22:18:44 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-yw1-xc35.google.com (mail-yw1-xc35.google.com [IPv6:2607:f8b0:4864:20::c35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mFMS2BFtz4C9f; Sun, 29 Dec 2019 22:18:44 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-yw1-xc35.google.com with SMTP id t141so13458710ywc.11; Sun, 29 Dec 2019 14:18:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=b/8vejs0xnZxMHQEl4L24IDmb9C7W3RYxSUZzqzSVsc=; b=WYnjyR116LSPFEHdyoqR4cppSFqfNSZgR0hsBEJ67yCCuJcz/g5QDlh0cmIAmvccWk YIjiWxZvFYWfRq/li83D1FHY4WJgVy0pWCDKgl0ejNTbjkhwYFi6Z4kNwIIyFrTFKhy6 kTQapRj0xVhNCkh2ErnTOrvcKIaZYAtqMwibBIWchdQ1tILS8OiW92TYsLIvOzG9buNs KTe/hxEjAcCnaqDIpt+0Vp7G49BTpNPTfk4prfrj23nxF2aBtSPiCEnHz6CCXLmyFbBc bJnc9PG1km/g8MxQPZrd7ct5p3sMt4Hq9vvdSBHI6kSOP+a17QJfo7jgHvzpvpcJyR0x sR3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=b/8vejs0xnZxMHQEl4L24IDmb9C7W3RYxSUZzqzSVsc=; b=R4nPHB2s6zyhH/yTaCP2OpVdcPUtUPQN0a2p5JDJPJAo+LQ+kl5oDb1fRPsMgJ+VcD Ka8d/SlvjvFDnP0Ci2q5iVuNCkuGaXhyKIxrv1IiMll+fRd5VRRi+Tvr+9Y7v8NKgzBz nEJqsBZED1Vc7uYs/ztJajmOfs32GwK4CLBqqaYQQcglZ7GX4jNASuFGz9kQQykExxu6 sHvozjYQo3OYM3YRakjYuJCaSyND92cVfM8sBsWwPLAITbGQcJyFvJHj+ipDI5Qg2nCr Igk/z3QEErXISorRWqCi34bVDqQ6ck1i14rskTSIe2ZP467H44Chw9XnnvhI6KQT9LhS LEVA== X-Gm-Message-State: APjAAAXeueMcUu5nryXS6tMehKYdCYU2frtVmpuxbeWNNwzIQN93SHj5 U4I7zC7yBt9Tw4BVjR+SJCx3fCAafHdSzq/jG8Ub3A== X-Google-Smtp-Source: APXvYqxKcCz4Cze4f2VQnFcLZsnas1EIKF8AGYfg7RzyvZWZfU1Rnkf+ZJUFYJJl1aJ5RFAtbPXRgyRxO4x3fh1tLuc= X-Received: by 2002:a81:f81:: with SMTP id 123mr46504174ywp.268.1577657922971; Sun, 29 Dec 2019 14:18:42 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:3816:0:0:0:0:0 with HTTP; Sun, 29 Dec 2019 14:18:42 -0800 (PST) In-Reply-To: <20191229165032.GC30375@raichu> References: <201912281904.xBSJ4T19064948@repo.freebsd.org> <20191229165032.GC30375@raichu> From: Oliver Pinter Date: Sun, 29 Dec 2019 23:18:42 +0100 Message-ID: Subject: Re: svn commit: r356159 - head/sys/vm To: Mark Johnston Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 47mFMS2BFtz4C9f X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 22:18:44 -0000 Thanks for the detailed answer Mark! On Sunday, December 29, 2019, Mark Johnston wrote: > On Sun, Dec 29, 2019 at 03:39:55AM +0100, Oliver Pinter wrote: > > Is there any performance measurement from before and after. It would be > > nice to see them. > > I did not do extensive benchmarking. The aim of the patch set was > simply to remove the use of the hashed page lock, since it shows up > prominently in lock profiles of some workloads. The problem is that we > acquire these locks any time a page's LRU state is updated, and the use > of the hash lock means that we get false sharing. The solution is to > implement these state updates using atomic operations on the page > structure itself, making data contention much less likely. Another > option was to embed a mutex into the vm_page structure, but this would > bloat a structure which is already too large. > > A secondary goal was to reduce the number of locks held during page > queue scans. Such scans frequently call pmap_ts_referenced() to collect > info about recent references to the page. This operation can be > expensive since it may require a TLB shootdown, and it can block for a > long time on the pmap lock, for example if the lock holder is copying > the page tables as part of a fork(). Now, the active queue scan body is > executed without any locks held, so a page daemon thread blocked on a > pmap lock no longer has the potential to block other threads by holding > on to a shared page lock. Before, the page daemon could block faulting > threads for a long time, hurting latency. I don't have any benchmarks > that capture this, but it's something that I've observed in production > workloads. > > I used some microbenchmarks to verify that the change did not penalize > the single-threaded case. Here are some results on a 64-core arm64 > system I have been playing with: > https://people.freebsd.org/~markj/arm64_page_lock/ > > The benchmark from will-it-scale simply maps 128MB of anonymous memory, > faults on each page, and unmaps it, in a loop. In the fault handler we > allocate a page and insert it into the active queue, and the unmap > operation removes all of those pages from the queue. I collected the > throughput for 1, 2, 4, 8, 16 and 32 concurrent processes. > > With my patches we see some modest gains at low concurrency. At higher > levels of concurrency we actually get lower throughput than before as > contention moves from the page locks and the page queue lock to just the > page queue lock. I don't believe this is a real regression: first, the > benchmark is quite extreme relative to any useful workload, and second, > arm64 suffers from using a much smaller batch size than amd64 for > batched page queue operations. Changing that pushes the results out > somewhat. Some earlier testing on a 2-socket Xeon system showed a > similar pattern with smaller differences. > From owner-svn-src-head@freebsd.org Mon Dec 30 00:46:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A34CA1D0017; Mon, 30 Dec 2019 00:46:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mJdb3pfPz4L0D; Mon, 30 Dec 2019 00:46:11 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79CFD21D5D; Mon, 30 Dec 2019 00:46: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 xBU0kBge035307; Mon, 30 Dec 2019 00:46:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBU0kAhm035303; Mon, 30 Dec 2019 00:46:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912300046.xBU0kAhm035303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 30 Dec 2019 00:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356192 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 356192 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 00:46:11 -0000 Author: mav Date: Mon Dec 30 00:46:10 2019 New Revision: 356192 URL: https://svnweb.freebsd.org/changeset/base/356192 Log: Retire nstart/nend counters. Those counters were abused for decade to workaround broken orphanization process in different classes by delaying the call while there are active requests. But from one side it did not close all the races, while from another was quite expensive on SMP due to trashing twice per request cache lines of consumer and provider and requiring locks. It lost its sense after I manually went through all the GEOM classes in base and made orphanization wait for either provider close or request completion. Consumer counters are still used under INVARIANTS to detect premature consumer close and detach. Provider counters are removed completely. Sponsored by: iXsystems, Inc. Modified: head/sys/geom/geom.h head/sys/geom/geom_event.c head/sys/geom/geom_io.c head/sys/geom/geom_subr.c Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Mon Dec 30 00:16:58 2019 (r356191) +++ head/sys/geom/geom.h Mon Dec 30 00:46:10 2019 (r356192) @@ -218,7 +218,8 @@ struct g_provider { off_t stripesize; off_t stripeoffset; struct devstat *stat; - u_int nstart, nend; + u_int spare1; + u_int spare2; u_int flags; #define G_PF_WITHER 0x2 #define G_PF_ORPHAN 0x4 Modified: head/sys/geom/geom_event.c ============================================================================== --- head/sys/geom/geom_event.c Mon Dec 30 00:16:58 2019 (r356191) +++ head/sys/geom/geom_event.c Mon Dec 30 00:46:10 2019 (r356192) @@ -241,10 +241,7 @@ one_event(void) g_topology_assert(); mtx_lock(&g_eventlock); - TAILQ_FOREACH(pp, &g_doorstep, orphan) { - if (pp->nstart == pp->nend) - break; - } + pp = TAILQ_FIRST(&g_doorstep); if (pp != NULL) { G_VALID_PROVIDER(pp); TAILQ_REMOVE(&g_doorstep, pp, orphan); @@ -299,7 +296,7 @@ g_run_events() } else { g_topology_unlock(); msleep(&g_wait_event, &g_eventlock, PRIBIO | PDROP, - "-", TAILQ_EMPTY(&g_doorstep) ? 0 : hz / 10); + "-", 0); } } /* NOTREACHED */ Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Mon Dec 30 00:16:58 2019 (r356191) +++ head/sys/geom/geom_io.c Mon Dec 30 00:46:10 2019 (r356192) @@ -580,8 +580,9 @@ g_io_request(struct bio *bp, struct g_consumer *cp) devstat_start_transaction(pp->stat, &bp->bio_t0); if (g_collectstats & G_STATS_CONSUMERS) devstat_start_transaction(cp->stat, &bp->bio_t0); - pp->nstart++; +#ifdef INVARIANTS cp->nstart++; +#endif mtx_unlock(mtxp); if (direct) { @@ -691,8 +692,9 @@ g_io_deliver(struct bio *bp, int error) devstat_end_transaction_bio_bt(pp->stat, bp, &now); if (g_collectstats & G_STATS_CONSUMERS) devstat_end_transaction_bio_bt(cp->stat, bp, &now); +#ifdef INVARIANTS cp->nend++; - pp->nend++; +#endif mtx_unlock(mtxp); if (error != ENOMEM) { Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Mon Dec 30 00:16:58 2019 (r356191) +++ head/sys/geom/geom_subr.c Mon Dec 30 00:46:10 2019 (r356192) @@ -939,6 +939,9 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int KASSERT(cp->acw + dcw >= 0, ("access resulting in negative acw")); KASSERT(cp->ace + dce >= 0, ("access resulting in negative ace")); KASSERT(dcr != 0 || dcw != 0 || dce != 0, ("NOP access request")); + KASSERT(cp->acr + dcr != 0 || cp->acw + dcw != 0 || + cp->ace + dce != 0 || cp->nstart == cp->nend, + ("Last close with active requests")); KASSERT(gp->access != NULL, ("NULL geom->access")); /* @@ -1426,8 +1429,10 @@ db_show_geom_consumer(int indent, struct g_consumer *c } gprintln(" access: r%dw%de%d", cp->acr, cp->acw, cp->ace); gprintln(" flags: 0x%04x", cp->flags); +#ifdef INVARIANTS gprintln(" nstart: %u", cp->nstart); gprintln(" nend: %u", cp->nend); +#endif } else { gprintf("consumer: %p (%s), access=r%dw%de%d", cp, cp->provider != NULL ? cp->provider->name : "none", @@ -1459,8 +1464,6 @@ db_show_geom_provider(int indent, struct g_provider *p provider_flags_to_string(pp, flags, sizeof(flags)), pp->flags); gprintln(" error: %d", pp->error); - gprintln(" nstart: %u", pp->nstart); - gprintln(" nend: %u", pp->nend); if (LIST_EMPTY(&pp->consumers)) gprintln(" consumers: none"); } else { From owner-svn-src-head@freebsd.org Mon Dec 30 01:38:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24D4D1D0EBA; Mon, 30 Dec 2019 01:38:20 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mKnm0DpNz4Mfr; Mon, 30 Dec 2019 01:38:20 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F344E2265E; Mon, 30 Dec 2019 01:38:19 +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 xBU1cJ1m064430; Mon, 30 Dec 2019 01:38:19 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBU1cJqR064429; Mon, 30 Dec 2019 01:38:19 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912300138.xBU1cJqR064429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 30 Dec 2019 01:38:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356194 - head/sys/dev/random X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/random X-SVN-Commit-Revision: 356194 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 01:38:20 -0000 Author: cem Date: Mon Dec 30 01:38:19 2019 New Revision: 356194 URL: https://svnweb.freebsd.org/changeset/base/356194 Log: random(4): Make entropy source deregistration safe Allow loadable modules that provide random entropy source(s) to safely unload. Prior to this change, no driver could ensure that their random_source structure was not being used by random_harvestq.c for any period of time after invoking random_source_deregister(). This change converts the source_list LIST to a ConcurrencyKit CK_LIST and uses an epoch(9) to protect typical read accesses of the list. The existing HARVEST_LOCK spin mutex is used to safely add and remove list entries. random_source_deregister() uses epoch_wait() to ensure no concurrent source_list readers are accessing a random_source before freeing the list item and returning to the caller. Callers can safely unload immediately after random_source_deregister() returns. Reviewed by: markj Approved by: csprng(markm) Discussed with: jhb Differential Revision: https://reviews.freebsd.org/D22489 Modified: head/sys/dev/random/random_harvestq.c Modified: head/sys/dev/random/random_harvestq.c ============================================================================== --- head/sys/dev/random/random_harvestq.c Mon Dec 30 00:49:49 2019 (r356193) +++ head/sys/dev/random/random_harvestq.c Mon Dec 30 01:38:19 2019 (r356194) @@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include #include @@ -76,6 +78,14 @@ static void random_sources_feed(void); static u_int read_rate; /* + * Random must initialize much earlier than epoch, but we can initialize the + * epoch code before SMP starts. Prior to SMP, we can safely bypass + * concurrency primitives. + */ +static __read_mostly bool epoch_inited; +static __read_mostly epoch_t rs_epoch; + +/* * How many events to queue up. We create this many items in * an 'empty' queue, then transfer them to the 'harvest' queue with * supplied junk. When used, they are transferred back to the @@ -94,12 +104,12 @@ volatile int random_kthread_control; __read_frequently u_int hc_source_mask; struct random_sources { - LIST_ENTRY(random_sources) rrs_entries; + CK_LIST_ENTRY(random_sources) rrs_entries; struct random_source *rrs_source; }; -static LIST_HEAD(sources_head, random_sources) source_list = - LIST_HEAD_INITIALIZER(source_list); +static CK_LIST_HEAD(sources_head, random_sources) source_list = + CK_LIST_HEAD_INITIALIZER(source_list); SYSCTL_NODE(_kern_random, OID_AUTO, harvest, CTLFLAG_RW, 0, "Entropy Device Parameters"); @@ -202,6 +212,14 @@ random_kthread(void) SYSINIT(random_device_h_proc, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, kproc_start, &random_proc_kp); +static void +rs_epoch_init(void *dummy __unused) +{ + rs_epoch = epoch_alloc("Random Sources", EPOCH_PREEMPT); + epoch_inited = true; +} +SYSINIT(rs_epoch_init, SI_SUB_EPOCH, SI_ORDER_ANY, rs_epoch_init, NULL); + /* * Run through all fast sources reading entropy for the given * number of rounds, which should be a multiple of the number @@ -211,9 +229,13 @@ static void random_sources_feed(void) { uint32_t entropy[HARVESTSIZE]; + struct epoch_tracker et; struct random_sources *rrs; u_int i, n, local_read_rate; + bool rse_warm; + rse_warm = epoch_inited; + /* * Step over all of live entropy sources, and feed their output * to the system-wide RNG. @@ -223,7 +245,9 @@ random_sources_feed(void) local_read_rate = MAX(local_read_rate, 1); /* But not exceeding RANDOM_KEYSIZE_WORDS */ local_read_rate = MIN(local_read_rate, RANDOM_KEYSIZE_WORDS); - LIST_FOREACH(rrs, &source_list, rrs_entries) { + if (rse_warm) + epoch_enter_preempt(rs_epoch, &et); + CK_LIST_FOREACH(rrs, &source_list, rrs_entries) { for (i = 0; i < p_random_alg_context->ra_poolcount*local_read_rate; i++) { n = rrs->rrs_source->rs_read(entropy, sizeof(entropy)); KASSERT((n <= sizeof(entropy)), ("%s: rs_read returned too much data (%u > %zu)", __func__, n, sizeof(entropy))); @@ -243,6 +267,8 @@ random_sources_feed(void) random_harvest_direct(entropy, n, rrs->rrs_source->rs_source); } } + if (rse_warm) + epoch_exit_preempt(rs_epoch, &et); explicit_bzero(entropy, sizeof(entropy)); } @@ -573,7 +599,10 @@ random_source_register(struct random_source *rsource) random_harvest_register_source(rsource->rs_source); printf("random: registering fast source %s\n", rsource->rs_ident); - LIST_INSERT_HEAD(&source_list, rrs, rrs_entries); + + RANDOM_HARVEST_LOCK(); + CK_LIST_INSERT_HEAD(&source_list, rrs, rrs_entries); + RANDOM_HARVEST_UNLOCK(); } void @@ -585,29 +614,40 @@ random_source_deregister(struct random_source *rsource random_harvest_deregister_source(rsource->rs_source); - LIST_FOREACH(rrs, &source_list, rrs_entries) + RANDOM_HARVEST_LOCK(); + CK_LIST_FOREACH(rrs, &source_list, rrs_entries) if (rrs->rrs_source == rsource) { - LIST_REMOVE(rrs, rrs_entries); + CK_LIST_REMOVE(rrs, rrs_entries); break; } - if (rrs != NULL) - free(rrs, M_ENTROPY); + RANDOM_HARVEST_UNLOCK(); + + if (rrs != NULL && epoch_inited) + epoch_wait_preempt(rs_epoch); + free(rrs, M_ENTROPY); } static int random_source_handler(SYSCTL_HANDLER_ARGS) { + struct epoch_tracker et; struct random_sources *rrs; struct sbuf sbuf; int error, count; + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + sbuf_new_for_sysctl(&sbuf, NULL, 64, req); count = 0; - LIST_FOREACH(rrs, &source_list, rrs_entries) { + epoch_enter_preempt(rs_epoch, &et); + CK_LIST_FOREACH(rrs, &source_list, rrs_entries) { sbuf_cat(&sbuf, (count++ ? ",'" : "'")); sbuf_cat(&sbuf, rrs->rrs_source->rs_ident); sbuf_cat(&sbuf, "'"); } + epoch_exit_preempt(rs_epoch, &et); error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); return (error); From owner-svn-src-head@freebsd.org Mon Dec 30 01:41:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F1241D112C; Mon, 30 Dec 2019 01:41:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mKrr02nGz4MtW; Mon, 30 Dec 2019 01:41:00 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0E9A226A1; Mon, 30 Dec 2019 01:40:59 +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 xBU1exC6065549; Mon, 30 Dec 2019 01:40:59 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBU1exFk065548; Mon, 30 Dec 2019 01:40:59 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912300140.xBU1exFk065548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 30 Dec 2019 01:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356195 - head/sys/dev/virtio/random X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/virtio/random X-SVN-Commit-Revision: 356195 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 01:41:00 -0000 Author: cem Date: Mon Dec 30 01:40:59 2019 New Revision: 356195 URL: https://svnweb.freebsd.org/changeset/base/356195 Log: virtio_random(4): Drop no longer needed unload kludge After r356194, source deregistration no longer races with concurrent use. Reviewed by: bryanv, markm Differential Revision: https://reviews.freebsd.org/D22490 Modified: head/sys/dev/virtio/random/virtio_random.c Modified: head/sys/dev/virtio/random/virtio_random.c ============================================================================== --- head/sys/dev/virtio/random/virtio_random.c Mon Dec 30 01:38:19 2019 (r356194) +++ head/sys/dev/virtio/random/virtio_random.c Mon Dec 30 01:40:59 2019 (r356195) @@ -176,14 +176,6 @@ vtrnd_detach(device_t dev) random_source_deregister(&random_vtrnd); atomic_store_explicit(&g_vtrnd_softc, NULL, memory_order_release); - - /* - * Unfortunately, deregister does not guarantee our source callback - * will not be invoked after it returns. Use a kludge to prevent some, - * but not all, possible races. - */ - tsleep_sbt(&g_vtrnd_softc, 0, "vtrnddet", mstosbt(50), 0, C_HARDCLOCK); - return (0); } From owner-svn-src-head@freebsd.org Mon Dec 30 02:07:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69AE71D1A9B; Mon, 30 Dec 2019 02:07:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mLRx2CrZz4PN7; Mon, 30 Dec 2019 02:07:57 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28E3A22BD5; Mon, 30 Dec 2019 02:07:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBU27vOe081920; Mon, 30 Dec 2019 02:07:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBU27uA6081916; Mon, 30 Dec 2019 02:07:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912300207.xBU27uA6081916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 30 Dec 2019 02:07:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356196 - in head/sys: arm/arm isa mips/mips powerpc/powerpc sparc64/sparc64 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: arm/arm isa mips/mips powerpc/powerpc sparc64/sparc64 X-SVN-Commit-Revision: 356196 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 02:07:57 -0000 Author: kevans Date: Mon Dec 30 02:07:55 2019 New Revision: 356196 URL: https://svnweb.freebsd.org/changeset/base/356196 Log: sc(4) md bits: stop setting sc->kbd entirely The machdep parts no longer need to touch keyboard parts after r356043; sc->kbd will be 0-initialized and this works as expected. Modified: head/sys/arm/arm/sc_machdep.c head/sys/isa/syscons_isa.c head/sys/mips/mips/sc_machdep.c head/sys/powerpc/powerpc/sc_machdep.c head/sys/sparc64/sparc64/sc_machdep.c Modified: head/sys/arm/arm/sc_machdep.c ============================================================================== --- head/sys/arm/arm/sc_machdep.c Mon Dec 30 01:40:59 2019 (r356195) +++ head/sys/arm/arm/sc_machdep.c Mon Dec 30 02:07:55 2019 (r356196) @@ -69,7 +69,6 @@ sc_get_softc(int unit, int flags) sc = &sc_softcs[unit]; sc->unit = unit; if ((sc->flags & SC_INIT_DONE) == 0) { - sc->kbd = NULL; sc->adapter = -1; sc->cursor_char = SC_CURSOR_CHAR; sc->mouse_char = SC_MOUSE_CHAR; Modified: head/sys/isa/syscons_isa.c ============================================================================== --- head/sys/isa/syscons_isa.c Mon Dec 30 01:40:59 2019 (r356195) +++ head/sys/isa/syscons_isa.c Mon Dec 30 02:07:55 2019 (r356196) @@ -117,7 +117,6 @@ sc_softc_t } sc->unit = unit; if ((sc->flags & SC_INIT_DONE) == 0) { - sc->kbd = NULL; sc->adapter = -1; sc->cursor_char = SC_CURSOR_CHAR; sc->mouse_char = SC_MOUSE_CHAR; Modified: head/sys/mips/mips/sc_machdep.c ============================================================================== --- head/sys/mips/mips/sc_machdep.c Mon Dec 30 01:40:59 2019 (r356195) +++ head/sys/mips/mips/sc_machdep.c Mon Dec 30 02:07:55 2019 (r356196) @@ -69,7 +69,6 @@ sc_get_softc(int unit, int flags) sc = &sc_softcs[unit]; sc->unit = unit; if ((sc->flags & SC_INIT_DONE) == 0) { - sc->kbd = NULL; sc->adapter = -1; sc->cursor_char = SC_CURSOR_CHAR; sc->mouse_char = SC_MOUSE_CHAR; Modified: head/sys/powerpc/powerpc/sc_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/sc_machdep.c Mon Dec 30 01:40:59 2019 (r356195) +++ head/sys/powerpc/powerpc/sc_machdep.c Mon Dec 30 02:07:55 2019 (r356196) @@ -69,7 +69,6 @@ sc_get_softc(int unit, int flags) sc = &sc_softcs[unit]; sc->unit = unit; if ((sc->flags & SC_INIT_DONE) == 0) { - sc->kbd = NULL; sc->adapter = -1; sc->cursor_char = SC_CURSOR_CHAR; sc->mouse_char = SC_MOUSE_CHAR; Modified: head/sys/sparc64/sparc64/sc_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/sc_machdep.c Mon Dec 30 01:40:59 2019 (r356195) +++ head/sys/sparc64/sparc64/sc_machdep.c Mon Dec 30 02:07:55 2019 (r356196) @@ -131,7 +131,6 @@ sc_get_softc(int unit, int flags) sc = &sc_softcs[unit]; sc->unit = unit; if ((sc->flags & SC_INIT_DONE) == 0) { - sc->kbd = NULL; sc->adapter = -1; sc->cursor_char = SC_CURSOR_CHAR; sc->mouse_char = SC_MOUSE_CHAR; From owner-svn-src-head@freebsd.org Mon Dec 30 02:56:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE9E21D2B12; Mon, 30 Dec 2019 02:56:48 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mMXJ4qsXz4RQ7; Mon, 30 Dec 2019 02:56:48 +0000 (UTC) (envelope-from bdragon@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8734823500; Mon, 30 Dec 2019 02:56:48 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBU2um0K011799; Mon, 30 Dec 2019 02:56:48 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBU2um5a011798; Mon, 30 Dec 2019 02:56:48 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201912300256.xBU2um5a011798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Mon, 30 Dec 2019 02:56:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356199 - in head/sys/powerpc: include powernv X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: in head/sys/powerpc: include powernv X-SVN-Commit-Revision: 356199 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 02:56:48 -0000 Author: bdragon Date: Mon Dec 30 02:56:47 2019 New Revision: 356199 URL: https://svnweb.freebsd.org/changeset/base/356199 Log: [PowerPC] Fix panic when attempting to handle an HMI from an idle thread In IRC, sfs_ finally managed to get a good trace of a kernel panic that was happening when attempting to use webengine. As it turns out, we were using vtophys() from interrupt context on an idle thread in opal_hmi_handler2(). Since this involves locking the kernel pmap on PPC64 at the moment, this ended up tripping a KASSERT in mtx_lock(), which then caused a parallel panic stampede. So, avoid this by preallocating the flags variable and storing it in PCPU. Fixes "panic: mtx_lock() by idle thread 0x... on sleep mutex kernelpmap". Differential Revision: https://reviews.freebsd.org/D22962 Modified: head/sys/powerpc/include/pcpu.h head/sys/powerpc/powernv/opal_hmi.c Modified: head/sys/powerpc/include/pcpu.h ============================================================================== --- head/sys/powerpc/include/pcpu.h Mon Dec 30 02:40:55 2019 (r356198) +++ head/sys/powerpc/include/pcpu.h Mon Dec 30 02:56:47 2019 (r356199) @@ -68,7 +68,8 @@ struct pvo_entry; uint8_t slbstack[1024]; \ struct pvo_entry *qmap_pvo; \ struct mtx qmap_lock; \ - char __pad[1345]; + uint64_t opal_hmi_flags; \ + char __pad[1337]; #ifdef __powerpc64__ #define PCPU_MD_AIM_FIELDS PCPU_MD_AIM64_FIELDS Modified: head/sys/powerpc/powernv/opal_hmi.c ============================================================================== --- head/sys/powerpc/powernv/opal_hmi.c Mon Dec 30 02:40:55 2019 (r356198) +++ head/sys/powerpc/powernv/opal_hmi.c Mon Dec 30 02:56:47 2019 (r356199) @@ -84,13 +84,17 @@ opal_hmi_event_handler(void *unused, struct opal_msg * static int opal_hmi_handler2(struct trapframe *frame) { - uint64_t flags; + /* + * Use DMAP preallocated pcpu memory to handle + * the phys flags pointer. + */ + uint64_t *flags = PCPU_PTR(aim.opal_hmi_flags); int err; - flags = 0; - err = opal_call(OPAL_HANDLE_HMI2, vtophys(&flags)); + *flags = 0; + err = opal_call(OPAL_HANDLE_HMI2, DMAP_TO_PHYS((vm_offset_t)flags)); - if (flags & OPAL_HMI_FLAGS_TOD_TB_FAIL) + if (*flags & OPAL_HMI_FLAGS_TOD_TB_FAIL) panic("TOD/TB recovery failure"); if (err == OPAL_SUCCESS) From owner-svn-src-head@freebsd.org Mon Dec 30 03:13:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42D471D30D2; Mon, 30 Dec 2019 03:13:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mMvm12F6z4SVk; Mon, 30 Dec 2019 03:13:40 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EAD7238F0; Mon, 30 Dec 2019 03:13:40 +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 xBU3DeP4024362; Mon, 30 Dec 2019 03:13:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBU3Dc2P024355; Mon, 30 Dec 2019 03:13:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912300313.xBU3Dc2P024355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 30 Dec 2019 03:13:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356200 - in head/sys: cam/ctl dev/md dev/nvdimm geom kern X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys: cam/ctl dev/md dev/nvdimm geom kern X-SVN-Commit-Revision: 356200 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 03:13:40 -0000 Author: mav Date: Mon Dec 30 03:13:38 2019 New Revision: 356200 URL: https://svnweb.freebsd.org/changeset/base/356200 Log: Use atomic for start_count in devstat_start_transaction(). Combined with earlier nstart/nend removal it allows to remove several locks from request path of GEOM and few other places. It would be cool if we had more SMP-friendly statistics, but this helps too. Sponsored by: iXsystems, Inc. Modified: head/sys/cam/ctl/ctl_backend_block.c head/sys/dev/md/md.c head/sys/dev/nvdimm/nvdimm_spa.c head/sys/dev/nvdimm/nvdimm_var.h head/sys/geom/geom_disk.c head/sys/geom/geom_io.c head/sys/kern/subr_devstat.c Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Mon Dec 30 02:56:47 2019 (r356199) +++ head/sys/cam/ctl/ctl_backend_block.c Mon Dec 30 03:13:38 2019 (r356200) @@ -580,9 +580,7 @@ ctl_be_block_flush_file(struct ctl_be_block_lun *be_lu DPRINTF("entered\n"); binuptime(&beio->ds_t0); - mtx_lock(&be_lun->io_lock); devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); - mtx_unlock(&be_lun->io_lock); (void) vn_start_write(be_lun->vn, &mountpoint, V_WAIT); @@ -663,9 +661,7 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be } binuptime(&beio->ds_t0); - mtx_lock(&be_lun->io_lock); devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); - mtx_unlock(&be_lun->io_lock); if (beio->bio_cmd == BIO_READ) { vn_lock(be_lun->vn, LK_SHARED | LK_RETRY); @@ -894,9 +890,7 @@ ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be } binuptime(&beio->ds_t0); - mtx_lock(&be_lun->io_lock); devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); - mtx_unlock(&be_lun->io_lock); csw = devvn_refthread(be_lun->vn, &dev, &ref); if (csw) { @@ -1034,9 +1028,7 @@ ctl_be_block_flush_dev(struct ctl_be_block_lun *be_lun beio->send_complete = 1; binuptime(&beio->ds_t0); - mtx_lock(&be_lun->io_lock); devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0); - mtx_unlock(&be_lun->io_lock); csw = devvn_refthread(be_lun->vn, &dev, &ref); if (csw) { @@ -1107,9 +1099,7 @@ ctl_be_block_unmap_dev(struct ctl_be_block_lun *be_lun DPRINTF("entered\n"); binuptime(&beio->ds_t0); - mtx_lock(&be_lun->io_lock); devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0); - mtx_unlock(&be_lun->io_lock); if (beio->io_offset == -1) { beio->io_len = 0; @@ -1186,11 +1176,9 @@ ctl_be_block_dispatch_dev(struct ctl_be_block_lun *be_ beio->num_bios_sent++; } } + beio->send_complete = 1; binuptime(&beio->ds_t0); - mtx_lock(&be_lun->io_lock); devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0); - beio->send_complete = 1; - mtx_unlock(&be_lun->io_lock); /* * Fire off all allocated requests! Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Mon Dec 30 02:56:47 2019 (r356199) +++ head/sys/dev/md/md.c Mon Dec 30 03:13:38 2019 (r356200) @@ -247,7 +247,6 @@ struct md_s { LIST_ENTRY(md_s) list; struct bio_queue_head bio_queue; struct mtx queue_mtx; - struct mtx stat_mtx; struct cdev *dev; enum md_types type; off_t mediasize; @@ -477,9 +476,7 @@ g_md_start(struct bio *bp) sc = bp->bio_to->geom->softc; if ((bp->bio_cmd == BIO_READ) || (bp->bio_cmd == BIO_WRITE)) { - mtx_lock(&sc->stat_mtx); devstat_start_transaction_bio(sc->devstat, bp); - mtx_unlock(&sc->stat_mtx); } mtx_lock(&sc->queue_mtx); bioq_disksort(&sc->bio_queue, bp); @@ -1274,7 +1271,6 @@ mdnew(int unit, int *errp, enum md_types type) sc->type = type; bioq_init(&sc->bio_queue); mtx_init(&sc->queue_mtx, "md bio queue", NULL, MTX_DEF); - mtx_init(&sc->stat_mtx, "md stat", NULL, MTX_DEF); sc->unit = unit; sprintf(sc->name, "md%d", unit); LIST_INSERT_HEAD(&md_softc_list, sc, list); @@ -1282,7 +1278,6 @@ mdnew(int unit, int *errp, enum md_types type) if (error == 0) return (sc); LIST_REMOVE(sc, list); - mtx_destroy(&sc->stat_mtx); mtx_destroy(&sc->queue_mtx); free_unr(md_uh, sc->unit); free(sc, M_MD); @@ -1512,7 +1507,6 @@ mddestroy(struct md_s *sc, struct thread *td) while (!(sc->flags & MD_EXITING)) msleep(sc->procp, &sc->queue_mtx, PRIBIO, "mddestroy", hz / 10); mtx_unlock(&sc->queue_mtx); - mtx_destroy(&sc->stat_mtx); mtx_destroy(&sc->queue_mtx); if (sc->vnode != NULL) { vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY); Modified: head/sys/dev/nvdimm/nvdimm_spa.c ============================================================================== --- head/sys/dev/nvdimm/nvdimm_spa.c Mon Dec 30 02:56:47 2019 (r356199) +++ head/sys/dev/nvdimm/nvdimm_spa.c Mon Dec 30 03:13:38 2019 (r356200) @@ -413,9 +413,7 @@ nvdimm_spa_g_start(struct bio *bp) sc = bp->bio_to->geom->softc; if (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE) { - mtx_lock(&sc->spa_g_stat_mtx); devstat_start_transaction_bio(sc->spa_g_devstat, bp); - mtx_unlock(&sc->spa_g_stat_mtx); } mtx_lock(&sc->spa_g_mtx); bioq_disksort(&sc->spa_g_queue, bp); @@ -544,14 +542,12 @@ nvdimm_spa_g_create(struct nvdimm_spa_dev *dev, const sc->dev = dev; bioq_init(&sc->spa_g_queue); mtx_init(&sc->spa_g_mtx, "spag", NULL, MTX_DEF); - mtx_init(&sc->spa_g_stat_mtx, "spagst", NULL, MTX_DEF); sc->spa_g_proc_run = true; sc->spa_g_proc_exiting = false; error = kproc_create(nvdimm_spa_g_thread, sc, &sc->spa_g_proc, 0, 0, "g_spa"); if (error != 0) { mtx_destroy(&sc->spa_g_mtx); - mtx_destroy(&sc->spa_g_stat_mtx); free(sc, M_NVDIMM); printf("NVDIMM %s cannot create geom worker, error %d\n", name, error); @@ -621,7 +617,6 @@ nvdimm_spa_g_destroy_geom(struct gctl_req *req, struct sc->spa_g_devstat = NULL; } mtx_destroy(&sc->spa_g_mtx); - mtx_destroy(&sc->spa_g_stat_mtx); free(sc, M_NVDIMM); return (0); } Modified: head/sys/dev/nvdimm/nvdimm_var.h ============================================================================== --- head/sys/dev/nvdimm/nvdimm_var.h Mon Dec 30 02:56:47 2019 (r356199) +++ head/sys/dev/nvdimm/nvdimm_var.h Mon Dec 30 03:13:38 2019 (r356200) @@ -129,7 +129,6 @@ struct g_spa { struct g_provider *spa_p; struct bio_queue_head spa_g_queue; struct mtx spa_g_mtx; - struct mtx spa_g_stat_mtx; struct devstat *spa_g_devstat; struct proc *spa_g_proc; bool spa_g_proc_run; Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Mon Dec 30 02:56:47 2019 (r356199) +++ head/sys/geom/geom_disk.c Mon Dec 30 03:13:38 2019 (r356200) @@ -64,13 +64,12 @@ __FBSDID("$FreeBSD$"); #include struct g_disk_softc { - struct mtx done_mtx; struct disk *dp; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; char led[64]; uint32_t state; - struct mtx start_mtx; + struct mtx done_mtx; }; static g_access_t g_disk_access; @@ -473,9 +472,7 @@ g_disk_start(struct bio *bp) bp2->bio_pblkno = bp2->bio_offset / dp->d_sectorsize; bp2->bio_bcount = bp2->bio_length; bp2->bio_disk = dp; - mtx_lock(&sc->start_mtx); devstat_start_transaction_bio(dp->d_devstat, bp2); - mtx_unlock(&sc->start_mtx); dp->d_strategy(bp2); if (bp3 == NULL) @@ -559,9 +556,7 @@ g_disk_start(struct bio *bp) } bp2->bio_done = g_disk_done; bp2->bio_disk = dp; - mtx_lock(&sc->start_mtx); devstat_start_transaction_bio(dp->d_devstat, bp2); - mtx_unlock(&sc->start_mtx); dp->d_strategy(bp2); break; default: @@ -709,7 +704,6 @@ g_disk_create(void *arg, int flag) mtx_pool_unlock(mtxpool_sleep, dp); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); - mtx_init(&sc->start_mtx, "g_disk_start", NULL, MTX_DEF); mtx_init(&sc->done_mtx, "g_disk_done", NULL, MTX_DEF); sc->dp = dp; gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit); @@ -795,7 +789,6 @@ g_disk_providergone(struct g_provider *pp) pp->private = NULL; pp->geom->softc = NULL; mtx_destroy(&sc->done_mtx); - mtx_destroy(&sc->start_mtx); g_free(sc); } Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Mon Dec 30 02:56:47 2019 (r356199) +++ head/sys/geom/geom_io.c Mon Dec 30 03:13:38 2019 (r356200) @@ -490,7 +490,6 @@ void g_io_request(struct bio *bp, struct g_consumer *cp) { struct g_provider *pp; - struct mtx *mtxp; int direct, error, first; uint8_t cmd; @@ -545,11 +544,19 @@ g_io_request(struct bio *bp, struct g_consumer *cp) KASSERT(!(bp->bio_flags & BIO_ONQUEUE), ("Bio already on queue bp=%p", bp)); + if ((g_collectstats & G_STATS_CONSUMERS) != 0 || ((g_collectstats & G_STATS_PROVIDERS) != 0 && pp->stat != NULL)) binuptime(&bp->bio_t0); else getbinuptime(&bp->bio_t0); + if (g_collectstats & G_STATS_CONSUMERS) + devstat_start_transaction(cp->stat, &bp->bio_t0); + if (g_collectstats & G_STATS_PROVIDERS) + devstat_start_transaction(pp->stat, &bp->bio_t0); +#ifdef INVARIANTS + atomic_add_int(&cp->nstart, 1); +#endif #ifdef GET_STACK_USAGE direct = (cp->flags & G_CF_DIRECT_SEND) != 0 && @@ -568,22 +575,6 @@ g_io_request(struct bio *bp, struct g_consumer *cp) #else direct = 0; #endif - - /* - * The statistics collection is lockless, as such, but we - * can not update one instance of the statistics from more - * than one thread at a time, so grab the lock first. - */ - mtxp = mtx_pool_find(mtxpool_sleep, pp); - mtx_lock(mtxp); - if (g_collectstats & G_STATS_PROVIDERS) - devstat_start_transaction(pp->stat, &bp->bio_t0); - if (g_collectstats & G_STATS_CONSUMERS) - devstat_start_transaction(cp->stat, &bp->bio_t0); -#ifdef INVARIANTS - cp->nstart++; -#endif - mtx_unlock(mtxp); if (direct) { error = g_io_check(bp); Modified: head/sys/kern/subr_devstat.c ============================================================================== --- head/sys/kern/subr_devstat.c Mon Dec 30 02:56:47 2019 (r356199) +++ head/sys/kern/subr_devstat.c Mon Dec 30 03:13:38 2019 (r356200) @@ -227,8 +227,6 @@ void devstat_start_transaction(struct devstat *ds, const struct bintime *now) { - mtx_assert(&devstat_mutex, MA_NOTOWNED); - /* sanity check */ if (ds == NULL) return; @@ -239,13 +237,12 @@ devstat_start_transaction(struct devstat *ds, const st * to busy. The start time is really the start of the latest busy * period. */ - if (ds->start_count == ds->end_count) { + if (atomic_fetchadd_int(&ds->start_count, 1) == ds->end_count) { if (now != NULL) ds->busy_from = *now; else binuptime(&ds->busy_from); } - ds->start_count++; atomic_add_rel_int(&ds->sequence0, 1); DTRACE_DEVSTAT_START(); } @@ -253,8 +250,6 @@ devstat_start_transaction(struct devstat *ds, const st void devstat_start_transaction_bio(struct devstat *ds, struct bio *bp) { - - mtx_assert(&devstat_mutex, MA_NOTOWNED); /* sanity check */ if (ds == NULL) From owner-svn-src-head@freebsd.org Mon Dec 30 04:20:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D4F71D4171 for ; Mon, 30 Dec 2019 04:20:46 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic304-23.consmr.mail.gq1.yahoo.com (sonic304-23.consmr.mail.gq1.yahoo.com [98.137.68.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47mPP94Nfnz4VtK for ; Mon, 30 Dec 2019 04:20:45 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: _2KcutcVM1mUYGEXWZR0rhgr5_vNGfGLHatQNADWmsn43CaYJCCWFtjfTejWru. touGkGJiiL1kxRNJK9gWALuF_Bo7NeMzyDwebX_pGzTE0xXfbsED.ieZAbEIwP4efQxMmvearniG Tbto06X7lHuRm6pw6GcTYS4KRLjEuu_VWr5o9NCNYC.bSzJjwEHwfaJstcxRo8nD8koDUoZ246OF .rNPxM_sUOpRr_ODmk1nKxCJMxDYyeg2keOMdt.KkoQrX7GgdHxoejQgrpai9R894YHdmRy1gbEc NJqoMABjawkw6gwc0o540uiEez7MBm.uPxRQRaFdvxPivkV3mKZGaI2UjRQp6NkRhkVS2runyPHM y3s4EmWwM0FFhCNrxnw1..4ydNbMI5x2nk.wS8hhRFdS_4RiITAUo8m9QPE3zgrqVmo5txZr9v59 FwEaf_ovMrxsFKWYSguwNB6UCiTsdQIMtEX5JmQ7B6cpxzrl6rDNLUWSq8MdvomwjTQ5kvPTO2w5 KmtP45uE9V8bYfX.iUPFz390ge4mgHXG0st6B99aJZ5fjRReNhX6TsoUaFVnLvdtUpAQrW4.d5n6 56yUu6Xv0ctcfa72adhDGWipFtfRZawyNnPtGrcMDi5M5OLPPeVsxDa1zgCrMgLca8CrTq8WsLe8 VJHlZpeSbZ__TdNTuwFrgogBlBBmVfpTIGPwn57Df5sdq_d5jAMrNqfWJI3yF0L__TrZeSnlqf3d n75OdboVFK1jzWamOIbuAKujAS93OF3dSQsf7hZWZjcIYMcuoyXrTqGeb9HIOksVThDYUCNA1DjG .KjZx1q1SRx6I7obA.1tEKTg9PkF6TnmTCwhCwjy78vTrjwfs5GZdEoh1F7cYYH97IMkSFK0f8mb pTiBxLpQfLRmr1zndgN1..IX0omxGxWwfcH42W4uLQymtzTNG9aC5xKp5mWX8ioR3kpH.skeAr_f Tfw2O5a8OHJbKrH6hEX71tR_0ONoXH9jYk44ura_AyNFmeBUAtxoEQa_ICMCfKXzcx.w_L8NBhF9 _TpQzdGRyY9A5capLhD8O9OfONT79CZT5fhysOZ9HvOSzWBIx2i6LJSKieVuO3To02Xl_mADIcqO rl4I2MwXybcHR9.t0n26qPfSOS_cLBwA_b5cOvGSbZsFk968K5hYK9Aqx6_g66MmktTB5jWuI6gv Q6eZRkw7SokvFEM1GjCv6IzMzsOAp6CWhQRtCqMRqQZ.JTj0d5CI0fuUNTB8CsW.N8Od4ZtqKBAD WOyO70Ss.eK_3fMpmfdG5oOu6DRfRm.IeQ3Q4WSXsJIwZUW8b4izMP5eXITto3qaPNnDAu3kqdDL Cgnac88d8UG_P2h6_z1WnuBkn31eIPPE8ZvIisigf9p9cOCDtdlQfEvqgqn988QuGpAqmF3CnlUB 9AIdllaKqv7dkRQy31NiPS6n6ypz7ZziS.GE0tG0- Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.gq1.yahoo.com with HTTP; Mon, 30 Dec 2019 04:20:43 +0000 Received: by smtp408.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 9fc9715ceb9eeeb367cb3abfb0ca7cae; Mon, 30 Dec 2019 04:20:40 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: svn commit: r356054 - in head: share/mk stand Date: Sun, 29 Dec 2019 20:20:39 -0800 References: <8A9C94C7-094F-45B4-B156-5A04958C4938@yahoo.com> To: "jhibbits@freebsd.org" , svn-src-head@freebsd.org In-Reply-To: <8A9C94C7-094F-45B4-B156-5A04958C4938@yahoo.com> Message-Id: X-Mailer: Apple Mail (2.3608.40.2.2.4) X-Rspamd-Queue-Id: 47mPP94Nfnz4VtK X-Spamd-Bar: - X-Spamd-Result: default: False [-1.21 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; NEURAL_HAM_MEDIUM(-0.02)[-0.017,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; FREEMAIL_FROM(0.00)[yahoo.com]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-0.69)[-0.694,0]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[204.68.137.98.list.dnswl.org : 127.0.5.0]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.00)[ip: (7.71), ipnet: 98.137.64.0/21(0.89), asn: 36647(0.71), country: US(-0.05)]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 04:20:46 -0000 On 2019-Dec-24, at 21:26, Mark Millard wrote: > In: >=20 > +# Defines a variable for Binutils linker, to be used to workaround = some > +# issue with LLVM LLD (i.e. support for PowerPC32 bit on PowerPC64) > +# > +# This is an unavoidable cross coupling with Makefile.inc1 and > +# normal builds works when CROSS_BINUTILS_PREFIX and could be removed > +# when LLD PowerPC 32 bit support is completed > +.if defined(CROSS_BINUTILS_PREFIX) > +LD_BFD=3D${LOCALBASE}/bin/${CROSS_BINUTILS_PREFIX}-ld.bfd > +.else > +LD_BFD=3D${OBJTOP}/tmp/usr/bin/ld.bfd > +.endif >=20 > I'm confused by the 2 lines: >=20 > +.if defined(CROSS_BINUTILS_PREFIX) > +LD_BFD=3D${LOCALBASE}/bin/${CROSS_BINUTILS_PREFIX}-ld.bfd >=20 > Looking in /usr/local/share/toolchains/*.mk I see > CROSS_BINUTILS_PREFIX as a full path in each case > ( based on devel/freebsd-gcc[69] in my context): >=20 > # grep -r CROSS_BINU /usr/local/share/toolchains/ | more > = /usr/local/share/toolchains/aarch64-gcc6.mk:CROSS_BINUTILS_PREFIX=3D/usr/l= ocal/aarch64-unknown-freebsd13.0/bin/ > = /usr/local/share/toolchains/amd64-gcc6.mk:CROSS_BINUTILS_PREFIX=3D/usr/loc= al/x86_64-unknown-freebsd13.0/bin/ > = /usr/local/share/toolchains/powerpc64-gcc6.mk:CROSS_BINUTILS_PREFIX=3D/usr= /local/powerpc64-unknown-freebsd13.0/bin/ > = /usr/local/share/toolchains/aarch64-gcc9.mk:CROSS_BINUTILS_PREFIX=3D/usr/l= ocal/aarch64-unknown-freebsd13.0/bin/ > = /usr/local/share/toolchains/amd64-gcc9.mk:CROSS_BINUTILS_PREFIX=3D/usr/loc= al/x86_64-unknown-freebsd13.0/bin/ > = /usr/local/share/toolchains/powerpc64-gcc9.mk:CROSS_BINUTILS_PREFIX=3D/usr= /local/powerpc64-unknown-freebsd13.0/bin/ > = /usr/local/share/toolchains/powerpc-gcc9.mk:CROSS_BINUTILS_PREFIX=3D/usr/l= ocal/powerpc-unknown-freebsd13.0/bin/ >=20 > And when I look in /usr/srcv/Makefile.inc1 I see: >=20 > = /usr/src/Makefile.inc1:CROSS_BINUTILS_PREFIX=3D/usr/local/${TARGET_TRIPLE}= /bin/ >=20 > Having an overall path structure like: >=20 > ${LOCALBASE}/bin/usr/local/powerpc64-unknown-freebsd13.0/bin/-ld.bfd >=20 > seems strange (using powerpc64 as an example). >=20 I got to the point of trying a build that happens to have tried to use this code. It failed, reporting: --- libc.so.7.full --- building shared library libc.so.7 cc: error: invalid linker name in argument = '-fuse-ld=3D/usr/local/bin//usr/local/powerpc64-unknown-freebsd13.0/bin/-l= d.bfd' *** [libc.so.7.full] Error code 1 So I switched the code to: .if defined(CROSS_BINUTILS_PREFIX) LD_BFD=3D${CROSS_BINUTILS_PREFIX}ld.bfd .else LD_BFD=3D${OBJTOP}/tmp/usr/bin/ld.bfd .endif With that in place, the build completed. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Mon Dec 30 04:48:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A2851D4F02; Mon, 30 Dec 2019 04:48:15 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mQ0v3fHbz4Y3k; Mon, 30 Dec 2019 04:48:15 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x431.google.com with SMTP id q6so31579887wro.9; Sun, 29 Dec 2019 20:48:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gg/ZrELw0N1zChfsLdN75g4MLPSOTfzK8UMyBjc+wtA=; b=m2t9WUNdKy7ZyWTciGULHVArEAxD+LhQMEuYfWx/zr7obUBX8Y7QQ1NE6ATYLhT3V3 6iPDa0IhFEIn6ub4FX7WSxgcQeeSKFQdWvbvyMcMVX/mD3dmM6jSaUlddJr7Huxkmsqt gNTUr2/O4vqqRetV1R57rzd4RUew59BrSHZVyovkccWzZU/wkUsqKUl4rOx2g1kSMY6k z4Rqa0LxxuW8+C8AGHtEzfNEGsUAQMVbdaOzmBIdcFGn8GvkZdnYbnk3bo4RwnGjndKQ 5PWekKoY5s0q2YwUU7ncZd+n/stXF1r01yWzqY0u6GYCqVFbtyXWKDZd8SrRQIm7kw9g 350A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gg/ZrELw0N1zChfsLdN75g4MLPSOTfzK8UMyBjc+wtA=; b=oXU44MGQcLXUtZiMaw3cIpMPzJok+Iy9ubLm/eT3l4823XePe3HzG3qPXqsXw5pnoZ HYP3zqkeoxclc7jBEx04Iv0uP14Us8mAVWTS6qGmaxhyoG4nc5jo+DyELEwIgkcjQko5 W3z0JrKtnBSLjukTJ/OWQfTI0CV84ESIpN+Oiv10lVeyuqFRlxbEakcxhXIvL3lJf3TA WbrxXFZhY5/rClOQAsaP2JO32QUkuduzN5w3LIZeqQVE6GRjJt0scgrLUSCzXMKQIdeg Xna142MyIdpmpwQKw/3+t3HVdKz4+tVVzTYy2QwewA2z7zFDUAB14h0D+b/BPY+/MqQd VV7A== X-Gm-Message-State: APjAAAXep/pl4leoOADscQdDpzx7U6UTV3ou7xWBuDSh35Mh9hnSkozT aD1rFguKuaZzZbe4ffgw9UlbNVR8WBdeIYi9Z2GSag== X-Google-Smtp-Source: APXvYqxZVPwpdvFYHEvnowfxccmuC0Uvb/se+Q+UqmsiTUs18obHTS7m2WOay+NELih7ofiqfzNH1Iitn+DlqqwZoWk= X-Received: by 2002:a5d:4f8e:: with SMTP id d14mr24940804wru.112.1577681293460; Sun, 29 Dec 2019 20:48:13 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:6b02:0:0:0:0:0 with HTTP; Sun, 29 Dec 2019 20:48:12 -0800 (PST) In-Reply-To: <201912300138.xBU1cJqR064429@repo.freebsd.org> References: <201912300138.xBU1cJqR064429@repo.freebsd.org> From: Mateusz Guzik Date: Mon, 30 Dec 2019 05:48:12 +0100 Message-ID: Subject: Re: svn commit: r356194 - head/sys/dev/random To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47mQ0v3fHbz4Y3k X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 04:48:15 -0000 On 12/30/19, Conrad Meyer wrote: > Author: cem > Date: Mon Dec 30 01:38:19 2019 > New Revision: 356194 > URL: https://svnweb.freebsd.org/changeset/base/356194 > > Log: > random(4): Make entropy source deregistration safe > > Allow loadable modules that provide random entropy source(s) to safely > unload. Prior to this change, no driver could ensure that their > random_source structure was not being used by random_harvestq.c for any > period of time after invoking random_source_deregister(). > > This change converts the source_list LIST to a ConcurrencyKit CK_LIST and > uses an epoch(9) to protect typical read accesses of the list. The > existing > HARVEST_LOCK spin mutex is used to safely add and remove list entries. > random_source_deregister() uses epoch_wait() to ensure no concurrent > source_list readers are accessing a random_source before freeing the list > item and returning to the caller. > > Callers can safely unload immediately after random_source_deregister() > returns. > What's the point of using epoch for this one instead of rmlocks? rmlocks have the upshot of being faster single-threaded for the case you want (no fences). epoch would make sense if the list was expected to change over time, -- Mateusz Guzik From owner-svn-src-head@freebsd.org Mon Dec 30 09:22:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61FBC1DAB59; Mon, 30 Dec 2019 09:22:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mX5n1qSvz3J8t; Mon, 30 Dec 2019 09:22:53 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39F5A27A9A; Mon, 30 Dec 2019 09:22:53 +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 xBU9MraE045913; Mon, 30 Dec 2019 09:22:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBU9MrLJ045912; Mon, 30 Dec 2019 09:22:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912300922.xBU9MrLJ045912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 30 Dec 2019 09:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356201 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 356201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 09:22:53 -0000 Author: hselasky Date: Mon Dec 30 09:22:52 2019 New Revision: 356201 URL: https://svnweb.freebsd.org/changeset/base/356201 Log: Fix spelling. PR: 242891 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Dec 30 03:13:38 2019 (r356200) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Dec 30 09:22:52 2019 (r356201) @@ -1506,7 +1506,7 @@ hn_vf_rss_fixup(struct hn_softc *sc, bool reconf) strlcpy(ifrk.ifrk_name, vf_ifp->if_xname, sizeof(ifrk.ifrk_name)); error = vf_ifp->if_ioctl(vf_ifp, SIOCGIFRSSKEY, (caddr_t)&ifrk); if (error) { - if_printf(ifp, "%s SIOCGRSSKEY failed: %d\n", + if_printf(ifp, "%s SIOCGIFRSSKEY failed: %d\n", vf_ifp->if_xname, error); goto done; } From owner-svn-src-head@freebsd.org Mon Dec 30 11:32:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B58D21DD076; Mon, 30 Dec 2019 11:32:43 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mZzb4MFpz3P37; Mon, 30 Dec 2019 11:32:43 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 8E51B185AF; Mon, 30 Dec 2019 11:32:43 +0000 (UTC) Date: Mon, 30 Dec 2019 11:32:43 +0000 From: Alexey Dokuchaev To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r356185 - in head: lib/geom lib/geom/sched sys/geom sys/geom/sched sys/modules/geom sys/modules/geom/geom_sched sys/sys Message-ID: <20191230113243.GA58338@FreeBSD.org> References: <201912292116.xBTLG4kV012809@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201912292116.xBTLG4kV012809@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 11:32:43 -0000 On Sun, Dec 29, 2019 at 09:16:04PM +0000, Alexander Motin wrote: > New Revision: 356185 > URL: https://svnweb.freebsd.org/changeset/base/356185 > > Log: > Remove GEOM_SCHED class and gsched tool. > > This code was not actively maintained since it was introduced 10 years ago. > It lacks support for many later GEOM features, such as direct dispatch, > unmapped I/O, stripesize/stripeoffset, resize, etc. Plus it is the only > remaining use of GEOM nstart/nend request counters, used there to implement > live insertion/removal, questionable by itself. Wow, that was unexpected, I use it on all my machines' HDD drives. Is there a planned replacement, or I'd better create a port for the GEOM_SCHED class and gsched(8) tool? ./danfe From owner-svn-src-head@freebsd.org Mon Dec 30 13:29:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A9801DFEBD; Mon, 30 Dec 2019 13:29:31 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mdZM2dXVz3yft; Mon, 30 Dec 2019 13:29:31 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51836258C; Mon, 30 Dec 2019 13:29:31 +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 xBUDTVf1088273; Mon, 30 Dec 2019 13:29:31 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBUDTVqG088272; Mon, 30 Dec 2019 13:29:31 GMT (envelope-from br@FreeBSD.org) Message-Id: <201912301329.xBUDTVqG088272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 30 Dec 2019 13:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356202 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 356202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 13:29:31 -0000 Author: br Date: Mon Dec 30 13:29:30 2019 New Revision: 356202 URL: https://svnweb.freebsd.org/changeset/base/356202 Log: Round the kernel stack allocation up as required. Submitted by: James Clarke Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22961 Modified: head/sys/riscv/riscv/locore.S Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Mon Dec 30 09:22:52 2019 (r356201) +++ head/sys/riscv/riscv/locore.S Mon Dec 30 13:29:30 2019 (r356202) @@ -186,8 +186,10 @@ va: /* Initialize stack pointer */ la s3, initstack_end mv sp, s3 - addi sp, sp, -PCB_SIZE + /* Allocate space for thread0 PCB and riscv_bootparams */ + addi sp, sp, -(PCB_SIZE + 40) & ~STACKALIGNBYTES + /* Clear BSS */ la s0, _C_LABEL(__bss_start) la s1, _C_LABEL(_end) @@ -203,8 +205,6 @@ va: #endif /* Fill riscv_bootparams */ - addi sp, sp, -40 - la t0, pagetable_l1 sd t0, 0(sp) /* kern_l1pt */ sd s9, 8(sp) /* kern_phys */ From owner-svn-src-head@freebsd.org Mon Dec 30 13:47:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CB9E1E05DF; Mon, 30 Dec 2019 13:47:19 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47mdyt2G34z40X5; Mon, 30 Dec 2019 13:47:17 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 23AD52602AB; Mon, 30 Dec 2019 14:47:14 +0100 (CET) Subject: Re: svn commit: r356092 - head/sys/dev/kbdmux From: Hans Petter Selasky To: Kyle Evans Cc: src-committers , svn-src-all , svn-src-head References: <201912261725.xBQHPq8u076460@repo.freebsd.org> <62d80c6e-f0c0-05bb-cb22-b6cf40d4c06f@selasky.org> <3767f83b-c8a0-5aee-c57f-837aaf187ee7@selasky.org> Message-ID: <053a7dc5-3647-15d8-d13e-86008702ca30@selasky.org> Date: Mon, 30 Dec 2019 14:44:17 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <3767f83b-c8a0-5aee-c57f-837aaf187ee7@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47mdyt2G34z40X5 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-4.94 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-2.64)[ip: (-9.19), ipnet: 2a01:4f8::/29(-2.43), asn: 24940(-1.54), country: DE(-0.02)]; TO_DN_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 13:47:19 -0000 On 2019-12-27 16:34, Hans Petter Selasky wrote: > On 2019-12-27 17:28, Kyle Evans wrote: >> At the risk of asking a dumb question, where are you wanting to make >> this distinction at? > > For example when implementing applications which allow playing the piano > via the system keyboard this is useful. See here for example: > > https://doc.qt.io/qt-5/qkeyevent.html#isAutoRepeat > > Needs to be implemented for FreeBSD, though! > What do you think? I see the evdev.c layer detects automagically if a key is already down, and treat that as a key-repeat event. But I couldn't find similar logic in xf86-input-keyboard . --HPS From owner-svn-src-head@freebsd.org Mon Dec 30 14:18:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7CFF1E12C9; Mon, 30 Dec 2019 14:18:39 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mfg33x0Qz429m; Mon, 30 Dec 2019 14:18:39 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.5] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id EB35411979; Mon, 30 Dec 2019 14:18:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r356185 - in head: lib/geom lib/geom/sched sys/geom sys/geom/sched sys/modules/geom sys/modules/geom/geom_sched sys/sys To: Alexey Dokuchaev , Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912292116.xBTLG4kV012809@repo.freebsd.org> <20191230113243.GA58338@FreeBSD.org> From: Pedro Giffuni Autocrypt: addr=pfg@FreeBSD.org; keydata= mQENBFU6tr0BCAC/MABNSg8O9sLZZ1cCl8GczwjnyF6WEvtfLpIkAWEo49H3TuG3cMNwuavi xnwASLS73ppj6ziWK1QsfdAaA8Mkvk25UtenfsCTiA38q0RwvHPn8W6eorJ6rYHRReNnncA+ oPLrLmL6IOUK9dlcLJP5i45PGwpx9YNI+D/BFcji7enpnsGjunhRE3NJ1YBXiKMormfnPvpV yVWpKnnB03nFIQphW108G5U9wytZqsiGkshn0ar0FBGsdJ19d/ePBuMceaWRtf0nJrNkC9sB D8ISmFp6/DAoQBhyJxvemC83/QNV5u9kGdwemaKOJ6SdAmBBZYbdAxCO8i/Eq33mrXx7ABEB AAG0H1BlZHJvIEdpZmZ1bmkgPHBmZ0BGcmVlQlNELm9yZz6JATcEEwEKACEFAlU6tr0CGwMF CwkIBwMFFQoJCAsFFgMCAQACHgECF4AACgkQzWsLls7yLQTFEgf/blVvg7MPpZp/KWwEShqI VpkJLhXLjvYzjoSCrpuVtNMCdpYh3L6gY5mBr9VASc/iWb6DUUxX9g6oLQ4l1e8eEwSHdXda RG/NjxJhz8dsLO8H6dnwl6HEZ+nymXIibX6GGy10gQeyv6sNGsgSCwlyFJZcv2lW2M1ev11w 3yY1eQnIsPq4vyIMYEQ1aIIYu1JPNEzRZ7sDuRGdnvMH7FhHaNzSs8d4PHw2JSwDHPuN/W6S UhK+A/TDW9BQ4ZzDRpKrIPfWqkAa+76NtGglmJWS99WG7rJAoPUIj2xpzojoQbT3z1vbeGxK cgGvOyQMlrJSRZwOtFuhcdbQ6DX4ETI7NrkBDQRVOra9AQgA1ACQK5u/H1MgjSKXQttCv8Kz /k7fHmaWLrhPAJH6bqR7wpv/Hz2y/8uD+5qg/vk9/pwYuj9TzbCXs9NeWye/+DV8Aw7Z22b2 OjB0VbEpHREDs0zS+0KMP7STOPpyHVYdgWCQ7Qgd/LG0gfUP5M0R8s2OH3Il8rcS4ZeEd/tr O3LyoDiK4mInT/X3oJX7xetws3jpSPk51TDOplamehXjndwemttUTw1czITF9MfDosaihoUr o6NcAtBzFYIF2NuKhrASs9prec+e36a3lCUbMOHof62TnBZZnWtNdmnv1RNv3q17yavqi0F/ rvtmckHhJ8NcnYL8/gGD48nhKf60UQARAQABiQEfBBgBCgAJBQJVOra9AhsMAAoJEM1rC5bO 8i0EkGAH+QG/1y0mcOBFsouMdmDUpRusRxWHdmdIjFt4FJ2/K7YDyrliKcUTOp+zjCyfLVE6 UELiRvsT+mg4QcZL7e+JAuLkW5LhiAskz8/1fRgnwVquTcYd7TPJrYnejpLyumhbsgo0bN4G s9yrJeQpKbln6YQxifzT4Eqot3aEeZxlUEKzQd0Vq1ci8PTI1krvda9x+FdGvKxY9Iz4T+SW NZsvBaCXo9hjJZ7U1VaCdWxgHhy5tuTuMAGGS9lCGbdvdKuAbSQDtcvx0jcY5s7Q2t2udCyV mRDbQYrl8PEyJa3Cz3NoBD9g9EEr9PlX05hOWMVf3M5pS4j/XKbzUbKqiBy1VPw= Organization: FreeBSD Message-ID: Date: Mon, 30 Dec 2019 09:18:36 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20191230113243.GA58338@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 14:18:39 -0000 On 2019-12-30 06:32, Alexey Dokuchaev wrote: > On Sun, Dec 29, 2019 at 09:16:04PM +0000, Alexander Motin wrote: >> New Revision: 356185 >> URL: https://svnweb.freebsd.org/changeset/base/356185 >> >> Log: >> Remove GEOM_SCHED class and gsched tool. >> =20 >> This code was not actively maintained since it was introduced 10 yea= rs ago. >> It lacks support for many later GEOM features, such as direct dispat= ch, >> unmapped I/O, stripesize/stripeoffset, resize, etc. Plus it is the = only >> remaining use of GEOM nstart/nend request counters, used there to im= plement >> live insertion/removal, questionable by itself. > Wow, that was unexpected, I use it on all my machines' HDD drives. There was a posting by mav@ on the -arch list : " gsched: modernize or remove?". It was a short notice (Dec 27), but there was strong agreement from the author. > Is there a planned replacement, or I'd better create a port for the > GEOM_SCHED class and gsched(8) tool? If you can convince someone to update it with the enhancements suggested in the -arch post, I guess it could be resurrected, otherwise a port. Pedro. From owner-svn-src-head@freebsd.org Mon Dec 30 14:38:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C93041E18EA; Mon, 30 Dec 2019 14:38:06 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mg5V4yVqz435x; Mon, 30 Dec 2019 14:38:06 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5852320E; Mon, 30 Dec 2019 14:38:06 +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 xBUEc6uQ030033; Mon, 30 Dec 2019 14:38:06 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBUEc6bd030031; Mon, 30 Dec 2019 14:38:06 GMT (envelope-from br@FreeBSD.org) Message-Id: <201912301438.xBUEc6bd030031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 30 Dec 2019 14:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356203 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 356203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 14:38:06 -0000 Author: br Date: Mon Dec 30 14:38:06 2019 New Revision: 356203 URL: https://svnweb.freebsd.org/changeset/base/356203 Log: Don't hard-code size of struct riscv_bootparams. Submitted by: James Clarke Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22968 Modified: head/sys/riscv/riscv/genassym.c head/sys/riscv/riscv/locore.S Modified: head/sys/riscv/riscv/genassym.c ============================================================================== --- head/sys/riscv/riscv/genassym.c Mon Dec 30 13:29:30 2019 (r356202) +++ head/sys/riscv/riscv/genassym.c Mon Dec 30 14:38:06 2019 (r356203) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include ASSYM(KERNBASE, KERNBASE); ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); @@ -98,3 +99,5 @@ ASSYM(TF_SEPC, offsetof(struct trapframe, tf_sepc)); ASSYM(TF_STVAL, offsetof(struct trapframe, tf_stval)); ASSYM(TF_SCAUSE, offsetof(struct trapframe, tf_scause)); ASSYM(TF_SSTATUS, offsetof(struct trapframe, tf_sstatus)); + +ASSYM(RISCV_BOOTPARAMS_SIZE, sizeof(struct riscv_bootparams)); Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Mon Dec 30 13:29:30 2019 (r356202) +++ head/sys/riscv/riscv/locore.S Mon Dec 30 14:38:06 2019 (r356203) @@ -188,7 +188,7 @@ va: mv sp, s3 /* Allocate space for thread0 PCB and riscv_bootparams */ - addi sp, sp, -(PCB_SIZE + 40) & ~STACKALIGNBYTES + addi sp, sp, -(PCB_SIZE + RISCV_BOOTPARAMS_SIZE) & ~STACKALIGNBYTES /* Clear BSS */ la s0, _C_LABEL(__bss_start) From owner-svn-src-head@freebsd.org Mon Dec 30 15:54:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44EB01E29FC; Mon, 30 Dec 2019 15:54:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mhnn14mLz45mf; Mon, 30 Dec 2019 15:54:37 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 204CF433F; Mon, 30 Dec 2019 15:54:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBUFsbbc077613; Mon, 30 Dec 2019 15:54:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBUFsbVG077612; Mon, 30 Dec 2019 15:54:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912301554.xBUFsbVG077612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 30 Dec 2019 15:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356204 - head/usr.sbin/inetd X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/inetd X-SVN-Commit-Revision: 356204 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 15:54:37 -0000 Author: kevans Date: Mon Dec 30 15:54:36 2019 New Revision: 356204 URL: https://svnweb.freebsd.org/changeset/base/356204 Log: inetd: don't leak `policy` on return sep->se_policy gets a strdup'd version of policy, so we don't need it to stick around afterwards. While here, remove a couple of NULL checks prior to free(policy). CID: 1006865 MFC after: 3 days Modified: head/usr.sbin/inetd/inetd.c Modified: head/usr.sbin/inetd/inetd.c ============================================================================== --- head/usr.sbin/inetd/inetd.c Mon Dec 30 14:38:06 2019 (r356203) +++ head/usr.sbin/inetd/inetd.c Mon Dec 30 15:54:36 2019 (r356204) @@ -1629,12 +1629,10 @@ more: for (p = cp + 2; p && *p && isspace(*p); p++) ; if (*p == '\0') { - if (policy) - free(policy); + free(policy); policy = NULL; } else if (ipsec_get_policylen(p) >= 0) { - if (policy) - free(policy); + free(policy); policy = newstr(p); } else { syslog(LOG_ERR, @@ -1969,6 +1967,7 @@ more: LIST_INIT(&sep->se_conn[i]); #ifdef IPSEC sep->se_policy = policy ? newstr(policy) : NULL; + free(policy); #endif return (sep); } From owner-svn-src-head@freebsd.org Mon Dec 30 15:55:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33F2A1E2A7E for ; Mon, 30 Dec 2019 15:55:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mhpm1fccz45vZ for ; Mon, 30 Dec 2019 15:55:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72b.google.com with SMTP id z14so25266486qkg.9 for ; Mon, 30 Dec 2019 07:55:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1V8JbL55kx9iNcRTxqxQ0e9UiVZvjhP9kZLMUK8m8kQ=; b=zJxKE/mAqNJA561DKknozQSpjAVVehimwpXQLV16pnu3KFUsU9v/xSLK4+YQcd0bRX 0sAcO6A29jMxbeVHh1cEEDNxcxVZMseIwKzkDuG2otAv3jeZ22Grl5YeF1cZYkc0/l5Q 2cWU7AahtJaFkQvoUadRUIv3gomcWQw2XnO33b1IJ8GM2OFPARiP9ynKRKbtOiYyspvG JHEmZqPleDjK9yoOBQC4Zg4nFV3UkqeriUK3/6xO1trh7XcQn+XSjttruqBBkiGFOjBU 4lymhKtXzczJYMy1qC4hrSsNV04abaaeLRzyDDxmfxWNM/UKmSyayoQazDMMD4OuFDvg o+9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1V8JbL55kx9iNcRTxqxQ0e9UiVZvjhP9kZLMUK8m8kQ=; b=P7k/Fk0pxGCayJgnNLZIGsAmgpOEcLz3YhlX6I+2lbDN++UOXCzguq+Zt3+WMGQbue grhNL4AApi4m+hiVtKw4BrNyrFHw1L91/a5KzYuBSK69tN4PIbgvvqhLXkzv7TIH6Arc MruVeC+Y6/XAKxUNRYBKAK43KjW/XuFbULlZYCNjGnhjusaRGuZVX0K5OUCWFgB72Bip 4MYheAo2w+CYTBQFhpYkRhuS9WKn6sqU4Yb0G+PikzM3fTrb31U+rDqP5qRJ6r+KDL5a ng/Ze6UvOeIZ/K42+K5xoRoJTMQPwzzIiZO4PmMu+J35d6fG19EDKE6l/75wKHOUqWMQ 00Aw== X-Gm-Message-State: APjAAAUGTpuOJhFOfS4oGEFYpDWJtxDIBLxDjxoPdqvjV/P7JRPuCzBL M5CQJ08H0olOuA3bRKWft2sOkCRSI7hPUx0DG77gcA== X-Google-Smtp-Source: APXvYqwqI1zRbi9niMz9u4yi9U5Eszf4iWhuHeshxcYjFxXhLR2tJd46m6Tz+G2KyGamanbGRN9zH5kKPRfFLlPkX9Y= X-Received: by 2002:a05:620a:94f:: with SMTP id w15mr54027430qkw.380.1577721327047; Mon, 30 Dec 2019 07:55:27 -0800 (PST) MIME-Version: 1.0 References: <201912292116.xBTLG4kV012809@repo.freebsd.org> <20191230113243.GA58338@FreeBSD.org> In-Reply-To: <20191230113243.GA58338@FreeBSD.org> From: Warner Losh Date: Mon, 30 Dec 2019 08:55:14 -0700 Message-ID: Subject: Re: svn commit: r356185 - in head: lib/geom lib/geom/sched sys/geom sys/geom/sched sys/modules/geom sys/modules/geom/geom_sched sys/sys To: Alexey Dokuchaev Cc: Alexander Motin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 47mhpm1fccz45vZ X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=zJxKE/mA; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72b) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.69 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[b.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.69)[ip: (-9.37), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.87), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 15:55:29 -0000 On Mon, Dec 30, 2019, 5:32 AM Alexey Dokuchaev wrote: > On Sun, Dec 29, 2019 at 09:16:04PM +0000, Alexander Motin wrote: > > New Revision: 356185 > > URL: https://svnweb.freebsd.org/changeset/base/356185 > > > > Log: > > Remove GEOM_SCHED class and gsched tool. > > > > This code was not actively maintained since it was introduced 10 years > ago. > > It lacks support for many later GEOM features, such as direct dispatch, > > unmapped I/O, stripesize/stripeoffset, resize, etc. Plus it is the > only > > remaining use of GEOM nstart/nend request counters, used there to > implement > > live insertion/removal, questionable by itself. > > Wow, that was unexpected, I use it on all my machines' HDD drives. > Is there a planned replacement, or I'd better create a port for the > GEOM_SCHED class and gsched(8) tool? How much of a performance improvement do you see with it? There has been no tweaks to this geom in years and years. It was tuned to 10 year old hard drives and never retuned for anything newer. And when I played with it a few years ago, I saw no improvements... Warner > From owner-svn-src-head@freebsd.org Mon Dec 30 17:02:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C01F1E47C1; Mon, 30 Dec 2019 17:02:08 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mkHh1D16z4FD1; Mon, 30 Dec 2019 17:02:08 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 224BC1DF94; Mon, 30 Dec 2019 17:02:08 +0000 (UTC) Date: Mon, 30 Dec 2019 17:02:08 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: Alexander Motin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r356185 - in head: lib/geom lib/geom/sched sys/geom sys/geom/sched sys/modules/geom sys/modules/geom/geom_sched sys/sys Message-ID: <20191230170208.GA20424@FreeBSD.org> References: <201912292116.xBTLG4kV012809@repo.freebsd.org> <20191230113243.GA58338@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 17:02:08 -0000 On Mon, Dec 30, 2019 at 08:55:14AM -0700, Warner Losh wrote: > On Mon, Dec 30, 2019, 5:32 AM Alexey Dokuchaev wrote: > > On Sun, Dec 29, 2019 at 09:16:04PM +0000, Alexander Motin wrote: > > > New Revision: 356185 > > > URL: https://svnweb.freebsd.org/changeset/base/356185 > > > > > > Log: > > > Remove GEOM_SCHED class and gsched tool. > > > [...] > > > > Wow, that was unexpected, I use it on all my machines' HDD drives. > > Is there a planned replacement, or I'd better create a port for the > > GEOM_SCHED class and gsched(8) tool? > > How much of a performance improvement do you see with it? > > There has been no tweaks to this geom in years and years. It was tuned > to 10 year old hard drives and never retuned for anything newer. Well, hard drives essentially didn't change since then, still being the same roration media. :) > And when I played with it a few years ago, I saw no improvements... Admittedly, I've only did some tests no later than in 8.4 times when I first started using it. Fair point, though, I should redo them again. ./danfe From owner-svn-src-head@freebsd.org Mon Dec 30 17:18:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 021561E4CAD; Mon, 30 Dec 2019 17:18:51 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mkfy6M8cz4G4D; Mon, 30 Dec 2019 17:18:50 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D578A51E5; Mon, 30 Dec 2019 17:18:50 +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 xBUHIoKk031774; Mon, 30 Dec 2019 17:18:50 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBUHIoxw031772; Mon, 30 Dec 2019 17:18:50 GMT (envelope-from br@FreeBSD.org) Message-Id: <201912301718.xBUHIoxw031772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 30 Dec 2019 17:18:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356205 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 356205 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 17:18:51 -0000 Author: br Date: Mon Dec 30 17:18:50 2019 New Revision: 356205 URL: https://svnweb.freebsd.org/changeset/base/356205 Log: Don't hard-code field offsets of struct riscv_bootparams. Submitted by: James Clarke Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22970 Modified: head/sys/riscv/riscv/genassym.c head/sys/riscv/riscv/locore.S Modified: head/sys/riscv/riscv/genassym.c ============================================================================== --- head/sys/riscv/riscv/genassym.c Mon Dec 30 15:54:36 2019 (r356204) +++ head/sys/riscv/riscv/genassym.c Mon Dec 30 17:18:50 2019 (r356205) @@ -101,3 +101,9 @@ ASSYM(TF_SCAUSE, offsetof(struct trapframe, tf_scause) ASSYM(TF_SSTATUS, offsetof(struct trapframe, tf_sstatus)); ASSYM(RISCV_BOOTPARAMS_SIZE, sizeof(struct riscv_bootparams)); +ASSYM(RISCV_BOOTPARAMS_KERN_L1PT, offsetof(struct riscv_bootparams, kern_l1pt)); +ASSYM(RISCV_BOOTPARAMS_KERN_PHYS, offsetof(struct riscv_bootparams, kern_phys)); +ASSYM(RISCV_BOOTPARAMS_KERN_STACK, offsetof(struct riscv_bootparams, + kern_stack)); +ASSYM(RISCV_BOOTPARAMS_DTBP_VIRT, offsetof(struct riscv_bootparams, dtbp_virt)); +ASSYM(RISCV_BOOTPARAMS_DTBP_PHYS, offsetof(struct riscv_bootparams, dtbp_phys)); Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Mon Dec 30 15:54:36 2019 (r356204) +++ head/sys/riscv/riscv/locore.S Mon Dec 30 17:18:50 2019 (r356205) @@ -206,15 +206,15 @@ va: /* Fill riscv_bootparams */ la t0, pagetable_l1 - sd t0, 0(sp) /* kern_l1pt */ - sd s9, 8(sp) /* kern_phys */ + sd t0, RISCV_BOOTPARAMS_KERN_L1PT(sp) + sd s9, RISCV_BOOTPARAMS_KERN_PHYS(sp) la t0, initstack - sd t0, 16(sp) /* kern_stack */ + sd t0, RISCV_BOOTPARAMS_KERN_STACK(sp) li t0, (VM_MAX_KERNEL_ADDRESS - 2 * L2_SIZE) - sd t0, 24(sp) /* dtbp_virt */ - sd a1, 32(sp) /* dtbp_phys */ + sd t0, RISCV_BOOTPARAMS_DTBP_VIRT(sp) + sd a1, RISCV_BOOTPARAMS_DTBP_PHYS(sp) mv a0, sp call _C_LABEL(initriscv) /* Off we go */ From owner-svn-src-head@freebsd.org Mon Dec 30 18:11:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77A911E610B; Mon, 30 Dec 2019 18:11:08 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mlqJ29Fsz4K9m; Mon, 30 Dec 2019 18:11:08 +0000 (UTC) (envelope-from kaktus@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 459A15B63; Mon, 30 Dec 2019 18:11:08 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBUIB8Ak063407; Mon, 30 Dec 2019 18:11:08 GMT (envelope-from kaktus@FreeBSD.org) Received: (from kaktus@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBUIB7iV063402; Mon, 30 Dec 2019 18:11:07 GMT (envelope-from kaktus@FreeBSD.org) Message-Id: <201912301811.xBUIB7iV063402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kaktus set sender to kaktus@FreeBSD.org using -f From: Pawel Biernacki Date: Mon, 30 Dec 2019 18:11:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356206 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Group: head X-SVN-Commit-Author: kaktus X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Commit-Revision: 356206 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 18:11:08 -0000 Author: kaktus Date: Mon Dec 30 18:11:06 2019 New Revision: 356206 URL: https://svnweb.freebsd.org/changeset/base/356206 Log: linux(4): implement copy_file_range(2) copy_file_range(2) is implemented natively since r350315, make it available for Linux binaries too. Reviewed by: kib (mentor), trasz (previous version) Approved by: kib (mentor) Differential Revision: https://reviews.freebsd.org/D22959 Modified: head/sys/amd64/linux/linux_dummy.c head/sys/amd64/linux32/linux32_dummy.c head/sys/arm64/linux/linux_dummy.c head/sys/compat/linux/linux_file.c head/sys/i386/linux/linux_dummy.c Modified: head/sys/amd64/linux/linux_dummy.c ============================================================================== --- head/sys/amd64/linux/linux_dummy.c Mon Dec 30 17:18:50 2019 (r356205) +++ head/sys/amd64/linux/linux_dummy.c Mon Dec 30 18:11:06 2019 (r356206) @@ -144,8 +144,6 @@ DUMMY(userfaultfd); DUMMY(membarrier); /* Linux 4.4: */ DUMMY(mlock2); -/* Linux 4.5: */ -DUMMY(copy_file_range); /* Linux 4.6: */ DUMMY(preadv2); DUMMY(pwritev2); Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Mon Dec 30 17:18:50 2019 (r356205) +++ head/sys/amd64/linux32/linux32_dummy.c Mon Dec 30 18:11:06 2019 (r356206) @@ -148,8 +148,6 @@ DUMMY(userfaultfd); DUMMY(membarrier); /* Linux 4.4: */ DUMMY(mlock2); -/* Linux 4.5: */ -DUMMY(copy_file_range); /* Linux 4.6: */ DUMMY(preadv2); DUMMY(pwritev2); Modified: head/sys/arm64/linux/linux_dummy.c ============================================================================== --- head/sys/arm64/linux/linux_dummy.c Mon Dec 30 17:18:50 2019 (r356205) +++ head/sys/arm64/linux/linux_dummy.c Mon Dec 30 18:11:06 2019 (r356206) @@ -142,8 +142,6 @@ DUMMY(userfaultfd); DUMMY(membarrier); /* Linux 4.4: */ DUMMY(mlock2); -/* Linux 4.5: */ -DUMMY(copy_file_range); /* Linux 4.6: */ DUMMY(preadv2); DUMMY(pwritev2); Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Mon Dec 30 17:18:50 2019 (r356205) +++ head/sys/compat/linux/linux_file.c Mon Dec 30 18:11:06 2019 (r356206) @@ -1565,3 +1565,44 @@ linux_fallocate(struct thread *td, struct linux_falloc return (kern_posix_fallocate(td, args->fd, args->offset, args->len)); } + +int +linux_copy_file_range(struct thread *td, struct linux_copy_file_range_args + *args) +{ + l_loff_t inoff, outoff, *inoffp, *outoffp; + int error, flags; + + /* + * copy_file_range(2) on Linux doesn't define any flags (yet), so is + * the native implementation. Enforce it. + */ + if (args->flags != 0) { + linux_msg(td, "copy_file_range unsupported flags 0x%x", + args->flags); + return (EINVAL); + } + flags = 0; + inoffp = outoffp = NULL; + if (args->off_in != NULL) { + error = copyin(args->off_in, &inoff, sizeof(l_loff_t)); + if (error != 0) + return (error); + inoffp = &inoff; + } + if (args->off_out != NULL) { + error = copyin(args->off_out, &outoff, sizeof(l_loff_t)); + if (error != 0) + return (error); + outoffp = &outoff; + } + + error = kern_copy_file_range(td, args->fd_in, inoffp, args->fd_out, + outoffp, args->len, flags); + if (error == 0 && args->off_in != NULL) + error = copyout(inoffp, args->off_in, sizeof(l_loff_t)); + if (error == 0 && args->off_out != NULL) + error = copyout(outoffp, args->off_out, sizeof(l_loff_t)); + return (error); +} + Modified: head/sys/i386/linux/linux_dummy.c ============================================================================== --- head/sys/i386/linux/linux_dummy.c Mon Dec 30 17:18:50 2019 (r356205) +++ head/sys/i386/linux/linux_dummy.c Mon Dec 30 18:11:06 2019 (r356206) @@ -144,8 +144,6 @@ DUMMY(userfaultfd); DUMMY(membarrier); /* Linux 4.4: */ DUMMY(mlock2); -/* Linux 4.5: */ -DUMMY(copy_file_range); /* Linux 4.6: */ DUMMY(preadv2); DUMMY(pwritev2); From owner-svn-src-head@freebsd.org Mon Dec 30 19:50:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 849C21E8721 for ; Mon, 30 Dec 2019 19:50:00 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mp1M4dw2z4PrR for ; Mon, 30 Dec 2019 19:49:59 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pf1-x444.google.com with SMTP id n9so10838748pff.13 for ; Mon, 30 Dec 2019 11:49:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=DxC1N0ciGqInvwWGpLGSWVktCIi38YN07JLahGkMKDU=; b=lBzTQxKz9uhCyzVg9z+PXcAWGZmb6gZVyOeKNbpScb8umy45iyHKAT5VcwpTDV1t0a g7SLmSWJEPLMSb/XlWib5JXRHic0qaXxwUkKgHo1CWa7DcZ+0FM64Usq9w10tAsyoX/j A9legO4F49USuFg3z3pxuNosbyO1i+3KFXdOVUHAa/W94CxgOcj+hWus+ZNJ5dDpRnuq CW6zGi9BQkAL8Y0jW/RisUM6cDvAWK+Z8zMekLXjmz57AGykk6p0PyVklZOzxbrfHYG1 V3AsnBwDqLmN87aLw7T5AOCScMxuEw6V9n4FriHCdVJelumIhOVSUFRxZQxcrDSsNLUw zdTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=DxC1N0ciGqInvwWGpLGSWVktCIi38YN07JLahGkMKDU=; b=idxl6kw2597caX0IIH9N3wpByjs6H/Ps8wwUmClVEpNBjeC0ZrMSSrD+1riTRX4m5S AeiUPn9LsWqbxHqdBH4UmQ9oR0zH1P8HAoRnKdNF0nO+wUc8Y2wDnC7zgOqtjCBVlcV4 ZRXra2rLhDw5FB8YGLodgiKH1DWHWrBG26GOeKcn2z5kFqp18pWupXXPTvVxJcm+ILU0 CVWvg5+tGEqA3ksw7IPlPd+ztkcK8qWddnWQHQ415ANW5y2FwW/NlR0+D7DbUIp6Usmm qmhhmAnFfrUW1BTLsWPb50xAwpnMGFlCaRSKY+F9C6cMrZpQUemcl9ODOCfvfrOcKcT5 MGqQ== X-Gm-Message-State: APjAAAVPCDM/oXLCBl17oBkKs2Unlr9gPvUZbeUAoPJr6+xJPCyZjOfU g74T4Xy0MrsnbKDT4anlYAzLOg== X-Google-Smtp-Source: APXvYqx1YcrLC/v5jB2/rHOOOj8G37sv8bD+t2jf9Z3ShfiLEQGGVfD3WWfeF+40etgaExhHG2IqdA== X-Received: by 2002:a63:904c:: with SMTP id a73mr74354392pge.335.1577735398072; Mon, 30 Dec 2019 11:49:58 -0800 (PST) Received: from rrcs-76-81-105-82.west.biz.rr.com (rrcs-76-81-105-82.west.biz.rr.com. [76.81.105.82]) by smtp.gmail.com with ESMTPSA id j17sm25174928pfa.28.2019.12.30.11.49.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Dec 2019 11:49:57 -0800 (PST) Date: Mon, 30 Dec 2019 09:49:55 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: "Kevin P. Neal" cc: rgrimes@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org, Pedro Giffuni , src-committers@freebsd.org Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys In-Reply-To: <20191230020202.GB74518@neutralgood.org> Message-ID: References: <201912280527.xBS5R8fk041737@gndrsh.dnsmgr.net> <20191230020202.GB74518@neutralgood.org> User-Agent: Alpine 2.21.9999 (BSF 287 2018-06-16) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Rspamd-Queue-Id: 47mp1M4dw2z4PrR X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=jroberson-net.20150623.gappssmtp.com header.s=20150623 header.b=lBzTQxKz; dmarc=none; spf=none (mx1.freebsd.org: domain of jroberson@jroberson.net has no SPF policy when checking 2607:f8b0:4864:20::444) smtp.mailfrom=jroberson@jroberson.net X-Spamd-Result: default: False [-2.72 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[jroberson-net.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[jroberson.net]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[jroberson-net.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[4.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-0.92)[ip: (-0.53), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.87), country: US(-0.05)] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 19:50:00 -0000 On Sun, 29 Dec 2019, Kevin P. Neal wrote: > On Sat, Dec 28, 2019 at 10:11:48AM -1000, Jeff Roberson wrote: >> It seems to be the prevailing theory that headers are not even really >> copyrightable. This has even been tested in court a few times (bsd, java). >> >> http://lkml.iu.edu/hypermail/linux/kernel/0301.1/0362.html >> >> The original definitions from this file were part of posix.1b and so it's >> hard to argue they are anything but public. Coincidentally I know Greg and > > Wow is Google v Oracle going to screw this up. I fully expect the US Supreme > Court to make a total hash of that case and cause havoc for the whole > software industry. > > The right thing for FreeBSD to do is decrease the size of the attack surface > by getting the licenses as straight as possible. IMHO. But IANAL. > >> In my opinion, this has already wasted everyone's time with an irrelevant >> nit-picking argument. The onus is not on Pedro to chase this down just so > > Lawyers make a living nit-picking. That's why one has to be very careful > to do a preemptive nit-pick before they get involved. I personally participated when a fortune < 100 company sent a team of lawyers to audit the licensing terms of FreeBSD to ensure compliance in a multi-billion dollar a year product. None of them batted an eye at this. It is my understanding that this has taken place multiple times and once even resulted in phk receiving an official beer from a similarly sized company per the terms of his beerware license. Do we actually believe that someone somewhere is going to sue the project or it's users on behalf of myself or greg because the user is in compliance with one bsd license and not the other? I trust the lawyer's opinions over yours. The problem here isn't the license. It's that everyone who allegedly thinks this is of such dire importance that they must continue spaming the list and arguing about it hasn't thought it important enough to send a single email to Greg Ansley so they personally can commit a simplification. It literally would've taken less time to simply copy Greg, ask approval, and commit a change and no one would've argued. I would argue that we don't even need greg's approval to copy 8 standards defined function prototypes. Richard Stallman seems to argue the same and I guarantee he's spent more time with copyright lawyers than any of us. I assert that the point here is not the license at all or it would've been resolved already. I see a lot of low effort sniping on the list off and on since my return to opensource. In most cases it is not even from particularly active contributors. It is very discourging to donate time and energy to the project only to be rewarded with criticism delivered with an air of superiority. It drives people away at a time when operating systems are all facing declining and aging developer populations. Jeff > -- > Kevin P. Neal http://www.pobox.com/~kpn/ > On the community of supercomputer fans: > "But what we lack in size we make up for in eccentricity." > from Steve Gombosi, comp.sys.super, 31 Jul 2000 11:22:43 -0600 > From owner-svn-src-head@freebsd.org Mon Dec 30 19:55:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7979D1E89E7; Mon, 30 Dec 2019 19:55:21 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mp7W1nnxz4QHS; Mon, 30 Dec 2019 19:55:19 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yb1-xb33.google.com with SMTP id z10so7171128ybr.9; Mon, 30 Dec 2019 11:55:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ilYWDKTmAtcdQZtffoY8gziAAU/yZVcZafhTWUaOazo=; b=Qn77SqkS73J5IUts+nRbiSaLc8P2JYYCqFqyClwqkc68JZtwBKzFSMmSVeAQ5SDnmn RfSZy3lC9CRj4gf72nWlPY4X2FfmrF7G55vFZ4K16gaOBwc4XQ80AcfLVeE16ZiG3jlh R+1Im1WiPJGmmtg+a7LnQsaCYEGBPLnHTnE8AdihdcWbVfI0NHN9MhOPV80N0Trufq0g Lvn5S2UWDEIMAeB7x+xCn/cm9P0JJJcY0vgoA7h20QsmrjOSRU6tHDrukbRwLZY1PxRi t8xxIL2mstE8TdnVSSK/pZzkpwnaqzF+fZSx9vF7asSDEBmB2Y2y4JxQuxFRblkLxmSU lHtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=ilYWDKTmAtcdQZtffoY8gziAAU/yZVcZafhTWUaOazo=; b=ouYXY7y5u3ote8uooPUWh5jPRHYPeaJaLCKiWdjD6Hpyb1xKG39i6FWAP4j+LK/a3Q N+ffbCeqhtsyQ7Q4dsAIVPCxl1CqnzXGJRbfrFMV567dT0gpMVtM8J3dlP1YGYy/O8Ck EfwH8LOLQa5+mO4XUOJiOpgK1dQoWm3Qlij1nkS+mOqW9Wb08pTXBePEsurRXMZlJwgt Hh3148OVATikvTWiqcvFGY2t1yBq+NH/fs64bsVxp4TezFUuBKckNjvDp9l0dirZqDUp EEpdYCaXHU577rltO7Eja1mFqVgfQVzuBII0XANPjw3t24jWcQnZSunD9syjaN6Q/ev8 Wwtw== X-Gm-Message-State: APjAAAVZdUV74Oxv4VO5NfrlzQSkNHaaW6qBffsRtHDL4DzY89vnCgjK abi18t1+WNgbaxLLOBihHPGM8tTt X-Google-Smtp-Source: APXvYqwAvz/A7aYNloIpJl8XUSLlyJkMJBXZQ1lilgvAg7aVq5RVCXOZfUAy8LYYYr5vppIRkcSpBA== X-Received: by 2002:a25:d343:: with SMTP id e64mr46621587ybf.436.1577735717737; Mon, 30 Dec 2019 11:55:17 -0800 (PST) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id g5sm18035268ywk.46.2019.12.30.11.55.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Dec 2019 11:55:17 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r356185 - in head: lib/geom lib/geom/sched sys/geom sys/geom/sched sys/modules/geom sys/modules/geom/geom_sched sys/sys To: Alexey Dokuchaev , Warner Losh Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912292116.xBTLG4kV012809@repo.freebsd.org> <20191230113243.GA58338@FreeBSD.org> <20191230170208.GA20424@FreeBSD.org> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: <5a97d344-8741-3b8e-b6dd-b8e4cfa05aeb@FreeBSD.org> Date: Mon, 30 Dec 2019 14:55:16 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191230170208.GA20424@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 47mp7W1nnxz4QHS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Qn77SqkS; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::b33 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-4.88 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[3.3.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.68)[ip: (-9.35), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.87), country: US(-0.05)]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 19:55:21 -0000 On 30.12.2019 12:02, Alexey Dokuchaev wrote: > On Mon, Dec 30, 2019 at 08:55:14AM -0700, Warner Losh wrote: >> On Mon, Dec 30, 2019, 5:32 AM Alexey Dokuchaev wrote: >>> On Sun, Dec 29, 2019 at 09:16:04PM +0000, Alexander Motin wrote: >>>> New Revision: 356185 >>>> URL: https://svnweb.freebsd.org/changeset/base/356185 >>>> >>>> Log: >>>> Remove GEOM_SCHED class and gsched tool. >>>> [...] >>> >>> Wow, that was unexpected, I use it on all my machines' HDD drives. >>> Is there a planned replacement, or I'd better create a port for the >>> GEOM_SCHED class and gsched(8) tool? >> >> How much of a performance improvement do you see with it? >> >> There has been no tweaks to this geom in years and years. It was tuned >> to 10 year old hard drives and never retuned for anything newer. > > Well, hard drives essentially didn't change since then, still being the > same roration media. :) At least some papers about gsched I read mention adX devices, which means old ATA stack and no NCQ. It can be quite a significant change to let HDD to do its own scheduling. Also about a year ago in r335066 Warner added sysctl debug.bioq_batchsize, which if set to non-zero value may, I think, improve fairness between several processes, just not sure why it was never enabled. >> And when I played with it a few years ago, I saw no improvements... > > Admittedly, I've only did some tests no later than in 8.4 times when I > first started using it. Fair point, though, I should redo them again. I'm sorry to create a regression for you, if there is really one. As I have written I don't have so much against the scheduler part itself, as against the accumulated technical debt and the way integration is done, such as mechanism of live insertion, etc. Without unmapped I/O and direct dispatch I bet it must be quite slow on bigger systems, that is why I doubted anybody really use it. > Is there a planned replacement, or I'd better create a port for the > GEOM_SCHED class and gsched(8) tool? I wasn't planning replacement. And moving it to ports would be a problem, since in process I removed few capabilities critical for it: nstart/nend for live insertion and BIO classification for scheduling. But the last I don't mind to return if there appear to be a need. It is only the first I am strongly against. But if somebody would like to reimplement it, may be it would be better to consider merging it with CAM I/O scheduler by Warner? The one at least knows about device queue depth, etc. We could return the BIO classification to be used by CAM scheduler instead, if needed. -- Alexander Motin From owner-svn-src-head@freebsd.org Mon Dec 30 20:04:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29E7C1E8CE3 for ; Mon, 30 Dec 2019 20:04:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mpL833wfz4Qm7 for ; Mon, 30 Dec 2019 20:04:32 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf33.google.com with SMTP id f16so12737976qvi.4 for ; Mon, 30 Dec 2019 12:04:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=N3fDC5vGni+EGmI53GBweebpyYJh+vKuFVWLgo+Kh4U=; b=U9B1aHj77b5UoJkarVF6BOM7KHPEb9OHq+XQv8EuIV0UAmtgt41VZfC+4TrGr2JzdM YqUfhECtVY3PX6CP8e/K3uPAWLIcBMV8JwwxKhYhhu/JP+ZgJ5sjOGWxWRcBoZdwDVRc gAiaUfYAcvHMJMElPIZwD05ZqXmhThucCzqktLlizWu/G82X+FAaSwjJtzdsHZNjK1Us w/HjZPEztigKWo0mL+yRaawNXx/5k3vmGPms1+RdBAn3JeHoZ7H/7J5yjeYWKvWEcvjQ snFSSFKiwcAxg8fb//ORs7omFOphWKMB8uNiMqnKTNxrIGAVyWx1c+iivtc0HlJtlA2Q drMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=N3fDC5vGni+EGmI53GBweebpyYJh+vKuFVWLgo+Kh4U=; b=CqV6NKF8iUTGZcJZng/OfCuLzPP8LBMyJlWmUxVV69ho3Wn4GS7qgTMPsDIHaPj73W 1/KEvUGXy0bs2KdKEVSFDLJByB3ruuwehsIMm34i5RnqT5qd6onx1Gg+mT5gVpjTgNxW v6WFqj/HO9JBRGXlbPF5cFZOn4vd9jqqh80r6jeQY4QEDsPwu8oKuS05YvzCAm5lwmKM eDcI9DGs8lYB1ZZ799wUo4M7W+f4QNZEgjpvTfDMim5Y7xq+NP5jBptIe2GTkbtcpBDt XeL8U5imDYoSwVe15Z01dNh+OM8J0Vk7QicZIhFf1dsZTyBREZANr0vNABlKs7ynTNQ/ r1yA== X-Gm-Message-State: APjAAAUzx5H5xkeWAnQw3e0+92B5oRfu47OxRuVnfqt3CJFg4Mn0dsj2 DozBgoV1fVhtUyGDOq5j4w/LkXgB1CfkntD+P8mRvg== X-Google-Smtp-Source: APXvYqyP+p0l+QvebuPpjwHuhPav0JC7IcLPdoOnWFgbJ2q3Q5qMfDFOVIl7yqho1KBB8GWMxQBwIbX028dIeGPedy8= X-Received: by 2002:a0c:ec02:: with SMTP id y2mr53452362qvo.118.1577736266232; Mon, 30 Dec 2019 12:04:26 -0800 (PST) MIME-Version: 1.0 References: <201912280527.xBS5R8fk041737@gndrsh.dnsmgr.net> <20191230020202.GB74518@neutralgood.org> In-Reply-To: <20191230020202.GB74518@neutralgood.org> From: Warner Losh Date: Mon, 30 Dec 2019 13:04:13 -0700 Message-ID: Subject: Re: svn commit: r356142 - in head/sys: dev/ofw sys To: "Kevin P. Neal" Cc: Jeff Roberson , "Rodney W. Grimes" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Pedro Giffuni , src-committers@freebsd.org X-Rspamd-Queue-Id: 47mpL833wfz4Qm7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=U9B1aHj7; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::f33) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.81 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.81)[ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.87), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 20:04:33 -0000 On Sun, Dec 29, 2019, 8:02 PM Kevin P. Neal wrote: > On Sat, Dec 28, 2019 at 10:11:48AM -1000, Jeff Roberson wrote: > > It seems to be the prevailing theory that headers are not even really > > copyrightable. This has even been tested in court a few times (bsd, > java). > > > > http://lkml.iu.edu/hypermail/linux/kernel/0301.1/0362.html > > > > The original definitions from this file were part of posix.1b and so it's > > hard to argue they are anything but public. Coincidentally I know Greg > and > > Wow is Google v Oracle going to screw this up. I fully expect the US > Supreme > Court to make a total hash of that case and cause havoc for the whole > software industry. > > The right thing for FreeBSD to do is decrease the size of the attack > surface > by getting the licenses as straight as possible. IMHO. But IANAL. > > > In my opinion, this has already wasted everyone's time with an irrelevant > > nit-picking argument. The onus is not on Pedro to chase this down just > so > > Lawyers make a living nit-picking. That's why one has to be very careful > to do a preemptive nit-pick before they get involved. > Nit picking with no sound legal basis by an engineer who has no license to practice law, however, could be more trouble than it's worth. We as a project have been doing this for at least 20 years, and there have been several legal reviews by companies using FreeBSD that haven't flagged this as an issue. Being nit-picky just to be nit-picky isn't helpful if the nits picked are snipe hunts without any benefit. Especially when accompanied by a arrogant and condescending tone and a know it all attitude with no professional credentials to back it. So we need, as a project, to be careful what we spend time on. Doubly so for stupid nit picks that we know have no merit. Those drain enthusiasm from the volunteers far in excess of any possible benefit the unit picks may bring to the project. Warner -- > Kevin P. Neal http://www.pobox.com/~kpn/ > On the community of supercomputer fans: > "But what we lack in size we make up for in eccentricity." > from Steve Gombosi, comp.sys.super, 31 Jul 2000 11:22:43 -0600 > From owner-svn-src-head@freebsd.org Mon Dec 30 20:30:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C67991E92B6; Mon, 30 Dec 2019 20:30:32 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mpw84vnMz4RXw; Mon, 30 Dec 2019 20:30:32 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3A1C7481; Mon, 30 Dec 2019 20:30:32 +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 xBUKUWKF044696; Mon, 30 Dec 2019 20:30:32 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBUKUWAO044693; Mon, 30 Dec 2019 20:30:32 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201912302030.xBUKUWAO044693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 30 Dec 2019 20:30:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356207 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 356207 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 20:30:32 -0000 Author: alc Date: Mon Dec 30 20:30:31 2019 New Revision: 356207 URL: https://svnweb.freebsd.org/changeset/base/356207 Log: Determine whether the MMU hardware is capable of updating a page table entry's access flag and dirty state, and enable this feature when it's available. Ensure that we don't overlook a dirty state update that is concurrent with a call to pmap_enter(). (Previously, all dirty state updates would have occurred with the containing pmap's lock held, so a page table entry's dirty state could not have changed while pmap_enter() held that same lock.) Reviewed by: andrew, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22907 Modified: head/sys/arm64/arm64/locore.S head/sys/arm64/arm64/pmap.c head/sys/arm64/include/armreg.h Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Mon Dec 30 18:11:06 2019 (r356206) +++ head/sys/arm64/arm64/locore.S Mon Dec 30 20:30:31 2019 (r356207) @@ -683,7 +683,8 @@ start_mmu: /* * Setup TCR according to the PARange and ASIDBits fields - * from ID_AA64MMFR0_EL1. More precisely, set TCR_EL1.AS + * from ID_AA64MMFR0_EL1 and the HAFDBS field from the + * ID_AA64MMFR1_EL1. More precisely, set TCR_EL1.AS * to 1 only if the ASIDBits field equals 0b0010. */ ldr x2, tcr @@ -700,6 +701,21 @@ start_mmu: /* Set TCR.AS with x3 */ bfi x2, x3, #(TCR_ASID_SHIFT), #(TCR_ASID_WIDTH) + /* + * Check if the HW supports access flag and dirty state updates, + * and set TCR_EL1.HA and TCR_EL1.HD accordingly. + */ + mrs x3, id_aa64mmfr1_el1 + and x3, x3, #(ID_AA64MMFR1_HAFDBS_MASK) + cmp x3, #1 + b.ne 1f + orr x2, x2, #(TCR_HA) + b 2f +1: + cmp x3, #2 + b.ne 2f + orr x2, x2, #(TCR_HA | TCR_HD) +2: msr tcr_el1, x2 /* Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Dec 30 18:11:06 2019 (r356206) +++ head/sys/arm64/arm64/pmap.c Mon Dec 30 20:30:31 2019 (r356207) @@ -3510,8 +3510,7 @@ validate: KASSERT(opa == pa, ("pmap_enter: invalid update")); if ((orig_l3 & ~ATTR_AF) != (new_l3 & ~ATTR_AF)) { /* same PA, different attributes */ - /* XXXMJ need to reload orig_l3 for hardware DBM. */ - pmap_load_store(l3, new_l3); + orig_l3 = pmap_load_store(l3, new_l3); pmap_invalidate_page(pmap, va); if ((orig_l3 & ATTR_SW_MANAGED) != 0 && pmap_pte_dirty(orig_l3)) Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Mon Dec 30 18:11:06 2019 (r356206) +++ head/sys/arm64/include/armreg.h Mon Dec 30 20:30:31 2019 (r356207) @@ -619,6 +619,11 @@ #define PSR_FLAGS 0xf0000000 /* TCR_EL1 - Translation Control Register */ +#define TCR_HD_SHIFT 40 +#define TCR_HD (0x1UL << TCR_HD_SHIFT) +#define TCR_HA_SHIFT 39 +#define TCR_HA (0x1UL << TCR_HA_SHIFT) + #define TCR_ASID_SHIFT 36 #define TCR_ASID_WIDTH 1 #define TCR_ASID_16 (0x1UL << TCR_ASID_SHIFT) From owner-svn-src-head@freebsd.org Mon Dec 30 21:00:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 252961E9AA6 for ; Mon, 30 Dec 2019 21:00:00 +0000 (UTC) (envelope-from 0100016f589bb787-fbbbf972-bb53-4b10-bf6d-dd23046709b7-000000@amazonses.com) Received: from a8-26.smtp-out.amazonses.com (a8-26.smtp-out.amazonses.com [54.240.8.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47mqZ66xdkz4Sx9 for ; Mon, 30 Dec 2019 20:59:58 +0000 (UTC) (envelope-from 0100016f589bb787-fbbbf972-bb53-4b10-bf6d-dd23046709b7-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57; d=tarsnap.com; t=1577739597; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=0VflKvt/MotU/81KmiolJTqHC5MpK1ThYSQLfdWAnZ0=; b=LhtBA5mwVGeJWCy4ZFxSiVw6K/a6wpHkV3oai5LBpbfbOQNqW6MR9+GMWbdgHNiH dDeV6RYI+ZZ7kyka2bckW30CW1Deyxh2n8V9ai6aRi0abFmi3SmLqGDm/Hp5NEw2zic Z1GFRh0C9U9pv2/64U5eSdxhBNqszQutQW7MnSdQ= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1577739597; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=0VflKvt/MotU/81KmiolJTqHC5MpK1ThYSQLfdWAnZ0=; b=EOUH7px2wxqoRZifJ9XTXuhwmA9OXWS7nDb0LUBfpfnekBastky9cb8M36uNjPCR eWWpsvh19gHogZDsy/8RPD4/JrruTup0kpVX7jvceqw4jHEUpIPr6dHFH8m/FbgMu09 wBG7acBSFIRmzM/X1m5dlM5v+JJlqBkQjC3QDoW0= Subject: Re: svn commit: r356207 - in head/sys/arm64: arm64 include To: Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912302030.xBUKUWAO044693@repo.freebsd.org> From: Colin Percival Autocrypt: addr=cperciva@tarsnap.com; prefer-encrypt=mutual; keydata= mQGhBElrAAcRBACDfDys4ZtK+ErCJ1HAzYeteKpm3OEsvT/49AjUTLihkF79HhIKrCQU+1KC zv7BwHCMLb6hq30As9L7iFKG7n5QFLFC4Te/VcITUnWHMG/c3ViLOfJGvi+9/nOEHaM1dVJY D6tEp5yM1nHmVQpo9932j4KGuGFR0LhOK5IHXOSfGwCgxSFDPdgxe2OEjWxjGgY+oV3EafcD +JROXCTjlcQiG/OguQH4Vks3mhHfFnEppLxTkDuYgHZQiUtpcT9ssH5khgqoTyMar05OUdAj ZIhNbWDh4LgTj+7ZmvLhXT5Zxw8LX9d7T36aTB8XDQSenDqEtinMWOb0TCBBLbsB8EFG1WTT ESbZci9jJS5yhtktuZoY/eM8uXMD/3k4FWFO80VRRkELSp+XSy/VlSQjyi/rhl2nQq/oOA9F oJbDaB0yq9VNhxP+uFBzBWSqeIX0t1ZWLtNfVFr4TRP5hihI5ICrg/0OpqgisKsU2NFe9xyO hyJLYmfD8ebpDJ/9k30C7Iju9pVrwLm1QgS4S2fqJRcR+U4WbjvP7CgStCVDb2xpbiBQZXJj aXZhbCA8Y3BlcmNpdmFAdGFyc25hcC5jb20+iGEEExECACEFAklrALYCGwMHCwkIBwMCAQQV AggDBBYCAwECHgECF4AACgkQOM7KaQxqam6/igCgn+z2k3V5ggNppmWrZstt1U2lugsAoL7L wS9V9yLtil3oWmHtwpUqYruEuQINBElrAAcQCAD3ZLMIsP4CIDoJORg+YY0lqLVBgcnF7pFb 4Uy2+KvdWofN+DKH61rZLjgXXkNE9M4EQC1B4lGttBP8IY2gs41y3AUogGdyFbidq99rCBz7 LTsgARHwFxZoaHmXyiZLEU1QZuMqwPZV1mCviRhN5E3rRqYNXVcrnXAAuhBpvNyj/ntHvcDN 2/m+ochiuBYueU4kX3lHya7sOj+mTsndcWmQ9soOUyr8O0r/BG088bMn4qqtUw4dl5/pglXk jbl7uOOPinKf0WVd2r6M0wLPJCD4NPHrCWRLLLAjwfjrtoSRvXxDbXhCdgGBa72+K8eYLzVs hgq7tJOoBWzjVK6XRxR7AAMGB/9Mo3iJ2DxqDecd02KCB5BsFDICbJGhPltU7FwrtbC7djSb XUrwsEVLHi4st4cbdGNCWCrp0BRezXZKohKnNAPFOTK++ZfgeKxrV2sJod+Q9RILF86tQ4XF 7A7Yme5hy92t/WgiU4vc/fWbgP8gV/19f8nunaT2E9NSa70mZFjZNu4iuwThoUUO5CV3Wo0Y UISsnRK8XD1+LR3A2qVyLiFRwh/miC1hgLFCTGCQ3GLxZeZzIpYSlGdQJ0L5lixW5ZQD9r1I 8i/8zhE6qRFAM0upUMI3Gt1Oq2w03DiXrZU0Fu/R8Rm8rlnkQKA+95mRTUq1xL5P5NZIi4gJ Z569OPMFiEkEGBECAAkFAklrAAcCGwwACgkQOM7KaQxqam41igCfbaldnFTu5uAdrnrghESv EI3CAo8AoLkNMks1pThl2BJNRm4CtTK9xZeH Message-ID: <0100016f589bb787-fbbbf972-bb53-4b10-bf6d-dd23046709b7-000000@email.amazonses.com> Date: Mon, 30 Dec 2019 20:59:57 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <201912302030.xBUKUWAO044693@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SES-Outgoing: 2019.12.30-54.240.8.26 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-Rspamd-Queue-Id: 47mqZ66xdkz4Sx9 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tarsnap.com header.s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57 header.b=LhtBA5mw; dkim=pass header.d=amazonses.com header.s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw header.b=EOUH7px2; dmarc=none; spf=pass (mx1.freebsd.org: domain of 0100016f589bb787-fbbbf972-bb53-4b10-bf6d-dd23046709b7-000000@amazonses.com designates 54.240.8.26 as permitted sender) smtp.mailfrom=0100016f589bb787-fbbbf972-bb53-4b10-bf6d-dd23046709b7-000000@amazonses.com X-Spamd-Result: default: False [-1.69 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[tarsnap.com:s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57,amazonses.com:s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:54.240.0.0/18]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[tarsnap.com]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[tarsnap.com:+,amazonses.com:+]; RCVD_IN_DNSWL_NONE(0.00)[26.8.240.54.list.dnswl.org : 127.0.15.0]; FORGED_SENDER(0.30)[cperciva@tarsnap.com,0100016f589bb787-fbbbf972-bb53-4b10-bf6d-dd23046709b7-000000@amazonses.com]; RCVD_COUNT_ZERO(0.00)[0]; RWL_MAILSPIKE_POSSIBLE(0.00)[26.8.240.54.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; IP_SCORE(-1.99)[ip: (-2.15), ipnet: 54.240.8.0/21(-4.61), asn: 14618(-3.11), country: US(-0.05)]; ASN(0.00)[asn:14618, ipnet:54.240.8.0/21, country:US]; FORGED_MUA_THUNDERBIRD_MSGID_UNKNOWN(2.50)[]; FROM_NEQ_ENVFROM(0.00)[cperciva@tarsnap.com, 0100016f589bb787-fbbbf972-bb53-4b10-bf6d-dd23046709b7-000000@amazonses.com] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 21:00:00 -0000 On 2019-12-30 12:30, Alan Cox wrote: > Author: alc > Date: Mon Dec 30 20:30:31 2019 > New Revision: 356207 > URL: https://svnweb.freebsd.org/changeset/base/356207 > > Log: > Determine whether the MMU hardware is capable of updating a page table > entry's access flag and dirty state, and enable this feature when it's > available. Am I right in thinking that this should result in improved performance under load? (I'm wondering if it's time to redo my amd64 vs arm64 EC2 benchmarks.) -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-head@freebsd.org Mon Dec 30 21:01:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77CE81E9B56 for ; Mon, 30 Dec 2019 21:01:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mqbd2Pmtz4T72 for ; Mon, 30 Dec 2019 21:01:17 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x832.google.com with SMTP id q20so30424767qtp.3 for ; Mon, 30 Dec 2019 13:01:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pVoh+h4zUQmOcEalxHRk4hx7wZgyHbs2cLgdcIvLz+Y=; b=n/xaL/HsGId0Y+8qdzSFYSQg07GbYnJs+8lzuO0u4EmdqpF0xb+5InvZweWKtyOlbD Z17F8ekzQ4+CmevJVk8AiSBo2AlvSLO8kR47QkrKKFim5jWdcbH4YyjOvGdBn68Xv7ww WeQRVTSma+28GHlsYFlCxLhyqcpeenOkPTlMtniT7/XXP2bBU8yPsWC1weEi78+ADBo5 NAlVgTsd0oiPKhmqnh8suIUyZUlPdKrCvhVOfkRLAUwkYIEEl2N8w20BwVMVqxSwyOeJ xSCtokqTrv7rxDttUF4ASIxB4j+5qi+kUEsU3Zcdw7cNAsyUq33Z7xJIT5bnHtthNY/n scYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pVoh+h4zUQmOcEalxHRk4hx7wZgyHbs2cLgdcIvLz+Y=; b=UM/U99tayl4Srk+2t+PGaXNbhqN0LL8wd5eMlmv5v76rwB9EuGHEIqp4cMazHN7QGM v8luAG6LsdXdmasbq/eSR3d/kgTn2m9COgBhihYh4rPMi8rAmpttvWVwb+F+F47eM+tj k7J0aUguFoFOIA0ThSmzw7M3V5l4bZ9Dq5w+4Kv+g8mpCllmmnQ1b8hbovwa9VdCNfEZ bHzXISOTxe4YN4Hhus/VuWOZiQjdK+dzW13Zk1vbKsW5S5UlSGPUhLa9ilL9JLvlhKOU OPiEkInsjiSz8TgD21tFcv6DLX1L5xxL5nUDwP11Nny0OUa/91oyhKSjcdNvBAhuX2dR vewA== X-Gm-Message-State: APjAAAVHDQ3FlZddf2/ALIHCCI5MXfMI3ff2xo2OzmlrUf0novAEbGT1 1w4HpjHoATLFBZrDGmnQjbnUxKKrVOO5DYPWuPXtJw== X-Google-Smtp-Source: APXvYqwQ7aSC3bfzPIMxR+82l8FJbDnUQOdOZJERf0952rdQiqVgi5biCPVZOXyf6UX80BWs2zw33M+ME2myU0Shf/o= X-Received: by 2002:ac8:21ec:: with SMTP id 41mr50627676qtz.242.1577739676111; Mon, 30 Dec 2019 13:01:16 -0800 (PST) MIME-Version: 1.0 References: <201912292116.xBTLG4kV012809@repo.freebsd.org> <20191230113243.GA58338@FreeBSD.org> <20191230170208.GA20424@FreeBSD.org> <5a97d344-8741-3b8e-b6dd-b8e4cfa05aeb@FreeBSD.org> In-Reply-To: <5a97d344-8741-3b8e-b6dd-b8e4cfa05aeb@FreeBSD.org> From: Warner Losh Date: Mon, 30 Dec 2019 14:01:04 -0700 Message-ID: Subject: Re: svn commit: r356185 - in head: lib/geom lib/geom/sched sys/geom sys/geom/sched sys/modules/geom sys/modules/geom/geom_sched sys/sys To: Alexander Motin Cc: Alexey Dokuchaev , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47mqbd2Pmtz4T72 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=n/xaL/Hs; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::832) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.68 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.68)[ip: (-9.33), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.87), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 21:01:18 -0000 On Mon, Dec 30, 2019 at 12:55 PM Alexander Motin wrote: > On 30.12.2019 12:02, Alexey Dokuchaev wrote: > > On Mon, Dec 30, 2019 at 08:55:14AM -0700, Warner Losh wrote: > >> On Mon, Dec 30, 2019, 5:32 AM Alexey Dokuchaev wrote: > >>> On Sun, Dec 29, 2019 at 09:16:04PM +0000, Alexander Motin wrote: > >>>> New Revision: 356185 > >>>> URL: https://svnweb.freebsd.org/changeset/base/356185 > >>>> > >>>> Log: > >>>> Remove GEOM_SCHED class and gsched tool. > >>>> [...] > >>> > >>> Wow, that was unexpected, I use it on all my machines' HDD drives. > >>> Is there a planned replacement, or I'd better create a port for the > >>> GEOM_SCHED class and gsched(8) tool? > >> > >> How much of a performance improvement do you see with it? > >> > >> There has been no tweaks to this geom in years and years. It was tuned > >> to 10 year old hard drives and never retuned for anything newer. > > > > Well, hard drives essentially didn't change since then, still being the > > same roration media. :) > > At least some papers about gsched I read mention adX devices, which > means old ATA stack and no NCQ. It can be quite a significant change to > let HDD to do its own scheduling. Also about a year ago in r335066 > Warner added sysctl debug.bioq_batchsize, which if set to non-zero value > may, I think, improve fairness between several processes, just not sure > why it was never enabled. > I never enabled it because I never had a good car size as the default. I'm guessing it's somewhere on the order of 2 times the queue size in hardware, but with modern drives I think phk might be right and that disabling disksort entirely might be optimal, or close to optimal. > >> And when I played with it a few years ago, I saw no improvements... > > > > Admittedly, I've only did some tests no later than in 8.4 times when I > > first started using it. Fair point, though, I should redo them again. > > I'm sorry to create a regression for you, if there is really one. As I > have written I don't have so much against the scheduler part itself, as > against the accumulated technical debt and the way integration is done, > such as mechanism of live insertion, etc. Without unmapped I/O and > direct dispatch I bet it must be quite slow on bigger systems, that is > why I doubted anybody really use it. > > > Is there a planned replacement, or I'd better create a port for the > > GEOM_SCHED class and gsched(8) tool? > > I wasn't planning replacement. And moving it to ports would be a > problem, since in process I removed few capabilities critical for it: > nstart/nend for live insertion and BIO classification for scheduling. > But the last I don't mind to return if there appear to be a need. It is > only the first I am strongly against. But if somebody would like to > reimplement it, may be it would be better to consider merging it with > CAM I/O scheduler by Warner? The one at least knows about device queue > depth, etc. We could return the BIO classification to be used by CAM > scheduler instead, if needed. > I'd be keen on helping anybody that wants to experiment with hard disk drive optmizations in iosched. My doodles to make it better showed no early improvements, so Iv'e not tried to bring them into the tree. However, our workload is basically 'large block random' which isn't the same as others and others might have a workload that could benefit. I've found a marginal improvement from the read over writes bias in our workload, and another marginal improvement for favoring metadata reads over normal reads (because for us, sendfile blocks for some of these reads, but others may see no improvement). I'm working to clean up the metadata read stuff to get it into the tree. I've not tested it on ZFS, though, so there will be no ZFS metadata labeling in the initial commit. So I like the idea, and would love to work with someone that needs it and/or whose work loads can be improved by it. Warner -- > Alexander Motin > From owner-svn-src-head@freebsd.org Mon Dec 30 21:20:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B24D1EA61A for ; Mon, 30 Dec 2019 21:20:54 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mr2F43Fkz4VSM for ; Mon, 30 Dec 2019 21:20:53 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pl1-x642.google.com with SMTP id a6so14371857plm.3 for ; Mon, 30 Dec 2019 13:20:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=8rsmRUiuTjn0eLDGFXk1xS6lI21xJIcA1F80cpD82cs=; b=PxtLaa2A1BBiRjyaP2+YopNB/Wz6bNP16NARNDxUVzKchNrS1hs4CpW+7FSJUut8W6 YebJlAHo9JmcvmMMFwG230u5vjJXB0xa+8I3h/YpoFhZBeRNgWb8yWYS4FwG+qTRfopV ZhI2FZge0Fy7x/+AtK9NtsMSsPHAYEelO4XlALexRAHq7ZE/4D3XcP+ssGbbIbJUXhxT Mav+lOSUR+El+YkVnOKjx5EI656KC/I54ai4+HuJyiBF+r+2OYBKjw2EGjImfpNB6HW7 VPaohIgAS+ix5Lj2AEmNMlUixW7OsguszEG5UciCCt+6NsVXC+5TXFGgW0TlK7R+OPpD FgJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=8rsmRUiuTjn0eLDGFXk1xS6lI21xJIcA1F80cpD82cs=; b=FNhShgoqOzy5cGfN9ivZjtGMhPf3gn5K06dVDyHyiZa7jTFZVf7RYUCfIUe1S18sTE tAPFw9G3bkvTPun8nPz52p9wQK+M2Cj+ZYg5JdH+A8QLY1fvRnIobZcTNmsOsedqXvYG VchDMzZb9629Zpf5x+3aD5A3gUGjpT0gZQF4IWI8IHBk0DDj3p8wOCd6KnPIONHTVlY7 +rkcZMxTRi1MPBBebTTPplkU1zJMdVdGJwRaCh7b8LsrjiWIaXOYET/wrHLrFA3aNIqg NF/N1+Zi+Yyiux6izKHC9Wj8HEpmeDp7wnw3lPZpn6t2byAFPeT2kTfUdMTqvaq+A86U FB2A== X-Gm-Message-State: APjAAAVb164SWuTSD2Rxt8zIwgUrBm5uYYTXpdmSVtuYndCTJq7s5q4P FYhtOCEsWg5lns5Pkr7eNrWoPA== X-Google-Smtp-Source: APXvYqyro4rl48DI3Gh1A8oC0N2JrtYxp+GKt0Cg4zVTr59zrn76wZ5P3f3Pdn0i7RgMqw9rnshnew== X-Received: by 2002:a17:902:8f98:: with SMTP id z24mr64184163plo.51.1577740851492; Mon, 30 Dec 2019 13:20:51 -0800 (PST) Received: from rrcs-76-81-105-82.west.biz.rr.com (rrcs-76-81-105-82.west.biz.rr.com. [76.81.105.82]) by smtp.gmail.com with ESMTPSA id g24sm52546038pfk.92.2019.12.30.13.20.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Dec 2019 13:20:51 -0800 (PST) Date: Mon, 30 Dec 2019 11:20:48 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Warner Losh cc: Alexander Motin , Alexey Dokuchaev , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r356185 - in head: lib/geom lib/geom/sched sys/geom sys/geom/sched sys/modules/geom sys/modules/geom/geom_sched sys/sys In-Reply-To: Message-ID: References: <201912292116.xBTLG4kV012809@repo.freebsd.org> <20191230113243.GA58338@FreeBSD.org> <20191230170208.GA20424@FreeBSD.org> <5a97d344-8741-3b8e-b6dd-b8e4cfa05aeb@FreeBSD.org> User-Agent: Alpine 2.21.9999 (BSF 287 2018-06-16) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 47mr2F43Fkz4VSM X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=jroberson-net.20150623.gappssmtp.com header.s=20150623 header.b=PxtLaa2A; dmarc=none; spf=none (mx1.freebsd.org: domain of jroberson@jroberson.net has no SPF policy when checking 2607:f8b0:4864:20::642) smtp.mailfrom=jroberson@jroberson.net X-Spamd-Result: default: False [-2.73 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[jroberson-net.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[jroberson.net]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[jroberson-net.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2.4.6.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-0.93)[ip: (-0.59), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.87), country: US(-0.05)] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 21:20:54 -0000 On Mon, 30 Dec 2019, Warner Losh wrote: > > > On Mon, Dec 30, 2019 at 12:55 PM Alexander Motin wrote: > On 30.12.2019 12:02, Alexey Dokuchaev wrote: > > On Mon, Dec 30, 2019 at 08:55:14AM -0700, Warner Losh wrote: > >> On Mon, Dec 30, 2019, 5:32 AM Alexey Dokuchaev wrote: > >>> On Sun, Dec 29, 2019 at 09:16:04PM +0000, Alexander Motin > wrote: > >>>> New Revision: 356185 > >>>> URL: https://svnweb.freebsd.org/changeset/base/356185 > >>>> > >>>> Log: > >>>>? ?Remove GEOM_SCHED class and gsched tool. > >>>>? ?[...] > >>> > >>> Wow, that was unexpected, I use it on all my machines' HDD > drives. > >>> Is there a planned replacement, or I'd better create a port > for the > >>> GEOM_SCHED class and gsched(8) tool? > >> > >> How much of a performance improvement do you see with it? > >> > >> There has been no tweaks to this geom in years and years. It > was tuned > >> to 10 year old hard drives and never retuned for anything > newer. > > > > Well, hard drives essentially didn't change since then, still > being the > > same roration media. :) > > At least some papers about gsched I read mention adX devices, > which > means old ATA stack and no NCQ.? It can be quite a significant > change to > let HDD to do its own scheduling.? Also about a year ago in > r335066 > Warner added sysctl debug.bioq_batchsize, which if set to > non-zero value > may, I think, improve fairness between several processes, just > not sure > why it was never enabled. > > > I never?enabled it because I never had a good?car size as the default. I'm > guessing? it's somewhere?on the order of 2 times the queue size in hardware, > but with modern drives I think phk might be right and that disabling > disksort entirely might be optimal, or close to optimal. > ? > >> And when I played with it a few years ago, I saw no > improvements... > > > > Admittedly, I've only did some tests no later than in 8.4 > times when I > > first started using it.? Fair point, though, I should redo them > again. > > I'm sorry to create a regression for you, if there is really > one.? As I > have written I don't have so much against the scheduler part > itself, as > against the accumulated technical debt and the way integration > is done, > such as mechanism of live insertion, etc.? Without unmapped I/O > and > direct dispatch I bet it must be quite slow on bigger systems, > that is > why I doubted anybody really use it. > > > Is there a planned replacement, or I'd better create a port > for the > > GEOM_SCHED class and gsched(8) tool? > > I wasn't planning replacement.? And moving it to ports would be a > problem, since in process I removed few capabilities critical > for it: > nstart/nend for live insertion and BIO classification for > scheduling. > But the last I don't mind to return if there appear to be a > need.? It is > only the first I am strongly against.? But if somebody would like > to > reimplement it, may be it would be better to consider merging > it with > CAM I/O scheduler by Warner?? The one at least knows about device > queue > depth, etc.? We could return the BIO classification to be used by > CAM > scheduler instead, if needed. > > > I'd be keen on helping anybody that wants to experiment with hard disk > drive optmizations in iosched. My doodles to make it better showed no early > improvements, so Iv'e not tried to bring them into the tree. However, our > workload is basically 'large block random' which isn't the same as others > and others might have a workload that could benefit. I've found a marginal > improvement from the read over writes bias in our workload, and > another?marginal improvement for favoring metadata reads over normal reads > (because?for us, sendfile blocks for some of these reads, but others may see > no improvement). I'm working to clean up the metadata read stuff to get it > into the tree. I've not tested it on ZFS, though, so there will be no ZFS > metadata labeling in the initial commit. > > So I like the idea, and would love to work with someone that needs it > and/or whose work loads can be improved by it. The biggest issue I have found with drive sorting and traditional elevator algorithms is that it is not latency limiting. We have other problems at higher layers where we scheduling too many writes simultaneously that contribute substantially to I/O latency. Also read-after-writes are blocked in the buffer cache while a senseless number of buffers are queued and locked. An algorithm I have found effective and implemented at least twice is to estimate I/O time and then give a maximum sort latency. For many drives you have to go further and starve them for I/O until they complete a particularly long running operation or they can continue to decide to sort something out indefinitely if the I/O you add to the queue is preferable. The basic notion is to give a boundary, perhaps 100-200ms, for reads and usually twice that or more for writes. You can sort I/O within batches of that size. You might violate the batch if a directly adjacent block is scheduled and you an concatenate them into a single transfer. You also have to consider whether the drive has a write cache enabled or not and whether the filesystem or application is going to sync the disk. Many SATA drives want an idle queue when they sync for best behavior. You probably also want a larger write queue for uncached writes but preferably not the entire drive queue. Eventually cached writes cause stalls on flush and too many in queue will just hold up queue space while they normally complete so quickly that a deep queue depth is not important. Elements of this are also useful on SSDs where you want to manage latency and queue depth. I suspect the drive queue is indeed preferable to the simple implementations we've had in tree. Thanks, Jeff > > Warner > > -- > Alexander Motin > > > From owner-svn-src-head@freebsd.org Mon Dec 30 21:32:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B1321EABB0; Mon, 30 Dec 2019 21:32:57 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mrJ90Jgmz4W5y; Mon, 30 Dec 2019 21:32:57 +0000 (UTC) (envelope-from jilles@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05DC380FC; Mon, 30 Dec 2019 21:32:57 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBULWuGT085843; Mon, 30 Dec 2019 21:32:56 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBULWumr085838; Mon, 30 Dec 2019 21:32:56 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201912302132.xBULWumr085838@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Mon, 30 Dec 2019 21:32:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356208 - head/bin/sh/tests/execution X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/bin/sh/tests/execution X-SVN-Commit-Revision: 356208 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 21:32:57 -0000 Author: jilles Date: Mon Dec 30 21:32:55 2019 New Revision: 356208 URL: https://svnweb.freebsd.org/changeset/base/356208 Log: sh: Test that executing various binary files is rejected If executing a file fails with an [ENOEXEC] error, the shell executes the file as a shell script, except that this execution may instead result in an error message if the file is binary. Per a recent Austin Group interpretation, we will need to change this to allow a concatenation of a shell script and a binary payload. See Austin Group bugs #1226 and #1250. MFC after: 1 week Added: head/bin/sh/tests/execution/shellproc2.0 (contents, props changed) head/bin/sh/tests/execution/shellproc3.0 (contents, props changed) head/bin/sh/tests/execution/shellproc4.0 (contents, props changed) head/bin/sh/tests/execution/shellproc5.0 (contents, props changed) Modified: head/bin/sh/tests/execution/Makefile Modified: head/bin/sh/tests/execution/Makefile ============================================================================== --- head/bin/sh/tests/execution/Makefile Mon Dec 30 20:30:31 2019 (r356207) +++ head/bin/sh/tests/execution/Makefile Mon Dec 30 21:32:55 2019 (r356208) @@ -55,6 +55,10 @@ ${PACKAGE}FILES+= set-x2.0 ${PACKAGE}FILES+= set-x3.0 ${PACKAGE}FILES+= set-x4.0 ${PACKAGE}FILES+= shellproc1.0 +${PACKAGE}FILES+= shellproc2.0 +${PACKAGE}FILES+= shellproc3.0 +${PACKAGE}FILES+= shellproc4.0 +${PACKAGE}FILES+= shellproc5.0 ${PACKAGE}FILES+= subshell1.0 subshell1.0.stdout ${PACKAGE}FILES+= subshell2.0 ${PACKAGE}FILES+= subshell3.0 Added: head/bin/sh/tests/execution/shellproc2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/execution/shellproc2.0 Mon Dec 30 21:32:55 2019 (r356208) @@ -0,0 +1,18 @@ +# $FreeBSD$ +# This tests a quality of implementation issue. +# Shells are not required to reject executing binary files as shell scripts +# but executing, for example, ELF files for a different architecture as +# shell scripts may have annoying side effects. + +T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit +trap 'rm -rf "${T}"' 0 +printf '\0' >"$T/testshellproc" +chmod 755 "$T/testshellproc" +if [ ! -s "$T/testshellproc" ]; then + printf "printf did not write a NUL character\n" >&2 + exit 2 +fi +PATH=$T:$PATH +errout=`testshellproc 3>&2 2>&1 >&3 3>&-` +r=$? +[ "$r" = 126 ] && [ -n "$errout" ] Added: head/bin/sh/tests/execution/shellproc3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/execution/shellproc3.0 Mon Dec 30 21:32:55 2019 (r356208) @@ -0,0 +1,14 @@ +# $FreeBSD$ +# This tests a quality of implementation issue. +# Shells are not required to reject executing binary files as shell scripts +# but executing, for example, ELF files for a different architecture as +# shell scripts may have annoying side effects. + +T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit +trap 'rm -rf "${T}"' 0 +printf '\177ELF\001!!\011\0\0\0\0\0\0\0\0' >"$T/testshellproc" +chmod 755 "$T/testshellproc" +PATH=$T:$PATH +errout=`testshellproc 3>&2 2>&1 >&3 3>&-` +r=$? +[ "$r" = 126 ] && [ -n "$errout" ] Added: head/bin/sh/tests/execution/shellproc4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/execution/shellproc4.0 Mon Dec 30 21:32:55 2019 (r356208) @@ -0,0 +1,14 @@ +# $FreeBSD$ +# This tests a quality of implementation issue. +# Shells are not required to reject executing binary files as shell scripts +# but executing, for example, ELF files for a different architecture as +# shell scripts may have annoying side effects. + +T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit +trap 'rm -rf "${T}"' 0 +printf '\211PNG\015\012\032\012\0\0\0\015IHDR' >"$T/testshellproc" +chmod 755 "$T/testshellproc" +PATH=$T:$PATH +errout=`testshellproc 3>&2 2>&1 >&3 3>&-` +r=$? +[ "$r" = 126 ] && [ -n "$errout" ] Added: head/bin/sh/tests/execution/shellproc5.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/execution/shellproc5.0 Mon Dec 30 21:32:55 2019 (r356208) @@ -0,0 +1,14 @@ +# $FreeBSD$ +# This tests a quality of implementation issue. +# Shells are not required to reject executing binary files as shell scripts +# but executing, for example, ELF files for a different architecture as +# shell scripts may have annoying side effects. + +T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit +trap 'rm -rf "${T}"' 0 +printf '\177ELF\001!!\012\0\0\0\0\0\0\0\0' >"$T/testshellproc" +chmod 755 "$T/testshellproc" +PATH=$T:$PATH +errout=`testshellproc 3>&2 2>&1 >&3 3>&-` +r=$? +[ "$r" = 126 ] && [ -n "$errout" ] From owner-svn-src-head@freebsd.org Mon Dec 30 21:36:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46EC91EAE4B; Mon, 30 Dec 2019 21:36:40 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47mrNR1Fssz4WLT; Mon, 30 Dec 2019 21:36:38 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id C70A21AF135; Mon, 30 Dec 2019 21:36:30 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id xBULaU4Q027206 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 30 Dec 2019 21:36:30 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id xBULaToL027205; Mon, 30 Dec 2019 21:36:29 GMT (envelope-from phk) To: Warner Losh cc: Alexander Motin , Alexey Dokuchaev , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r356185 - in head: lib/geom lib/geom/sched sys/geom sys/geom/sched sys/modules/geom sys/modules/geom/geom_sched sys/sys In-reply-to: From: "Poul-Henning Kamp" References: <201912292116.xBTLG4kV012809@repo.freebsd.org> <20191230113243.GA58338@FreeBSD.org> <20191230170208.GA20424@FreeBSD.org> <5a97d344-8741-3b8e-b6dd-b8e4cfa05aeb@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <27203.1577741789.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Dec 2019 21:36:29 +0000 Message-ID: <27204.1577741789@critter.freebsd.dk> X-Rspamd-Queue-Id: 47mrNR1Fssz4WLT X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of phk@critter.freebsd.dk designates 130.225.244.222 as permitted sender) smtp.mailfrom=phk@critter.freebsd.dk X-Spamd-Result: default: False [-1.86 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.980,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-0.93)[-0.926,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.dk]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; IP_SCORE(0.05)[ip: (0.07), ipnet: 130.225.0.0/16(0.08), asn: 1835(0.10), country: EU(-0.00)]; FORGED_SENDER(0.30)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU]; FROM_NEQ_ENVFROM(0.00)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 21:36:40 -0000 -------- In message , Warner Losh writes: >I never enabled it because I never had a good car size as the default. I'= m >guessing it's somewhere on the order of 2 times the queue size in >hardware, but with modern drives I think phk might be right and that >disabling disksort entirely might be optimal, or close to optimal. I think that is a given for SSDs. For disks I fear it would be a model-by-model determination. The situation is quite different for "traditional" and shingled drives for instance, or if, God forbid, the rumours are true and we'll see IBM3380-style dual head assemblies in the market again. I guess the kernel could turn the disksort on/off a few times and only leave it on if it improves things. But first, Somebody Should=E2=84=A2 benchmark to see if disksort *ever* is= an improvement on contemporary disks. Poul-Henning PS: If somebody really want to improve disk- and ssd- performance, the low-hanging fruit is to write a log-structured storage engine under UFS, to make life easier for flash-adaptation layers and shingling drives. -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-head@freebsd.org Mon Dec 30 21:41:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABAFE1EAF36; Mon, 30 Dec 2019 21:41:05 +0000 (UTC) (envelope-from alc@rice.edu) Received: from mx0a-0010f301.pphosted.com (mx0a-0010f301.pphosted.com [148.163.149.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.pphosted.com", Issuer "Thawte RSA CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mrTX4V22z4WWL; Mon, 30 Dec 2019 21:41:04 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pps.filterd (m0102855.ppops.net [127.0.0.1]) by mx0b-0010f301.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xBULaDHo018302; Mon, 30 Dec 2019 15:41:02 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rice.edu; h=subject : to : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=ricemail; bh=CWg6+FyIDPaHENIR2FI74Tpm3RfEx8k+kIgWIak+GBE=; b=a4dn9weA4Wt1jJbbpv3+uPzKhUbQ/lr7V8xz4ldXFsUNjtUmYBaXtjDzAfePRpJckFIm MzD8Jj3oEqWyamXAQBW3LZK0k+Zr5KdmkrAm/2rjDGuJe8JyrT+aMACJjmpBcuZBPdSC uBQcbi/iiLif1bTfqJHBglr9suxGH56MxCROlopav+JIms8cFzNV/13fGYcamTYrknNo zLNttMIhbYbFbR3w3g02tPWAUo1MJCy+kqwpcYZVm9nr2GKoIfLtIx38GOsPFkps7zJ2 KMahw7NYjk2b5VvN6tb+YBqcS/TgHhW6SrysfmfbCp2qTIVOLjUladkiVDpc8jR3WfN/ tw== Received: from mh3.mail.rice.edu (mh3.mail.rice.edu [128.42.199.10]) by mx0b-0010f301.pphosted.com with ESMTP id 2x658chvck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Dec 2019 15:41:02 -0600 Received-X: from mh3.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh3.mail.rice.edu (Postfix) with ESMTP id 77B0A40591; Mon, 30 Dec 2019 15:41:01 -0600 (CST) Received-X: from mh3.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh3.mail.rice.edu (Postfix) with ESMTP id 767494058F; Mon, 30 Dec 2019 15:41:01 -0600 (CST) X-Virus-Scanned: by amavis-2.7.0 at mh3.mail.rice.edu, auth channel Received-X: from mh3.mail.rice.edu ([127.0.0.1]) by mh3.mail.rice.edu (mh3.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id OWW79q0EwMD6; Mon, 30 Dec 2019 15:41:01 -0600 (CST) Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: alc) by mh3.mail.rice.edu (Postfix) with ESMTPSA id 1B51F40429; Mon, 30 Dec 2019 15:41:01 -0600 (CST) Subject: Re: svn commit: r356207 - in head/sys/arm64: arm64 include To: Colin Percival , Alan Cox , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912302030.xBUKUWAO044693@repo.freebsd.org> <0100016f589bb7e4-ad3fd7d7-ffaa-4097-9e8f-ee0828daf017-000000@email.amazonses.com> From: Alan Cox Message-ID: <1e67ebf7-20ab-a007-1f62-04bc0cb7cfcb@rice.edu> Date: Mon, 30 Dec 2019 15:41:00 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <0100016f589bb7e4-ad3fd7d7-ffaa-4097-9e8f-ee0828daf017-000000@email.amazonses.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-30_06:2019-12-27,2019-12-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxlogscore=711 priorityscore=1501 clxscore=1015 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912300195 X-Rspamd-Queue-Id: 47mrTX4V22z4WWL X-Spamd-Bar: -------- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=rice.edu header.s=ricemail header.b=a4dn9weA; dmarc=pass (policy=none) header.from=rice.edu; spf=pass (mx1.freebsd.org: domain of alc@rice.edu designates 148.163.149.254 as permitted sender) smtp.mailfrom=alc@rice.edu X-Spamd-Result: default: False [-8.45 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[rice.edu:s=ricemail]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:a32.spf.rice.edu]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DWL_DNSWL_MED(-2.00)[rice.edu.dwl.dnswl.org : 127.0.11.2]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[rice.edu:+]; DMARC_POLICY_ALLOW(-0.50)[rice.edu,none]; IP_SCORE(-3.35)[ip: (-9.90), ipnet: 148.163.148.0/22(-4.80), asn: 26211(-2.02), country: US(-0.05)]; RCVD_IN_DNSWL_LOW(-0.10)[254.149.163.148.list.dnswl.org : 127.0.3.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:26211, ipnet:148.163.148.0/22, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 21:41:05 -0000 On 12/30/19 2:59 PM, Colin Percival wrote: > On 2019-12-30 12:30, Alan Cox wrote: >> Author: alc >> Date: Mon Dec 30 20:30:31 2019 >> New Revision: 356207 >> URL: https://svnweb.freebsd.org/changeset/base/356207 >> >> Log: >> Determine whether the MMU hardware is capable of updating a page table >> entry's access flag and dirty state, and enable this feature when it's >> available. > Am I right in thinking that this should result in improved performance under > load? (I'm wondering if it's time to redo my amd64 vs arm64 EC2 benchmarks.) > Yes, a modest one. From owner-svn-src-head@freebsd.org Mon Dec 30 22:05:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEC6C1EB9A6; Mon, 30 Dec 2019 22:05:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ms2F4vr8z4Xmd; Mon, 30 Dec 2019 22:05:57 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A37E68685; Mon, 30 Dec 2019 22:05: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 xBUM5v2s003565; Mon, 30 Dec 2019 22:05:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBUM5vEN003564; Mon, 30 Dec 2019 22:05:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912302205.xBUM5vEN003564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 30 Dec 2019 22:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356209 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 356209 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 22:05:58 -0000 Author: jhb Date: Mon Dec 30 22:05:57 2019 New Revision: 356209 URL: https://svnweb.freebsd.org/changeset/base/356209 Log: Formatting fixes for tables, no content changes. - Add missing .Pp after the end of some lists so that there is a blank line before the subsequent paragraph. - Use a more typical '-tag' bullet list of the make variable descriptions at the end. This adds separation between bullets and is the formatting typically used in manpages for this sort of list. Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Mon Dec 30 21:32:55 2019 (r356208) +++ head/share/man/man7/arch.7 Mon Dec 30 22:05:57 2019 (r356209) @@ -139,6 +139,7 @@ and .Vt void * are 8 bytes. .El +.Pp Compilers define the .Dv _LP64 symbol when compiling for an @@ -163,6 +164,7 @@ Examples are: .It Dv mips64* Ta Dv mips* .It Dv aarch64 Ta Dv armv6/armv7 .El +.Pp .Dv aarch64 will support execution of .Dv armv6 @@ -184,6 +186,7 @@ On all supported architectures: .It float Ta 4 .It double Ta 8 .El +.Pp Integers are represented in two's complement. Alignment of integer and pointer types is natural, that is, the address of the variable must be congruent to zero modulo the type size. @@ -421,8 +424,9 @@ Most of the externally settable variables are defined man page. These variables are not otherwise documented and are used extensively in the build system. -.Bl -column -offset indent "Sy Variable" "Sy Meaning and usage" -.It Dv MACHINE Represent the hardware platform. +.Bl -tag -width "MACHINE_CPUARCH" +.It Dv MACHINE +Represent the hardware platform. This is the same as the native platform's .Xr uname 1 .Fl m @@ -457,7 +461,8 @@ Generally, .Dv MACHINE should only be used in src/sys and src/stand or in system imagers or installers. -.It Dv MACHINE_ARCH Represents the CPU processor architecture. +.It Dv MACHINE_ARCH +Represents the CPU processor architecture. This is the same as the native platforms .Xr uname 1 .Fl p @@ -488,7 +493,8 @@ It is unfortunate that amd64 specifies the 64-bit evol platform (it matches the 'first rule') as everybody else uses x86_64. There is no standard name for the processor: each OS selects its own conventions. -.It Dv MACHINE_CPUARCH Represents the source location for a given +.It Dv MACHINE_CPUARCH +Represents the source location for a given .Dv MACHINE_ARCH . It is generally the common prefix for all the MACHINE_ARCH that share the same implementation, though 'riscv' breaks this rule. @@ -502,25 +508,29 @@ The FreeBSD source base supports amd64 and i386 with t distinct source bases living in subdirectories named amd64 and i386 (though behind the scenes there's some sharing that fits into this framework). -.It Dv CPUTYPE Sets the flavor of +.It Dv CPUTYPE +Sets the flavor of .Dv MACHINE_ARCH to build. It is used to optimize the build for a specific CPU / core that the binaries run on. Generally, this does not change the ABI, though it can be a fine line between optimization for specific cases. -.It Dv TARGET Used to set +.It Dv TARGET +Used to set .Dv MACHINE in the top level Makefile for cross building. Unused outside of that scope. It is not passed down to the rest of the build. Makefiles outside of the top level should not use it at all (though some have their own private copy for hysterical raisons). -.It Dv TARGET_ARCH Used to set +.It Dv TARGET_ARCH +Used to set .Dv MACHINE_ARCH by the top level Makefile for cross building. Like -.Dv TARGET , it is unused outside of that scope. +.Dv TARGET , +it is unused outside of that scope. .El .Sh SEE ALSO .Xr src.conf 5 , From owner-svn-src-head@freebsd.org Mon Dec 30 22:39:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8D951EC295; Mon, 30 Dec 2019 22:39:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47msmx3zMlz4Z5t; Mon, 30 Dec 2019 22:39:29 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F4FA8BE5; Mon, 30 Dec 2019 22:39:29 +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 xBUMdTqZ021437; Mon, 30 Dec 2019 22:39:29 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBUMdTli021436; Mon, 30 Dec 2019 22:39:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912302239.xBUMdTli021436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 30 Dec 2019 22:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356210 - head/sys/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/nfs X-SVN-Commit-Revision: 356210 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 22:39:29 -0000 Author: rmacklem Date: Mon Dec 30 22:39:29 2019 New Revision: 356210 URL: https://svnweb.freebsd.org/changeset/base/356210 Log: Add warning printf w.r.t. removal of sys/nfs/nfs_lock.c. The code in sys/nfs/nfs_lock.c has not been run by default since March 2008 when it was replaced by the in kernel sys/nlm code. It uses Giant, so it needs to be removed before the FreeBSD 13 release. This will happen in a couple of months, since few if any users run the code anyhow and can easily switch to the default in kernel NFSLOCKD. Modified: head/sys/nfs/nfs_lock.c Modified: head/sys/nfs/nfs_lock.c ============================================================================== --- head/sys/nfs/nfs_lock.c Mon Dec 30 22:05:57 2019 (r356209) +++ head/sys/nfs/nfs_lock.c Mon Dec 30 22:39:29 2019 (r356210) @@ -89,6 +89,8 @@ nfslock_open(struct cdev *dev, int oflags, int devtype { int error; + printf("WARNING: uses Giant and will be removed before FreeBSD 13\n" + "\tuse the kernel NFSLOCKD/nfslockd.ko\n"); error = priv_check(td, PRIV_NFS_LOCKD); if (error) return (error); From owner-svn-src-head@freebsd.org Mon Dec 30 23:20:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 694A81ECD87; Mon, 30 Dec 2019 23:20:47 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mthb2Cvbz4bsV; Mon, 30 Dec 2019 23:20:47 +0000 (UTC) (envelope-from ian@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 476DE9452; Mon, 30 Dec 2019 23:20:47 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBUNKlJ9045187; Mon, 30 Dec 2019 23:20:47 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBUNKkxb045185; Mon, 30 Dec 2019 23:20:46 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912302320.xBUNKkxb045185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 30 Dec 2019 23:20:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356211 - in head/sys: arm/arm conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: arm/arm conf X-SVN-Commit-Revision: 356211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 23:20:47 -0000 Author: ian Date: Mon Dec 30 23:20:46 2019 New Revision: 356211 URL: https://svnweb.freebsd.org/changeset/base/356211 Log: Set a "kernbase" symbol in 32-bit arm locore.S and use it with ldscript.arm. This brings arm into line with how every other arch does it. For some reason, only arm lacked a definition of a symbol named kernbase in its locore.S file(s) for use in its ldscript.arm file. Needlessly different means harder to maintain. Using a common symbol name also eases work in progress on a script to help generate arm and arm64 kernels packaged in various ways (like with a header blob needed for a bootloader prepended to the kernel file). Modified: head/sys/arm/arm/locore-v4.S head/sys/arm/arm/locore-v6.S head/sys/conf/Makefile.arm Modified: head/sys/arm/arm/locore-v4.S ============================================================================== --- head/sys/arm/arm/locore-v4.S Mon Dec 30 22:39:29 2019 (r356210) +++ head/sys/arm/arm/locore-v4.S Mon Dec 30 23:20:46 2019 (r356211) @@ -62,9 +62,11 @@ __FBSDID("$FreeBSD$"); */ .text .align 2 + + .globl kernbase + .set kernbase,KERNVIRTADDR + #ifdef PHYSADDR -.globl kernbase -.set kernbase,KERNBASE .globl physaddr .set physaddr,PHYSADDR #endif Modified: head/sys/arm/arm/locore-v6.S ============================================================================== --- head/sys/arm/arm/locore-v6.S Mon Dec 30 22:39:29 2019 (r356210) +++ head/sys/arm/arm/locore-v6.S Mon Dec 30 23:20:46 2019 (r356211) @@ -59,6 +59,9 @@ __FBSDID("$FreeBSD$"); .text .align 2 + .globl kernbase + .set kernbase,KERNVIRTADDR + #if __ARM_ARCH >= 7 #define HANDLE_HYP \ /* Leave HYP mode */ ;\ Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Mon Dec 30 22:39:29 2019 (r356210) +++ head/sys/conf/Makefile.arm Mon Dec 30 23:20:46 2019 (r356211) @@ -61,7 +61,7 @@ KERNVIRTADDR= 0xc0000000 # "ELF for the ARM architecture" for more info on the mapping symbols. SYSTEM_LD= \ ${SYSTEM_LD_BASECMD} \ - --defsym='text_start=${KERNVIRTADDR} + SIZEOF_HEADERS' \ + --defsym='text_start=kernbase + SIZEOF_HEADERS' \ -o ${.TARGET} ${SYSTEM_OBJS} vers.o; \ $(OBJCOPY) \ --wildcard \ @@ -77,7 +77,7 @@ KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin ${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o @echo "linking ${.TARGET}" @${SYSTEM_LD_BASECMD} \ - --defsym='text_start=${KERNVIRTADDR}' \ + --defsym='text_start=kernbase' \ -o ${.TARGET} ${SYSTEM_OBJS} vers.o ${SIZE} ${.TARGET} @${OBJCOPY} \ From owner-svn-src-head@freebsd.org Tue Dec 31 00:05:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA1B51ED8B2; Tue, 31 Dec 2019 00:05:10 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mvgp59Wvz4dP6; Tue, 31 Dec 2019 00:05:10 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9246C9C26; Tue, 31 Dec 2019 00:05:10 +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 xBV05Au6074083; Tue, 31 Dec 2019 00:05:10 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBV056p8074062; Tue, 31 Dec 2019 00:05:06 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201912310005.xBV056p8074062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Tue, 31 Dec 2019 00:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356212 - in head: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/test_utils lib/libarchive/tests usr.bin/bsdcat usr.bin/cpio usr... X-SVN-Group: head X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in head: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/test_utils lib/libarchive/tests usr.bin/bsdcat usr.bin/cpio usr.bin/tar X-SVN-Commit-Revision: 356212 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 00:05:10 -0000 Author: mm Date: Tue Dec 31 00:05:06 2019 New Revision: 356212 URL: https://svnweb.freebsd.org/changeset/base/356212 Log: MFV r356163,r356197: Update libarchive to 3.4.1 Relevant vendor changes since last update: Issue #351: Refactor and implement private state logic for write filters PR #1252: RAR5 reader - verify window size for solid files (OSS-Fuzz 15482) PR #1255: zip writer - don't append unused NUL for directories PR #1260: Fix sparse file offset overflow on 32-bit systems PR #1263: UNICODE filename support for reading lha/lzh format Issue #1276: Bugfix and optimize archive_wstring_append_from_mbs() PR #1288: Add the "xattrhdr" option to pax write options PR #1295: 7z reader - fix reading archives with digests in PackInfo PR #1296: RAR5 reader - verify window size for multivolume archives PR #1297: ZIP reader - support LZMA_STREAM_END marker in 'lzma alone' files Issue #1298: Fix a heap-buffer-overflow in archive_string_append_from_wcs() OSS-Fuzz 19360, 19362: LHA reader - plug two memory leaks on error Fix possible off-by-one when dealing with readlink(2) MFC after: 2 weeks Added: head/contrib/libarchive/libarchive/test/test_pax_xattr_header.c - copied unchanged from r356163, vendor/libarchive/dist/libarchive/test/test_pax_xattr_header.c head/contrib/libarchive/libarchive/test/test_pax_xattr_header_all.tar.uu - copied unchanged from r356163, vendor/libarchive/dist/libarchive/test/test_pax_xattr_header_all.tar.uu head/contrib/libarchive/libarchive/test/test_pax_xattr_header_libarchive.tar.uu - copied unchanged from r356163, vendor/libarchive/dist/libarchive/test/test_pax_xattr_header_libarchive.tar.uu head/contrib/libarchive/libarchive/test/test_pax_xattr_header_schily.tar.uu - copied unchanged from r356163, vendor/libarchive/dist/libarchive/test/test_pax_xattr_header_schily.tar.uu head/contrib/libarchive/libarchive/test/test_read_format_7zip_packinfo_digests.7z.uu - copied unchanged from r356163, vendor/libarchive/dist/libarchive/test/test_read_format_7zip_packinfo_digests.7z.uu head/contrib/libarchive/libarchive/test/test_read_format_7zip_packinfo_digests.c - copied unchanged from r356163, vendor/libarchive/dist/libarchive/test/test_read_format_7zip_packinfo_digests.c head/contrib/libarchive/libarchive/test/test_read_format_lha_filename_utf16.c - copied unchanged from r356163, vendor/libarchive/dist/libarchive/test/test_read_format_lha_filename_utf16.c head/contrib/libarchive/libarchive/test/test_read_format_lha_filename_utf16.lzh.uu - copied unchanged from r356163, vendor/libarchive/dist/libarchive/test/test_read_format_lha_filename_utf16.lzh.uu head/contrib/libarchive/libarchive/test/test_read_format_rar5_different_solid_window_size.rar.uu - copied unchanged from r356163, vendor/libarchive/dist/libarchive/test/test_read_format_rar5_different_solid_window_size.rar.uu head/contrib/libarchive/libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu - copied unchanged from r356163, vendor/libarchive/dist/libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu Modified: head/contrib/libarchive/NEWS head/contrib/libarchive/libarchive/archive.h head/contrib/libarchive/libarchive/archive_entry.h head/contrib/libarchive/libarchive/archive_entry_acl.3 head/contrib/libarchive/libarchive/archive_hmac.c head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c head/contrib/libarchive/libarchive/archive_read_disk_posix.c head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c head/contrib/libarchive/libarchive/archive_read_support_format_lha.c head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c head/contrib/libarchive/libarchive/archive_read_support_format_zip.c head/contrib/libarchive/libarchive/archive_string.c head/contrib/libarchive/libarchive/archive_write.c head/contrib/libarchive/libarchive/archive_write_add_filter_b64encode.c head/contrib/libarchive/libarchive/archive_write_add_filter_bzip2.c head/contrib/libarchive/libarchive/archive_write_add_filter_compress.c head/contrib/libarchive/libarchive/archive_write_add_filter_gzip.c head/contrib/libarchive/libarchive/archive_write_add_filter_lz4.c head/contrib/libarchive/libarchive/archive_write_add_filter_lzop.c head/contrib/libarchive/libarchive/archive_write_add_filter_program.c head/contrib/libarchive/libarchive/archive_write_add_filter_uuencode.c head/contrib/libarchive/libarchive/archive_write_add_filter_xz.c head/contrib/libarchive/libarchive/archive_write_add_filter_zstd.c head/contrib/libarchive/libarchive/archive_write_disk_posix.c head/contrib/libarchive/libarchive/archive_write_private.h head/contrib/libarchive/libarchive/archive_write_set_format_pax.c head/contrib/libarchive/libarchive/archive_write_set_format_zip.c head/contrib/libarchive/libarchive/archive_write_set_options.3 head/contrib/libarchive/libarchive/test/test_open_failure.c head/contrib/libarchive/libarchive/test/test_open_fd.c head/contrib/libarchive/libarchive/test/test_read_disk_directory_traversals.c head/contrib/libarchive/libarchive/test/test_read_format_rar5.c head/contrib/libarchive/libarchive/test/test_sparse_basic.c head/contrib/libarchive/test_utils/test_main.c head/lib/libarchive/tests/Makefile 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 Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/NEWS Tue Dec 31 00:05:06 2019 (r356212) @@ -1,3 +1,9 @@ +Dec 30, 2019: libarchive 3.4.1 released + +Dec 11, 2019: New pax write option "xattrhdr" + +Nov 17, 2019: Unicode filename support for reading lha/lzh archives + Jun 11, 2019: libarchive 3.4.0 released May 18, 2019: Fixes for reading Android APK and JAR archives Modified: head/contrib/libarchive/libarchive/archive.h ============================================================================== --- head/contrib/libarchive/libarchive/archive.h Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive.h Tue Dec 31 00:05:06 2019 (r356212) @@ -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 3004000 +#define ARCHIVE_VERSION_NUMBER 3004001 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.4.0" +#define ARCHIVE_VERSION_ONLY_STRING "3.4.1" #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 Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_entry.h Tue Dec 31 00:05:06 2019 (r356212) @@ -30,7 +30,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3004000 +#define ARCHIVE_VERSION_NUMBER 3004001 /* * Note: archive_entry.h is for use outside of libarchive; the @@ -524,9 +524,6 @@ __LA_DECL int archive_entry_acl_reset(struct archive_ __LA_DECL int archive_entry_acl_next(struct archive_entry *, int /* want_type */, int * /* type */, int * /* permset */, int * /* tag */, int * /* qual */, const char ** /* name */); -__LA_DECL int archive_entry_acl_next_w(struct archive_entry *, int /* want_type */, - int * /* type */, int * /* permset */, int * /* tag */, - int * /* qual */, const wchar_t ** /* name */); /* * Construct a text-format ACL. The flags argument is a bitmask that Modified: head/contrib/libarchive/libarchive/archive_entry_acl.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_acl.3 Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_entry_acl.3 Tue Dec 31 00:05:06 2019 (r356212) @@ -34,7 +34,6 @@ .Nm archive_entry_acl_from_text , .Nm archive_entry_acl_from_text_w , .Nm archive_entry_acl_next , -.Nm archive_entry_acl_next_w , .Nm archive_entry_acl_reset , .Nm archive_entry_acl_to_text , .Nm archive_entry_acl_to_text_w , @@ -89,16 +88,6 @@ Streaming Archive Library (libarchive, -larchive) .Fa "const char **ret_name" .Fc .Ft int -.Fo archive_entry_acl_next_w -.Fa "struct archive_entry *a" -.Fa "int type" -.Fa "int *ret_type" -.Fa "int *ret_permset" -.Fa "int *ret_tag" -.Fa "int *ret_qual" -.Fa "const wchar_t **ret_name" -.Fc -.Ft int .Fn archive_entry_acl_reset "struct archive_entry *a" "int type" .Ft char * .Fo archive_entry_acl_to_text @@ -349,8 +338,6 @@ character are skipped. .Pp .Fn archive_entry_acl_next -and -.Fn archive_entry_acl_next_w return the next entry of the ACL list. This functions may only be called after .Fn archive_entry_acl_reset @@ -358,9 +345,7 @@ has indicated the presence of extended ACL entries. .Pp .Fn archive_entry_acl_reset prepare reading the list of ACL entries with -.Fn archive_entry_acl_next -or -.Fn archive_entry_acl_next_w . +.Fn archive_entry_acl_next . The function returns 0 if no non-extended ACLs are found. In this case, the access permissions should be obtained by .Xr archive_entry_mode 3 @@ -447,9 +432,7 @@ if all entries were successfully parsed and if one or more entries were invalid or non-parseable. .Pp .Fn archive_entry_acl_next -and -.Fn archive_entry_acl_next_w -return +returns .Dv ARCHIVE_OK on success, .Dv ARCHIVE_EOF Modified: head/contrib/libarchive/libarchive/archive_hmac.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_hmac.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_hmac.c Tue Dec 31 00:05:06 2019 (r356212) @@ -83,7 +83,9 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) static int __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) { +#ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wcast-qual" +#endif BCRYPT_ALG_HANDLE hAlg; BCRYPT_HASH_HANDLE hHash; DWORD hash_len; Modified: head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Tue Dec 31 00:05:06 2019 (r356212) @@ -249,11 +249,11 @@ archive_read_disk_entry_from_file(struct archive *_a, #if defined(HAVE_READLINK) || defined(HAVE_READLINKAT) if (S_ISLNK(st->st_mode)) { - size_t linkbuffer_len = st->st_size + 1; + size_t linkbuffer_len = st->st_size; char *linkbuffer; int lnklen; - linkbuffer = malloc(linkbuffer_len); + linkbuffer = malloc(linkbuffer_len + 1); if (linkbuffer == NULL) { archive_set_error(&a->archive, ENOMEM, "Couldn't read link data"); @@ -280,7 +280,7 @@ archive_read_disk_entry_from_file(struct archive *_a, free(linkbuffer); return (ARCHIVE_FAILED); } - linkbuffer[lnklen] = 0; + linkbuffer[lnklen] = '\0'; archive_entry_set_symlink(entry, linkbuffer); free(linkbuffer); } Modified: head/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_posix.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_read_disk_posix.c Tue Dec 31 00:05:06 2019 (r356212) @@ -694,6 +694,7 @@ _archive_read_data_block(struct archive *_a, const voi struct tree *t = a->tree; int r; ssize_t bytes; + int64_t sparse_bytes; size_t buffbytes; int empty_sparse_region = 0; @@ -792,9 +793,9 @@ _archive_read_data_block(struct archive *_a, const voi a->archive.state = ARCHIVE_STATE_FATAL; goto abort_read_data; } - bytes = t->current_sparse->offset - t->entry_total; - t->entry_remaining_bytes -= bytes; - t->entry_total += bytes; + sparse_bytes = t->current_sparse->offset - t->entry_total; + t->entry_remaining_bytes -= sparse_bytes; + t->entry_total += sparse_bytes; } /* @@ -2172,7 +2173,7 @@ tree_reopen(struct tree *t, const char *path, int rest #elif defined(O_SEARCH) /* SunOS */ const int o_flag = O_SEARCH; -#elif defined(O_EXEC) +#elif defined(__FreeBSD__) && defined(O_EXEC) /* FreeBSD */ const int o_flag = O_EXEC; #endif @@ -2198,7 +2199,8 @@ tree_reopen(struct tree *t, const char *path, int rest t->stack->flags = needsFirstVisit; t->maxOpenCount = t->openCount = 1; t->initial_dir_fd = open(".", O_RDONLY | O_CLOEXEC); -#if defined(O_PATH) || defined(O_SEARCH) || defined(O_EXEC) +#if defined(O_PATH) || defined(O_SEARCH) || \ + (defined(__FreeBSD__) && defined(O_EXEC)) /* * Most likely reason to fail opening "." is that it's not readable, * so try again for execute. The consequences of not opening this are Modified: head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c Tue Dec 31 00:05:06 2019 (r356212) @@ -1787,7 +1787,7 @@ read_PackInfo(struct archive_read *a, struct _7z_pack_ return (0); } - if (*p != kSize) + if (*p != kCRC) return (-1); if (read_Digests(a, &(pi->digest), (size_t)pi->numPackStreams) < 0) Modified: head/contrib/libarchive/libarchive/archive_read_support_format_lha.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_lha.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_read_support_format_lha.c Tue Dec 31 00:05:06 2019 (r356212) @@ -175,7 +175,9 @@ struct lha { struct archive_string gname; uint16_t header_crc; uint16_t crc; - struct archive_string_conv *sconv; + /* dirname and filename could be in different codepages */ + struct archive_string_conv *sconv_dir; + struct archive_string_conv *sconv_fname; struct archive_string_conv *opt_sconv; struct archive_string dirname; @@ -232,8 +234,8 @@ static time_t lha_dos_time(const unsigned char *); static time_t lha_win_time(uint64_t, long *); static unsigned char lha_calcsum(unsigned char, const void *, int, size_t); -static int lha_parse_linkname(struct archive_string *, - struct archive_string *); +static int lha_parse_linkname(struct archive_wstring *, + struct archive_wstring *); static int lha_read_data_none(struct archive_read *, const void **, size_t *, int64_t *); static int lha_read_data_lzh(struct archive_read *, const void **, @@ -473,13 +475,15 @@ static int archive_read_format_lha_read_header(struct archive_read *a, struct archive_entry *entry) { - struct archive_string linkname; - struct archive_string pathname; + struct archive_wstring linkname; + struct archive_wstring pathname; struct lha *lha; const unsigned char *p; const char *signature; int err; - + struct archive_mstring conv_buffer; + const wchar_t *conv_buffer_p; + lha_crc16_init(); a->archive.archive_format = ARCHIVE_FORMAT_LHA; @@ -561,10 +565,13 @@ archive_read_format_lha_read_header(struct archive_rea archive_string_empty(&lha->dirname); archive_string_empty(&lha->filename); lha->dos_attr = 0; - if (lha->opt_sconv != NULL) - lha->sconv = lha->opt_sconv; - else - lha->sconv = NULL; + if (lha->opt_sconv != NULL) { + lha->sconv_dir = lha->opt_sconv; + lha->sconv_fname = lha->opt_sconv; + } else { + lha->sconv_dir = NULL; + lha->sconv_fname = NULL; + } switch (p[H_LEVEL_OFFSET]) { case 0: @@ -594,13 +601,55 @@ archive_read_format_lha_read_header(struct archive_rea return (truncated_error(a)); /* - * Make a pathname from a dirname and a filename. - */ - archive_string_concat(&lha->dirname, &lha->filename); + * Make a pathname from a dirname and a filename, after converting to Unicode. + * This is because codepages might differ between dirname and filename. + */ archive_string_init(&pathname); archive_string_init(&linkname); - archive_string_copy(&pathname, &lha->dirname); + archive_string_init(&conv_buffer.aes_mbs); + archive_string_init(&conv_buffer.aes_mbs_in_locale); + archive_string_init(&conv_buffer.aes_utf8); + archive_string_init(&conv_buffer.aes_wcs); + if (0 != archive_mstring_copy_mbs_len_l(&conv_buffer, lha->dirname.s, lha->dirname.length, lha->sconv_dir)) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Pathname cannot be converted " + "from %s to Unicode.", + archive_string_conversion_charset_name(lha->sconv_dir)); + err = ARCHIVE_FATAL; + } else if (0 != archive_mstring_get_wcs(&a->archive, &conv_buffer, &conv_buffer_p)) + err = ARCHIVE_FATAL; + if (err == ARCHIVE_FATAL) { + archive_mstring_clean(&conv_buffer); + archive_wstring_free(&pathname); + archive_wstring_free(&linkname); + return (err); + } + archive_wstring_copy(&pathname, &conv_buffer.aes_wcs); + archive_string_empty(&conv_buffer.aes_mbs); + archive_string_empty(&conv_buffer.aes_mbs_in_locale); + archive_string_empty(&conv_buffer.aes_utf8); + archive_wstring_empty(&conv_buffer.aes_wcs); + if (0 != archive_mstring_copy_mbs_len_l(&conv_buffer, lha->filename.s, lha->filename.length, lha->sconv_fname)) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Pathname cannot be converted " + "from %s to Unicode.", + archive_string_conversion_charset_name(lha->sconv_fname)); + err = ARCHIVE_FATAL; + } + else if (0 != archive_mstring_get_wcs(&a->archive, &conv_buffer, &conv_buffer_p)) + err = ARCHIVE_FATAL; + if (err == ARCHIVE_FATAL) { + archive_mstring_clean(&conv_buffer); + archive_wstring_free(&pathname); + archive_wstring_free(&linkname); + return (err); + } + archive_wstring_concat(&pathname, &conv_buffer.aes_wcs); + archive_mstring_clean(&conv_buffer); + if ((lha->mode & AE_IFMT) == AE_IFLNK) { /* * Extract the symlink-name if it's included in the pathname. @@ -610,8 +659,8 @@ archive_read_format_lha_read_header(struct archive_rea archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Unknown symlink-name"); - archive_string_free(&pathname); - archive_string_free(&linkname); + archive_wstring_free(&pathname); + archive_wstring_free(&linkname); return (ARCHIVE_FAILED); } } else { @@ -629,39 +678,13 @@ archive_read_format_lha_read_header(struct archive_rea /* * Set basic file parameters. */ - if (archive_entry_copy_pathname_l(entry, pathname.s, - pathname.length, lha->sconv) != 0) { - if (errno == ENOMEM) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate memory for Pathname"); - return (ARCHIVE_FATAL); - } - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Pathname cannot be converted " - "from %s to current locale.", - archive_string_conversion_charset_name(lha->sconv)); - err = ARCHIVE_WARN; - } - archive_string_free(&pathname); + archive_entry_copy_pathname_w(entry, pathname.s); + archive_wstring_free(&pathname); if (archive_strlen(&linkname) > 0) { - if (archive_entry_copy_symlink_l(entry, linkname.s, - linkname.length, lha->sconv) != 0) { - if (errno == ENOMEM) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate memory for Linkname"); - return (ARCHIVE_FATAL); - } - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Linkname cannot be converted " - "from %s to current locale.", - archive_string_conversion_charset_name(lha->sconv)); - err = ARCHIVE_WARN; - } + archive_entry_copy_symlink_w(entry, linkname.s); } else archive_entry_set_symlink(entry, NULL); - archive_string_free(&linkname); + archive_wstring_free(&linkname); /* * When a header level is 0, there is a possibility that * a pathname and a symlink has '\' character, a directory @@ -1208,6 +1231,26 @@ lha_read_file_extended_header(struct archive_read *a, archive_strncpy(&lha->filename, (const char *)extdheader, datasize); break; + case EXT_UTF16_FILENAME: + if (datasize == 0) { + /* maybe directory header */ + archive_string_empty(&lha->filename); + break; + } else if (datasize & 1) { + /* UTF-16 characters take always 2 or 4 bytes */ + goto invalid; + } + if (extdheader[0] == '\0') + goto invalid; + archive_string_empty(&lha->filename); + archive_array_append(&lha->filename, + (const char *)extdheader, datasize); + /* Setup a string conversion for a filename. */ + lha->sconv_fname = archive_string_conversion_from_charset( + &a->archive, "UTF-16LE", 1); + if (lha->sconv_fname == NULL) + return (ARCHIVE_FATAL); + break; case EXT_DIRECTORY: if (datasize == 0 || extdheader[0] == '\0') /* no directory name data. exit this case. */ @@ -1228,6 +1271,36 @@ lha_read_file_extended_header(struct archive_read *a, /* invalid directory data */ goto invalid; break; + case EXT_UTF16_DIRECTORY: + /* UTF-16 characters take always 2 or 4 bytes */ + if (datasize == 0 || (datasize & 1) || extdheader[0] == '\0') + /* no directory name data. exit this case. */ + goto invalid; + + archive_string_empty(&lha->dirname); + archive_array_append(&lha->dirname, + (const char *)extdheader, datasize); + lha->sconv_dir = archive_string_conversion_from_charset( + &a->archive, "UTF-16LE", 1); + if (lha->sconv_dir == NULL) + return (ARCHIVE_FATAL); + else { + /* + * Convert directory delimiter from 0xFF + * to '/' for local system. + */ + /* UTF-16LE character */ + uint16_t *utf16name = (uint16_t *)lha->dirname.s; + for (i = 0; i < lha->dirname.length / 2; i++) { + if (utf16name[i] == 0xFFFF) + utf16name[i] = L'/'; + } + /* Is last character directory separator? */ + if (utf16name[lha->dirname.length / 2 - 1] != L'/') + /* invalid directory data */ + goto invalid; + } + break; case EXT_DOS_ATTR: if (datasize == 2) lha->dos_attr = (unsigned char) @@ -1276,12 +1349,17 @@ lha_read_file_extended_header(struct archive_read *a, charset = cp.s; break; } - lha->sconv = + lha->sconv_dir = archive_string_conversion_from_charset( &(a->archive), charset, 1); + lha->sconv_fname = + archive_string_conversion_from_charset( + &(a->archive), charset, 1); archive_string_free(&cp); - if (lha->sconv == NULL) + if (lha->sconv_dir == NULL) return (ARCHIVE_FATAL); + if (lha->sconv_fname == NULL) + return (ARCHIVE_FATAL); } break; case EXT_UNIX_MODE: @@ -1336,8 +1414,7 @@ lha_read_file_extended_header(struct archive_read *a, } break; case EXT_TIMEZONE: /* Not supported */ - case EXT_UTF16_FILENAME: /* Not supported */ - case EXT_UTF16_DIRECTORY: /* Not supported */ + break; default: break; } @@ -1600,19 +1677,19 @@ archive_read_format_lha_cleanup(struct archive_read *a * then a archived pathname is 'xxx/bbb|aaa/bb/cc' */ static int -lha_parse_linkname(struct archive_string *linkname, - struct archive_string *pathname) +lha_parse_linkname(struct archive_wstring *linkname, + struct archive_wstring *pathname) { - char * linkptr; + wchar_t * linkptr; size_t symlen; - linkptr = strchr(pathname->s, '|'); + linkptr = wcschr(pathname->s, L'|'); if (linkptr != NULL) { - symlen = strlen(linkptr + 1); - archive_strncpy(linkname, linkptr+1, symlen); + symlen = wcslen(linkptr + 1); + archive_wstrncpy(linkname, linkptr+1, symlen); *linkptr = 0; - pathname->length = strlen(pathname->s); + pathname->length = wcslen(pathname->s); return (1); } Modified: head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Tue Dec 31 00:05:06 2019 (r356212) @@ -63,6 +63,7 @@ #if defined DEBUG #define DEBUG_CODE if(1) +#define LOG(...) do { printf("rar5: " __VA_ARGS__); puts(""); } while(0) #else #define DEBUG_CODE if(0) #endif @@ -115,6 +116,8 @@ struct file_header { /* Optional redir fields */ uint64_t redir_type; uint64_t redir_flags; + + ssize_t solid_window_size; /* Used in file format check. */ }; enum EXTRA { @@ -1177,7 +1180,7 @@ static int process_main_locator_extra_block(struct arc static int parse_file_extra_hash(struct archive_read* a, struct rar5* rar, ssize_t* extra_data_size) { - size_t hash_type; + size_t hash_type = 0; size_t value_len; if(!read_var_sized(a, &hash_type, &value_len)) @@ -1303,7 +1306,7 @@ static int parse_file_extra_htime(struct archive_read* struct archive_entry* e, struct rar5* rar, ssize_t* extra_data_size) { char unix_time = 0; - size_t flags; + size_t flags = 0; size_t value_len; enum HTIME_FLAGS { @@ -1665,7 +1668,18 @@ static int process_head_file(struct archive_read* a, s g_unpack_window_size << ((compression_info >> 10) & 15); rar->cstate.method = c_method; rar->cstate.version = c_version + 50; + rar->file.solid = (compression_info & SOLID) > 0; + /* Archives which declare solid files without initializing the window + * buffer first are invalid. */ + + if(rar->file.solid > 0 && rar->cstate.window_buf == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Declared solid file, but no window buffer " + "initialized yet."); + return ARCHIVE_FATAL; + } + /* Check if window_size is a sane value. Also, if the file is not * declared as a directory, disallow window_size == 0. */ if(window_size > (64 * 1024 * 1024) || @@ -1676,12 +1690,36 @@ static int process_head_file(struct archive_read* a, s return ARCHIVE_FATAL; } - /* Values up to 64M should fit into ssize_t on every - * architecture. */ - rar->cstate.window_size = (ssize_t) window_size; + if(rar->file.solid > 0) { + /* Re-check if current window size is the same as previous + * window size (for solid files only). */ + if(rar->file.solid_window_size > 0 && + rar->file.solid_window_size != (ssize_t) window_size) + { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Window size for this solid file doesn't match " + "the window size used in previous solid file. "); + return ARCHIVE_FATAL; + } + } + + /* If we're currently switching volumes, ignore the new definition of + * window_size. */ + if(rar->cstate.switch_multivolume == 0) { + /* Values up to 64M should fit into ssize_t on every + * architecture. */ + rar->cstate.window_size = (ssize_t) window_size; + } + + if(rar->file.solid > 0 && rar->file.solid_window_size == 0) { + /* Solid files have to have the same window_size across + whole archive. Remember the window_size parameter + for first solid file found. */ + rar->file.solid_window_size = rar->cstate.window_size; + } + init_window_mask(rar); - rar->file.solid = (compression_info & SOLID) > 0; rar->file.service = 0; if(!read_var_sized(a, &host_os, NULL)) Modified: head/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Tue Dec 31 00:05:06 2019 (r356212) @@ -1797,6 +1797,23 @@ zip_read_data_zipx_lzma_alone(struct archive_read *a, "lzma data error (error %d)", (int) lz_ret); return (ARCHIVE_FATAL); + /* This case is optional in lzma alone format. It can happen, + * but most of the files don't have it. (GitHub #1257) */ + case LZMA_STREAM_END: + lzma_end(&zip->zipx_lzma_stream); + zip->zipx_lzma_valid = 0; + if((int64_t) zip->zipx_lzma_stream.total_in != + zip->entry_bytes_remaining) + { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "lzma alone premature end of stream"); + return (ARCHIVE_FATAL); + } + + zip->end_of_entry = 1; + break; + case LZMA_OK: break; Modified: head/contrib/libarchive/libarchive/archive_string.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_string.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_string.c Tue Dec 31 00:05:06 2019 (r356212) @@ -75,6 +75,9 @@ __FBSDID("$FreeBSD$"); #define wmemmove(a,b,i) (wchar_t *)memmove((a), (b), (i) * sizeof(wchar_t)) #endif +#undef max +#define max(a, b) ((a)>(b)?(a):(b)) + struct archive_string_conv { struct archive_string_conv *next; char *from_charset; @@ -591,7 +594,7 @@ archive_wstring_append_from_mbs(struct archive_wstring * No single byte will be more than one wide character, * so this length estimate will always be big enough. */ - size_t wcs_length = len; + // size_t wcs_length = len; size_t mbs_length = len; const char *mbs = p; wchar_t *wcs; @@ -600,7 +603,11 @@ archive_wstring_append_from_mbs(struct archive_wstring memset(&shift_state, 0, sizeof(shift_state)); #endif - if (NULL == archive_wstring_ensure(dest, dest->length + wcs_length + 1)) + /* + * As we decided to have wcs_length == mbs_length == len + * we can use len here instead of wcs_length + */ + if (NULL == archive_wstring_ensure(dest, dest->length + len + 1)) return (-1); wcs = dest->s + dest->length; /* @@ -609,6 +616,12 @@ archive_wstring_append_from_mbs(struct archive_wstring * multi bytes. */ while (*mbs && mbs_length > 0) { + /* + * The buffer we allocated is always big enough. + * Keep this code path in a comment if we decide to choose + * smaller wcs_length in the future + */ +/* if (wcs_length == 0) { dest->length = wcs - dest->s; dest->s[dest->length] = L'\0'; @@ -618,24 +631,20 @@ archive_wstring_append_from_mbs(struct archive_wstring return (-1); wcs = dest->s + dest->length; } +*/ #if HAVE_MBRTOWC - r = mbrtowc(wcs, mbs, wcs_length, &shift_state); + r = mbrtowc(wcs, mbs, mbs_length, &shift_state); #else - r = mbtowc(wcs, mbs, wcs_length); + r = mbtowc(wcs, mbs, mbs_length); #endif if (r == (size_t)-1 || r == (size_t)-2) { ret_val = -1; - if (errno == EILSEQ) { - ++mbs; - --mbs_length; - continue; - } else - break; + break; } if (r == 0 || r > mbs_length) break; wcs++; - wcs_length--; + // wcs_length--; mbs += r; mbs_length -= r; } @@ -798,7 +807,8 @@ archive_string_append_from_wcs(struct archive_string * as->s[as->length] = '\0'; /* Re-allocate buffer for MBS. */ if (archive_string_ensure(as, - as->length + len * 2 + 1) == NULL) + as->length + max(len * 2, + (size_t)MB_CUR_MAX) + 1) == NULL) return (-1); p = as->s + as->length; end = as->s + as->buffer_length - MB_CUR_MAX -1; @@ -3440,7 +3450,8 @@ strncat_from_utf8_libarchive2(struct archive_string *a as->length = p - as->s; /* Re-allocate buffer for MBS. */ if (archive_string_ensure(as, - as->length + len * 2 + 1) == NULL) + as->length + max(len * 2, + (size_t)MB_CUR_MAX) + 1) == NULL) return (-1); p = as->s + as->length; end = as->s + as->buffer_length - MB_CUR_MAX -1; Modified: head/contrib/libarchive/libarchive/archive_write.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_write.c Tue Dec 31 00:05:06 2019 (r356212) @@ -212,6 +212,7 @@ __archive_write_allocate_filter(struct archive *_a) f = calloc(1, sizeof(*f)); f->archive = _a; + f->state = ARCHIVE_WRITE_FILTER_STATE_NEW; if (a->filter_first == NULL) a->filter_first = f; else @@ -228,6 +229,9 @@ __archive_write_filter(struct archive_write_filter *f, const void *buff, size_t length) { int r; + /* Never write to non-open filters */ + if (f->state != ARCHIVE_WRITE_FILTER_STATE_OPEN) + return(ARCHIVE_FATAL); if (length == 0) return(ARCHIVE_OK); if (f->write == NULL) @@ -240,29 +244,72 @@ __archive_write_filter(struct archive_write_filter *f, } /* - * Open a filter. + * Recursive function for opening the filter chain + * Last filter is opened first */ -int +static int __archive_write_open_filter(struct archive_write_filter *f) { - if (f->open == NULL) + int ret; + + ret = ARCHIVE_OK; + if (f->next_filter != NULL) + ret = __archive_write_open_filter(f->next_filter); + if (ret != ARCHIVE_OK) + return (ret); + if (f->state != ARCHIVE_WRITE_FILTER_STATE_NEW) + return (ARCHIVE_FATAL); + if (f->open == NULL) { + f->state = ARCHIVE_WRITE_FILTER_STATE_OPEN; return (ARCHIVE_OK); - return (f->open)(f); + } + ret = (f->open)(f); + if (ret == ARCHIVE_OK) + f->state = ARCHIVE_WRITE_FILTER_STATE_OPEN; + else + f->state = ARCHIVE_WRITE_FILTER_STATE_FATAL; + return (ret); } /* - * Close a filter. + * Open all filters */ -int -__archive_write_close_filter(struct archive_write_filter *f) +static int +__archive_write_filters_open(struct archive_write *a) { - if (f->close != NULL) - return (f->close)(f); - if (f->next_filter != NULL) - return (__archive_write_close_filter(f->next_filter)); - return (ARCHIVE_OK); + return (__archive_write_open_filter(a->filter_first)); } +/* + * Close all filtes + */ +static int +__archive_write_filters_close(struct archive_write *a) +{ + struct archive_write_filter *f; + int ret, ret1; + ret = ARCHIVE_OK; + for (f = a->filter_first; f != NULL; f = f->next_filter) { + /* Do not close filters that are not open */ + if (f->state == ARCHIVE_WRITE_FILTER_STATE_OPEN) { + if (f->close != NULL) { + ret1 = (f->close)(f); + if (ret1 < ret) + ret = ret1; + if (ret1 == ARCHIVE_OK) { + f->state = + ARCHIVE_WRITE_FILTER_STATE_CLOSED; + } else { + f->state = + ARCHIVE_WRITE_FILTER_STATE_FATAL; + } + } else + f->state = ARCHIVE_WRITE_FILTER_STATE_CLOSED; + } + } + return (ret); +} + int __archive_write_output(struct archive_write *a, const void *buff, size_t length) { @@ -440,7 +487,7 @@ archive_write_client_close(struct archive_write_filter free(state->buffer); free(state); /* Clear the close handler myself not to be called again. */ - f->close = NULL; + f->state = ARCHIVE_WRITE_FILTER_STATE_CLOSED; a->client_data = NULL; /* Clear passphrase. */ if (a->passphrase != NULL) { @@ -477,9 +524,10 @@ archive_write_open(struct archive *_a, void *client_da client_filter->write = archive_write_client_write; client_filter->close = archive_write_client_close; - ret = __archive_write_open_filter(a->filter_first); + ret = __archive_write_filters_open(a); if (ret < ARCHIVE_WARN) { - r1 = __archive_write_close_filter(a->filter_first); + r1 = __archive_write_filters_close(a); + __archive_write_filters_free(_a); return (r1 < ret ? r1 : ret); } @@ -521,7 +569,7 @@ _archive_write_close(struct archive *_a) } /* Finish the compression and close the stream. */ - r1 = __archive_write_close_filter(a->filter_first); + r1 = __archive_write_filters_close(a); if (r1 < r) r = r1; Modified: head/contrib/libarchive/libarchive/archive_write_add_filter_b64encode.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_add_filter_b64encode.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_write_add_filter_b64encode.c Tue Dec 31 00:05:06 2019 (r356212) @@ -149,12 +149,7 @@ archive_filter_b64encode_open(struct archive_write_fil { struct private_b64encode *state = (struct private_b64encode *)f->data; size_t bs = 65536, bpb; - int ret; - ret = __archive_write_open_filter(f->next_filter); - if (ret != ARCHIVE_OK) - return (ret); - if (f->archive->magic == ARCHIVE_WRITE_MAGIC) { /* Buffer size should be a multiple number of the of bytes * per block for performance. */ @@ -266,7 +261,6 @@ static int archive_filter_b64encode_close(struct archive_write_filter *f) { struct private_b64encode *state = (struct private_b64encode *)f->data; - int ret, ret2; /* Flush remaining bytes. */ if (state->hold_len != 0) @@ -274,12 +268,8 @@ archive_filter_b64encode_close(struct archive_write_fi archive_string_sprintf(&state->encoded_buff, "====\n"); /* Write the last block */ archive_write_set_bytes_in_last_block(f->archive, 1); - ret = __archive_write_filter(f->next_filter, + return __archive_write_filter(f->next_filter, state->encoded_buff.s, archive_strlen(&state->encoded_buff)); - ret2 = __archive_write_close_filter(f->next_filter); - if (ret > ret2) - ret = ret2; - return (ret); } static int Modified: head/contrib/libarchive/libarchive/archive_write_add_filter_bzip2.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_add_filter_bzip2.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_write_add_filter_bzip2.c Tue Dec 31 00:05:06 2019 (r356212) @@ -167,10 +167,6 @@ archive_compressor_bzip2_open(struct archive_write_fil struct private_data *data = (struct private_data *)f->data; int ret; - ret = __archive_write_open_filter(f->next_filter); - if (ret != 0) - return (ret); - if (data->compressed == NULL) { size_t bs = 65536, bpb; if (f->archive->magic == ARCHIVE_WRITE_MAGIC) { @@ -262,7 +258,7 @@ static int archive_compressor_bzip2_close(struct archive_write_filter *f) { struct private_data *data = (struct private_data *)f->data; - int ret, r1; + int ret; /* Finish compression cycle. */ ret = drive_compressor(f, data, 1); @@ -281,9 +277,7 @@ archive_compressor_bzip2_close(struct archive_write_fi "Failed to clean up compressor"); ret = ARCHIVE_FATAL; } - - r1 = __archive_write_close_filter(f->next_filter); - return (r1 < ret ? r1 : ret); + return ret; } static int Modified: head/contrib/libarchive/libarchive/archive_write_add_filter_compress.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_add_filter_compress.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_write_add_filter_compress.c Tue Dec 31 00:05:06 2019 (r356212) @@ -146,17 +146,12 @@ archive_write_add_filter_compress(struct archive *_a) static int archive_compressor_compress_open(struct archive_write_filter *f) { - int ret; struct private_data *state; size_t bs = 65536, bpb; f->code = ARCHIVE_FILTER_COMPRESS; f->name = "compress"; - ret = __archive_write_open_filter(f->next_filter); - if (ret != ARCHIVE_OK) - return (ret); - state = (struct private_data *)calloc(1, sizeof(*state)); if (state == NULL) { archive_set_error(f->archive, ENOMEM, @@ -426,30 +421,27 @@ static int archive_compressor_compress_close(struct archive_write_filter *f) { struct private_data *state = (struct private_data *)f->data; - int ret, ret2; + int ret; ret = output_code(f, state->cur_code); if (ret != ARCHIVE_OK) - goto cleanup; + return ret; ret = output_flush(f); if (ret != ARCHIVE_OK) - goto cleanup; + return ret; /* Write the last block */ ret = __archive_write_filter(f->next_filter, state->compressed, state->compressed_offset); -cleanup: - ret2 = __archive_write_close_filter(f->next_filter); - if (ret > ret2) - ret = ret2; - free(state->compressed); - free(state); return (ret); } static int archive_compressor_compress_free(struct archive_write_filter *f) { - (void)f; /* UNUSED */ + struct private_data *state = (struct private_data *)f->data; + + free(state->compressed); + free(state); return (ARCHIVE_OK); } Modified: head/contrib/libarchive/libarchive/archive_write_add_filter_gzip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_add_filter_gzip.c Mon Dec 30 23:20:46 2019 (r356211) +++ head/contrib/libarchive/libarchive/archive_write_add_filter_gzip.c Tue Dec 31 00:05:06 2019 (r356212) @@ -184,10 +184,6 @@ archive_compressor_gzip_open(struct archive_write_filt struct private_data *data = (struct private_data *)f->data; int ret; - ret = __archive_write_open_filter(f->next_filter); - if (ret != ARCHIVE_OK) - return (ret); - if (data->compressed == NULL) { size_t bs = 65536, bpb; if (f->archive->magic == ARCHIVE_WRITE_MAGIC) { @@ -307,7 +303,7 @@ archive_compressor_gzip_close(struct archive_write_fil { unsigned char trailer[8]; struct private_data *data = (struct private_data *)f->data; - int ret, r1; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Dec 31 00:07:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A823C1EDA04; Tue, 31 Dec 2019 00:07:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mvk6415Nz4dXX; Tue, 31 Dec 2019 00:07:10 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 823F99C2A; Tue, 31 Dec 2019 00:07:10 +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 xBV07ASc074218; Tue, 31 Dec 2019 00:07:10 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBV07ASR074217; Tue, 31 Dec 2019 00:07:10 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912310007.xBV07ASR074217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 31 Dec 2019 00:07:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356213 - head/usr.bin/nfsstat X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/usr.bin/nfsstat X-SVN-Commit-Revision: 356213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 00:07:10 -0000 Author: rmacklem Date: Tue Dec 31 00:07:10 2019 New Revision: 356213 URL: https://svnweb.freebsd.org/changeset/base/356213 Log: Replace .h files included from old NFS directories with the new NFS ones. Prior to this patch, nfsstat.c includes files from sys/nfs, sys/nfsclient and sys/nfsserver. These .h files (particularily the ones in sys/nfsclient and sys/nfsserver) are from the old NFS code and should eventually be deprecated/removed. This patch changes nfsstat.c to include files from the new/current NFS code instead of the old ones in preparation for eventual removal. Modified: head/usr.bin/nfsstat/nfsstat.c Modified: head/usr.bin/nfsstat/nfsstat.c ============================================================================== --- head/usr.bin/nfsstat/nfsstat.c Tue Dec 31 00:05:06 2019 (r356212) +++ head/usr.bin/nfsstat/nfsstat.c Tue Dec 31 00:07:10 2019 (r356213) @@ -79,11 +79,9 @@ static const char rcsid[] = #include #include #include -#include -#include -#include #include +#include #include #include From owner-svn-src-head@freebsd.org Tue Dec 31 02:38:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 152521F1153; Tue, 31 Dec 2019 02:38:00 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mz476ngXz3HPJ; Tue, 31 Dec 2019 02:37:59 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f65.google.com with SMTP id b18so26811064otp.0; Mon, 30 Dec 2019 18:37:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=MRCCLJFzavbHp7S9J8bIJAs9cBXeaBPTzteJKalLUpg=; b=uocS4KilCupfcviYnh0MRVMGlg+Cu8R76NE4U0dou2yajfM/pKf3jWphelEolWdgd1 bCggm8t1djTzewbvMGo15k6kCBMO4PzXqzEfjoGMEyvUDAXTkrHk1GDQDCigC5uM/yEL XlTusq6Dft4tBRsO+LSOpsNh8++ddAHdm/Rtzi7kBOzxi7IRsVSPEi6MPU+cpf68bBoY g4OWkJlM8a2ERtZnI9RArW6Uqj0QZtpML1d6ARBo3r9r2wu0oyOuaxRH3JlIzu2VD9q5 OGtfB7EOiGjwswf7HbdbLnbVPPFcU7hodVomKWXVEEUlQB1Asn1m8HdjnCRQo78Byb4k c7YQ== X-Gm-Message-State: APjAAAUwhpaH1O60N1tozCi7A2FA5oPsENqrnZREVrsB/YRNdIXtOJzy +07W93VJ2cjWzIhNGhcTfXu2uGoP X-Google-Smtp-Source: APXvYqy8SgDt3elLjKHHKNemlUaLKFnQxN/0M9xNCZb3OHcTQABdboE6bONAzp+FCvgyhOklROM5zQ== X-Received: by 2002:a9d:10d:: with SMTP id 13mr73952108otu.149.1577759878321; Mon, 30 Dec 2019 18:37:58 -0800 (PST) Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com. [209.85.210.47]) by smtp.gmail.com with ESMTPSA id m19sm16454910otn.47.2019.12.30.18.37.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Dec 2019 18:37:57 -0800 (PST) Received: by mail-ot1-f47.google.com with SMTP id p8so12192745oth.10; Mon, 30 Dec 2019 18:37:57 -0800 (PST) X-Received: by 2002:a9d:6c92:: with SMTP id c18mr62339496otr.157.1577759877831; Mon, 30 Dec 2019 18:37:57 -0800 (PST) MIME-Version: 1.0 References: <201912302239.xBUMdTli021436@repo.freebsd.org> In-Reply-To: <201912302239.xBUMdTli021436@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Mon, 30 Dec 2019 18:37:47 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r356210 - head/sys/nfs To: Rick Macklem Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47mz476ngXz3HPJ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 02:38:00 -0000 Hi Rick, One suggestion: On Mon, Dec 30, 2019 at 2:39 PM Rick Macklem wrote: > > Author: rmacklem > Date: Mon Dec 30 22:39:29 2019 > New Revision: 356210 > ... > --- head/sys/nfs/nfs_lock.c Mon Dec 30 22:05:57 2019 (r356209) > +++ head/sys/nfs/nfs_lock.c Mon Dec 30 22:39:29 2019 (r356210) > @@ -89,6 +89,8 @@ nfslock_open(struct cdev *dev, int oflags, int devtype > { > int error; > > + printf("WARNING: uses Giant and will be removed before FreeBSD 13\n" > + "\tuse the kernel NFSLOCKD/nfslockd.ko\n"); This could be 'gone_in(13, "uses Giant; replace with NFSLOCKD/nfslockd.ko");' Best, Conrad From owner-svn-src-head@freebsd.org Tue Dec 31 03:43:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45FF31F29B7; Tue, 31 Dec 2019 03:43:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47n0WQ12rpz3LgC; Tue, 31 Dec 2019 03:43:14 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F1FBC65E; Tue, 31 Dec 2019 03:43:14 +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 xBV3hDjt005333; Tue, 31 Dec 2019 03:43:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBV3hDpI005332; Tue, 31 Dec 2019 03:43:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912310343.xBV3hDpI005332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 31 Dec 2019 03:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356214 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 356214 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 03:43:14 -0000 Author: mav Date: Tue Dec 31 03:43:13 2019 New Revision: 356214 URL: https://svnweb.freebsd.org/changeset/base/356214 Log: Avoid few memory accesses in g_disk_done(). Modified: head/sys/geom/geom_disk.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Tue Dec 31 00:07:10 2019 (r356213) +++ head/sys/geom/geom_disk.c Tue Dec 31 03:43:13 2019 (r356214) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); struct g_disk_softc { struct disk *dp; + struct devstat *d_devstat; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; char led[64]; @@ -231,15 +232,13 @@ g_disk_done(struct bio *bp) struct g_disk_softc *sc; /* See "notes" for why we need a mutex here */ - /* XXX: will witness accept a mix of Giant/unGiant drivers here ? */ + sc = bp->bio_caller1; bp2 = bp->bio_parent; - sc = bp2->bio_to->private; - bp->bio_completed = bp->bio_length - bp->bio_resid; binuptime(&now); mtx_lock(&sc->done_mtx); if (bp2->bio_error == 0) bp2->bio_error = bp->bio_error; - bp2->bio_completed += bp->bio_completed; + bp2->bio_completed += bp->bio_length - bp->bio_resid; switch (bp->bio_cmd) { case BIO_ZONE: @@ -249,7 +248,7 @@ g_disk_done(struct bio *bp) case BIO_WRITE: case BIO_DELETE: case BIO_FLUSH: - devstat_end_transaction_bio_bt(sc->dp->d_devstat, bp, &now); + devstat_end_transaction_bio_bt(sc->d_devstat, bp, &now); break; default: break; @@ -469,6 +468,7 @@ g_disk_start(struct bio *bp) bp->bio_error = ENOMEM; } bp2->bio_done = g_disk_done; + bp2->bio_caller1 = sc; bp2->bio_pblkno = bp2->bio_offset / dp->d_sectorsize; bp2->bio_bcount = bp2->bio_length; bp2->bio_disk = dp; @@ -555,6 +555,7 @@ g_disk_start(struct bio *bp) return; } bp2->bio_done = g_disk_done; + bp2->bio_caller1 = sc; bp2->bio_disk = dp; devstat_start_transaction_bio(dp->d_devstat, bp2); dp->d_strategy(bp2); @@ -706,6 +707,7 @@ g_disk_create(void *arg, int flag) sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); mtx_init(&sc->done_mtx, "g_disk_done", NULL, MTX_DEF); sc->dp = dp; + sc->d_devstat = dp->d_devstat; gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit); gp->softc = sc; LIST_FOREACH(dap, &dp->d_aliases, da_next) { From owner-svn-src-head@freebsd.org Tue Dec 31 04:00:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FD0B1F2C72; Tue, 31 Dec 2019 04:00:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47n0vD6kLRz3M5m; Tue, 31 Dec 2019 04:00:24 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2232C82B; Tue, 31 Dec 2019 04:00:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBV40Onn011342; Tue, 31 Dec 2019 04:00:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBV40Oes011340; Tue, 31 Dec 2019 04:00:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912310400.xBV40Oes011340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 31 Dec 2019 04:00:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356215 - head/usr.sbin/inetd X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/inetd X-SVN-Commit-Revision: 356215 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 04:00:25 -0000 Author: kevans Date: Tue Dec 31 04:00:24 2019 New Revision: 356215 URL: https://svnweb.freebsd.org/changeset/base/356215 Log: inetd: knock out some clang analyze warnings chargen_dg: clang-analyze is convinced that endring could be non-NULL at entry, and thus wants to assume that rs == NULL. Just independently initialize rs if it's NULL to appease the analyzer. getconfigent: policy leaks on return free_connlist: reorganize the loop to make it clear that we're not going to access `conn` after it's been freed. cpmip/hashval: left-shifts performed will result in UB as we take signed 0xABC3D20F and left shift it by 5. Modified: head/usr.sbin/inetd/builtins.c head/usr.sbin/inetd/inetd.c Modified: head/usr.sbin/inetd/builtins.c ============================================================================== --- head/usr.sbin/inetd/builtins.c Tue Dec 31 03:43:13 2019 (r356214) +++ head/usr.sbin/inetd/builtins.c Tue Dec 31 04:00:24 2019 (r356215) @@ -132,10 +132,10 @@ chargen_dg(int s, struct servtab *sep) socklen_t size; char text[LINESIZ+2]; - if (endring == 0) { + if (endring == NULL) initring(); + if (rs == NULL) rs = ring; - } size = sizeof(ss); if (recvfrom(s, text, sizeof(text), 0, Modified: head/usr.sbin/inetd/inetd.c ============================================================================== --- head/usr.sbin/inetd/inetd.c Tue Dec 31 03:43:13 2019 (r356214) +++ head/usr.sbin/inetd/inetd.c Tue Dec 31 04:00:24 2019 (r356215) @@ -1646,8 +1646,11 @@ more: continue; break; } - if (cp == NULL) - return ((struct servtab *)0); + if (cp == NULL) { + free(policy); + return (NULL); + } + /* * clear the static buffer, since some fields (se_ctrladdr, * for example) don't get initialized here. @@ -2206,7 +2209,7 @@ cpmip(const struct servtab *sep, int ctrl) (sep->se_family == AF_INET || sep->se_family == AF_INET6) && getpeername(ctrl, (struct sockaddr *)&rss, &rssLen) == 0 ) { time_t t = time(NULL); - int hv = 0xABC3D20F; + unsigned int hv = 0xABC3D20F; int i; int cnt = 0; CHash *chBest = NULL; @@ -2493,11 +2496,15 @@ resize_conn(struct servtab *sep, int maxpip) static void free_connlist(struct servtab *sep) { - struct conninfo *conn; + struct conninfo *conn, *conn_temp; int i, j; for (i = 0; i < PERIPSIZE; ++i) { - while ((conn = LIST_FIRST(&sep->se_conn[i])) != NULL) { + LIST_FOREACH_SAFE(conn, &sep->se_conn[i], co_link, conn_temp) { + if (conn == NULL) { + LIST_REMOVE(conn, co_link); + continue; + } for (j = 0; j < conn->co_numchild; ++j) free_proc(conn->co_proc[j]); conn->co_numchild = 0; @@ -2553,7 +2560,8 @@ free_proc(struct procinfo *proc) static int hashval(char *p, int len) { - int i, hv = 0xABC3D20F; + unsigned int hv = 0xABC3D20F; + int i; for (i = 0; i < len; ++i, ++p) hv = (hv << 5) ^ (hv >> 23) ^ *p; From owner-svn-src-head@freebsd.org Tue Dec 31 04:16:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5A0D1F3047; Tue, 31 Dec 2019 04:16:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47n1GF4JtKz3Mls; Tue, 31 Dec 2019 04:16:53 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7690CCBB4; Tue, 31 Dec 2019 04:16:53 +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 xBV4GreY022904; Tue, 31 Dec 2019 04:16:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBV4Grai022903; Tue, 31 Dec 2019 04:16:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912310416.xBV4Grai022903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 31 Dec 2019 04:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356216 - head/sys/dev/ioat X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ioat X-SVN-Commit-Revision: 356216 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 04:16:53 -0000 Author: mav Date: Tue Dec 31 04:16:52 2019 New Revision: 356216 URL: https://svnweb.freebsd.org/changeset/base/356216 Log: Don't spin on cleanup_lock if we are not interrupt. If somebody else holds that lock, it will likely do the work for us. If it won't, then we return here later and retry. Under heavy load it allows to avoid lock congestion between interrupt and polling threads. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Dec 31 04:00:24 2019 (r356215) +++ head/sys/dev/ioat/ioat.c Tue Dec 31 04:16:52 2019 (r356216) @@ -789,7 +789,12 @@ ioat_process_events(struct ioat_softc *ioat, boolean_t uint32_t completed, chanerr; int error; - mtx_lock(&ioat->cleanup_lock); + if (intr) { + mtx_lock(&ioat->cleanup_lock); + } else { + if (!mtx_trylock(&ioat->cleanup_lock)) + return; + } /* * Don't run while the hardware is being reset. Reset is responsible From owner-svn-src-head@freebsd.org Tue Dec 31 04:36:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B3A41F3508; Tue, 31 Dec 2019 04:36:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47n1hb17GCz3NQy; Tue, 31 Dec 2019 04:36:15 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21C82CF29; Tue, 31 Dec 2019 04:36:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBV4aFfu034617; Tue, 31 Dec 2019 04:36:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBV4aFSH034616; Tue, 31 Dec 2019 04:36:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912310436.xBV4aFSH034616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 31 Dec 2019 04:36:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356217 - head/usr.sbin/inetd X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/inetd X-SVN-Commit-Revision: 356217 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 04:36:15 -0000 Author: kevans Date: Tue Dec 31 04:36:14 2019 New Revision: 356217 URL: https://svnweb.freebsd.org/changeset/base/356217 Log: inetd: prefer strtonum(3) to strspn(3)+atoi(3), NFC strtonum(3) does effectively the same validation as we had, but it's more concise. Modified: head/usr.sbin/inetd/builtins.c Modified: head/usr.sbin/inetd/builtins.c ============================================================================== --- head/usr.sbin/inetd/builtins.c Tue Dec 31 04:16:52 2019 (r356216) +++ head/usr.sbin/inetd/builtins.c Tue Dec 31 04:36:14 2019 (r356217) @@ -649,8 +649,14 @@ ident_stream(int s, struct servtab *sep) goto fakeid_fail; if (!Fflag) { if (iflag) { - if (p[strspn(p, "0123456789")] == '\0' && - getpwuid(atoi(p)) != NULL) + const char *errstr; + uid_t uid; + + uid = strtonum(p, 0, UID_MAX, &errstr); + if (errstr != NULL) + goto fakeid_fail; + + if (getpwuid(uid) != NULL) goto fakeid_fail; } else { if (getpwnam(p) != NULL) From owner-svn-src-head@freebsd.org Tue Dec 31 04:53:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E93DC1F395B; Tue, 31 Dec 2019 04:53:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47n24t5sMGz3PND; Tue, 31 Dec 2019 04:53:50 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C45E3D2B8; Tue, 31 Dec 2019 04:53:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBV4ro1e046965; Tue, 31 Dec 2019 04:53:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBV4roH6046964; Tue, 31 Dec 2019 04:53:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912310453.xBV4roH6046964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 31 Dec 2019 04:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356218 - head/usr.sbin/inetd X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/inetd X-SVN-Commit-Revision: 356218 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 04:53:51 -0000 Author: kevans Date: Tue Dec 31 04:53:50 2019 New Revision: 356218 URL: https://svnweb.freebsd.org/changeset/base/356218 Log: inetd: prefer strlcpy to strlen(3) check + strcpy(3), NFC This is again functionally equivalent but more concise. Modified: head/usr.sbin/inetd/inetd.c Modified: head/usr.sbin/inetd/inetd.c ============================================================================== --- head/usr.sbin/inetd/inetd.c Tue Dec 31 04:36:14 2019 (r356217) +++ head/usr.sbin/inetd/inetd.c Tue Dec 31 04:53:50 2019 (r356218) @@ -1612,6 +1612,7 @@ getconfigent(void) int v6bind; #endif int i; + size_t unsz; #ifdef IPSEC policy = NULL; @@ -1832,16 +1833,18 @@ more: break; #endif case AF_UNIX: - if (strlen(sep->se_service) >= sizeof(sep->se_ctrladdr_un.sun_path)) { - syslog(LOG_ERR, +#define SUN_PATH_MAXSIZE sizeof(sep->se_ctrladdr_un.sun_path) + memset(&sep->se_ctrladdr, 0, sizeof(sep->se_ctrladdr)); + sep->se_ctrladdr_un.sun_family = sep->se_family; + if ((unsz = strlcpy(sep->se_ctrladdr_un.sun_path, + sep->se_service, SUN_PATH_MAXSIZE) >= SUN_PATH_MAXSIZE)) { + syslog(LOG_ERR, "domain socket pathname too long for service %s", sep->se_service); goto more; } - memset(&sep->se_ctrladdr, 0, sizeof(sep->se_ctrladdr)); - sep->se_ctrladdr_un.sun_family = sep->se_family; - sep->se_ctrladdr_un.sun_len = strlen(sep->se_service); - strcpy(sep->se_ctrladdr_un.sun_path, sep->se_service); + sep->se_ctrladdr_un.sun_len = unsz; +#undef SUN_PATH_MAXSIZE sep->se_ctrladdr_size = SUN_LEN(&sep->se_ctrladdr_un); } arg = sskip(&cp); From owner-svn-src-head@freebsd.org Tue Dec 31 05:39:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C9061F42C2; Tue, 31 Dec 2019 05:39:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47n35X0wlFz3R8v; Tue, 31 Dec 2019 05:39:28 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AF53D9D4; Tue, 31 Dec 2019 05:39:28 +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 xBV5dRgD071226; Tue, 31 Dec 2019 05:39:27 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBV5dR2l071225; Tue, 31 Dec 2019 05:39:27 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912310539.xBV5dR2l071225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 31 Dec 2019 05:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356219 - head/sys/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/nfs X-SVN-Commit-Revision: 356219 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 05:39:28 -0000 Author: rmacklem Date: Tue Dec 31 05:39:27 2019 New Revision: 356219 URL: https://svnweb.freebsd.org/changeset/base/356219 Log: Switch r356210 to use gone_in() instead of printf(). Suggested by: cem Modified: head/sys/nfs/nfs_lock.c Modified: head/sys/nfs/nfs_lock.c ============================================================================== --- head/sys/nfs/nfs_lock.c Tue Dec 31 04:53:50 2019 (r356218) +++ head/sys/nfs/nfs_lock.c Tue Dec 31 05:39:27 2019 (r356219) @@ -89,8 +89,7 @@ nfslock_open(struct cdev *dev, int oflags, int devtype { int error; - printf("WARNING: uses Giant and will be removed before FreeBSD 13\n" - "\tuse the kernel NFSLOCKD/nfslockd.ko\n"); + gone_in(13, "uses Giant; replace with NFSLOCKD/nfslockd.ko"); error = priv_check(td, PRIV_NFS_LOCKD); if (error) return (error); From owner-svn-src-head@freebsd.org Tue Dec 31 05:41:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F9B01F4479; Tue, 31 Dec 2019 05:41:48 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47n38D10nMz3wff; Tue, 31 Dec 2019 05:41:48 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DB01DA53; Tue, 31 Dec 2019 05:41:48 +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 xBV5fmJA075685; Tue, 31 Dec 2019 05:41:48 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBV5flfe075684; Tue, 31 Dec 2019 05:41:47 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912310541.xBV5flfe075684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 31 Dec 2019 05:41:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356220 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 356220 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 05:41:48 -0000 Author: cem Date: Tue Dec 31 05:41:47 2019 New Revision: 356220 URL: https://svnweb.freebsd.org/changeset/base/356220 Log: rtld(1): Do booleans like C99 Reviewed by: kib, rlibby Differential Revision: https://reviews.freebsd.org/D22964 Modified: head/libexec/rtld-elf/rtld.h Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Tue Dec 31 05:39:27 2019 (r356219) +++ head/libexec/rtld-elf/rtld.h Tue Dec 31 05:41:47 2019 (r356220) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -45,11 +46,6 @@ #define NEW(type) ((type *) xmalloc(sizeof(type))) #define CNEW(type) ((type *) xcalloc(1, sizeof(type))) - -/* We might as well do booleans like C++. */ -typedef unsigned char bool; -#define false 0 -#define true 1 extern size_t tls_last_offset; extern size_t tls_last_size; From owner-svn-src-head@freebsd.org Tue Dec 31 10:53:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5E991D146C; Tue, 31 Dec 2019 10:53:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nB3M4tnHz48ht; Tue, 31 Dec 2019 10:53:03 +0000 (UTC) (envelope-from kp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2FFB19280; Tue, 31 Dec 2019 10:53:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVAr3xa059022; Tue, 31 Dec 2019 10:53:03 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVAr3Yh059021; Tue, 31 Dec 2019 10:53:03 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201912311053.xBVAr3Yh059021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 31 Dec 2019 10:53:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356221 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 356221 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 10:53:03 -0000 Author: kp Date: Tue Dec 31 10:53:03 2019 New Revision: 356221 URL: https://svnweb.freebsd.org/changeset/base/356221 Log: riscv: Remove pointless loop There's no point in checking for absent CPUs if we're not going to do anything about either the present or absent case. This loop can just be removed. Reviewed by: philip Sponsored by: Axiado Modified: head/sys/riscv/riscv/mp_machdep.c Modified: head/sys/riscv/riscv/mp_machdep.c ============================================================================== --- head/sys/riscv/riscv/mp_machdep.c Tue Dec 31 05:41:47 2019 (r356220) +++ head/sys/riscv/riscv/mp_machdep.c Tue Dec 31 10:53:03 2019 (r356221) @@ -204,13 +204,8 @@ release_aps(void *dummy __unused) sbi_send_ipi(mask.__bits); for (i = 0; i < 2000; i++) { - if (smp_started) { - for (cpu = 0; cpu <= mp_maxid; cpu++) { - if (CPU_ABSENT(cpu)) - continue; - } + if (smp_started) return; - } DELAY(1000); } From owner-svn-src-head@freebsd.org Tue Dec 31 10:54:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5F5B1D1504; Tue, 31 Dec 2019 10:54:13 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nB4j5K2Nz48qR; Tue, 31 Dec 2019 10:54:13 +0000 (UTC) (envelope-from kp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1A0519281; Tue, 31 Dec 2019 10:54:13 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVAsDVa059116; Tue, 31 Dec 2019 10:54:13 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVAsDQs059114; Tue, 31 Dec 2019 10:54:13 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201912311054.xBVAsDQs059114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 31 Dec 2019 10:54:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356222 - head/sys/riscv/sifive X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/riscv/sifive X-SVN-Commit-Revision: 356222 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 10:54:13 -0000 Author: kp Date: Tue Dec 31 10:54:13 2019 New Revision: 356222 URL: https://svnweb.freebsd.org/changeset/base/356222 Log: sifive: uart driver Implement support for the UART as found on the SiFive FU540. It should also work on, but has not been tested with, the FU310. Reviewed by: philip Sponsored by: Axiado Added: head/sys/riscv/sifive/sifive_uart.c (contents, props changed) Modified: head/sys/riscv/sifive/files.sifive Modified: head/sys/riscv/sifive/files.sifive ============================================================================== --- head/sys/riscv/sifive/files.sifive Tue Dec 31 10:53:03 2019 (r356221) +++ head/sys/riscv/sifive/files.sifive Tue Dec 31 10:54:13 2019 (r356222) @@ -2,3 +2,4 @@ riscv/sifive/fu540_prci.c standard riscv/sifive/fu540_spi.c optional fu540spi spibus +riscv/sifive/sifive_uart.c standard Added: head/sys/riscv/sifive/sifive_uart.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/riscv/sifive/sifive_uart.c Tue Dec 31 10:54:13 2019 (r356222) @@ -0,0 +1,543 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Axiado Corporation + * All rights reserved. + * + * This software was developed in part by Kristof Provost under contract for + * Axiado Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include "uart_if.h" + +#define SFUART_TXDATA 0x00 +#define SFUART_TXDATA_FULL (1 << 31) +#define SFUART_RXDATA 0x04 +#define SFUART_RXDATA_EMPTY (1 << 31) +#define SFUART_TXCTRL 0x08 +#define SFUART_TXCTRL_ENABLE 0x01 +#define SFUART_TXCTRL_NSTOP 0x02 +#define SFUART_TXCTRL_TXCNT 0xb0000 +#define SFUART_TXCTRL_TXCNT_SHIFT 16 +#define SFUART_RXCTRL 0x0c +#define SFUART_RXCTRL_ENABLE 0x01 +#define SFUART_RXCTRL_RXCNT 0xb0000 +#define SFUART_RXCTRL_RXCNT_SHIFT 16 +#define SFUART_IRQ_ENABLE 0x10 +#define SFUART_IRQ_ENABLE_TXWM 0x01 +#define SFUART_IRQ_ENABLE_RXWM 0x02 +#define SFUART_IRQ_PENDING 0x14 +#define SFUART_IRQ_PENDING_TXWM 0x01 +#define SFUART_IRQ_PENDING_RXQM 0x02 +#define SFUART_DIV 0x18 +#define SFUART_REGS_SIZE 0x1c + +#define SFUART_RX_FIFO_DEPTH 8 +#define SFUART_TX_FIFO_DEPTH 8 + +struct sfuart_softc { + struct uart_softc uart_softc; + clk_t clk; +}; + +static int +sfuart_probe(struct uart_bas *bas) +{ + + bas->regiowidth = 4; + + return (0); +} + +static void +sfuart_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, + int parity) +{ + uint32_t reg; + + uart_setreg(bas, SFUART_IRQ_ENABLE, 0); + + /* Enable RX and configure the watermark so that we get an interrupt + * when a single character arrives (if interrupts are enabled). */ + reg = SFUART_RXCTRL_ENABLE; + reg |= (0 << SFUART_RXCTRL_RXCNT_SHIFT); + uart_setreg(bas, SFUART_RXCTRL, reg); + + /* Enable TX and configure the watermark so that we get an interrupt + * when there's room for one more character in the TX fifo (if + * interrupts are enabled). */ + reg = SFUART_TXCTRL_ENABLE; + reg |= (1 << SFUART_TXCTRL_TXCNT_SHIFT); + if (stopbits == 2) + reg |= SFUART_TXCTRL_NSTOP; + uart_setreg(bas, SFUART_TXCTRL, reg); + + /* Don't touch DIV. Assume that's set correctly until we can + * reconfigure. */ +} + +static void +sfuart_putc(struct uart_bas *bas, int c) +{ + + while ((uart_getreg(bas, SFUART_TXDATA) & SFUART_TXDATA_FULL) + != 0) + cpu_spinwait(); + + uart_setreg(bas, SFUART_TXDATA, c); +} + +static int +sfuart_rxready(struct uart_bas *bas) +{ + + return ((uart_getreg(bas, SFUART_RXDATA) & + SFUART_RXDATA_EMPTY) == 0); +} + +static int +sfuart_getc(struct uart_bas *bas, struct mtx *hwmtx) +{ + int c; + + uart_lock(hwmtx); + + while (((c = uart_getreg(bas, SFUART_RXDATA)) & + SFUART_RXDATA_EMPTY) != 0) { + uart_unlock(hwmtx); + DELAY(4); + uart_lock(hwmtx); + } + + uart_unlock(hwmtx); + + return (c & 0xff); +} + +static int +sfuart_bus_probe(struct uart_softc *sc) +{ + int error; + + error = sfuart_probe(&sc->sc_bas); + if (error) + return (error); + + sc->sc_rxfifosz = SFUART_RX_FIFO_DEPTH; + sc->sc_txfifosz = SFUART_TX_FIFO_DEPTH; + sc->sc_hwiflow = 0; + sc->sc_hwoflow = 0; + + device_set_desc(sc->sc_dev, "SiFive UART"); + + return (0); +} + +static int +sfuart_bus_attach(struct uart_softc *sc) +{ + struct uart_bas *bas; + struct sfuart_softc *sfsc; + uint64_t freq; + uint32_t reg; + int error; + + sfsc = (struct sfuart_softc *)sc; + bas = &sc->sc_bas; + + error = clk_get_by_ofw_index(sc->sc_dev, 0, 0, &sfsc->clk); + if (error) { + device_printf(sc->sc_dev, "couldn't allocate clock\n"); + return (ENXIO); + } + + error = clk_enable(sfsc->clk); + if (error) { + device_printf(sc->sc_dev, "couldn't enable clock\n"); + return (ENXIO); + } + + error = clk_get_freq(sfsc->clk, &freq); + if (error || freq == 0) { + clk_disable(sfsc->clk); + device_printf(sc->sc_dev, "couldn't get clock frequency\n"); + return (ENXIO); + } + + bas->rclk = freq; + + /* Enable RX/RX */ + reg = SFUART_RXCTRL_ENABLE; + reg |= (0 << SFUART_RXCTRL_RXCNT_SHIFT); + uart_setreg(bas, SFUART_RXCTRL, reg); + + reg = SFUART_TXCTRL_ENABLE; + reg |= (1 << SFUART_TXCTRL_TXCNT_SHIFT); + uart_setreg(bas, SFUART_TXCTRL, reg); + + /* Enable RX interrupt */ + uart_setreg(bas, SFUART_IRQ_ENABLE, SFUART_IRQ_ENABLE_RXWM); + + return (0); +} + +static int +sfuart_bus_detach(struct uart_softc *sc) +{ + struct sfuart_softc *sfsc; + struct uart_bas *bas; + + sfsc = (struct sfuart_softc *)sc; + bas = &sc->sc_bas; + + /* Disable RX/TX */ + uart_setreg(bas, SFUART_RXCTRL, 0); + uart_setreg(bas, SFUART_TXCTRL, 0); + + /* Disable interrupts */ + uart_setreg(bas, SFUART_IRQ_ENABLE, 0); + + clk_disable(sfsc->clk); + + return (0); +} + +static int +sfuart_bus_flush(struct uart_softc *sc, int what) +{ + struct uart_bas *bas; + uint32_t reg; + + bas = &sc->sc_bas; + uart_lock(sc->sc_hwmtx); + + if (what & UART_FLUSH_TRANSMITTER) { + do { + reg = uart_getreg(bas, SFUART_TXDATA); + } while ((reg & SFUART_TXDATA_FULL) != 0); + } + + if (what & UART_FLUSH_RECEIVER) { + do { + reg = uart_getreg(bas, SFUART_RXDATA); + } while ((reg & SFUART_RXDATA_EMPTY) == 0); + } + uart_unlock(sc->sc_hwmtx); + + return (0); +} + +#define SIGCHG(c, i, s, d) \ + do { \ + if (c) \ + i |= ((i) & (s)) ? (s) : (s) | (d); \ + else \ + i = ((i) & (s)) ? (i) & ~(s) | (d) : (i); \ + } while (0) + +static int +sfuart_bus_getsig(struct uart_softc *sc) +{ + uint32_t new, old, sig; + + do { + old = sc->sc_hwsig; + sig = old; + SIGCHG(1, sig, SER_DSR, SER_DDSR); + SIGCHG(1, sig, SER_DCD, SER_DDCD); + SIGCHG(1, sig, SER_CTS, SER_DCTS); + new = sig & ~SER_MASK_DELTA; + } while (!atomic_cmpset_32(&sc->sc_hwsig, old, new)); + + return (sig); +} + +static int +sfuart_bus_setsig(struct uart_softc *sc, int sig) +{ + uint32_t new, old; + + do { + old = sc->sc_hwsig; + new = old; + if (sig & SER_DDTR) { + SIGCHG(sig & SER_DTR, new, SER_DTR, SER_DDTR); + } + if (sig & SER_DRTS) { + SIGCHG(sig & SER_RTS, new, SER_RTS, SER_DRTS); + } + } while (!atomic_cmpset_32(&sc->sc_hwsig, old, new)); + + return (0); +} + +static int +sfuart_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) +{ + struct uart_bas *bas; + uint32_t reg; + int error; + + bas = &sc->sc_bas; + + uart_lock(sc->sc_hwmtx); + + switch (request) { + case UART_IOCTL_BAUD: + reg = uart_getreg(bas, SFUART_DIV); + if (reg == 0) { + /* Possible if the divisor hasn't been set up yet. */ + error = ENXIO; + break; + } + *(int*)data = bas->rclk / (reg + 1); + error = 0; + break; + default: + error = EINVAL; + break; + } + + uart_unlock(sc->sc_hwmtx); + + return (error); +} + +static int +sfuart_bus_ipend(struct uart_softc *sc) +{ + struct uart_bas *bas; + int ipend; + uint32_t reg, ie; + + bas = &sc->sc_bas; + uart_lock(sc->sc_hwmtx); + + ipend = 0; + reg = uart_getreg(bas, SFUART_IRQ_PENDING); + ie = uart_getreg(bas, SFUART_IRQ_ENABLE); + + if ((reg & SFUART_IRQ_PENDING_TXWM) != 0 && + (ie & SFUART_IRQ_ENABLE_TXWM) != 0) { + ipend |= SER_INT_TXIDLE; + + /* Disable TX interrupt */ + ie &= ~(SFUART_IRQ_ENABLE_TXWM); + uart_setreg(bas, SFUART_IRQ_ENABLE, ie); + } + + if ((reg & SFUART_IRQ_PENDING_RXQM) != 0) + ipend |= SER_INT_RXREADY; + + uart_unlock(sc->sc_hwmtx); + + return (ipend); +} + +static int +sfuart_bus_param(struct uart_softc *sc, int baudrate, int databits, + int stopbits, int parity) +{ + struct uart_bas *bas; + uint32_t reg; + + bas = &sc->sc_bas; + + if (databits != 8) + return (EINVAL); + + if (parity != UART_PARITY_NONE) + return (EINVAL); + + uart_lock(sc->sc_hwmtx); + + reg = uart_getreg(bas, SFUART_TXCTRL); + if (stopbits == 2) { + reg |= SFUART_TXCTRL_NSTOP; + } else if (stopbits == 1) { + reg &= ~SFUART_TXCTRL_NSTOP; + } else { + uart_unlock(sc->sc_hwmtx); + return (EINVAL); + } + + if (baudrate > 0 && bas->rclk != 0) { + reg = (bas->rclk / baudrate) - 1; + uart_setreg(bas, SFUART_DIV, reg); + } + + uart_unlock(sc->sc_hwmtx); + return (0); +} + +static int +sfuart_bus_receive(struct uart_softc *sc) +{ + struct uart_bas *bas; + uint32_t reg; + + bas = &sc->sc_bas; + uart_lock(sc->sc_hwmtx); + + reg = uart_getreg(bas, SFUART_RXDATA); + while ((reg & SFUART_RXDATA_EMPTY) == 0) { + if (uart_rx_full(sc)) { + sc->sc_rxbuf[sc->sc_rxput] = UART_STAT_OVERRUN; + break; + } + + uart_rx_put(sc, reg & 0xff); + + reg = uart_getreg(bas, SFUART_RXDATA); + } + + uart_unlock(sc->sc_hwmtx); + + return (0); +} + +static int +sfuart_bus_transmit(struct uart_softc *sc) +{ + struct uart_bas *bas; + int i; + uint32_t reg; + + bas = &sc->sc_bas; + uart_lock(sc->sc_hwmtx); + + reg = uart_getreg(bas, SFUART_IRQ_ENABLE); + reg |= SFUART_IRQ_ENABLE_TXWM; + uart_setreg(bas, SFUART_IRQ_ENABLE, reg); + + for (i = 0; i < sc->sc_txdatasz; i++) + sfuart_putc(bas, sc->sc_txbuf[i]); + + sc->sc_txbusy = 1; + + uart_unlock(sc->sc_hwmtx); + + return (0); +} + +static void +sfuart_bus_grab(struct uart_softc *sc) +{ + struct uart_bas *bas; + uint32_t reg; + + bas = &sc->sc_bas; + uart_lock(sc->sc_hwmtx); + + reg = uart_getreg(bas, SFUART_IRQ_ENABLE); + reg &= ~(SFUART_IRQ_ENABLE_TXWM | SFUART_IRQ_PENDING_RXQM); + uart_setreg(bas, SFUART_IRQ_ENABLE, reg); + + uart_unlock(sc->sc_hwmtx); +} + +static void +sfuart_bus_ungrab(struct uart_softc *sc) +{ + struct uart_bas *bas; + uint32_t reg; + + bas = &sc->sc_bas; + uart_lock(sc->sc_hwmtx); + + reg = uart_getreg(bas, SFUART_IRQ_ENABLE); + reg |= SFUART_IRQ_ENABLE_TXWM | SFUART_IRQ_PENDING_RXQM; + uart_setreg(bas, SFUART_IRQ_ENABLE, reg); + + uart_unlock(sc->sc_hwmtx); +} + +static kobj_method_t sfuart_methods[] = { + KOBJMETHOD(uart_probe, sfuart_bus_probe), + KOBJMETHOD(uart_attach, sfuart_bus_attach), + KOBJMETHOD(uart_detach, sfuart_bus_detach), + KOBJMETHOD(uart_flush, sfuart_bus_flush), + KOBJMETHOD(uart_getsig, sfuart_bus_getsig), + KOBJMETHOD(uart_setsig, sfuart_bus_setsig), + KOBJMETHOD(uart_ioctl, sfuart_bus_ioctl), + KOBJMETHOD(uart_ipend, sfuart_bus_ipend), + KOBJMETHOD(uart_param, sfuart_bus_param), + KOBJMETHOD(uart_receive, sfuart_bus_receive), + KOBJMETHOD(uart_transmit, sfuart_bus_transmit), + KOBJMETHOD(uart_grab, sfuart_bus_grab), + KOBJMETHOD(uart_ungrab, sfuart_bus_ungrab), + KOBJMETHOD_END +}; + +static struct uart_ops sfuart_ops = { + .probe = sfuart_probe, + .init = sfuart_init, + .term = NULL, + .putc = sfuart_putc, + .rxready = sfuart_rxready, + .getc = sfuart_getc, +}; + +struct uart_class sfuart_class = { + "sifiveuart", + sfuart_methods, + sizeof(struct sfuart_softc), + .uc_ops = &sfuart_ops, + .uc_range = SFUART_REGS_SIZE, + .uc_rclk = 0, + .uc_rshift = 0 +}; + +static struct ofw_compat_data compat_data[] = { + { "sifive,uart0", (uintptr_t)&sfuart_class }, + { NULL, (uintptr_t)NULL } +}; + +UART_FDT_CLASS_AND_DEVICE(compat_data); From owner-svn-src-head@freebsd.org Tue Dec 31 11:45:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CA751D22F4; Tue, 31 Dec 2019 11:45:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nCCh0BBWz4Bm4; Tue, 31 Dec 2019 11:45:20 +0000 (UTC) (envelope-from kp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0189A19B96; Tue, 31 Dec 2019 11:45:20 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVBjJnw088518; Tue, 31 Dec 2019 11:45:19 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVBjJrp088517; Tue, 31 Dec 2019 11:45:19 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201912311145.xBVBjJrp088517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 31 Dec 2019 11:45:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356223 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 356223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 11:45:20 -0000 Author: kp Date: Tue Dec 31 11:45:19 2019 New Revision: 356223 URL: https://svnweb.freebsd.org/changeset/base/356223 Log: riscv: Remove unused variable Fix the build that was broken by r356221. Pointy hat to myself. Modified: head/sys/riscv/riscv/mp_machdep.c Modified: head/sys/riscv/riscv/mp_machdep.c ============================================================================== --- head/sys/riscv/riscv/mp_machdep.c Tue Dec 31 10:54:13 2019 (r356222) +++ head/sys/riscv/riscv/mp_machdep.c Tue Dec 31 11:45:19 2019 (r356223) @@ -185,7 +185,7 @@ static void release_aps(void *dummy __unused) { cpuset_t mask; - int cpu, i; + int i; if (mp_ncpus == 1) return; From owner-svn-src-head@freebsd.org Tue Dec 31 11:54:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E85E1D2566; Tue, 31 Dec 2019 11:54:21 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nCQ51CZDz4C9n; Tue, 31 Dec 2019 11:54:21 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 22C568E38; Tue, 31 Dec 2019 11:54:21 +0000 (UTC) Date: Tue, 31 Dec 2019 11:54:21 +0000 From: Alexey Dokuchaev To: Alexander Motin Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r356185 - in head: lib/geom lib/geom/sched sys/geom sys/geom/sched sys/modules/geom sys/modules/geom/geom_sched sys/sys Message-ID: <20191231115421.GA41351@FreeBSD.org> References: <201912292116.xBTLG4kV012809@repo.freebsd.org> <20191230113243.GA58338@FreeBSD.org> <20191230170208.GA20424@FreeBSD.org> <5a97d344-8741-3b8e-b6dd-b8e4cfa05aeb@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5a97d344-8741-3b8e-b6dd-b8e4cfa05aeb@FreeBSD.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 11:54:21 -0000 On Mon, Dec 30, 2019 at 02:55:16PM -0500, Alexander Motin wrote: > On 30.12.2019 12:02, Alexey Dokuchaev wrote: > > ... > > Well, hard drives essentially didn't change since then, still being > > the same rotation media. :) > > At least some papers about gsched I read mention adX devices, which > means old ATA stack and no NCQ. It can be quite a significant change to > let HDD to do its own scheduling. Also about a year ago in r335066 > Warner added sysctl debug.bioq_batchsize, which if set to non-zero value > may, I think, improve fairness between several processes, just not sure > why it was never enabled. Thanks for the pointer, I'll remember to play with it. > > Admittedly, I've only did some tests no later than in 8.4 times when I > > first started using it. Fair point, though, I should redo them again. > > I'm sorry to create a regression for you, if there is really one. As I > have written I don't have so much against the scheduler part itself, as > against the accumulated technical debt and the way integration is done, > such as mechanism of live insertion, etc. Without unmapped I/O and > direct dispatch I bet it must be quite slow on bigger systems, that is > why I doubted anybody really use it. It's OK, no need to be sorry, I understand the reasons behind the move and it certainly looks justified enough. > > Is there a planned replacement, or I'd better create a port for the > > GEOM_SCHED class and gsched(8) tool? > > I wasn't planning replacement. And moving it to ports would be a > problem, since in process I removed few capabilities critical for it: > nstart/nend for live insertion and BIO classification for scheduling. > But the last I don't mind to return if there appear to be a need. It > is only the first I am strongly against. But if somebody would like to > reimplement it, may be it would be better to consider merging it with > CAM I/O scheduler by Warner? The one at least knows about device queue > depth, etc. We could return the BIO classification to be used by CAM > scheduler instead, if needed. Make sense; thanks everyone who replied in the thread, it was quite fruitful. ./danfe From owner-svn-src-head@freebsd.org Tue Dec 31 12:29:02 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C57F1D3A7C; Tue, 31 Dec 2019 12:29:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nDB62hJYz4DlC; Tue, 31 Dec 2019 12:29:02 +0000 (UTC) (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5780B1A2F7; Tue, 31 Dec 2019 12:29:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVCT2LW012605; Tue, 31 Dec 2019 12:29:02 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVCT2ID012604; Tue, 31 Dec 2019 12:29:02 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912311229.xBVCT2ID012604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 31 Dec 2019 12:29:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356224 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 356224 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 12:29:02 -0000 Author: tuexen Date: Tue Dec 31 12:29:01 2019 New Revision: 356224 URL: https://svnweb.freebsd.org/changeset/base/356224 Log: Add curly braces missed in https://svnweb.freebsd.org/changeset/base/354773 Sponsored by: Netflix, Inc. CID: 1407649 Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Tue Dec 31 11:45:19 2019 (r356223) +++ head/sys/netinet/cc/cc_cubic.c Tue Dec 31 12:29:01 2019 (r356224) @@ -200,10 +200,11 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) * max_cwnd. */ if (cubic_data->num_cong_events == 0 && - cubic_data->max_cwnd < CCV(ccv, snd_cwnd)) + cubic_data->max_cwnd < CCV(ccv, snd_cwnd)) { cubic_data->max_cwnd = CCV(ccv, snd_cwnd); cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg)); + } } } } From owner-svn-src-head@freebsd.org Tue Dec 31 13:56:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F8371D5B46; Tue, 31 Dec 2019 13:56:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nG7P3pSKz4Jx1; Tue, 31 Dec 2019 13:56:49 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DE4C1B31C; Tue, 31 Dec 2019 13:56:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVDunOF066280; Tue, 31 Dec 2019 13:56:49 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVDun45066279; Tue, 31 Dec 2019 13:56:49 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912311356.xBVDun45066279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 31 Dec 2019 13:56:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356225 - head/sys/dev/atkbdc X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/atkbdc X-SVN-Commit-Revision: 356225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 13:56:49 -0000 Author: kevans Date: Tue Dec 31 13:56:48 2019 New Revision: 356225 URL: https://svnweb.freebsd.org/changeset/base/356225 Log: psm: properly check for atkbdc_open failure atkbdc_open can return NULL if the unit's out of bounds or the softc isn't setup. Check it to be safe. Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Tue Dec 31 12:29:01 2019 (r356224) +++ head/sys/dev/atkbdc/psm.c Tue Dec 31 13:56:48 2019 (r356225) @@ -1390,6 +1390,8 @@ psmprobe(device_t dev) sc->unit = unit; sc->kbdc = atkbdc_open(device_get_unit(device_get_parent(dev))); + if (sc->kbdc == NULL) + return (ENXIO); sc->config = device_get_flags(dev) & PSM_CONFIG_FLAGS; /* XXX: for backward compatibility */ #if defined(PSM_HOOKRESUME) || defined(PSM_HOOKAPM) From owner-svn-src-head@freebsd.org Tue Dec 31 14:23:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F207E1D633D; Tue, 31 Dec 2019 14:23:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nGkc5wBDz4L9r; Tue, 31 Dec 2019 14:23:52 +0000 (UTC) (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C66D91B86C; Tue, 31 Dec 2019 14:23:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVENqpQ084041; Tue, 31 Dec 2019 14:23:52 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVENq1V084040; Tue, 31 Dec 2019 14:23:52 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912311423.xBVENq1V084040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 31 Dec 2019 14:23:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356226 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 356226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 14:23:53 -0000 Author: tuexen Date: Tue Dec 31 14:23:52 2019 New Revision: 356226 URL: https://svnweb.freebsd.org/changeset/base/356226 Log: Clear the flag indicating that the last received packet was marked CE also in the case where a packet not marked was received. Submitted by: Richard Scheffenegger Reviewed by: rgrimes@, tuexen@ MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D19143 Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Dec 31 13:56:48 2019 (r356225) +++ head/sys/netinet/tcp_input.c Tue Dec 31 14:23:52 2019 (r356226) @@ -522,14 +522,15 @@ cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, if (CC_ALGO(tp)->ecnpkt_handler != NULL) { switch (iptos & IPTOS_ECN_MASK) { case IPTOS_ECN_CE: - tp->ccv->flags |= CCF_IPHDR_CE; - break; + tp->ccv->flags |= CCF_IPHDR_CE; + break; case IPTOS_ECN_ECT0: - tp->ccv->flags &= ~CCF_IPHDR_CE; - break; + /* FALLTHROUGH */ case IPTOS_ECN_ECT1: - tp->ccv->flags &= ~CCF_IPHDR_CE; - break; + /* FALLTHROUGH */ + case IPTOS_ECN_NOTECT: + tp->ccv->flags &= ~CCF_IPHDR_CE; + break; } if (th->th_flags & TH_CWR) From owner-svn-src-head@freebsd.org Tue Dec 31 14:32:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE5011D6571; Tue, 31 Dec 2019 14:32:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nGww53fzz4LZ0; Tue, 31 Dec 2019 14:32:48 +0000 (UTC) (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8DE31BA58; Tue, 31 Dec 2019 14:32:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVEWm9g089603; Tue, 31 Dec 2019 14:32:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVEWmEa089602; Tue, 31 Dec 2019 14:32:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912311432.xBVEWmEa089602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 31 Dec 2019 14:32:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356227 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 356227 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 14:32:48 -0000 Author: tuexen Date: Tue Dec 31 14:32:48 2019 New Revision: 356227 URL: https://svnweb.freebsd.org/changeset/base/356227 Log: Add flags for upcoming patches related to improved ECN handling. No functional change. Submitted by: Richard Scheffenegger Reviewed by: rgrimes@, tuexen@ Differential Revision: https://reviews.freebsd.org/D22429 Modified: head/sys/netinet/tcp.h head/sys/netinet/tcp_syncache.h Modified: head/sys/netinet/tcp.h ============================================================================== --- head/sys/netinet/tcp.h Tue Dec 31 14:23:52 2019 (r356226) +++ head/sys/netinet/tcp.h Tue Dec 31 14:32:48 2019 (r356227) @@ -71,8 +71,9 @@ struct tcphdr { #define TH_URG 0x20 #define TH_ECE 0x40 #define TH_CWR 0x80 +#define TH_AE 0x100 /* maps into th_x2 */ #define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG|TH_ECE|TH_CWR) -#define PRINT_TH_FLAGS "\20\1FIN\2SYN\3RST\4PUSH\5ACK\6URG\7ECE\10CWR" +#define PRINT_TH_FLAGS "\20\1FIN\2SYN\3RST\4PUSH\5ACK\6URG\7ECE\10CWR\11AE" u_short th_win; /* window */ u_short th_sum; /* checksum */ Modified: head/sys/netinet/tcp_syncache.h ============================================================================== --- head/sys/netinet/tcp_syncache.h Tue Dec 31 14:23:52 2019 (r356226) +++ head/sys/netinet/tcp_syncache.h Tue Dec 31 14:32:48 2019 (r356227) @@ -90,6 +90,10 @@ struct syncache { #define SCF_SIGNATURE 0x20 /* send MD5 digests */ #define SCF_SACK 0x80 /* send SACK option */ #define SCF_ECN 0x100 /* send ECN setup packet */ +#define SCF_ACE_N 0x200 /* send ACE non-ECT setup */ +#define SCF_ACE_0 0x400 /* send ACE ECT0 setup */ +#define SCF_ACE_1 0x800 /* send ACE ECT1 setup */ +#define SCF_ACE_CE 0x1000 /* send ACE CE setup */ struct syncache_head { struct mtx sch_mtx; From owner-svn-src-head@freebsd.org Tue Dec 31 15:50:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 970CC1D7E27; Tue, 31 Dec 2019 15:50:42 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nJfp3sJRz4QF6; Tue, 31 Dec 2019 15:50:42 +0000 (UTC) (envelope-from cy@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6622D1C6E5; Tue, 31 Dec 2019 15:50:42 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVFogbc036427; Tue, 31 Dec 2019 15:50:42 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVFofO6036423; Tue, 31 Dec 2019 15:50:41 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912311550.xBVFofO6036423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 31 Dec 2019 15:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356228 - in head/contrib/unbound: . cachedb compat contrib daemon dns64 dnscrypt doc ipsecmod ipset iterator libunbound respip services sldns smallapp util util/data util/shm_side vali... X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in head/contrib/unbound: . cachedb compat contrib daemon dns64 dnscrypt doc ipsecmod ipset iterator libunbound respip services sldns smallapp util util/data util/shm_side validator X-SVN-Commit-Revision: 356228 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 15:50:42 -0000 Author: cy Date: Tue Dec 31 15:50:41 2019 New Revision: 356228 URL: https://svnweb.freebsd.org/changeset/base/356228 Log: MFV r356143: Update unbound 1.9.2 --> 1.9.6. MFC after: 3 days Security: CVE-2019-18934 (fixed by 1.9.5) Added: head/contrib/unbound/compat/getentropy_freebsd.c - copied unchanged from r356143, vendor/unbound/dist/compat/getentropy_freebsd.c head/contrib/unbound/contrib/drop-tld.diff - copied unchanged from r356143, vendor/unbound/dist/contrib/drop-tld.diff head/contrib/unbound/contrib/unbound-fuzzers.tar.bz2 - copied unchanged from r356143, vendor/unbound/dist/contrib/unbound-fuzzers.tar.bz2 head/contrib/unbound/doc/README.ipset.md - copied unchanged from r356143, vendor/unbound/dist/doc/README.ipset.md head/contrib/unbound/ipset/ - copied from r356143, vendor/unbound/dist/ipset/ Modified: head/contrib/unbound/Makefile.in head/contrib/unbound/README.md head/contrib/unbound/aclocal.m4 head/contrib/unbound/cachedb/cachedb.c head/contrib/unbound/compat/getentropy_linux.c head/contrib/unbound/compat/getentropy_osx.c head/contrib/unbound/compat/getentropy_solaris.c head/contrib/unbound/compat/getentropy_win.c head/contrib/unbound/compat/malloc.c head/contrib/unbound/compat/snprintf.c head/contrib/unbound/config.guess head/contrib/unbound/config.h head/contrib/unbound/config.h.in head/contrib/unbound/config.sub head/contrib/unbound/configure head/contrib/unbound/configure.ac head/contrib/unbound/contrib/README head/contrib/unbound/contrib/create_unbound_ad_servers.sh head/contrib/unbound/contrib/fastrpz.patch head/contrib/unbound/contrib/unbound.init head/contrib/unbound/contrib/unbound.init_fedora head/contrib/unbound/contrib/unbound.service.in head/contrib/unbound/daemon/daemon.c head/contrib/unbound/daemon/remote.c head/contrib/unbound/daemon/stats.c head/contrib/unbound/daemon/unbound.c head/contrib/unbound/daemon/worker.c head/contrib/unbound/dns64/dns64.c head/contrib/unbound/dnscrypt/dnscrypt.c head/contrib/unbound/doc/Changelog head/contrib/unbound/doc/README head/contrib/unbound/doc/TODO head/contrib/unbound/doc/example.conf.in head/contrib/unbound/doc/libunbound.3.in head/contrib/unbound/doc/unbound-anchor.8.in head/contrib/unbound/doc/unbound-checkconf.8.in head/contrib/unbound/doc/unbound-control.8.in head/contrib/unbound/doc/unbound-host.1.in head/contrib/unbound/doc/unbound.8.in head/contrib/unbound/doc/unbound.conf.5.in head/contrib/unbound/install-sh head/contrib/unbound/ipsecmod/ipsecmod.c head/contrib/unbound/iterator/iter_scrub.c head/contrib/unbound/iterator/iterator.c head/contrib/unbound/libunbound/context.c head/contrib/unbound/libunbound/context.h head/contrib/unbound/libunbound/libunbound.c head/contrib/unbound/libunbound/libworker.c head/contrib/unbound/respip/respip.c head/contrib/unbound/services/authzone.c head/contrib/unbound/services/localzone.c head/contrib/unbound/services/mesh.c head/contrib/unbound/services/modstack.c head/contrib/unbound/services/outside_network.c head/contrib/unbound/sldns/parse.c head/contrib/unbound/sldns/rrdef.c head/contrib/unbound/sldns/sbuffer.c head/contrib/unbound/sldns/sbuffer.h head/contrib/unbound/sldns/str2wire.c head/contrib/unbound/sldns/wire2str.c head/contrib/unbound/sldns/wire2str.h head/contrib/unbound/smallapp/unbound-anchor.c head/contrib/unbound/smallapp/unbound-checkconf.c head/contrib/unbound/smallapp/unbound-control.c head/contrib/unbound/smallapp/unbound-host.c head/contrib/unbound/util/config_file.c head/contrib/unbound/util/config_file.h head/contrib/unbound/util/configlexer.lex head/contrib/unbound/util/configparser.y head/contrib/unbound/util/data/dname.c head/contrib/unbound/util/data/msgencode.c head/contrib/unbound/util/data/msgencode.h head/contrib/unbound/util/data/msgparse.c head/contrib/unbound/util/data/msgreply.c head/contrib/unbound/util/fptr_wlist.c head/contrib/unbound/util/iana_ports.inc head/contrib/unbound/util/log.c head/contrib/unbound/util/mini_event.c head/contrib/unbound/util/net_help.c head/contrib/unbound/util/net_help.h head/contrib/unbound/util/netevent.c head/contrib/unbound/util/random.c head/contrib/unbound/util/random.h head/contrib/unbound/util/regional.c head/contrib/unbound/util/shm_side/shm_main.c head/contrib/unbound/util/ub_event.c head/contrib/unbound/util/ub_event_pluggable.c head/contrib/unbound/util/winsock_event.c head/contrib/unbound/validator/autotrust.c head/contrib/unbound/validator/val_anchor.c head/contrib/unbound/validator/val_secalgo.c head/contrib/unbound/validator/val_sigcrypt.c head/contrib/unbound/validator/validator.c Directory Properties: head/contrib/unbound/ (props changed) Modified: head/contrib/unbound/Makefile.in ============================================================================== --- head/contrib/unbound/Makefile.in Tue Dec 31 14:32:48 2019 (r356227) +++ head/contrib/unbound/Makefile.in Tue Dec 31 15:50:41 2019 (r356228) @@ -126,7 +126,7 @@ validator/val_sigcrypt.c validator/val_utils.c dns64/d edns-subnet/edns-subnet.c edns-subnet/subnetmod.c \ edns-subnet/addrtree.c edns-subnet/subnet-whitelist.c \ cachedb/cachedb.c cachedb/redis.c respip/respip.c $(CHECKLOCK_SRC) \ -$(DNSTAP_SRC) $(DNSCRYPT_SRC) $(IPSECMOD_SRC) +$(DNSTAP_SRC) $(DNSCRYPT_SRC) $(IPSECMOD_SRC) $(IPSET_SRC) COMMON_OBJ_WITHOUT_NETCALL=dns.lo infra.lo rrset.lo dname.lo msgencode.lo \ as112.lo msgparse.lo msgreply.lo packed_rrset.lo iterator.lo iter_delegpt.lo \ iter_donotq.lo iter_fwd.lo iter_hints.lo iter_priv.lo iter_resptype.lo \ @@ -139,7 +139,7 @@ autotrust.lo val_anchor.lo \ validator.lo val_kcache.lo val_kentry.lo val_neg.lo val_nsec3.lo val_nsec.lo \ val_secalgo.lo val_sigcrypt.lo val_utils.lo dns64.lo cachedb.lo redis.lo authzone.lo \ $(SUBNET_OBJ) $(PYTHONMOD_OBJ) $(CHECKLOCK_OBJ) $(DNSTAP_OBJ) $(DNSCRYPT_OBJ) \ -$(IPSECMOD_OBJ) respip.lo +$(IPSECMOD_OBJ) $(IPSET_OBJ) respip.lo COMMON_OBJ_WITHOUT_UB_EVENT=$(COMMON_OBJ_WITHOUT_NETCALL) netevent.lo listen_dnsport.lo \ outside_network.lo COMMON_OBJ=$(COMMON_OBJ_WITHOUT_UB_EVENT) ub_event.lo @@ -148,7 +148,7 @@ COMMON_OBJ_ALL_SYMBOLS=@COMMON_OBJ_ALL_SYMBOLS@ COMPAT_SRC=compat/ctime_r.c compat/fake-rfc2553.c compat/gmtime_r.c \ compat/inet_aton.c compat/inet_ntop.c compat/inet_pton.c compat/malloc.c \ compat/memcmp.c compat/memmove.c compat/snprintf.c compat/strlcat.c \ -compat/strlcpy.c compat/strptime.c compat/getentropy_linux.c \ +compat/strlcpy.c compat/strptime.c compat/getentropy_freebsd.c compat/getentropy_linux.c \ compat/getentropy_osx.c compat/getentropy_solaris.c compat/getentropy_win.c \ compat/explicit_bzero.c compat/arc4random.c compat/arc4random_uniform.c \ compat/arc4_lock.c compat/sha512.c compat/reallocarray.c compat/isblank.c \ @@ -160,6 +160,7 @@ SLDNS_SRC=sldns/keyraw.c sldns/sbuffer.c sldns/wire2st sldns/parseutil.c sldns/rrdef.c sldns/str2wire.c SLDNS_OBJ=keyraw.lo sbuffer.lo wire2str.lo parse.lo parseutil.lo rrdef.lo \ str2wire.lo +SLDNS_ALLOCCHECK_EXTRA_OBJ=@SLDNS_ALLOCCHECK_EXTRA_OBJ@ UNITTEST_SRC=testcode/unitanchor.c testcode/unitdname.c \ testcode/unitlruhash.c testcode/unitmain.c testcode/unitmsgparse.c \ testcode/unitneg.c testcode/unitregional.c testcode/unitslabhash.c \ @@ -187,11 +188,11 @@ CONTROL_OBJ_LINK=$(CONTROL_OBJ) worker_cb.lo $(COMMON_ $(SLDNS_OBJ) $(COMPAT_OBJ) @WIN_CONTROL_OBJ_LINK@ HOST_SRC=smallapp/unbound-host.c HOST_OBJ=unbound-host.lo -HOST_OBJ_LINK=$(HOST_OBJ) $(SLDNS_OBJ) $(COMPAT_OBJ_WITHOUT_CTIMEARC4) @WIN_HOST_OBJ_LINK@ +HOST_OBJ_LINK=$(HOST_OBJ) $(SLDNS_OBJ) $(COMPAT_OBJ_WITHOUT_CTIMEARC4) $(SLDNS_ALLOCCHECK_EXTRA_OBJ) @WIN_HOST_OBJ_LINK@ UBANCHOR_SRC=smallapp/unbound-anchor.c UBANCHOR_OBJ=unbound-anchor.lo UBANCHOR_OBJ_LINK=$(UBANCHOR_OBJ) parseutil.lo \ -$(COMPAT_OBJ_WITHOUT_CTIME) @WIN_UBANCHOR_OBJ_LINK@ +$(COMPAT_OBJ_WITHOUT_CTIME) $(SLDNS_ALLOCCHECK_EXTRA_OBJ) @WIN_UBANCHOR_OBJ_LINK@ TESTBOUND_SRC=testcode/testbound.c testcode/testpkts.c \ daemon/worker.c daemon/acl_list.c \ daemon/daemon.c daemon/stats.c \ @@ -217,7 +218,7 @@ MEMSTATS_OBJ_LINK=$(MEMSTATS_OBJ) worker_cb.lo $(COMMO $(SLDNS_OBJ) ASYNCLOOK_SRC=testcode/asynclook.c ASYNCLOOK_OBJ=asynclook.lo -ASYNCLOOK_OBJ_LINK=$(ASYNCLOOK_OBJ) log.lo locks.lo $(COMPAT_OBJ) +ASYNCLOOK_OBJ_LINK=$(ASYNCLOOK_OBJ) log.lo locks.lo $(COMPAT_OBJ) @ASYNCLOOK_ALLOCCHECK_EXTRA_OBJ@ STREAMTCP_SRC=testcode/streamtcp.c STREAMTCP_OBJ=streamtcp.lo STREAMTCP_OBJ_LINK=$(STREAMTCP_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \ @@ -229,6 +230,8 @@ DELAYER_SRC=testcode/delayer.c DELAYER_OBJ=delayer.lo DELAYER_OBJ_LINK=$(DELAYER_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \ $(SLDNS_OBJ) +IPSET_SRC=@IPSET_SRC@ +IPSET_OBJ=@IPSET_OBJ@ LIBUNBOUND_SRC=libunbound/context.c libunbound/libunbound.c \ libunbound/libworker.c LIBUNBOUND_OBJ=context.lo libunbound.lo libworker.lo ub_event_pluggable.lo @@ -256,8 +259,9 @@ ALL_SRC=$(COMMON_SRC) $(UNITTEST_SRC) $(DAEMON_SRC) \ $(MEMSTATS_SRC) $(CHECKCONF_SRC) $(LIBUNBOUND_SRC) $(HOST_SRC) \ $(ASYNCLOOK_SRC) $(STREAMTCP_SRC) $(PERF_SRC) $(DELAYER_SRC) \ $(CONTROL_SRC) $(UBANCHOR_SRC) $(PETAL_SRC) \ - $(PYTHONMOD_SRC) $(PYUNBOUND_SRC) $(WIN_DAEMON_THE_SRC)\ + $(PYTHONMOD_SRC) $(PYUNBOUND_SRC) $(WIN_DAEMON_THE_SRC) \ $(SVCINST_SRC) $(SVCUNINST_SRC) $(ANCHORUPD_SRC) $(SLDNS_SRC) + ALL_OBJ=$(COMMON_OBJ) $(UNITTEST_OBJ) $(DAEMON_OBJ) \ $(TESTBOUND_OBJ) $(LOCKVERIFY_OBJ) $(PKTVIEW_OBJ) \ $(MEMSTATS_OBJ) $(CHECKCONF_OBJ) $(LIBUNBOUND_OBJ) $(HOST_OBJ) \ @@ -452,14 +456,19 @@ clean: rm -f _unbound.la libunbound/python/libunbound_wrap.c libunbound/python/unbound.py pythonmod/interface.h pythonmod/unboundmodule.py rm -rf autom4te.cache .libs build doc/html doc/xml -realclean: clean - rm -f config.status config.log config.h.in config.h - rm -f configure config.sub config.guess ltmain.sh aclocal.m4 libtool - rm -f util/configlexer.c util/configparser.c util/configparser.h - rm -f doc/example.conf doc/libunbound.3 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound-control.8 doc/unbound.8 doc/unbound.conf.5 +distclean: clean + rm -f config.status config.log config.h + rm -f doc/example.conf doc/libunbound.3 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound-control.8 doc/unbound.8 doc/unbound.conf.5 doc/unbound-host.1 + rm -f smallapp/unbound-control-setup.sh dnstap/dnstap_config.h dnscrypt/dnscrypt_config.h contrib/libunbound.pc contrib/unbound.socket contrib/unbound.service rm -f $(TEST_BIN) rm -f Makefile +maintainer-clean: distclean + rm -f util/configlexer.c util/configparser.c util/configparser.h + +realclean: maintainer-clean + rm -f configure config.h.in config.sub config.guess ltmain.sh aclocal.m4 libtool + .SUFFIXES: .lint .c.lint: $(LINT) $(LINTFLAGS) -I. -I$(srcdir) $< @@ -635,15 +644,17 @@ depend: # Dependencies dns.lo dns.o: $(srcdir)/services/cache/dns.c config.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h \ - $(srcdir)/validator/val_nsec.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/validator/val_utils.h $(srcdir)/sldns/pkthdr.h $(srcdir)/services/cache/dns.h \ + $(srcdir)/iterator/iter_utils.h $(srcdir)/iterator/iter_resptype.h $(srcdir)/validator/val_nsec.h \ + $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ + $(srcdir)/validator/val_utils.h $(srcdir)/sldns/pkthdr.h $(srcdir)/services/cache/dns.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ $(srcdir)/util/data/dname.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/rrdef.h \ $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/sldns/sbuffer.h infra.lo infra.o: $(srcdir)/services/cache/infra.c config.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h \ - $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/util/netevent.h \ - $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/util/data/msgreply.h \ + $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h $(srcdir)/services/cache/infra.h \ + $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/dnstree.h \ + $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lookup3.h \ $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/iterator/iterator.h \ $(srcdir)/services/outbound_list.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h \ @@ -670,11 +681,11 @@ msgparse.lo msgparse.o: $(srcdir)/util/data/msgparse.c msgreply.lo msgreply.o: $(srcdir)/util/data/msgreply.c config.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/storage/lookup3.h $(srcdir)/util/alloc.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/regional.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ - $(srcdir)/util/data/msgencode.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h $(srcdir)/util/module.h \ - $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/modstack.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/net_help.h \ + $(srcdir)/util/data/dname.h $(srcdir)/util/regional.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgencode.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h \ + $(srcdir)/util/module.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \ + $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h packed_rrset.lo packed_rrset.o: $(srcdir)/util/data/packed_rrset.c config.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/alloc.h $(srcdir)/util/regional.h \ @@ -688,11 +699,11 @@ iterator.lo iterator.o: $(srcdir)/iterator/iterator.c $(srcdir)/iterator/iter_delegpt.h $(srcdir)/iterator/iter_scrub.h $(srcdir)/iterator/iter_priv.h \ $(srcdir)/validator/val_neg.h $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/infra.h \ $(srcdir)/util/rtt.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/services/authzone.h $(srcdir)/services/mesh.h \ - $(srcdir)/services/modstack.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/data/msgencode.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h $(srcdir)/util/config_file.h \ - $(srcdir)/util/random.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/parseutil.h \ - $(srcdir)/sldns/sbuffer.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/services/authzone.h \ + $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h \ + $(srcdir)/util/data/dname.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h \ + $(srcdir)/util/config_file.h $(srcdir)/util/random.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h \ + $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/sbuffer.h iter_delegpt.lo iter_delegpt.o: $(srcdir)/iterator/iter_delegpt.c config.h $(srcdir)/iterator/iter_delegpt.h \ $(srcdir)/util/log.h $(srcdir)/services/cache/dns.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/regional.h \ @@ -734,18 +745,19 @@ iter_utils.lo iter_utils.o: $(srcdir)/iterator/iter_ut $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_fwd.h \ $(srcdir)/iterator/iter_donotq.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/iterator/iter_priv.h \ $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h \ - $(srcdir)/util/regional.h $(srcdir)/util/data/dname.h $(srcdir)/util/random.h $(srcdir)/util/fptr_wlist.h \ - $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/validator/val_anchor.h \ - $(srcdir)/validator/val_kcache.h $(srcdir)/validator/val_kentry.h $(srcdir)/validator/val_utils.h \ - $(srcdir)/validator/val_sigcrypt.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/str2wire.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/services/cache/dns.h \ + $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/net_help.h \ + $(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/data/dname.h $(srcdir)/util/random.h \ + $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h \ + $(srcdir)/validator/val_anchor.h $(srcdir)/validator/val_kcache.h $(srcdir)/validator/val_kentry.h \ + $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_sigcrypt.h $(srcdir)/sldns/sbuffer.h \ + $(srcdir)/sldns/str2wire.h listen_dnsport.lo listen_dnsport.o: $(srcdir)/services/listen_dnsport.c config.h \ $(srcdir)/services/listen_dnsport.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h \ - $(srcdir)/util/log.h $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h \ - $(srcdir)/sldns/sbuffer.h $(srcdir)/services/mesh.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ + $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h \ + $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/sldns/sbuffer.h $(srcdir)/services/mesh.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/services/modstack.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h localzone.lo localzone.o: $(srcdir)/services/localzone.c config.h $(srcdir)/services/localzone.h \ @@ -755,15 +767,16 @@ localzone.lo localzone.o: $(srcdir)/services/localzone $(srcdir)/sldns/rrdef.h $(srcdir)/services/view.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h \ $(srcdir)/util/data/msgencode.h $(srcdir)/util/net_help.h $(srcdir)/util/netevent.h \ - $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/util/as112.h + $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \ + $(srcdir)/util/as112.h mesh.lo mesh.o: $(srcdir)/services/mesh.c config.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/modstack.h $(srcdir)/services/outbound_list.h \ - $(srcdir)/services/cache/dns.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h \ - $(srcdir)/util/data/msgencode.h $(srcdir)/util/timehist.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h \ - $(srcdir)/util/alloc.h $(srcdir)/util/config_file.h $(srcdir)/util/edns.h $(srcdir)/sldns/sbuffer.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgparse.h \ + $(srcdir)/util/storage/lruhash.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h \ + $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/modstack.h \ + $(srcdir)/services/outbound_list.h $(srcdir)/services/cache/dns.h $(srcdir)/util/net_help.h \ + $(srcdir)/util/regional.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/timehist.h $(srcdir)/util/fptr_wlist.h \ + $(srcdir)/util/tube.h $(srcdir)/util/alloc.h $(srcdir)/util/config_file.h $(srcdir)/util/edns.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/sldns/wire2str.h $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h \ $(srcdir)/services/view.h $(srcdir)/util/data/dname.h $(srcdir)/respip/respip.h \ $(srcdir)/services/listen_dnsport.h @@ -771,11 +784,13 @@ modstack.lo modstack.o: $(srcdir)/services/modstack.c $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h \ - $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/dns64/dns64.h $(srcdir)/iterator/iterator.h \ - $(srcdir)/services/outbound_list.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h \ - $(srcdir)/respip/respip.h $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h \ - $(srcdir)/services/view.h $(PYTHONMOD_HEADER) $(srcdir)/ipsecmod/ipsecmod.h + $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \ + $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/dns64/dns64.h \ + $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/validator/validator.h \ + $(srcdir)/validator/val_utils.h $(srcdir)/respip/respip.h $(srcdir)/services/localzone.h \ + $(srcdir)/util/storage/dnstree.h $(srcdir)/services/view.h $(PYTHONMOD_HEADER) $(srcdir)/ipsecmod/ipsecmod.h \ + $(srcdir)/util/storage/slabhash.h $(srcdir)/edns-subnet/addrtree.h $(srcdir)/edns-subnet/edns-subnet.h \ + $(srcdir)/ipset/ipset.h view.lo view.o: $(srcdir)/services/view.c config.h $(srcdir)/services/view.h $(srcdir)/util/rbtree.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h \ $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/msgreply.h \ @@ -784,32 +799,33 @@ view.lo view.o: $(srcdir)/services/view.c config.h $(s outbound_list.lo outbound_list.o: $(srcdir)/services/outbound_list.c config.h \ $(srcdir)/services/outbound_list.h $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h outside_network.lo outside_network.o: $(srcdir)/services/outside_network.c config.h \ $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h $(srcdir)/util/netevent.h \ - $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/iterator/iterator.h \ - $(srcdir)/services/outbound_list.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/random.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/sldns/sbuffer.h $(srcdir)/dnstap/dnstap.h \ + $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \ + $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/services/listen_dnsport.h \ + $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/storage/dnstree.h \ + $(srcdir)/util/rtt.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/util/module.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgencode.h \ + $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/random.h $(srcdir)/util/fptr_wlist.h \ + $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/sldns/sbuffer.h \ + $(srcdir)/dnstap/dnstap.h \ alloc.lo alloc.o: $(srcdir)/util/alloc.c config.h $(srcdir)/util/alloc.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/util/regional.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/module.h \ + $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ + $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h config_file.lo config_file.o: $(srcdir)/util/config_file.c config.h $(srcdir)/util/log.h \ $(srcdir)/util/configyyrename.h $(srcdir)/util/config_file.h util/configparser.h \ $(srcdir)/util/net_help.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/regional.h $(srcdir)/util/fptr_wlist.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/rtt.h $(srcdir)/services/cache/infra.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ + $(srcdir)/services/modstack.h $(srcdir)/util/data/dname.h $(srcdir)/util/rtt.h $(srcdir)/services/cache/infra.h \ $(srcdir)/util/storage/dnstree.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/parseutil.h \ $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/util/iana_ports.inc configlexer.lo configlexer.o: util/configlexer.c config.h $(srcdir)/util/configyyrename.h \ @@ -821,7 +837,7 @@ shm_main.lo shm_main.o: $(srcdir)/util/shm_side/shm_ma $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \ $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h \ $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/util/data/msgreply.h \ + $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h \ $(srcdir)/util/timehist.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h $(srcdir)/services/mesh.h \ $(srcdir)/util/rbtree.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ @@ -830,21 +846,21 @@ shm_main.lo shm_main.o: $(srcdir)/util/shm_side/shm_ma $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h authzone.lo authzone.o: $(srcdir)/services/authzone.c config.h $(srcdir)/services/authzone.h \ $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/services/mesh.h $(srcdir)/util/netevent.h \ - $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/modstack.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/random.h $(srcdir)/services/cache/dns.h \ - $(srcdir)/services/outside_network.h \ + $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ + $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/services/modstack.h $(srcdir)/util/data/dname.h $(srcdir)/util/data/msgencode.h \ + $(srcdir)/util/regional.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/util/random.h \ + $(srcdir)/services/cache/dns.h $(srcdir)/services/outside_network.h \ $(srcdir)/services/listen_dnsport.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/str2wire.h \ $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/keyraw.h \ $(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_secalgo.h fptr_wlist.lo fptr_wlist.o: $(srcdir)/util/fptr_wlist.c config.h $(srcdir)/util/fptr_wlist.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/modstack.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/lruhash.h \ + $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ + $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/mini_event.h \ $(srcdir)/services/outside_network.h $(srcdir)/services/localzone.h \ $(srcdir)/util/storage/dnstree.h $(srcdir)/services/view.h $(srcdir)/services/authzone.h \ $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/services/cache/rrset.h \ @@ -855,26 +871,23 @@ fptr_wlist.lo fptr_wlist.o: $(srcdir)/util/fptr_wlist. $(srcdir)/validator/autotrust.h $(srcdir)/libunbound/libworker.h $(srcdir)/libunbound/context.h \ $(srcdir)/util/alloc.h $(srcdir)/libunbound/unbound.h $(srcdir)/libunbound/unbound-event.h \ $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h $(srcdir)/respip/respip.h \ - $(PYTHONMOD_HEADER) $(srcdir)/ipsecmod/ipsecmod.h + $(PYTHONMOD_HEADER) $(srcdir)/ipsecmod/ipsecmod.h $(srcdir)/edns-subnet/subnetmod.h $(srcdir)/util/net_help.h \ + $(srcdir)/edns-subnet/addrtree.h $(srcdir)/edns-subnet/edns-subnet.h $(srcdir)/ipset/ipset.h locks.lo locks.o: $(srcdir)/util/locks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h log.lo log.o: $(srcdir)/util/log.c config.h $(srcdir)/util/log.h $(srcdir)/util/locks.h $(srcdir)/sldns/sbuffer.h -mini_event.lo mini_event.o: $(srcdir)/util/mini_event.c config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \ - $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/log.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h +mini_event.lo mini_event.o: $(srcdir)/util/mini_event.c config.h $(srcdir)/util/mini_event.h module.lo module.o: $(srcdir)/util/module.c config.h $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/wire2str.h netevent.lo netevent.o: $(srcdir)/util/netevent.c config.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/ub_event.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/tcp_conn_limit.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h \ - $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \ - $(srcdir)/services/modstack.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/str2wire.h $(srcdir)/dnstap/dnstap.h \ - $(srcdir)/services/listen_dnsport.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ + $(srcdir)/util/ub_event.h $(srcdir)/util/net_help.h $(srcdir)/util/tcp_conn_limit.h \ + $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/fptr_wlist.h \ + $(srcdir)/util/storage/lruhash.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ + $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h \ + $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/str2wire.h $(srcdir)/dnstap/dnstap.h \ + $(srcdir)/services/listen_dnsport.h \ net_help.lo net_help.o: $(srcdir)/util/net_help.c config.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h \ $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/module.h \ @@ -885,10 +898,10 @@ net_help.lo net_help.o: $(srcdir)/util/net_help.c conf random.lo random.o: $(srcdir)/util/random.c config.h $(srcdir)/util/random.h $(srcdir)/util/log.h rbtree.lo rbtree.o: $(srcdir)/util/rbtree.c config.h $(srcdir)/util/log.h $(srcdir)/util/fptr_wlist.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/modstack.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/lruhash.h \ + $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ + $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h regional.lo regional.o: $(srcdir)/util/regional.c config.h $(srcdir)/util/log.h $(srcdir)/util/regional.h rtt.lo rtt.o: $(srcdir)/util/rtt.c config.h $(srcdir)/util/rtt.h $(srcdir)/iterator/iterator.h \ $(srcdir)/services/outbound_list.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/storage/lruhash.h \ @@ -896,19 +909,19 @@ rtt.lo rtt.o: $(srcdir)/util/rtt.c config.h $(srcdir)/ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h edns.lo edns.o: $(srcdir)/util/edns.c config.h $(srcdir)/util/edns.h $(srcdir)/util/config_file.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/regional.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/log.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/regional.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ + $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h dnstree.lo dnstree.o: $(srcdir)/util/storage/dnstree.c config.h $(srcdir)/util/storage/dnstree.h \ $(srcdir)/util/rbtree.h $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ $(srcdir)/util/log.h $(srcdir)/util/net_help.h lookup3.lo lookup3.o: $(srcdir)/util/storage/lookup3.c config.h $(srcdir)/util/storage/lookup3.h lruhash.lo lruhash.o: $(srcdir)/util/storage/lruhash.c config.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h \ - $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/modstack.h + $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \ + $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ + $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h slabhash.lo slabhash.o: $(srcdir)/util/storage/slabhash.c config.h $(srcdir)/util/storage/slabhash.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h tcp_conn_limit.lo tcp_conn_limit.o: $(srcdir)/util/tcp_conn_limit.c config.h $(srcdir)/util/regional.h \ @@ -920,20 +933,22 @@ tcp_conn_limit.lo tcp_conn_limit.o: $(srcdir)/util/tcp timehist.lo timehist.o: $(srcdir)/util/timehist.c config.h $(srcdir)/util/timehist.h $(srcdir)/util/log.h tube.lo tube.o: $(srcdir)/util/tube.c config.h $(srcdir)/util/tube.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/modstack.h $(srcdir)/util/ub_event.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h \ + $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/services/mesh.h \ + $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/ub_event.h ub_event.lo ub_event.o: $(srcdir)/util/ub_event.c config.h $(srcdir)/util/ub_event.h $(srcdir)/util/log.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/tube.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/tube.h \ + ub_event_pluggable.lo ub_event_pluggable.o: $(srcdir)/util/ub_event_pluggable.c config.h $(srcdir)/util/ub_event.h \ $(srcdir)/libunbound/unbound-event.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/log.h $(srcdir)/util/fptr_wlist.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/modstack.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ + $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/module.h \ + $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ + $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ + $(srcdir)/services/modstack.h \ + winsock_event.lo winsock_event.o: $(srcdir)/util/winsock_event.c config.h autotrust.lo autotrust.o: $(srcdir)/validator/autotrust.c config.h $(srcdir)/validator/autotrust.h \ $(srcdir)/util/rbtree.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ @@ -942,9 +957,9 @@ autotrust.lo autotrust.o: $(srcdir)/validator/autotrus $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/net_help.h \ $(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/random.h $(srcdir)/services/mesh.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/services/modstack.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ - $(srcdir)/validator/val_kcache.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h \ - $(srcdir)/sldns/keyraw.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/services/modstack.h $(srcdir)/services/cache/rrset.h \ + $(srcdir)/util/storage/slabhash.h $(srcdir)/validator/val_kcache.h $(srcdir)/sldns/sbuffer.h \ + $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/keyraw.h \ val_anchor.lo val_anchor.o: $(srcdir)/validator/val_anchor.c config.h $(srcdir)/validator/val_anchor.h \ $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/validator/val_sigcrypt.h \ @@ -962,7 +977,7 @@ validator.lo validator.o: $(srcdir)/validator/validato $(srcdir)/validator/autotrust.h $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/rrset.h \ $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h \ $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \ $(srcdir)/services/modstack.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h val_kcache.lo val_kcache.o: $(srcdir)/validator/val_kcache.c config.h $(srcdir)/validator/val_kcache.h \ $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ @@ -1022,9 +1037,9 @@ dns64.lo dns64.o: $(srcdir)/dns64/dns64.c config.h $(s $(srcdir)/sldns/rrdef.h $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/rrset.h \ $(srcdir)/util/storage/slabhash.h $(srcdir)/util/config_file.h $(srcdir)/util/fptr_wlist.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/data/dname.h \ - $(srcdir)/sldns/str2wire.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ + $(srcdir)/services/modstack.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h \ + $(srcdir)/util/storage/dnstree.h $(srcdir)/util/data/dname.h $(srcdir)/sldns/str2wire.h edns-subnet.lo edns-subnet.o: $(srcdir)/edns-subnet/edns-subnet.c config.h subnetmod.lo subnetmod.o: $(srcdir)/edns-subnet/subnetmod.c config.h addrtree.lo addrtree.o: $(srcdir)/edns-subnet/addrtree.c config.h $(srcdir)/util/log.h \ @@ -1040,31 +1055,34 @@ respip.lo respip.o: $(srcdir)/respip/respip.c config.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/services/view.h \ $(srcdir)/services/cache/dns.h $(srcdir)/sldns/str2wire.h $(srcdir)/util/config_file.h \ $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \ $(srcdir)/services/modstack.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/respip/respip.h checklocks.lo checklocks.o: $(srcdir)/testcode/checklocks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/testcode/checklocks.h dnstap.lo dnstap.o: $(srcdir)/dnstap/dnstap.c config.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/util/netevent.h \ - $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/dnstap/dnstap.h \ + $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \ + $(srcdir)/util/locks.h $(srcdir)/dnstap/dnstap.h \ dnstap/dnstap.pb-c.h dnstap.pb-c.lo dnstap.pb-c.o: dnstap/dnstap.pb-c.c dnstap/dnstap.pb-c.h \ -ipsecmod.lo ipsecmod.o: $(srcdir)/ipsecmod/ipsecmod.c config.h $(srcdir)/ipsecmod/ipsecmod.h \ - $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/rbtree.h $(srcdir)/ipsecmod/ipsecmod-whitelist.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h \ - $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/config_file.h $(srcdir)/services/cache/dns.h $(srcdir)/sldns/wire2str.h +dnscrypt.lo dnscrypt.o: $(srcdir)/dnscrypt/dnscrypt.c config.h $(srcdir)/sldns/sbuffer.h \ + $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/util/netevent.h \ + $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \ + $(srcdir)/util/locks.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h \ + $(srcdir)/util/storage/lookup3.h +ipsecmod.lo ipsecmod.o: $(srcdir)/ipsecmod/ipsecmod.c config.h ipsecmod-whitelist.lo ipsecmod-whitelist.o: $(srcdir)/ipsecmod/ipsecmod-whitelist.c config.h \ $(srcdir)/ipsecmod/ipsecmod.h $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/rbtree.h \ $(srcdir)/ipsecmod/ipsecmod-whitelist.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/regional.h \ $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h $(srcdir)/sldns/str2wire.h +ipset.lo ipset.o: $(srcdir)/ipset/ipset.c config.h $(srcdir)/ipset/ipset.h $(srcdir)/util/module.h \ + $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \ + $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/services/cache/dns.h \ + $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/parseutil.h unitanchor.lo unitanchor.o: $(srcdir)/testcode/unitanchor.c config.h $(srcdir)/util/log.h $(srcdir)/util/data/dname.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/testcode/unitmain.h \ $(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h @@ -1081,7 +1099,7 @@ unitmain.lo unitmain.o: $(srcdir)/testcode/unitmain.c $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h \ $(srcdir)/sldns/pkthdr.h $(srcdir)/libunbound/unbound.h $(srcdir)/services/cache/infra.h \ $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/random.h $(srcdir)/respip/respip.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/random.h $(srcdir)/respip/respip.h \ $(srcdir)/services/localzone.h $(srcdir)/services/view.h unitmsgparse.lo unitmsgparse.o: $(srcdir)/testcode/unitmsgparse.c config.h $(srcdir)/util/log.h \ $(srcdir)/testcode/unitmain.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h \ @@ -1116,11 +1134,12 @@ unitldns.lo unitldns.o: $(srcdir)/testcode/unitldns.c unitecs.lo unitecs.o: $(srcdir)/testcode/unitecs.c config.h unitauth.lo unitauth.o: $(srcdir)/testcode/unitauth.c config.h $(srcdir)/services/authzone.h \ $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/services/mesh.h $(srcdir)/util/netevent.h \ - $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/modstack.h \ - $(srcdir)/testcode/unitmain.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h \ - $(srcdir)/services/cache/dns.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/sbuffer.h + $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ + $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/services/modstack.h $(srcdir)/testcode/unitmain.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h \ + $(srcdir)/util/config_file.h $(srcdir)/services/cache/dns.h $(srcdir)/sldns/str2wire.h \ + $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/sbuffer.h acl_list.lo acl_list.o: $(srcdir)/daemon/acl_list.c config.h $(srcdir)/daemon/acl_list.h \ $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/services/view.h $(srcdir)/util/locks.h \ $(srcdir)/util/log.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h \ @@ -1131,24 +1150,24 @@ cachedump.lo cachedump.o: $(srcdir)/daemon/cachedump.c $(srcdir)/daemon/cachedump.h $(srcdir)/daemon/remote.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h \ $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h \ - $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ - $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/data/dname.h $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h \ - $(srcdir)/iterator/iter_delegpt.h $(srcdir)/iterator/iter_utils.h $(srcdir)/iterator/iter_resptype.h \ - $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h $(srcdir)/sldns/wire2str.h \ - $(srcdir)/sldns/str2wire.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/alloc.h \ + $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ + $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h $(srcdir)/util/module.h \ + $(srcdir)/dnstap/dnstap.h $(srcdir)/services/cache/rrset.h \ + $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/infra.h \ + $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/util/regional.h \ + $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h $(srcdir)/iterator/iterator.h \ + $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/iterator/iter_utils.h \ + $(srcdir)/iterator/iter_resptype.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h \ + $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h daemon.lo daemon.o: $(srcdir)/daemon/daemon.c config.h \ $(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \ $(srcdir)/daemon/worker.h \ $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ - $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h $(srcdir)/util/module.h \ - $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h \ + $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h \ $(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/services/view.h \ $(srcdir)/util/config_file.h $(srcdir)/util/shm_side/shm_main.h $(srcdir)/util/storage/lookup3.h \ $(srcdir)/util/storage/slabhash.h $(srcdir)/util/tcp_conn_limit.h $(srcdir)/services/listen_dnsport.h \ @@ -1160,51 +1179,53 @@ remote.lo remote.o: $(srcdir)/daemon/remote.c config.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h \ - $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/daemon.h \ - $(srcdir)/services/modstack.h $(srcdir)/daemon/cachedump.h $(srcdir)/util/config_file.h \ - $(srcdir)/util/net_help.h $(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/services/mesh.h $(srcdir)/services/localzone.h \ - $(srcdir)/services/view.h $(srcdir)/services/authzone.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h \ - $(srcdir)/util/data/dname.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h \ - $(srcdir)/validator/val_kcache.h $(srcdir)/validator/val_kentry.h $(srcdir)/validator/val_anchor.h \ - $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_fwd.h \ - $(srcdir)/iterator/iter_hints.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/services/outside_network.h \ - $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \ + $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \ + $(srcdir)/libunbound/unbound.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \ + $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h \ + $(srcdir)/daemon/cachedump.h $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h \ + $(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ + $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h \ + $(srcdir)/services/mesh.h $(srcdir)/services/localzone.h $(srcdir)/services/view.h $(srcdir)/services/authzone.h \ + $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h $(srcdir)/util/data/dname.h $(srcdir)/validator/validator.h \ + $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_kcache.h $(srcdir)/validator/val_kentry.h \ + $(srcdir)/validator/val_anchor.h $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h \ + $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h $(srcdir)/iterator/iter_delegpt.h \ + $(srcdir)/services/outside_network.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/parseutil.h \ + $(srcdir)/sldns/wire2str.h stats.lo stats.o: $(srcdir)/daemon/stats.c config.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \ $(srcdir)/libunbound/unbound.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \ - $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/outside_network.h $(srcdir)/services/listen_dnsport.h $(srcdir)/util/config_file.h \ - $(srcdir)/util/tube.h $(srcdir)/util/net_help.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h \ - $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \ - $(srcdir)/util/rtt.h $(srcdir)/services/authzone.h $(srcdir)/validator/val_kcache.h \ - $(srcdir)/validator/val_neg.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \ + $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \ + $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h \ + $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/outside_network.h \ + $(srcdir)/services/listen_dnsport.h $(srcdir)/util/config_file.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h \ + $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/iterator/iterator.h \ + $(srcdir)/services/outbound_list.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ + $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h \ + $(srcdir)/services/authzone.h $(srcdir)/validator/val_kcache.h $(srcdir)/validator/val_neg.h \ unbound.lo unbound.o: $(srcdir)/daemon/unbound.c config.h $(srcdir)/util/log.h $(srcdir)/daemon/daemon.h \ $(srcdir)/util/locks.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \ $(srcdir)/daemon/remote.h \ $(srcdir)/util/config_file.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/services/listen_dnsport.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/cache/infra.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/ub_event.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h \ + $(srcdir)/util/data/msgreply.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ + $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h $(srcdir)/util/ub_event.h worker.lo worker.o: $(srcdir)/daemon/worker.c config.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \ $(srcdir)/util/random.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h \ - $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/daemon.h \ - $(srcdir)/services/modstack.h $(srcdir)/daemon/remote.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \ + $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \ + $(srcdir)/libunbound/unbound.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \ + $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h \ + $(srcdir)/daemon/remote.h \ $(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/services/view.h \ $(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/storage/slabhash.h \ $(srcdir)/services/listen_dnsport.h $(srcdir)/services/outside_network.h \ @@ -1217,16 +1238,15 @@ worker.lo worker.o: $(srcdir)/daemon/worker.c config.h $(srcdir)/libunbound/libworker.h $(srcdir)/sldns/wire2str.h $(srcdir)/util/shm_side/shm_main.h testbound.lo testbound.o: $(srcdir)/testcode/testbound.c config.h $(srcdir)/testcode/testpkts.h \ $(srcdir)/testcode/replay.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/rbtree.h $(srcdir)/testcode/fake_event.h \ - $(srcdir)/daemon/remote.h \ - $(srcdir)/util/config_file.h $(srcdir)/sldns/keyraw.h $(srcdir)/daemon/unbound.c $(srcdir)/util/log.h \ - $(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \ - $(srcdir)/util/rtt.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h $(srcdir)/util/ub_event.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ + $(srcdir)/util/rbtree.h $(srcdir)/testcode/fake_event.h $(srcdir)/daemon/remote.h \ + $(srcdir)/util/config_file.h $(srcdir)/sldns/keyraw.h $(srcdir)/daemon/unbound.c $(srcdir)/daemon/daemon.h \ + $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \ + $(srcdir)/util/storage/slabhash.h $(srcdir)/util/storage/lruhash.h $(srcdir)/services/listen_dnsport.h \ + $(srcdir)/services/cache/rrset.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/cache/infra.h \ + $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/fptr_wlist.h \ + $(srcdir)/util/module.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ + $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h $(srcdir)/util/ub_event.h testpkts.lo testpkts.o: $(srcdir)/testcode/testpkts.c config.h $(srcdir)/testcode/testpkts.h \ $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h @@ -1234,10 +1254,11 @@ worker.lo worker.o: $(srcdir)/daemon/worker.c config.h $(srcdir)/util/random.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h \ - $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/daemon.h \ - $(srcdir)/services/modstack.h $(srcdir)/daemon/remote.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \ + $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h \ + $(srcdir)/libunbound/unbound.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \ + $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h \ + $(srcdir)/daemon/remote.h \ $(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/services/view.h \ $(srcdir)/util/config_file.h $(srcdir)/util/regional.h $(srcdir)/util/storage/slabhash.h \ $(srcdir)/services/listen_dnsport.h $(srcdir)/services/outside_network.h \ @@ -1259,9 +1280,9 @@ daemon.lo daemon.o: $(srcdir)/daemon/daemon.c config.h $(srcdir)/daemon/worker.h \ $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ - $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h $(srcdir)/util/module.h \ - $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h \ + $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h \ $(srcdir)/daemon/acl_list.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/services/view.h \ $(srcdir)/util/config_file.h $(srcdir)/util/shm_side/shm_main.h $(srcdir)/util/storage/lookup3.h \ $(srcdir)/util/storage/slabhash.h $(srcdir)/util/tcp_conn_limit.h $(srcdir)/services/listen_dnsport.h \ @@ -1272,36 +1293,38 @@ stats.lo stats.o: $(srcdir)/daemon/stats.c config.h $( $(srcdir)/libunbound/unbound.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \ - $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ - $(srcdir)/services/outside_network.h $(srcdir)/services/listen_dnsport.h $(srcdir)/util/config_file.h \ - $(srcdir)/util/tube.h $(srcdir)/util/net_help.h $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h \ - $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/services/cache/rrset.h \ - $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \ - $(srcdir)/util/rtt.h $(srcdir)/services/authzone.h $(srcdir)/validator/val_kcache.h \ - $(srcdir)/validator/val_neg.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/alloc.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h \ + $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h \ + $(srcdir)/daemon/daemon.h $(srcdir)/services/modstack.h \ + $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/outside_network.h \ + $(srcdir)/services/listen_dnsport.h $(srcdir)/util/config_file.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h \ + $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/iterator/iterator.h \ + $(srcdir)/services/outbound_list.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ + $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h \ + $(srcdir)/services/authzone.h $(srcdir)/validator/val_kcache.h $(srcdir)/validator/val_neg.h \ replay.lo replay.o: $(srcdir)/testcode/replay.c config.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \ $(srcdir)/util/config_file.h $(srcdir)/testcode/replay.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/testcode/testpkts.h $(srcdir)/util/rbtree.h \ - $(srcdir)/testcode/fake_event.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h \ + $(srcdir)/testcode/testpkts.h $(srcdir)/util/rbtree.h $(srcdir)/testcode/fake_event.h $(srcdir)/sldns/str2wire.h \ + $(srcdir)/sldns/rrdef.h fake_event.lo fake_event.o: $(srcdir)/testcode/fake_event.c config.h $(srcdir)/testcode/fake_event.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h \ - $(srcdir)/util/locks.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/config_file.h $(srcdir)/services/listen_dnsport.h $(srcdir)/services/outside_network.h \ - $(srcdir)/util/rbtree.h $(srcdir)/services/cache/infra.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h $(srcdir)/testcode/replay.h $(srcdir)/testcode/testpkts.h \ - $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \ - $(srcdir)/services/modstack.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ + $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgencode.h \ + $(srcdir)/util/data/dname.h $(srcdir)/util/config_file.h $(srcdir)/services/listen_dnsport.h \ + $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h \ + $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h \ + $(srcdir)/testcode/replay.h $(srcdir)/testcode/testpkts.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h \ + $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/sldns/sbuffer.h \ + $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h lock_verify.lo lock_verify.o: $(srcdir)/testcode/lock_verify.c config.h $(srcdir)/util/log.h $(srcdir)/util/rbtree.h \ $(srcdir)/util/locks.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \ - $(srcdir)/services/modstack.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/storage/lruhash.h \ + $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ + $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h pktview.lo pktview.o: $(srcdir)/testcode/pktview.c config.h $(srcdir)/util/log.h $(srcdir)/util/data/dname.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/testcode/unitmain.h $(srcdir)/testcode/readhex.h $(srcdir)/sldns/sbuffer.h \ @@ -1310,10 +1333,10 @@ readhex.lo readhex.o: $(srcdir)/testcode/readhex.c con $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parseutil.h memstats.lo memstats.o: $(srcdir)/testcode/memstats.c config.h $(srcdir)/util/log.h $(srcdir)/util/rbtree.h \ $(srcdir)/util/locks.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/module.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h \ - $(srcdir)/services/modstack.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/storage/lruhash.h \ + $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ + $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h unbound-checkconf.lo unbound-checkconf.o: $(srcdir)/smallapp/unbound-checkconf.c config.h $(srcdir)/util/log.h \ $(srcdir)/util/config_file.h $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ @@ -1322,16 +1345,16 @@ unbound-checkconf.lo unbound-checkconf.o: $(srcdir)/sm $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h \ $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/services/localzone.h \ $(srcdir)/services/view.h $(srcdir)/services/authzone.h $(srcdir)/services/mesh.h $(srcdir)/util/netevent.h \ - $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/services/modstack.h \ - $(srcdir)/respip/respip.h $(srcdir)/sldns/sbuffer.h $(PYTHONMOD_HEADER) + $(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/dnscrypt/cert.h \ + $(srcdir)/services/modstack.h $(srcdir)/respip/respip.h $(srcdir)/sldns/sbuffer.h worker_cb.lo worker_cb.o: $(srcdir)/smallapp/worker_cb.c config.h $(srcdir)/libunbound/context.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ $(srcdir)/libunbound/unbound.h $(srcdir)/libunbound/unbound-event.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/module.h \ + $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ + $(srcdir)/util/tube.h $(srcdir)/services/mesh.h context.lo context.o: $(srcdir)/libunbound/context.c config.h $(srcdir)/libunbound/context.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ $(srcdir)/libunbound/unbound.h $(srcdir)/libunbound/unbound-event.h $(srcdir)/util/data/packed_rrset.h \ @@ -1340,8 +1363,8 @@ context.lo context.o: $(srcdir)/libunbound/context.c c $(srcdir)/util/net_help.h $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h \ $(srcdir)/services/view.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/services/authzone.h $(srcdir)/services/mesh.h \ - $(srcdir)/sldns/sbuffer.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/services/authzone.h \ + $(srcdir)/services/mesh.h $(srcdir)/sldns/sbuffer.h libunbound.lo libunbound.o: $(srcdir)/libunbound/libunbound.c $(srcdir)/libunbound/unbound.h \ $(srcdir)/libunbound/unbound-event.h config.h $(srcdir)/libunbound/context.h $(srcdir)/util/locks.h \ $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ @@ -1351,7 +1374,7 @@ libunbound.lo libunbound.o: $(srcdir)/libunbound/libun $(srcdir)/util/random.h $(srcdir)/util/net_help.h $(srcdir)/util/tube.h $(srcdir)/util/ub_event.h \ $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h $(srcdir)/services/view.h \ $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/services/cache/rrset.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/services/cache/rrset.h \ $(srcdir)/util/storage/slabhash.h $(srcdir)/services/authzone.h $(srcdir)/services/mesh.h \ $(srcdir)/sldns/sbuffer.h libworker.lo libworker.o: $(srcdir)/libunbound/libworker.c config.h \ @@ -1360,14 +1383,15 @@ libworker.lo libworker.o: $(srcdir)/libunbound/libwork $(srcdir)/services/modstack.h $(srcdir)/libunbound/unbound.h $(srcdir)/libunbound/unbound-event.h \ $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/services/outside_network.h \ $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/data/msgparse.h \ - $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h $(srcdir)/services/view.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/outbound_list.h \ - $(srcdir)/services/authzone.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h $(srcdir)/util/regional.h \ - $(srcdir)/util/random.h $(srcdir)/util/config_file.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/data/msgencode.h $(srcdir)/iterator/iter_fwd.h \ - $(srcdir)/iterator/iter_hints.h $(srcdir)/sldns/str2wire.h + $(srcdir)/dnscrypt/cert.h $(srcdir)/services/mesh.h \ + $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h \ + $(srcdir)/util/data/msgreply.h $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h \ + $(srcdir)/services/view.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ + $(srcdir)/services/outbound_list.h $(srcdir)/services/authzone.h $(srcdir)/util/fptr_wlist.h \ + $(srcdir)/util/tube.h $(srcdir)/util/regional.h $(srcdir)/util/random.h $(srcdir)/util/config_file.h \ + $(srcdir)/util/storage/lookup3.h $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h \ + $(srcdir)/util/data/msgencode.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h \ + $(srcdir)/sldns/str2wire.h unbound-host.lo unbound-host.o: $(srcdir)/smallapp/unbound-host.c config.h $(srcdir)/libunbound/unbound.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/wire2str.h \ @@ -1401,18 +1425,17 @@ pythonmod_utils.lo pythonmod_utils.o: $(srcdir)/python $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/net_help.h $(srcdir)/services/cache/dns.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/regional.h \ - $(srcdir)/iterator/iter_delegpt.h $(srcdir)/sldns/sbuffer.h \ - + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/net_help.h \ + $(srcdir)/services/cache/dns.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ + $(srcdir)/util/regional.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/sldns/sbuffer.h win_svc.lo win_svc.o: $(srcdir)/winrc/win_svc.c config.h $(srcdir)/winrc/win_svc.h $(srcdir)/winrc/w_inst.h \ $(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \ $(srcdir)/daemon/worker.h \ $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \ - $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h \ - $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h $(srcdir)/util/module.h \ - $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h \ + $(srcdir)/dnscrypt/cert.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h \ + $(srcdir)/util/module.h $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h \ $(srcdir)/util/config_file.h $(srcdir)/util/ub_event.h $(srcdir)/util/net_help.h w_inst.lo w_inst.o: $(srcdir)/winrc/w_inst.c config.h $(srcdir)/winrc/w_inst.h $(srcdir)/winrc/win_svc.h unbound-service-install.lo unbound-service-install.o: $(srcdir)/winrc/unbound-service-install.c config.h \ @@ -1428,7 +1451,7 @@ sbuffer.lo sbuffer.o: $(srcdir)/sldns/sbuffer.c config wire2str.lo wire2str.o: $(srcdir)/sldns/wire2str.c config.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/sldns/keyraw.h \ - + $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h parse.lo parse.o: $(srcdir)/sldns/parse.c config.h $(srcdir)/sldns/parse.h $(srcdir)/sldns/parseutil.h \ $(srcdir)/sldns/sbuffer.h parseutil.lo parseutil.o: $(srcdir)/sldns/parseutil.c config.h $(srcdir)/sldns/parseutil.h @@ -1448,9 +1471,10 @@ snprintf.lo snprintf.o: $(srcdir)/compat/snprintf.c co strlcat.lo strlcat.o: $(srcdir)/compat/strlcat.c config.h strlcpy.lo strlcpy.o: $(srcdir)/compat/strlcpy.c config.h strptime.lo strptime.o: $(srcdir)/compat/strptime.c config.h +getentropy_freebsd.lo getentropy_freebsd.o: $(srcdir)/compat/getentropy_freebsd.c getentropy_linux.lo getentropy_linux.o: $(srcdir)/compat/getentropy_linux.c config.h \ -getentropy_osx.lo getentropy_osx.o: $(srcdir)/compat/getentropy_osx.c config.h +getentropy_osx.lo getentropy_osx.o: $(srcdir)/compat/getentropy_osx.c getentropy_solaris.lo getentropy_solaris.o: $(srcdir)/compat/getentropy_solaris.c config.h \ getentropy_win.lo getentropy_win.o: $(srcdir)/compat/getentropy_win.c Modified: head/contrib/unbound/README.md ============================================================================== --- head/contrib/unbound/README.md Tue Dec 31 14:32:48 2019 (r356227) +++ head/contrib/unbound/README.md Tue Dec 31 15:50:41 2019 (r356228) @@ -2,6 +2,7 @@ [![Travis Build Status](https://travis-ci.org/NLnetLabs/unbound.svg?branch=master)](https://travis-ci.org/NLnetLabs/unbound) [![Packaging status](https://repology.org/badge/tiny-repos/unbound.svg)](https://repology.org/project/unbound/versions) +[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/unbound.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:unbound) Unbound is a validating, recursive, caching DNS resolver. It is designed to be fast and lean and incorporates modern features based on open standards. If you Modified: head/contrib/unbound/aclocal.m4 ============================================================================== --- head/contrib/unbound/aclocal.m4 Tue Dec 31 14:32:48 2019 (r356227) +++ head/contrib/unbound/aclocal.m4 Tue Dec 31 15:50:41 2019 (r356228) @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.1 -*- Autoconf -*- +# generated automatically by aclocal 1.15.1 -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -736,7 +736,6 @@ _LT_CONFIG_SAVE_COMMANDS([ cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. @@ -2873,9 +2872,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) # before this can be enabled. hardcode_into_libs=yes - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command @@ -2884,7 +2880,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -2896,6 +2892,18 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) dynamic_linker='GNU/Linux ld.so' ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -3555,7 +3563,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else @@ -4433,7 +4441,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise @@ -4945,6 +4953,9 @@ m4_if([$1], [CXX], [ ;; esac *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Dec 31 15:57:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD02C1D8015; Tue, 31 Dec 2019 15:57:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nJpd5Yblz4QgT; Tue, 31 Dec 2019 15:57:29 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA21E1C88E; Tue, 31 Dec 2019 15:57:29 +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 xBVFvTfm039840; Tue, 31 Dec 2019 15:57:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVFvTFY039839; Tue, 31 Dec 2019 15:57:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912311557.xBVFvTFY039839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 31 Dec 2019 15:57:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356229 - in head/sys: amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys: amd64/linux32 i386/linux X-SVN-Commit-Revision: 356229 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 15:57:29 -0000 Author: trasz Date: Tue Dec 31 15:57:29 2019 New Revision: 356229 URL: https://svnweb.freebsd.org/changeset/base/356229 Log: Fix definitions for Linux getcpu(2). MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/linux32/syscalls.master head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Tue Dec 31 15:50:41 2019 (r356228) +++ head/sys/amd64/linux32/syscalls.master Tue Dec 31 15:57:29 2019 (r356229) @@ -531,7 +531,8 @@ ; Linux 2.6.18: 317 AUE_NULL STD { int linux_move_pages(void); } ; Linux 2.6.19: -318 AUE_NULL STD { int linux_getcpu(void); } +318 AUE_NULL STD { int linux_getcpu(l_uint *cpu, l_uint *node, \ + void *cache); } 319 AUE_NULL STD { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \ l_int maxevents, l_int timeout, l_sigset_t *mask, \ l_size_t sigsetsize); } Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Tue Dec 31 15:50:41 2019 (r356228) +++ head/sys/i386/linux/syscalls.master Tue Dec 31 15:57:29 2019 (r356229) @@ -540,7 +540,8 @@ ; Linux 2.6.18: 317 AUE_NULL STD { int linux_move_pages(void); } ; Linux 2.6.19: -318 AUE_NULL STD { int linux_getcpu(void); } +318 AUE_NULL STD { int linux_getcpu(l_uint *cpu, l_uint *node, \ + void *cache); } 319 AUE_NULL STD { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \ l_int maxevents, l_int timeout, l_sigset_t *mask, \ l_size_t sigsetsize); } From owner-svn-src-head@freebsd.org Tue Dec 31 16:01:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AE9B1D8126; Tue, 31 Dec 2019 16:01:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nJvP1Hymz4Qy6; Tue, 31 Dec 2019 16:01:37 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27C7C1C8F0; Tue, 31 Dec 2019 16:01:37 +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 xBVG1bT4043452; Tue, 31 Dec 2019 16:01:37 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVG1aCM043442; Tue, 31 Dec 2019 16:01:36 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201912311601.xBVG1aCM043442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 31 Dec 2019 16:01:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356230 - in head: . sys/sys X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in head: . sys/sys X-SVN-Commit-Revision: 356230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 16:01:37 -0000 Author: gjb Date: Tue Dec 31 16:01:36 2019 New Revision: 356230 URL: https://svnweb.freebsd.org/changeset/base/356230 Log: Happy New Year 2020! MFC after: 1 minute Sponsored by: Rubicon Communications, LLC (netgate.com) Modified: head/COPYRIGHT head/sys/sys/copyright.h Modified: head/COPYRIGHT ============================================================================== --- head/COPYRIGHT Tue Dec 31 15:57:29 2019 (r356229) +++ head/COPYRIGHT Tue Dec 31 16:01:36 2019 (r356230) @@ -4,7 +4,7 @@ The compilation of software known as FreeBSD is distributed under the following terms: -Copyright (c) 1992-2019 The FreeBSD Project. +Copyright (c) 1992-2020 The FreeBSD Project. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: head/sys/sys/copyright.h ============================================================================== --- head/sys/sys/copyright.h Tue Dec 31 15:57:29 2019 (r356229) +++ head/sys/sys/copyright.h Tue Dec 31 16:01:36 2019 (r356230) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (C) 1992-2018 The FreeBSD Project. All rights reserved. + * Copyright (C) 1992-2020 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -36,7 +36,7 @@ /* FreeBSD */ #define COPYRIGHT_FreeBSD \ - "Copyright (c) 1992-2019 The FreeBSD Project.\n" + "Copyright (c) 1992-2020 The FreeBSD Project.\n" /* Foundation */ #define TRADEMARK_Foundation \ From owner-svn-src-head@freebsd.org Tue Dec 31 16:01:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4425F1D8142; Tue, 31 Dec 2019 16:01:39 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nJvR0kFtz4QyD; Tue, 31 Dec 2019 16:01:39 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 141F91C8F1; Tue, 31 Dec 2019 16:01:39 +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 xBVG1cw6043492; Tue, 31 Dec 2019 16:01:38 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVG1bTS043486; Tue, 31 Dec 2019 16:01:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912311601.xBVG1bTS043486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 31 Dec 2019 16:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356231 - in head/sys: amd64/linux32 i386/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys: amd64/linux32 i386/linux X-SVN-Commit-Revision: 356231 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 16:01:39 -0000 Author: trasz Date: Tue Dec 31 16:01:37 2019 New Revision: 356231 URL: https://svnweb.freebsd.org/changeset/base/356231 Log: Regen after r356229. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux32/linux32_proto.h ============================================================================== --- head/sys/amd64/linux32/linux32_proto.h Tue Dec 31 16:01:36 2019 (r356230) +++ head/sys/amd64/linux32/linux32_proto.h Tue Dec 31 16:01:37 2019 (r356231) @@ -1035,7 +1035,9 @@ struct linux_move_pages_args { register_t dummy; }; struct linux_getcpu_args { - register_t dummy; + char cpu_l_[PADL_(l_uint *)]; l_uint * cpu; char cpu_r_[PADR_(l_uint *)]; + char node_l_[PADL_(l_uint *)]; l_uint * node; char node_r_[PADR_(l_uint *)]; + char cache_l_[PADL_(void *)]; void * cache; char cache_r_[PADR_(void *)]; }; struct linux_epoll_pwait_args { char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)]; Modified: head/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysent.c Tue Dec 31 16:01:36 2019 (r356230) +++ head/sys/amd64/linux32/linux32_sysent.c Tue Dec 31 16:01:37 2019 (r356231) @@ -335,7 +335,7 @@ struct sysent linux32_sysent[] = { { 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 315 = linux_tee */ { 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 316 = linux_vmsplice */ { 0, (sy_call_t *)linux_move_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 317 = linux_move_pages */ - { 0, (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 318 = linux_getcpu */ + { AS(linux_getcpu_args), (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 318 = linux_getcpu */ { AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 319 = linux_epoll_pwait */ { AS(linux_utimensat_args), (sy_call_t *)linux_utimensat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 320 = linux_utimensat */ { 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 321 = linux_signalfd */ Modified: head/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- head/sys/amd64/linux32/linux32_systrace_args.c Tue Dec 31 16:01:36 2019 (r356230) +++ head/sys/amd64/linux32/linux32_systrace_args.c Tue Dec 31 16:01:37 2019 (r356231) @@ -2143,7 +2143,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg } /* linux_getcpu */ case 318: { - *n_args = 0; + struct linux_getcpu_args *p = params; + uarg[0] = (intptr_t) p->cpu; /* l_uint * */ + uarg[1] = (intptr_t) p->node; /* l_uint * */ + uarg[2] = (intptr_t) p->cache; /* void * */ + *n_args = 3; break; } /* linux_epoll_pwait */ @@ -6197,6 +6201,19 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; /* linux_getcpu */ case 318: + switch(ndx) { + case 0: + p = "userland l_uint *"; + break; + case 1: + p = "userland l_uint *"; + break; + case 2: + p = "userland void *"; + break; + default: + break; + }; break; /* linux_epoll_pwait */ case 319: @@ -8686,6 +8703,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char * case 317: /* linux_getcpu */ case 318: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_epoll_pwait */ case 319: if (ndx == 0 || ndx == 1) Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Tue Dec 31 16:01:36 2019 (r356230) +++ head/sys/i386/linux/linux_proto.h Tue Dec 31 16:01:37 2019 (r356231) @@ -1053,7 +1053,9 @@ struct linux_move_pages_args { register_t dummy; }; struct linux_getcpu_args { - register_t dummy; + char cpu_l_[PADL_(l_uint *)]; l_uint * cpu; char cpu_r_[PADR_(l_uint *)]; + char node_l_[PADL_(l_uint *)]; l_uint * node; char node_r_[PADR_(l_uint *)]; + char cache_l_[PADL_(void *)]; void * cache; char cache_r_[PADR_(void *)]; }; struct linux_epoll_pwait_args { char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)]; Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Tue Dec 31 16:01:36 2019 (r356230) +++ head/sys/i386/linux/linux_sysent.c Tue Dec 31 16:01:37 2019 (r356231) @@ -335,7 +335,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 315 = linux_tee */ { 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 316 = linux_vmsplice */ { 0, (sy_call_t *)linux_move_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 317 = linux_move_pages */ - { 0, (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 318 = linux_getcpu */ + { AS(linux_getcpu_args), (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 318 = linux_getcpu */ { AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 319 = linux_epoll_pwait */ { AS(linux_utimensat_args), (sy_call_t *)linux_utimensat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 320 = linux_utimensat */ { 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 321 = linux_signalfd */ Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Tue Dec 31 16:01:36 2019 (r356230) +++ head/sys/i386/linux/linux_systrace_args.c Tue Dec 31 16:01:37 2019 (r356231) @@ -2219,7 +2219,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg } /* linux_getcpu */ case 318: { - *n_args = 0; + struct linux_getcpu_args *p = params; + uarg[0] = (intptr_t) p->cpu; /* l_uint * */ + uarg[1] = (intptr_t) p->node; /* l_uint * */ + uarg[2] = (intptr_t) p->cache; /* void * */ + *n_args = 3; break; } /* linux_epoll_pwait */ @@ -6428,6 +6432,19 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; /* linux_getcpu */ case 318: + switch(ndx) { + case 0: + p = "userland l_uint *"; + break; + case 1: + p = "userland l_uint *"; + break; + case 2: + p = "userland void *"; + break; + default: + break; + }; break; /* linux_epoll_pwait */ case 319: @@ -8964,6 +8981,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char * case 317: /* linux_getcpu */ case 318: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_epoll_pwait */ case 319: if (ndx == 0 || ndx == 1) From owner-svn-src-head@freebsd.org Tue Dec 31 16:05:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10BDA1D8584; Tue, 31 Dec 2019 16:05:08 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nJzR6n2vz4RjR; Tue, 31 Dec 2019 16:05:07 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3BDD1CA54; Tue, 31 Dec 2019 16:05:07 +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 xBVG57wa046186; Tue, 31 Dec 2019 16:05:07 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVG57JP046185; Tue, 31 Dec 2019 16:05:07 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912311605.xBVG57JP046185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 31 Dec 2019 16:05:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356233 - head/sys/arm/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/arm/linux X-SVN-Commit-Revision: 356233 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 16:05:08 -0000 Author: trasz Date: Tue Dec 31 16:05:07 2019 New Revision: 356233 URL: https://svnweb.freebsd.org/changeset/base/356233 Log: Sigh, add getcpu(2) chunk missed in r356229. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/linux/syscalls.master Modified: head/sys/arm/linux/syscalls.master ============================================================================== --- head/sys/arm/linux/syscalls.master Tue Dec 31 16:04:16 2019 (r356232) +++ head/sys/arm/linux/syscalls.master Tue Dec 31 16:05:07 2019 (r356233) @@ -1711,7 +1711,11 @@ } ; linux 2.6.19: 345 AUE_NULL STD { - int linux_getcpu(void); + int linux_getcpu( + l_uint *cpu, + l_uint *node, + void *cache + ); } 346 AUE_NULL STD { int linux_epoll_pwait( From owner-svn-src-head@freebsd.org Tue Dec 31 16:07:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 592771D86C0; Tue, 31 Dec 2019 16:07:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nK1s1kqwz4S2b; Tue, 31 Dec 2019 16:07:13 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36A9C1CA63; Tue, 31 Dec 2019 16:07:13 +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 xBVG7DgZ046599; Tue, 31 Dec 2019 16:07:13 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVG7CQe046597; Tue, 31 Dec 2019 16:07:12 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912311607.xBVG7CQe046597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 31 Dec 2019 16:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356234 - head/sys/arm/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/arm/linux X-SVN-Commit-Revision: 356234 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 16:07:13 -0000 Author: trasz Date: Tue Dec 31 16:07:12 2019 New Revision: 356234 URL: https://svnweb.freebsd.org/changeset/base/356234 Log: Regen after r356233. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/linux/linux_proto.h head/sys/arm/linux/linux_sysent.c head/sys/arm/linux/linux_systrace_args.c Modified: head/sys/arm/linux/linux_proto.h ============================================================================== --- head/sys/arm/linux/linux_proto.h Tue Dec 31 16:05:07 2019 (r356233) +++ head/sys/arm/linux/linux_proto.h Tue Dec 31 16:07:12 2019 (r356234) @@ -1091,7 +1091,9 @@ struct linux_move_pages_args { register_t dummy; }; struct linux_getcpu_args { - register_t dummy; + char cpu_l_[PADL_(l_uint *)]; l_uint * cpu; char cpu_r_[PADR_(l_uint *)]; + char node_l_[PADL_(l_uint *)]; l_uint * node; char node_r_[PADR_(l_uint *)]; + char cache_l_[PADL_(void *)]; void * cache; char cache_r_[PADR_(void *)]; }; struct linux_epoll_pwait_args { char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)]; Modified: head/sys/arm/linux/linux_sysent.c ============================================================================== --- head/sys/arm/linux/linux_sysent.c Tue Dec 31 16:05:07 2019 (r356233) +++ head/sys/arm/linux/linux_sysent.c Tue Dec 31 16:07:12 2019 (r356234) @@ -362,7 +362,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 342 = linux_tee */ { 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 343 = linux_vmsplice */ { 0, (sy_call_t *)linux_move_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 344 = linux_move_pages */ - { 0, (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 345 = linux_getcpu */ + { AS(linux_getcpu_args), (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 345 = linux_getcpu */ { AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 346 = linux_epoll_pwait */ { 0, (sy_call_t *)linux_kexec_load, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 347 = linux_kexec_load */ { AS(linux_utimensat_args), (sy_call_t *)linux_utimensat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 348 = linux_utimensat */ Modified: head/sys/arm/linux/linux_systrace_args.c ============================================================================== --- head/sys/arm/linux/linux_systrace_args.c Tue Dec 31 16:05:07 2019 (r356233) +++ head/sys/arm/linux/linux_systrace_args.c Tue Dec 31 16:07:12 2019 (r356234) @@ -2249,7 +2249,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg } /* linux_getcpu */ case 345: { - *n_args = 0; + struct linux_getcpu_args *p = params; + uarg[0] = (intptr_t) p->cpu; /* l_uint * */ + uarg[1] = (intptr_t) p->node; /* l_uint * */ + uarg[2] = (intptr_t) p->cache; /* void * */ + *n_args = 3; break; } /* linux_epoll_pwait */ @@ -6008,6 +6012,19 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; /* linux_getcpu */ case 345: + switch(ndx) { + case 0: + p = "userland l_uint *"; + break; + case 1: + p = "userland l_uint *"; + break; + case 2: + p = "userland void *"; + break; + default: + break; + }; break; /* linux_epoll_pwait */ case 346: @@ -7547,6 +7564,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char * case 344: /* linux_getcpu */ case 345: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_epoll_pwait */ case 346: if (ndx == 0 || ndx == 1) From owner-svn-src-head@freebsd.org Tue Dec 31 16:15:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 489CA1D8A70; Tue, 31 Dec 2019 16:15:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nKCm1HWxz4ScS; Tue, 31 Dec 2019 16:15:48 +0000 (UTC) (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D25A1CC77; Tue, 31 Dec 2019 16:15:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVGFlCN052663; Tue, 31 Dec 2019 16:15:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVGFl0A052662; Tue, 31 Dec 2019 16:15:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912311615.xBVGFl0A052662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 31 Dec 2019 16:15:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356235 - in head/sys/netinet: . cc X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys/netinet: . cc X-SVN-Commit-Revision: 356235 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 16:15:48 -0000 Author: tuexen Date: Tue Dec 31 16:15:47 2019 New Revision: 356235 URL: https://svnweb.freebsd.org/changeset/base/356235 Log: Fix delayed ACK generation for DCTCP. Submitted by: Richard Scheffenegger Reviewed by: chengc@netapp.com, rgrimes@, tuexen@ Differential Revision: https://reviews.freebsd.org/D22644 Modified: head/sys/netinet/cc/cc_dctcp.c head/sys/netinet/tcp_input.c Modified: head/sys/netinet/cc/cc_dctcp.c ============================================================================== --- head/sys/netinet/cc/cc_dctcp.c Tue Dec 31 16:07:12 2019 (r356234) +++ head/sys/netinet/cc/cc_dctcp.c Tue Dec 31 16:15:47 2019 (r356235) @@ -318,46 +318,43 @@ dctcp_post_recovery(struct cc_var *ccv) } /* - * Execute an additional ECN processing using ECN field in IP header and the CWR - * bit in TCP header. - * - * delay_ack == 0 - Delayed ACK disabled - * delay_ack == 1 - Delayed ACK enabled + * Execute an additional ECN processing using ECN field in IP header + * and the CWR bit in TCP header. */ - static void dctcp_ecnpkt_handler(struct cc_var *ccv) { struct dctcp *dctcp_data; uint32_t ccflag; - int delay_ack; + int acknow; dctcp_data = ccv->cc_data; ccflag = ccv->flags; - delay_ack = 1; + acknow = 0; /* * DCTCP responds with an ACK immediately when the CE state * in between this segment and the last segment has changed. */ if (ccflag & CCF_IPHDR_CE) { - if (!dctcp_data->ce_prev && (ccflag & CCF_DELACK)) - delay_ack = 0; - dctcp_data->ce_prev = 1; - CCV(ccv, t_flags2) |= TF2_ECN_SND_ECE; + if (!dctcp_data->ce_prev) { + acknow = 1; + dctcp_data->ce_prev = 1; + CCV(ccv, t_flags2) |= TF2_ECN_SND_ECE; + } } else { - if (dctcp_data->ce_prev && (ccflag & CCF_DELACK)) - delay_ack = 0; - dctcp_data->ce_prev = 0; - CCV(ccv, t_flags2) &= ~TF2_ECN_SND_ECE; + if (dctcp_data->ce_prev) { + acknow = 1; + dctcp_data->ce_prev = 0; + CCV(ccv, t_flags2) &= ~TF2_ECN_SND_ECE; + } } - /* DCTCP sets delayed ack when this segment sets the CWR flag. */ - if ((ccflag & CCF_DELACK) && (ccflag & CCF_TCPHDR_CWR)) - delay_ack = 1; - - if (delay_ack == 0) + if ((acknow) || (ccflag & CCF_TCPHDR_CWR)) { ccv->flags |= CCF_ACKNOW; + } else { + ccv->flags &= ~CCF_ACKNOW; + } } /* Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Dec 31 16:07:12 2019 (r356234) +++ head/sys/netinet/tcp_input.c Tue Dec 31 16:15:47 2019 (r356235) @@ -538,15 +538,12 @@ cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, else tp->ccv->flags &= ~CCF_TCPHDR_CWR; - if (tp->t_flags & TF_DELACK) - tp->ccv->flags |= CCF_DELACK; - else - tp->ccv->flags &= ~CCF_DELACK; - CC_ALGO(tp)->ecnpkt_handler(tp->ccv); - if (tp->ccv->flags & CCF_ACKNOW) + if (tp->ccv->flags & CCF_ACKNOW) { tcp_timer_activate(tp, TT_DELACK, tcp_delacktime); + tp->t_flags |= TF_ACKNOW; + } } } From owner-svn-src-head@freebsd.org Tue Dec 31 17:26:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBE2D1D9C9C; Tue, 31 Dec 2019 17:26:54 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nLnp5m7lz4WTb; Tue, 31 Dec 2019 17:26:54 +0000 (UTC) (envelope-from melifaro@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C05401D91F; Tue, 31 Dec 2019 17:26:54 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVHQs7e095934; Tue, 31 Dec 2019 17:26:54 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVHQrhf095930; Tue, 31 Dec 2019 17:26:53 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201912311726.xBVHQrhf095930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 31 Dec 2019 17:26:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356236 - in head/sys: kern net sys X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: kern net sys X-SVN-Commit-Revision: 356236 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 17:26:54 -0000 Author: melifaro Date: Tue Dec 31 17:26:53 2019 New Revision: 356236 URL: https://svnweb.freebsd.org/changeset/base/356236 Log: Split gigantic rtsock route_output() into smaller functions. Amount of changes to the original code has been intentionally minimised to ease diffing. The changes are mostly mechanical, with the following exceptions: * lltable handler is now called directly based of RTF_LLINFO flag presense. * "report" logic for updating rtm in RTM_GET/RTM_DELETE has been simplified, fixing several potential use-after-free cases in rt_addrinfo. * llable asserts has been replaced with error-returning, preventing kernel crashes when lltable gw af family is invalid (root required). MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22864 Modified: head/sys/kern/kern_jail.c head/sys/net/if_llatbl.c head/sys/net/route.h head/sys/net/rtsock.c head/sys/sys/jail.h Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Tue Dec 31 16:15:47 2019 (r356235) +++ head/sys/kern/kern_jail.c Tue Dec 31 17:26:53 2019 (r356236) @@ -2782,13 +2782,13 @@ prison_check_af(struct ucred *cred, int af) * the jail doesn't allow the address family. IPv4 Address passed in in NBO. */ int -prison_if(struct ucred *cred, struct sockaddr *sa) +prison_if(struct ucred *cred, const struct sockaddr *sa) { #ifdef INET - struct sockaddr_in *sai; + const struct sockaddr_in *sai; #endif #ifdef INET6 - struct sockaddr_in6 *sai6; + const struct sockaddr_in6 *sai6; #endif int error; @@ -2805,13 +2805,13 @@ prison_if(struct ucred *cred, struct sockaddr *sa) { #ifdef INET case AF_INET: - sai = (struct sockaddr_in *)sa; + sai = (const struct sockaddr_in *)sa; error = prison_check_ip4(cred, &sai->sin_addr); break; #endif #ifdef INET6 case AF_INET6: - sai6 = (struct sockaddr_in6 *)sa; + sai6 = (const struct sockaddr_in6 *)sa; error = prison_check_ip6(cred, &sai6->sin6_addr); break; #endif Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Tue Dec 31 16:15:47 2019 (r356235) +++ head/sys/net/if_llatbl.c Tue Dec 31 17:26:53 2019 (r356236) @@ -663,8 +663,8 @@ lla_rt_output(struct rt_msghdr *rtm, struct rt_addrinf u_int laflags = 0; int error; - KASSERT(dl != NULL && dl->sdl_family == AF_LINK, - ("%s: invalid dl\n", __func__)); + if (dl == NULL || dl->sdl_family != AF_LINK) + return (EINVAL); ifp = ifnet_byindex(dl->sdl_index); if (ifp == NULL) { @@ -681,7 +681,8 @@ lla_rt_output(struct rt_msghdr *rtm, struct rt_addrinf break; } LLTABLE_LIST_RUNLOCK(); - KASSERT(llt != NULL, ("Yep, ugly hacks are bad\n")); + if (llt == NULL) + return (ESRCH); error = 0; Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Tue Dec 31 16:15:47 2019 (r356235) +++ head/sys/net/route.h Tue Dec 31 17:26:53 2019 (r356236) @@ -145,6 +145,8 @@ struct rtentry { */ #define rt_key(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_key))) #define rt_mask(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_mask))) +#define rt_key_const(r) (*((const struct sockaddr * const *)(&(r)->rt_nodes->rn_key))) +#define rt_mask_const(r) (*((const struct sockaddr * const *)(&(r)->rt_nodes->rn_mask))) struct sockaddr *rt_gateway; /* value */ struct ifnet *rt_ifp; /* the answer: interface to use */ struct ifaddr *rt_ifa; /* the answer: interface address to use */ Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Tue Dec 31 16:15:47 2019 (r356235) +++ head/sys/net/rtsock.c Tue Dec 31 17:26:53 2019 (r356236) @@ -181,6 +181,15 @@ static void rt_getmetrics(const struct rtentry *rt, st static void rt_dispatch(struct mbuf *, sa_family_t); static struct sockaddr *rtsock_fix_netmask(struct sockaddr *dst, struct sockaddr *smask, struct sockaddr_storage *dmask); +static int handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, + struct rt_msghdr *rtm, struct rtentry **ret_nrt); +static int update_rtm_from_rte(struct rt_addrinfo *info, + struct rt_msghdr **prtm, int alloc_len, + struct rtentry *rt); +static void send_rtm_reply(struct socket *so, struct rt_msghdr *rtm, + struct mbuf *m, sa_family_t saf, u_int fibnum, + int rtm_errno); +static int can_export_rte(struct ucred *td_ucred, const struct rtentry *rt); static struct netisr_handler rtsock_nh = { .nh_name = "rtsock", @@ -550,14 +559,287 @@ rtm_get_jailed(struct rt_addrinfo *info, struct ifnet return (0); } +/* + * Fills in @info based on userland-provided @rtm message. + * + * Returns 0 on success. + */ +static int +fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fibnum, struct rt_addrinfo *info) +{ + int error; + sa_family_t saf; + + rtm->rtm_pid = curproc->p_pid; + info->rti_addrs = rtm->rtm_addrs; + + info->rti_mflags = rtm->rtm_inits; + info->rti_rmx = &rtm->rtm_rmx; + + /* + * rt_xaddrs() performs s6_addr[2] := sin6_scope_id for AF_INET6 + * link-local address because rtrequest requires addresses with + * embedded scope id. + */ + if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, info)) + return (EINVAL); + + if (rtm->rtm_flags & RTF_RNH_LOCKED) + return (EINVAL); + info->rti_flags = rtm->rtm_flags; + if (info->rti_info[RTAX_DST] == NULL || + info->rti_info[RTAX_DST]->sa_family >= AF_MAX || + (info->rti_info[RTAX_GATEWAY] != NULL && + info->rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) + return (EINVAL); + saf = info->rti_info[RTAX_DST]->sa_family; + /* + * Verify that the caller has the appropriate privilege; RTM_GET + * is the only operation the non-superuser is allowed. + */ + if (rtm->rtm_type != RTM_GET) { + error = priv_check(curthread, PRIV_NET_ROUTE); + if (error != 0) + return (error); + } + + /* + * The given gateway address may be an interface address. + * For example, issuing a "route change" command on a route + * entry that was created from a tunnel, and the gateway + * address given is the local end point. In this case the + * RTF_GATEWAY flag must be cleared or the destination will + * not be reachable even though there is no error message. + */ + if (info->rti_info[RTAX_GATEWAY] != NULL && + info->rti_info[RTAX_GATEWAY]->sa_family != AF_LINK) { + struct rt_addrinfo ginfo; + struct sockaddr *gdst; + struct sockaddr_storage ss; + + bzero(&ginfo, sizeof(ginfo)); + bzero(&ss, sizeof(ss)); + ss.ss_len = sizeof(ss); + + ginfo.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&ss; + gdst = info->rti_info[RTAX_GATEWAY]; + + /* + * A host route through the loopback interface is + * installed for each interface adddress. In pre 8.0 + * releases the interface address of a PPP link type + * is not reachable locally. This behavior is fixed as + * part of the new L2/L3 redesign and rewrite work. The + * signature of this interface address route is the + * AF_LINK sa_family type of the rt_gateway, and the + * rt_ifp has the IFF_LOOPBACK flag set. + */ + if (rib_lookup_info(fibnum, gdst, NHR_REF, 0, &ginfo) == 0) { + if (ss.ss_family == AF_LINK && + ginfo.rti_ifp->if_flags & IFF_LOOPBACK) { + info->rti_flags &= ~RTF_GATEWAY; + info->rti_flags |= RTF_GWFLAG_COMPAT; + } + rib_free_info(&ginfo); + } + } + + return (0); +} + +/* + * Handles RTM_GET message from routing socket, returning matching rt. + * + * Returns: + * 0 on success, with locked and referenced matching rt in @rt_nrt + * errno of failure + */ +static int +handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, + struct rt_msghdr *rtm, struct rtentry **ret_nrt) +{ + RIB_RLOCK_TRACKER; + struct rtentry *rt; + struct rib_head *rnh; + sa_family_t saf; + + saf = info->rti_info[RTAX_DST]->sa_family; + + rnh = rt_tables_get_rnh(fibnum, saf); + if (rnh == NULL) + return (EAFNOSUPPORT); + + RIB_RLOCK(rnh); + + if (info->rti_info[RTAX_NETMASK] == NULL) { + /* + * Provide longest prefix match for + * address lookup (no mask). + * 'route -n get addr' + */ + rt = (struct rtentry *) rnh->rnh_matchaddr( + info->rti_info[RTAX_DST], &rnh->head); + } else + rt = (struct rtentry *) rnh->rnh_lookup( + info->rti_info[RTAX_DST], + info->rti_info[RTAX_NETMASK], &rnh->head); + + if (rt == NULL) { + RIB_RUNLOCK(rnh); + return (ESRCH); + } +#ifdef RADIX_MPATH + /* + * for RTM_GET, gate is optional even with multipath. + * if gate == NULL the first match is returned. + * (no need to call rt_mpath_matchgate if gate == NULL) + */ + if (rt_mpath_capable(rnh) && info->rti_info[RTAX_GATEWAY]) { + rt = rt_mpath_matchgate(rt, info->rti_info[RTAX_GATEWAY]); + if (!rt) { + RIB_RUNLOCK(rnh); + return (ESRCH); + } + } +#endif + /* + * If performing proxied L2 entry insertion, and + * the actual PPP host entry is found, perform + * another search to retrieve the prefix route of + * the local end point of the PPP link. + */ + if (rtm->rtm_flags & RTF_ANNOUNCE) { + struct sockaddr laddr; + + if (rt->rt_ifp != NULL && + rt->rt_ifp->if_type == IFT_PROPVIRTUAL) { + struct epoch_tracker et; + struct ifaddr *ifa; + + NET_EPOCH_ENTER(et); + ifa = ifa_ifwithnet(info->rti_info[RTAX_DST], 1, + RT_ALL_FIBS); + NET_EPOCH_EXIT(et); + if (ifa != NULL) + rt_maskedcopy(ifa->ifa_addr, + &laddr, + ifa->ifa_netmask); + } else + rt_maskedcopy(rt->rt_ifa->ifa_addr, + &laddr, + rt->rt_ifa->ifa_netmask); + /* + * refactor rt and no lock operation necessary + */ + rt = (struct rtentry *)rnh->rnh_matchaddr(&laddr, + &rnh->head); + if (rt == NULL) { + RIB_RUNLOCK(rnh); + return (ESRCH); + } + } + RT_LOCK(rt); + RT_ADDREF(rt); + RIB_RUNLOCK(rnh); + + *ret_nrt = rt; + + return (0); +} + +/* + * Update sockaddrs, flags, etc in @prtm based on @rt data. + * Assumes @rt is locked. + * rtm can be reallocated. + * + * Returns 0 on success, along with pointer to (potentially reallocated) + * rtm. + * + */ +static int +update_rtm_from_rte(struct rt_addrinfo *info, struct rt_msghdr **prtm, + int alloc_len, struct rtentry *rt) +{ + struct sockaddr_storage netmask_ss; + struct walkarg w; + union sockaddr_union saun; + struct rt_msghdr *rtm, *orig_rtm = NULL; + struct ifnet *ifp; + int error, len; + + RT_LOCK_ASSERT(rt); + + rtm = *prtm; + + info->rti_info[RTAX_DST] = rt_key(rt); + info->rti_info[RTAX_GATEWAY] = rt->rt_gateway; + info->rti_info[RTAX_NETMASK] = rtsock_fix_netmask(rt_key(rt), + rt_mask(rt), &netmask_ss); + info->rti_info[RTAX_GENMASK] = 0; + ifp = rt->rt_ifp; + if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) { + if (ifp) { + info->rti_info[RTAX_IFP] = + ifp->if_addr->ifa_addr; + error = rtm_get_jailed(info, ifp, rt, + &saun, curthread->td_ucred); + if (error != 0) + return (error); + if (ifp->if_flags & IFF_POINTOPOINT) + info->rti_info[RTAX_BRD] = + rt->rt_ifa->ifa_dstaddr; + rtm->rtm_index = ifp->if_index; + } else { + info->rti_info[RTAX_IFP] = NULL; + info->rti_info[RTAX_IFA] = NULL; + } + } else if (ifp != NULL) + rtm->rtm_index = ifp->if_index; + + /* Check if we need to realloc storage */ + rtsock_msg_buffer(rtm->rtm_type, info, NULL, &len); + if (len > alloc_len) { + struct rt_msghdr *tmp_rtm; + + tmp_rtm = malloc(len, M_TEMP, M_NOWAIT); + if (tmp_rtm == NULL) + return (ENOBUFS); + bcopy(rtm, tmp_rtm, rtm->rtm_msglen); + orig_rtm = rtm; + rtm = tmp_rtm; + alloc_len = len; + + /* + * Delay freeing original rtm as info contains + * data referencing it. + */ + } + + w.w_tmem = (caddr_t)rtm; + w.w_tmemsize = alloc_len; + rtsock_msg_buffer(rtm->rtm_type, info, &w, &len); + + if (rt->rt_flags & RTF_GWFLAG_COMPAT) + rtm->rtm_flags = RTF_GATEWAY | + (rt->rt_flags & ~RTF_GWFLAG_COMPAT); + else + rtm->rtm_flags = rt->rt_flags; + rt_getmetrics(rt, &rtm->rtm_rmx); + rtm->rtm_addrs = info->rti_addrs; + + if (orig_rtm != NULL) + free(orig_rtm, M_TEMP); + *prtm = rtm; + + return (0); +} + /*ARGSUSED*/ static int route_output(struct mbuf *m, struct socket *so, ...) { - RIB_RLOCK_TRACKER; struct rt_msghdr *rtm = NULL; struct rtentry *rt = NULL; - struct rib_head *rnh; struct rt_addrinfo info; struct sockaddr_storage ss; struct epoch_tracker et; @@ -566,10 +848,7 @@ route_output(struct mbuf *m, struct socket *so, ...) int i, rti_need_deembed = 0; #endif int alloc_len = 0, len, error = 0, fibnum; - struct ifnet *ifp = NULL; - union sockaddr_union saun; sa_family_t saf = AF_UNSPEC; - struct rawcb *rp = NULL; struct walkarg w; fibnum = so->so_fibnum; @@ -612,77 +891,20 @@ route_output(struct mbuf *m, struct socket *so, ...) * caller PID and error value. */ - rtm->rtm_pid = curproc->p_pid; - info.rti_addrs = rtm->rtm_addrs; + if ((error = fill_addrinfo(rtm, len, fibnum, &info)) != 0) { + senderr(error); + } - info.rti_mflags = rtm->rtm_inits; - info.rti_rmx = &rtm->rtm_rmx; - - /* - * rt_xaddrs() performs s6_addr[2] := sin6_scope_id for AF_INET6 - * link-local address because rtrequest requires addresses with - * embedded scope id. - */ - if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, &info)) - senderr(EINVAL); - - if (rtm->rtm_flags & RTF_RNH_LOCKED) - senderr(EINVAL); - info.rti_flags = rtm->rtm_flags; - if (info.rti_info[RTAX_DST] == NULL || - info.rti_info[RTAX_DST]->sa_family >= AF_MAX || - (info.rti_info[RTAX_GATEWAY] != NULL && - info.rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) - senderr(EINVAL); saf = info.rti_info[RTAX_DST]->sa_family; - /* - * Verify that the caller has the appropriate privilege; RTM_GET - * is the only operation the non-superuser is allowed. - */ - if (rtm->rtm_type != RTM_GET) { - error = priv_check(curthread, PRIV_NET_ROUTE); - if (error) - senderr(error); - } - /* - * The given gateway address may be an interface address. - * For example, issuing a "route change" command on a route - * entry that was created from a tunnel, and the gateway - * address given is the local end point. In this case the - * RTF_GATEWAY flag must be cleared or the destination will - * not be reachable even though there is no error message. - */ - if (info.rti_info[RTAX_GATEWAY] != NULL && - info.rti_info[RTAX_GATEWAY]->sa_family != AF_LINK) { - struct rt_addrinfo ginfo; - struct sockaddr *gdst; - - bzero(&ginfo, sizeof(ginfo)); - bzero(&ss, sizeof(ss)); - ss.ss_len = sizeof(ss); - - ginfo.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&ss; - gdst = info.rti_info[RTAX_GATEWAY]; - - /* - * A host route through the loopback interface is - * installed for each interface adddress. In pre 8.0 - * releases the interface address of a PPP link type - * is not reachable locally. This behavior is fixed as - * part of the new L2/L3 redesign and rewrite work. The - * signature of this interface address route is the - * AF_LINK sa_family type of the rt_gateway, and the - * rt_ifp has the IFF_LOOPBACK flag set. - */ - if (rib_lookup_info(fibnum, gdst, NHR_REF, 0, &ginfo) == 0) { - if (ss.ss_family == AF_LINK && - ginfo.rti_ifp->if_flags & IFF_LOOPBACK) { - info.rti_flags &= ~RTF_GATEWAY; - info.rti_flags |= RTF_GWFLAG_COMPAT; - } - rib_free_info(&ginfo); - } + /* support for new ARP code */ + if (rtm->rtm_flags & RTF_LLDATA) { + error = lla_rt_output(rtm, &info); +#ifdef INET6 + if (error == 0) + rti_need_deembed = (V_deembed_scopeid) ? 1 : 0; +#endif + goto flush; } switch (rtm->rtm_type) { @@ -695,18 +917,6 @@ route_output(struct mbuf *m, struct socket *so, ...) senderr(EINVAL); } saved_nrt = NULL; - - /* support for new ARP code */ - if (info.rti_info[RTAX_GATEWAY] != NULL && - info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK && - (rtm->rtm_flags & RTF_LLDATA) != 0) { - error = lla_rt_output(rtm, &info); -#ifdef INET6 - if (error == 0) - rti_need_deembed = (V_deembed_scopeid) ? 1 : 0; -#endif - break; - } error = rtrequest1_fib(rtm->rtm_type, &info, &saved_nrt, fibnum); if (error == 0 && saved_nrt != NULL) { @@ -722,17 +932,6 @@ route_output(struct mbuf *m, struct socket *so, ...) case RTM_DELETE: saved_nrt = NULL; - /* support for new ARP code */ - if (info.rti_info[RTAX_GATEWAY] && - (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) && - (rtm->rtm_flags & RTF_LLDATA) != 0) { - error = lla_rt_output(rtm, &info); -#ifdef INET6 - if (error == 0) - rti_need_deembed = (V_deembed_scopeid) ? 1 : 0; -#endif - break; - } error = rtrequest1_fib(RTM_DELETE, &info, &saved_nrt, fibnum); if (error == 0) { RT_LOCK(saved_nrt); @@ -746,153 +945,33 @@ route_output(struct mbuf *m, struct socket *so, ...) break; case RTM_GET: - rnh = rt_tables_get_rnh(fibnum, saf); - if (rnh == NULL) - senderr(EAFNOSUPPORT); + error = handle_rtm_get(&info, fibnum, rtm, &rt); + if (error != 0) + senderr(error); - RIB_RLOCK(rnh); - - if (info.rti_info[RTAX_NETMASK] == NULL && - rtm->rtm_type == RTM_GET) { - /* - * Provide longest prefix match for - * address lookup (no mask). - * 'route -n get addr' - */ - rt = (struct rtentry *) rnh->rnh_matchaddr( - info.rti_info[RTAX_DST], &rnh->head); - } else - rt = (struct rtentry *) rnh->rnh_lookup( - info.rti_info[RTAX_DST], - info.rti_info[RTAX_NETMASK], &rnh->head); - - if (rt == NULL) { - RIB_RUNLOCK(rnh); - senderr(ESRCH); - } -#ifdef RADIX_MPATH - /* - * for RTM_CHANGE/LOCK, if we got multipath routes, - * we require users to specify a matching RTAX_GATEWAY. - * - * for RTM_GET, gate is optional even with multipath. - * if gate == NULL the first match is returned. - * (no need to call rt_mpath_matchgate if gate == NULL) - */ - if (rt_mpath_capable(rnh) && - (rtm->rtm_type != RTM_GET || info.rti_info[RTAX_GATEWAY])) { - rt = rt_mpath_matchgate(rt, info.rti_info[RTAX_GATEWAY]); - if (!rt) { - RIB_RUNLOCK(rnh); - senderr(ESRCH); - } - } -#endif - /* - * If performing proxied L2 entry insertion, and - * the actual PPP host entry is found, perform - * another search to retrieve the prefix route of - * the local end point of the PPP link. - */ - if (rtm->rtm_flags & RTF_ANNOUNCE) { - struct sockaddr laddr; - - if (rt->rt_ifp != NULL && - rt->rt_ifp->if_type == IFT_PROPVIRTUAL) { - struct epoch_tracker et; - struct ifaddr *ifa; - - NET_EPOCH_ENTER(et); - ifa = ifa_ifwithnet(info.rti_info[RTAX_DST], 1, - RT_ALL_FIBS); - NET_EPOCH_EXIT(et); - if (ifa != NULL) - rt_maskedcopy(ifa->ifa_addr, - &laddr, - ifa->ifa_netmask); - } else - rt_maskedcopy(rt->rt_ifa->ifa_addr, - &laddr, - rt->rt_ifa->ifa_netmask); - /* - * refactor rt and no lock operation necessary - */ - rt = (struct rtentry *)rnh->rnh_matchaddr(&laddr, - &rnh->head); - if (rt == NULL) { - RIB_RUNLOCK(rnh); - senderr(ESRCH); - } - } - RT_LOCK(rt); - RT_ADDREF(rt); - RIB_RUNLOCK(rnh); - report: RT_LOCK_ASSERT(rt); - if ((rt->rt_flags & RTF_HOST) == 0 - ? jailed_without_vnet(curthread->td_ucred) - : prison_if(curthread->td_ucred, - rt_key(rt)) != 0) { + if (!can_export_rte(curthread->td_ucred, rt)) { RT_UNLOCK(rt); senderr(ESRCH); } - info.rti_info[RTAX_DST] = rt_key(rt); - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; - info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask(rt_key(rt), - rt_mask(rt), &ss); - info.rti_info[RTAX_GENMASK] = 0; - if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) { - ifp = rt->rt_ifp; - if (ifp) { - info.rti_info[RTAX_IFP] = - ifp->if_addr->ifa_addr; - error = rtm_get_jailed(&info, ifp, rt, - &saun, curthread->td_ucred); - if (error != 0) { - RT_UNLOCK(rt); - senderr(error); - } - if (ifp->if_flags & IFF_POINTOPOINT) - info.rti_info[RTAX_BRD] = - rt->rt_ifa->ifa_dstaddr; - rtm->rtm_index = ifp->if_index; - } else { - info.rti_info[RTAX_IFP] = NULL; - info.rti_info[RTAX_IFA] = NULL; - } - } else if ((ifp = rt->rt_ifp) != NULL) { - rtm->rtm_index = ifp->if_index; - } + error = update_rtm_from_rte(&info, &rtm, alloc_len, rt); + /* + * Note that some sockaddr pointers may have changed to + * point to memory outsize @rtm. Some may be pointing + * to the on-stack variables. + * Given that, any pointer in @info CANNOT BE USED. + */ - /* Check if we need to realloc storage */ - rtsock_msg_buffer(rtm->rtm_type, &info, NULL, &len); - if (len > alloc_len) { - struct rt_msghdr *new_rtm; - new_rtm = malloc(len, M_TEMP, M_NOWAIT); - if (new_rtm == NULL) { - RT_UNLOCK(rt); - senderr(ENOBUFS); - } - bcopy(rtm, new_rtm, rtm->rtm_msglen); - free(rtm, M_TEMP); - rtm = new_rtm; - alloc_len = len; - } - - w.w_tmem = (caddr_t)rtm; - w.w_tmemsize = alloc_len; - rtsock_msg_buffer(rtm->rtm_type, &info, &w, &len); - - if (rt->rt_flags & RTF_GWFLAG_COMPAT) - rtm->rtm_flags = RTF_GATEWAY | - (rt->rt_flags & ~RTF_GWFLAG_COMPAT); - else - rtm->rtm_flags = rt->rt_flags; - rt_getmetrics(rt, &rtm->rtm_rmx); - rtm->rtm_addrs = info.rti_addrs; - + /* + * scopeid deembedding has been performed while + * writing updated rtm in rtsock_msg_buffer(). + * With that in mind, skip deembedding procedure below. + */ + rti_need_deembed = 0; RT_UNLOCK(rt); + if (error != 0) + senderr(error); break; default: @@ -903,22 +982,9 @@ flush: NET_EPOCH_EXIT(et); if (rt != NULL) RTFREE(rt); - /* - * Check to see if we don't want our own messages. - */ - if ((so->so_options & SO_USELOOPBACK) == 0) { - if (V_route_cb.any_count <= 1) { - if (rtm != NULL) - free(rtm, M_TEMP); - m_freem(m); - return (error); - } - /* There is another listener, so construct message */ - rp = sotorawcb(so); - } - if (rtm != NULL) { #ifdef INET6 + if (rtm != NULL) { if (rti_need_deembed) { /* sin6_scope_id is recovered before sending rtm. */ sin6 = (struct sockaddr_in6 *)&ss; @@ -933,9 +999,41 @@ flush: sizeof(*sin6)); } } + } #endif - if (error != 0) - rtm->rtm_errno = error; + send_rtm_reply(so, rtm, m, saf, fibnum, error); + + return (error); +} + +/* + * Sends the prepared reply message in @rtm to all rtsock clients. + * Frees @m and @rtm. + * + */ +static void +send_rtm_reply(struct socket *so, struct rt_msghdr *rtm, struct mbuf *m, + sa_family_t saf, u_int fibnum, int rtm_errno) +{ + struct rawcb *rp = NULL; + + /* + * Check to see if we don't want our own messages. + */ + if ((so->so_options & SO_USELOOPBACK) == 0) { + if (V_route_cb.any_count <= 1) { + if (rtm != NULL) + free(rtm, M_TEMP); + m_freem(m); + return; + } + /* There is another listener, so construct message */ + rp = sotorawcb(so); + } + + if (rtm != NULL) { + if (rtm_errno!= 0) + rtm->rtm_errno = rtm_errno; else rtm->rtm_flags |= RTF_DONE; @@ -963,10 +1061,9 @@ flush: } else rt_dispatch(m, saf); } - - return (error); } + static void rt_getmetrics(const struct rtentry *rt, struct rt_metrics *out) { @@ -1563,6 +1660,22 @@ rt_dispatch(struct mbuf *m, sa_family_t saf) } /* + * Checks if rte can be exported v.r.t jails/vnets. + * + * Returns 1 if it can, 0 otherwise. + */ +static int +can_export_rte(struct ucred *td_ucred, const struct rtentry *rt) +{ + + if ((rt->rt_flags & RTF_HOST) == 0 + ? jailed_without_vnet(td_ucred) + : prison_if(td_ucred, rt_key_const(rt)) != 0) + return (0); + return (1); +} + +/* * This is used in dumping the kernel table via sysctl(). */ static int @@ -1578,9 +1691,7 @@ sysctl_dumpentry(struct radix_node *rn, void *vw) if (w->w_op == NET_RT_FLAGS && !(rt->rt_flags & w->w_arg)) return 0; - if ((rt->rt_flags & RTF_HOST) == 0 - ? jailed_without_vnet(w->w_req->td->td_ucred) - : prison_if(w->w_req->td->td_ucred, rt_key(rt)) != 0) + if (!can_export_rte(w->w_req->td->td_ucred, rt)) return (0); bzero((caddr_t)&info, sizeof(info)); info.rti_info[RTAX_DST] = rt_key(rt); Modified: head/sys/sys/jail.h ============================================================================== --- head/sys/sys/jail.h Tue Dec 31 16:15:47 2019 (r356235) +++ head/sys/sys/jail.h Tue Dec 31 17:26:53 2019 (r356236) @@ -414,7 +414,7 @@ int prison_restrict_ip6(struct prison *, struct in6_ad int prison_qcmp_v6(const void *, const void *); #endif int prison_check_af(struct ucred *cred, int af); -int prison_if(struct ucred *cred, struct sockaddr *sa); +int prison_if(struct ucred *cred, const struct sockaddr *sa); char *prison_name(struct prison *, struct prison *); int prison_priv_check(struct ucred *cred, int priv); int sysctl_jail_param(SYSCTL_HANDLER_ARGS); From owner-svn-src-head@freebsd.org Tue Dec 31 17:57:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A9791DA3A7; Tue, 31 Dec 2019 17:57:13 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nMSn1H8Hz4XZL; Tue, 31 Dec 2019 17:57:13 +0000 (UTC) (envelope-from melifaro@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 272AB1DE8E; Tue, 31 Dec 2019 17:57:13 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVHvD0L013705; Tue, 31 Dec 2019 17:57:13 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVHvDKr013704; Tue, 31 Dec 2019 17:57:13 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201912311757.xBVHvDKr013704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 31 Dec 2019 17:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356237 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 356237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 17:57:13 -0000 Author: melifaro Date: Tue Dec 31 17:57:12 2019 New Revision: 356237 URL: https://svnweb.freebsd.org/changeset/base/356237 Log: Fix NOINET6 build broken by r356236. MFC after: 2 weeks Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Tue Dec 31 17:26:53 2019 (r356236) +++ head/sys/net/rtsock.c Tue Dec 31 17:57:12 2019 (r356237) @@ -841,9 +841,9 @@ route_output(struct mbuf *m, struct socket *so, ...) struct rt_msghdr *rtm = NULL; struct rtentry *rt = NULL; struct rt_addrinfo info; - struct sockaddr_storage ss; struct epoch_tracker et; #ifdef INET6 + struct sockaddr_storage ss; struct sockaddr_in6 *sin6; int i, rti_need_deembed = 0; #endif @@ -968,7 +968,9 @@ report: * writing updated rtm in rtsock_msg_buffer(). * With that in mind, skip deembedding procedure below. */ +#ifdef INET6 rti_need_deembed = 0; +#endif RT_UNLOCK(rt); if (error != 0) senderr(error); From owner-svn-src-head@freebsd.org Tue Dec 31 18:58:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 629FE1DB611; Tue, 31 Dec 2019 18:58:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nNqV2245z4b67; Tue, 31 Dec 2019 18:58:30 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FFD71E972; Tue, 31 Dec 2019 18:58:30 +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 xBVIwUrs048910; Tue, 31 Dec 2019 18:58:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVIwUSh048909; Tue, 31 Dec 2019 18:58:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912311858.xBVIwUSh048909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 31 Dec 2019 18:58:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356240 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 356240 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 18:58:30 -0000 Author: mav Date: Tue Dec 31 18:58:29 2019 New Revision: 356240 URL: https://svnweb.freebsd.org/changeset/base/356240 Log: Relax locking of carp_forus(). This fixes deadlock between CARP and bridge. Bridge calls this function taking CARP lock while holding bridge lock. Same time CARP tries to send its announcements via the bridge while holding CARP lock. Use of CARP_LOCK() here does not solve anything, since sc_addr is constant while race on sc_state is harmless and use of the lock does not close it. Reviewed by: glebius MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Tue Dec 31 18:28:25 2019 (r356239) +++ head/sys/netinet/ip_carp.c Tue Dec 31 18:58:29 2019 (r356240) @@ -1230,14 +1230,15 @@ carp_forus(struct ifnet *ifp, u_char *dhost) CIF_LOCK(ifp->if_carp); IFNET_FOREACH_CARP(ifp, sc) { - CARP_LOCK(sc); + /* + * CARP_LOCK() is not here, since would protect nothing, but + * cause deadlock with if_bridge, calling this under its lock. + */ if (sc->sc_state == MASTER && !bcmp(dhost, LLADDR(&sc->sc_addr), ETHER_ADDR_LEN)) { - CARP_UNLOCK(sc); CIF_UNLOCK(ifp->if_carp); return (1); } - CARP_UNLOCK(sc); } CIF_UNLOCK(ifp->if_carp); From owner-svn-src-head@freebsd.org Tue Dec 31 22:01:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AACBF1DE4B0; Tue, 31 Dec 2019 22:01:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nStF47PBz3FhR; Tue, 31 Dec 2019 22:01:09 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 890A9209A7; Tue, 31 Dec 2019 22:01:09 +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 xBVM19U3057559; Tue, 31 Dec 2019 22:01:09 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVM1889057554; Tue, 31 Dec 2019 22:01:08 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912312201.xBVM1889057554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 31 Dec 2019 22:01:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356241 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Commit-Revision: 356241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 22:01:09 -0000 Author: trasz Date: Tue Dec 31 22:01:08 2019 New Revision: 356241 URL: https://svnweb.freebsd.org/changeset/base/356241 Log: Add basic getcpu(2) support to linuxulator. The purpose of this syscall is to query the CPU number and the NUMA domain the calling thread is currently running on. The third argument is ignored. It doesn't do anything regarding scheduling - it's literally just a way to query the current state, without any guarantees you won't get rescheduled an opcode later. This unbreaks Java from CentOS 8 (java-11-openjdk-11.0.5.10-0.el8_0.x86_64). Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22972 Modified: head/sys/amd64/linux/linux_dummy.c head/sys/amd64/linux32/linux32_dummy.c head/sys/arm64/linux/linux_dummy.c head/sys/compat/linux/linux_misc.c head/sys/i386/linux/linux_dummy.c Modified: head/sys/amd64/linux/linux_dummy.c ============================================================================== --- head/sys/amd64/linux/linux_dummy.c Tue Dec 31 18:58:29 2019 (r356240) +++ head/sys/amd64/linux/linux_dummy.c Tue Dec 31 22:01:08 2019 (r356241) @@ -102,8 +102,6 @@ DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ DUMMY(move_pages); -/* Linux 2.6.19: */ -DUMMY(getcpu); /* Linux 2.6.22: */ DUMMY(signalfd); /* Linux 2.6.27: */ Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Tue Dec 31 18:58:29 2019 (r356240) +++ head/sys/amd64/linux32/linux32_dummy.c Tue Dec 31 22:01:08 2019 (r356241) @@ -108,8 +108,6 @@ DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ DUMMY(move_pages); -/* Linux 2.6.19: */ -DUMMY(getcpu); /* Linux 2.6.22: */ DUMMY(signalfd); /* Linux 2.6.27: */ Modified: head/sys/arm64/linux/linux_dummy.c ============================================================================== --- head/sys/arm64/linux/linux_dummy.c Tue Dec 31 18:58:29 2019 (r356240) +++ head/sys/arm64/linux/linux_dummy.c Tue Dec 31 22:01:08 2019 (r356241) @@ -104,8 +104,6 @@ DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ DUMMY(move_pages); -/* Linux 2.6.19: */ -DUMMY(getcpu); /* Linux 2.6.27: */ DUMMY(signalfd4); DUMMY(inotify_init1); Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Tue Dec 31 18:58:29 2019 (r356240) +++ head/sys/compat/linux/linux_misc.c Tue Dec 31 22:01:08 2019 (r356241) @@ -2353,3 +2353,19 @@ out: td->td_retval[0] = dst - args->buf; return (error); } + +int +linux_getcpu(struct thread *td, struct linux_getcpu_args *args) +{ + int cpu, error, node; + + cpu = td->td_oncpu; /* Make sure it doesn't change during copyout(9) */ + error = 0; + node = 0; /* XXX: Fake NUMA node 0 for now */ + + if (args->cpu != NULL) + error = copyout(&cpu, args->cpu, sizeof(l_int)); + if (args->node != NULL) + error = copyout(&node, args->node, sizeof(l_int)); + return (error); +} Modified: head/sys/i386/linux/linux_dummy.c ============================================================================== --- head/sys/i386/linux/linux_dummy.c Tue Dec 31 18:58:29 2019 (r356240) +++ head/sys/i386/linux/linux_dummy.c Tue Dec 31 22:01:08 2019 (r356241) @@ -104,8 +104,6 @@ DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ DUMMY(move_pages); -/* Linux 2.6.19: */ -DUMMY(getcpu); /* Linux 2.6.22: */ DUMMY(signalfd); /* Linux 2.6.27: */ From owner-svn-src-head@freebsd.org Tue Dec 31 22:16:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 148C51DE7FD; Tue, 31 Dec 2019 22:16:36 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nTD36KR5z3GMd; Tue, 31 Dec 2019 22:16:35 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: by mail-io1-f65.google.com with SMTP id c16so31448682ioo.8; Tue, 31 Dec 2019 14:16:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=agObeIW9YxLNGryBO4HTC7puIlTeGpXi8Uf3p03rCrs=; b=uhXELx2rlcOJNOlhM/7+k5z9VJniiOXEjVfNQp0mdYhDlbHwr7S8DGYkat+VmhrXI1 TEB6WZzoBbJvvBi1mV7MkQX5NwndAB3bvBQKRIGYWNFJ6c3lBtXfbry0bCGaK2EwFaLC thepVt6FnnIEM5Wa0Gf51PKbXa7NNl4EpPoofhY4yyAuB0e/yp3QSHYNqGQdm/nwg8GH PgBfb5ieS5A0m3bJZYf27X6fzxdooAGdmfEiOD9BM2M+dQjeN5hS6uzUcqaBYiStMgc0 /s1poHazzQaH0sgT9BaPRiyZdDJXJ+rTuldCQrSxHYPzapgs4ijMyLv9TcyxBhtKjT2X DFQw== X-Gm-Message-State: APjAAAXjavGSdGWHRSebstsNTSMxzX33NfCvwTGwH/eiUAPAskXzwTS7 U8uRGS2e1RTZUmPFzzguqanQzW1dmU8w0wzZXiLoxw== X-Google-Smtp-Source: APXvYqwY582Ncilck8ttyPD/leO3izS65K+TNnTqZal4MfkfSm3v4XkdhdiMwsYE2RkINIWgbKWA7ChWxrhXqfXxhO0= X-Received: by 2002:a05:6638:5b6:: with SMTP id b22mr59772513jar.6.1577830594228; Tue, 31 Dec 2019 14:16:34 -0800 (PST) MIME-Version: 1.0 References: <201912312201.xBVM1889057554@repo.freebsd.org> In-Reply-To: <201912312201.xBVM1889057554@repo.freebsd.org> From: Dmitry Chagin Date: Wed, 1 Jan 2020 01:16:23 +0300 Message-ID: Subject: Re: svn commit: r356241 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 47nTD36KR5z3GMd X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 22:16:36 -0000 Hi, HNY! What about vdso? =D1=81=D1=80, 1 =D1=8F=D0=BD=D0=B2. 2020 =D0=B3. =D0=B2 01:01, Edward Tomas= z Napierala : > Author: trasz > Date: Tue Dec 31 22:01:08 2019 > New Revision: 356241 > URL: https://svnweb.freebsd.org/changeset/base/356241 > > Log: > Add basic getcpu(2) support to linuxulator. The purpose of this > syscall is to query the CPU number and the NUMA domain the calling > thread is currently running on. The third argument is ignored. > It doesn't do anything regarding scheduling - it's literally > just a way to query the current state, without any guarantees > you won't get rescheduled an opcode later. > > This unbreaks Java from CentOS 8 > (java-11-openjdk-11.0.5.10-0.el8_0.x86_64). > > Reviewed by: kib > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D22972 > > Modified: > head/sys/amd64/linux/linux_dummy.c > head/sys/amd64/linux32/linux32_dummy.c > head/sys/arm64/linux/linux_dummy.c > head/sys/compat/linux/linux_misc.c > head/sys/i386/linux/linux_dummy.c > > Modified: head/sys/amd64/linux/linux_dummy.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/amd64/linux/linux_dummy.c Tue Dec 31 18:58:29 2019 > (r356240) > +++ head/sys/amd64/linux/linux_dummy.c Tue Dec 31 22:01:08 2019 > (r356241) > @@ -102,8 +102,6 @@ DUMMY(tee); > DUMMY(vmsplice); > /* Linux 2.6.18: */ > DUMMY(move_pages); > -/* Linux 2.6.19: */ > -DUMMY(getcpu); > /* Linux 2.6.22: */ > DUMMY(signalfd); > /* Linux 2.6.27: */ > > Modified: head/sys/amd64/linux32/linux32_dummy.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/amd64/linux32/linux32_dummy.c Tue Dec 31 18:58:29 2019 > (r356240) > +++ head/sys/amd64/linux32/linux32_dummy.c Tue Dec 31 22:01:08 2019 > (r356241) > @@ -108,8 +108,6 @@ DUMMY(tee); > DUMMY(vmsplice); > /* Linux 2.6.18: */ > DUMMY(move_pages); > -/* Linux 2.6.19: */ > -DUMMY(getcpu); > /* Linux 2.6.22: */ > DUMMY(signalfd); > /* Linux 2.6.27: */ > > Modified: head/sys/arm64/linux/linux_dummy.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/arm64/linux/linux_dummy.c Tue Dec 31 18:58:29 2019 > (r356240) > +++ head/sys/arm64/linux/linux_dummy.c Tue Dec 31 22:01:08 2019 > (r356241) > @@ -104,8 +104,6 @@ DUMMY(tee); > DUMMY(vmsplice); > /* Linux 2.6.18: */ > DUMMY(move_pages); > -/* Linux 2.6.19: */ > -DUMMY(getcpu); > /* Linux 2.6.27: */ > DUMMY(signalfd4); > DUMMY(inotify_init1); > > Modified: head/sys/compat/linux/linux_misc.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/compat/linux/linux_misc.c Tue Dec 31 18:58:29 2019 > (r356240) > +++ head/sys/compat/linux/linux_misc.c Tue Dec 31 22:01:08 2019 > (r356241) > @@ -2353,3 +2353,19 @@ out: > td->td_retval[0] =3D dst - args->buf; > return (error); > } > + > +int > +linux_getcpu(struct thread *td, struct linux_getcpu_args *args) > +{ > + int cpu, error, node; > + > + cpu =3D td->td_oncpu; /* Make sure it doesn't change during > copyout(9) */ > + error =3D 0; > + node =3D 0; /* XXX: Fake NUMA node 0 for now */ > + > + if (args->cpu !=3D NULL) > + error =3D copyout(&cpu, args->cpu, sizeof(l_int)); > + if (args->node !=3D NULL) > + error =3D copyout(&node, args->node, sizeof(l_int)); > + return (error); > +} > > Modified: head/sys/i386/linux/linux_dummy.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/i386/linux/linux_dummy.c Tue Dec 31 18:58:29 2019 > (r356240) > +++ head/sys/i386/linux/linux_dummy.c Tue Dec 31 22:01:08 2019 > (r356241) > @@ -104,8 +104,6 @@ DUMMY(tee); > DUMMY(vmsplice); > /* Linux 2.6.18: */ > DUMMY(move_pages); > -/* Linux 2.6.19: */ > -DUMMY(getcpu); > /* Linux 2.6.22: */ > DUMMY(signalfd); > /* Linux 2.6.27: */ > From owner-svn-src-head@freebsd.org Tue Dec 31 22:19:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76F441DE947; Tue, 31 Dec 2019 22:19:34 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nTHV2ZRKz3GXY; Tue, 31 Dec 2019 22:19:34 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53A2620D03; Tue, 31 Dec 2019 22:19:34 +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 xBVMJYnE067970; Tue, 31 Dec 2019 22:19:34 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVMJYxJ067969; Tue, 31 Dec 2019 22:19:34 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912312219.xBVMJYxJ067969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 31 Dec 2019 22:19:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356242 - head/usr.bin/nfsstat X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/usr.bin/nfsstat X-SVN-Commit-Revision: 356242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 22:19:34 -0000 Author: rmacklem Date: Tue Dec 31 22:19:33 2019 New Revision: 356242 URL: https://svnweb.freebsd.org/changeset/base/356242 Log: Get rid of old nfsstat options no longer used. The "-M" and "-N" options for nfsstat were used by the old NFS code and have never done anything for the new NFS code. This patch replaces code that assigns values to variables that are never used with printf()s noting the options are ignored. This has the side effect that it gets rid of warnings w.r.t. these variables being assigned but never used, that occur for some builds. Noticed during integration of the NFSv4.2 code. Modified: head/usr.bin/nfsstat/nfsstat.c Modified: head/usr.bin/nfsstat/nfsstat.c ============================================================================== --- head/usr.bin/nfsstat/nfsstat.c Tue Dec 31 22:01:08 2019 (r356241) +++ head/usr.bin/nfsstat/nfsstat.c Tue Dec 31 22:19:33 2019 (r356242) @@ -149,14 +149,12 @@ main(int argc, char **argv) int serverOnly = -1; int newStats = 0; int ch; - char *memf, *nlistf; int mntlen, i; char buf[1024]; struct statfs *mntbuf; struct nfscl_dumpmntopts dumpmntopts; interval = 0; - memf = nlistf = NULL; argc = xo_parse_args(argc, argv); if (argc < 0) @@ -167,7 +165,7 @@ main(int argc, char **argv) while ((ch = getopt(argc, argv, "cdEesWM:mN:w:zq")) != -1) switch(ch) { case 'M': - memf = optarg; + printf("*** -M option deprecated, ignored\n\n"); break; case 'm': /* Display mount options for NFS mount points. */ @@ -191,7 +189,7 @@ main(int argc, char **argv) } exit(0); case 'N': - nlistf = optarg; + printf("*** -N option deprecated, ignored\n\n"); break; case 'W': widemode = 1; @@ -239,14 +237,8 @@ main(int argc, char **argv) #define BACKWARD_COMPATIBILITY #ifdef BACKWARD_COMPATIBILITY - if (*argv) { + if (*argv) interval = atoi(*argv); - if (*++argv) { - nlistf = *argv; - if (*++argv) - memf = *argv; - } - } #endif if (modfind("nfscommon") < 0) xo_err(1, "NFS client/server not loaded"); @@ -529,7 +521,7 @@ static void usage(void) { (void)fprintf(stderr, - "usage: nfsstat [-cdemszW] [-M core] [-N system] [-w wait]\n"); + "usage: nfsstat [-cdemszW] [-w wait]\n"); exit(1); } From owner-svn-src-head@freebsd.org Tue Dec 31 22:20:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D05F1DEA46; Tue, 31 Dec 2019 22:20:55 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nTK26ddLz3Gj3; Tue, 31 Dec 2019 22:20:54 +0000 (UTC) (envelope-from dougm@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF13520D29; Tue, 31 Dec 2019 22:20:54 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBVMKsjp068918; Tue, 31 Dec 2019 22:20:54 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVMKshB068917; Tue, 31 Dec 2019 22:20:54 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201912312220.xBVMKshB068917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Tue, 31 Dec 2019 22:20:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356243 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356243 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 22:20:55 -0000 Author: dougm Date: Tue Dec 31 22:20:54 2019 New Revision: 356243 URL: https://svnweb.freebsd.org/changeset/base/356243 Log: The map-entry clipping functions modify start and end entries of an entry in the vm_map, making invariants related to the max_free entry field invalid. Move the clipping work into vm_map_entry_link, so that linking is okay when the new entry clips a current entry, and the vm_map doesn't have to be briefly corrupted. Change assertions and conditions in SPLAY_{LEFT,RIGHT}_STEP since the max_free invariants can now be trusted in all cases. Tested by: pho Reviewed by: alc Differential Revision: https://reviews.freebsd.org/D22897 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Tue Dec 31 22:19:33 2019 (r356242) +++ head/sys/vm/vm_map.c Tue Dec 31 22:20:54 2019 (r356243) @@ -1028,9 +1028,11 @@ vm_size_max(vm_size_t a, vm_size_t b) */ \ y = root->left; \ max_free = root->max_free; \ - KASSERT(max_free >= vm_map_entry_max_free_right(root, rlist), \ + KASSERT(max_free == vm_size_max( \ + vm_map_entry_max_free_left(root, llist), \ + vm_map_entry_max_free_right(root, rlist)), \ ("%s: max_free invariant fails", __func__)); \ - if (y == llist ? max_free > 0 : max_free - 1 < y->max_free) \ + if (max_free - 1 < vm_map_entry_max_free_left(root, llist)) \ max_free = vm_map_entry_max_free_right(root, rlist); \ if (y != llist && (test)) { \ /* Rotate right and make y root. */ \ @@ -1067,9 +1069,11 @@ vm_size_max(vm_size_t a, vm_size_t b) */ \ y = root->right; \ max_free = root->max_free; \ - KASSERT(max_free >= vm_map_entry_max_free_left(root, llist), \ + KASSERT(max_free == vm_size_max( \ + vm_map_entry_max_free_left(root, llist), \ + vm_map_entry_max_free_right(root, rlist)), \ ("%s: max_free invariant fails", __func__)); \ - if (y == rlist ? max_free > 0 : max_free - 1 < y->max_free) \ + if (max_free - 1 < vm_map_entry_max_free_right(root, rlist)) \ max_free = vm_map_entry_max_free_left(root, llist); \ if (y != rlist && (test)) { \ /* Rotate left and make y root. */ \ @@ -1356,12 +1360,17 @@ vm_map_splay(vm_map_t map, vm_offset_t addr) /* * vm_map_entry_{un,}link: * - * Insert/remove entries from maps. + * Insert/remove entries from maps. On linking, if new entry clips + * existing entry, trim existing entry to avoid overlap, and manage + * offsets. On unlinking, merge disappearing entry with neighbor, if + * called for, and manage offsets. Callers should not modify fields in + * entries already mapped. */ static void vm_map_entry_link(vm_map_t map, vm_map_entry_t entry) { vm_map_entry_t header, llist, rlist, root; + vm_size_t max_free_left, max_free_right; CTR3(KTR_VM, "vm_map_entry_link: map %p, nentries %d, entry %p", map, @@ -1370,13 +1379,48 @@ vm_map_entry_link(vm_map_t map, vm_map_entry_t entry) map->nentries++; header = &map->header; root = vm_map_splay_split(map, entry->start, 0, &llist, &rlist); - KASSERT(root == NULL, - ("vm_map_entry_link: link object already mapped")); - root = entry; - root->max_free = vm_size_max( - vm_map_splay_merge_pred(header, root, llist), - vm_map_splay_merge_succ(header, root, rlist)); - map->root = root; + if (root == NULL) { + /* + * The new entry does not overlap any existing entry in the + * map, so it becomes the new root of the map tree. + */ + max_free_left = vm_map_splay_merge_pred(header, entry, llist); + max_free_right = vm_map_splay_merge_succ(header, entry, rlist); + } else if (entry->start == root->start) { + /* + * The new entry is a clone of root, with only the end field + * changed. The root entry will be shrunk to abut the new + * entry, and will be the right child of the new root entry in + * the modified map. + */ + KASSERT(entry->end < root->end, + ("%s: clip_start not within entry", __func__)); + vm_map_splay_findprev(root, &llist); + root->offset += entry->end - root->start; + root->start = entry->end; + max_free_left = vm_map_splay_merge_pred(header, entry, llist); + max_free_right = root->max_free = vm_size_max( + vm_map_splay_merge_pred(entry, root, entry), + vm_map_splay_merge_right(header, root, rlist)); + } else { + /* + * The new entry is a clone of root, with only the start field + * changed. The root entry will be shrunk to abut the new + * entry, and will be the left child of the new root entry in + * the modified map. + */ + KASSERT(entry->end == root->end, + ("%s: clip_start not within entry", __func__)); + vm_map_splay_findnext(root, &rlist); + entry->offset += entry->start - root->start; + root->end = entry->start; + max_free_left = root->max_free = vm_size_max( + vm_map_splay_merge_left(header, root, llist), + vm_map_splay_merge_succ(entry, root, entry)); + max_free_right = vm_map_splay_merge_succ(header, entry, rlist); + } + entry->max_free = vm_size_max(max_free_left, max_free_right); + map->root = entry; VM_MAP_ASSERT_CONSISTENT(map); } @@ -2359,8 +2403,6 @@ _vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, * so that this entry has the specified starting address. */ new_entry->end = start; - entry->offset += (start - entry->start); - entry->start = start; vm_map_entry_link(map, new_entry); } @@ -2396,8 +2438,7 @@ _vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, v * Split off the back portion. Insert the new entry AFTER this one, * so that this entry has the specified ending address. */ - new_entry->start = entry->end = end; - new_entry->offset += (end - entry->start); + new_entry->start = end; vm_map_entry_link(map, new_entry); } From owner-svn-src-head@freebsd.org Tue Dec 31 22:25:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C43B1DEC9F; Tue, 31 Dec 2019 22:25:07 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nTPv38GHz3H3b; Tue, 31 Dec 2019 22:25:07 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62DCF20EC1; Tue, 31 Dec 2019 22:25:07 +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 xBVMP7YJ073463; Tue, 31 Dec 2019 22:25:07 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBVMP7GS073462; Tue, 31 Dec 2019 22:25:07 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912312225.xBVMP7GS073462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 31 Dec 2019 22:25:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356244 - head/usr.bin/nfsstat X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/usr.bin/nfsstat X-SVN-Commit-Revision: 356244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2019 22:25:07 -0000 Author: rmacklem Date: Tue Dec 31 22:25:06 2019 New Revision: 356244 URL: https://svnweb.freebsd.org/changeset/base/356244 Log: Update the man page to reflect that "-M" and "-N" are deprecated and ignored. r356242 updated nfsstat.c to report that the "-M" and "-N" options were being ignored. These options have never had any meaning for the new NFS code (which is now the only NFS code). This patch updates the man page to reflect this. This is a content change. Modified: head/usr.bin/nfsstat/nfsstat.1 Modified: head/usr.bin/nfsstat/nfsstat.1 ============================================================================== --- head/usr.bin/nfsstat/nfsstat.1 Tue Dec 31 22:20:54 2019 (r356243) +++ head/usr.bin/nfsstat/nfsstat.1 Tue Dec 31 22:25:06 2019 (r356244) @@ -28,7 +28,7 @@ .\" From: @(#)nfsstat.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd December 21, 2019 +.Dd December 31, 2019 .Dt NFSSTAT 1 .Os .Sh NAME @@ -40,8 +40,6 @@ statistics .Nm .Op Fl -libxo .Op Fl cdEemszW -.Op Fl M Ar core -.Op Fl N Ar system .Op Fl w Ar wait .Sh DESCRIPTION The @@ -94,17 +92,14 @@ or .Fl E can be specified. .It Fl M -Extract values associated with the name list from the specified core -instead of the default -.Pa /dev/kmem . +Deprecated and ignored. .It Fl m Report the mount options for all NFS client mounts. This option overrides all others and .Nm will exit after completing the report. .It Fl N -Extract the name list from the specified system instead of the default -.Pa /boot/kernel/kernel . +Deprecated and ignored. .It Fl s Only display server side statistics. .It Fl W @@ -133,13 +128,6 @@ in a selection of different human and machine readable See .Xr xo_parse_args 3 for details on command line arguments. -.El -.Sh FILES -.Bl -tag -width ".Pa /boot/kernel/kernel" -compact -.It Pa /boot/kernel/kernel -default kernel namelist -.It Pa /dev/kmem -default memory file .El .Sh SEE ALSO .Xr fstat 1 , From owner-svn-src-head@freebsd.org Wed Jan 1 00:35:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 010FD1E13C2; Wed, 1 Jan 2020 00:35:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nXHq5v3kz3NKF; Wed, 1 Jan 2020 00:35:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C409F22609; Wed, 1 Jan 2020 00:35:03 +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 0010Z36h050523; Wed, 1 Jan 2020 00:35:03 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0010Z3sv050520; Wed, 1 Jan 2020 00:35:03 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202001010035.0010Z3sv050520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 1 Jan 2020 00:35:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356245 - in head/sys: dev/random dev/vmgenc sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: dev/random dev/vmgenc sys X-SVN-Commit-Revision: 356245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 00:35:04 -0000 Author: cem Date: Wed Jan 1 00:35:02 2020 New Revision: 356245 URL: https://svnweb.freebsd.org/changeset/base/356245 Log: vmgenid(4): Integrate as a random(4) source The number is public and has no "entropy," but should be integrated quickly on VM rewind events to avoid duplicate sequences. Approved by: csprng(markm) Differential Revision: https://reviews.freebsd.org/D22946 Modified: head/sys/dev/random/fortuna.c head/sys/dev/random/random_harvestq.c head/sys/dev/vmgenc/vmgenc_acpi.c head/sys/sys/random.h Modified: head/sys/dev/random/fortuna.c ============================================================================== --- head/sys/dev/random/fortuna.c Tue Dec 31 22:25:06 2019 (r356244) +++ head/sys/dev/random/fortuna.c Wed Jan 1 00:35:02 2020 (r356245) @@ -359,6 +359,13 @@ random_fortuna_process_event(struct harvest_event *eve */ pl = event->he_destination % RANDOM_FORTUNA_NPOOLS; /* + * If a VM generation ID changes (clone and play or VM rewind), we want + * to incorporate that as soon as possible. Override destingation pool + * for immediate next use. + */ + if (event->he_source == RANDOM_PURE_VMGENID) + pl = 0; + /* * We ignore low entropy static/counter fields towards the end of the * he_event structure in order to increase measurable entropy when * conducting SP800-90B entropy analysis measurements of seed material Modified: head/sys/dev/random/random_harvestq.c ============================================================================== --- head/sys/dev/random/random_harvestq.c Tue Dec 31 22:25:06 2019 (r356244) +++ head/sys/dev/random/random_harvestq.c Wed Jan 1 00:35:02 2020 (r356245) @@ -354,6 +354,7 @@ static const char *random_source_descr[ENTROPYSOURCE] [RANDOM_PURE_CCP] = "PURE_CCP", [RANDOM_PURE_DARN] = "PURE_DARN", [RANDOM_PURE_TPM] = "PURE_TPM", + [RANDOM_PURE_VMGENID] = "VMGENID", /* "ENTROPYSOURCE" */ }; Modified: head/sys/dev/vmgenc/vmgenc_acpi.c ============================================================================== --- head/sys/dev/vmgenc/vmgenc_acpi.c Tue Dec 31 22:25:06 2019 (r356244) +++ head/sys/dev/vmgenc/vmgenc_acpi.c Wed Jan 1 00:35:02 2020 (r356245) @@ -52,12 +52,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include +#include #include #ifndef ACPI_NOTIFY_STATUS_CHANGED @@ -80,6 +82,20 @@ struct vmgenc_softc { }; static void +vmgenc_harvest_all(const void *p, size_t sz) +{ + size_t nbytes; + + while (sz > 0) { + nbytes = MIN(sz, + sizeof(((struct harvest_event *)0)->he_entropy)); + random_harvest_direct(p, nbytes, RANDOM_PURE_VMGENID); + p = (const char *)p + nbytes; + sz -= nbytes; + } +} + +static void vmgenc_status_changed(void *context) { uint8_t guid[GUID_BYTES]; @@ -97,6 +113,8 @@ vmgenc_status_changed(void *context) /* Update cache. */ memcpy(sc->vmg_cache_guid, guid, GUID_BYTES); + vmgenc_harvest_all(sc->vmg_cache_guid, sizeof(sc->vmg_cache_guid)); + EVENTHANDLER_INVOKE(acpi_vmgenc_event); acpi_UserNotify("VMGenerationCounter", acpi_get_handle(dev), 0); } @@ -219,6 +237,9 @@ vmgenc_attach(device_t dev) memcpy(sc->vmg_cache_guid, __DEVOLATILE(void *, sc->vmg_pguid), sizeof(sc->vmg_cache_guid)); + random_harvest_register_source(RANDOM_PURE_VMGENID); + vmgenc_harvest_all(sc->vmg_cache_guid, sizeof(sc->vmg_cache_guid)); + AcpiInstallNotifyHandler(h, ACPI_DEVICE_NOTIFY, vmgenc_notify, dev); return (0); } @@ -238,3 +259,4 @@ static driver_t vmgenc_driver = { static devclass_t vmgenc_devclass; DRIVER_MODULE(vmgenc, acpi, vmgenc_driver, vmgenc_devclass, NULL, NULL); MODULE_DEPEND(vmgenc, acpi, 1, 1, 1); +MODULE_DEPEND(vemgenc, random_harvestq, 1, 1, 1); Modified: head/sys/sys/random.h ============================================================================== --- head/sys/sys/random.h Tue Dec 31 22:25:06 2019 (r356244) +++ head/sys/sys/random.h Wed Jan 1 00:35:02 2020 (r356245) @@ -102,6 +102,7 @@ enum random_entropy_source { RANDOM_PURE_CCP, RANDOM_PURE_DARN, RANDOM_PURE_TPM, + RANDOM_PURE_VMGENID, ENTROPYSOURCE }; _Static_assert(ENTROPYSOURCE <= 32, From owner-svn-src-head@freebsd.org Wed Jan 1 02:37:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34ACD1E37DB; Wed, 1 Jan 2020 02:37:51 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nb1V1yD5z3xvm; Wed, 1 Jan 2020 02:37:49 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pl1-x641.google.com with SMTP id y8so16403661pll.13; Tue, 31 Dec 2019 18:37:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Po6xuQDXVEI5GLsilURv7eOaitTOc/AgjQBnYOxOpw0=; b=UxcBbktDNOzDc+R2YgDFx9t3gJ5Qht7Ga/+Y/Lvp7lgo6ahH8Yf9ancHcnd+C/7mas FxIy/GhWwxZKKZeSam+q9ZippnL6E2JLBi+7l52FImHyjkud+U8jro9NoY9oG/6B8Kg2 n1E8vTj9jYDlwPMZIM7FLZXNUt6pCa18lRHxLcGwWrB9MAxpT8LyaEztqpiAO6Jsb1Pn O3+kdzO5n0cBgKBDz9pBqUtIFBOuQzO6wefwJtTIgWQU0neFY6f5+qZ5ZBt0Lt8irErL SAVJSKhxZlgYueeGOMTUZDrfoFOrefkUOaVWsIbDLbUd/jbZOm5z3siwwl5BDF+RBLew JuaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Po6xuQDXVEI5GLsilURv7eOaitTOc/AgjQBnYOxOpw0=; b=qUPpzMCDS2pUT1QlLFzUFgwIvNte5YQawpq0qhTHn37y99QzPbjHsAYNV6H5bLaxTQ P8EZP4geozJRtB+n4px2mRs9WK8FdqS16N7Z1YRbM5VOoNcxz4YhFDIeZkvIhx3eHaKk e9f4y6i7o3Y90hJXovsGnqpde5qhHsJHPtVQeC86rsW+IcUSXPy40V9LvIJcQLdNlJlO pUf5d/HVvpqEFNPfYqlhuWIqWnZhkKAkWb3HSWzqRuj2/ePO4nOlw+VeEVpWKHayJf3N Ns2i7GWZtr3TCkStXfsxal+GX6RAUYB0g/OYfgujRb0mZr/8PYAteOH3/oSAvJ13sLd8 4bqg== X-Gm-Message-State: APjAAAUSDJqlPBIBzhiZxWw4Ymjb93dDY+wbDjePR3nRsEkYyDakrm1N vi8a83hRXxZSh3JwhpEQq4PUUpBi X-Google-Smtp-Source: APXvYqx0sa9WY1r5g51j3msFMsb/10suu/HI/LjRheYFnYfX0ynEN9ErcZ4G3Y0gsXJf8Jwj0NCHRg== X-Received: by 2002:a17:902:724a:: with SMTP id c10mr79376574pll.39.1577846268347; Tue, 31 Dec 2019 18:37:48 -0800 (PST) Received: from [192.168.1.110] (180-150-68-130.b49644.syd.nbn.aussiebb.net. [180.150.68.130]) by smtp.gmail.com with ESMTPSA id h126sm33384116pfe.19.2019.12.31.18.37.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Dec 2019 18:37:48 -0800 (PST) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r356240 - head/sys/netinet To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912311858.xBVIwUSh048909@repo.freebsd.org> From: Kubilay Kocak Message-ID: Date: Wed, 1 Jan 2020 13:37:44 +1100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Thunderbird/72.0 MIME-Version: 1.0 In-Reply-To: <201912311858.xBVIwUSh048909@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47nb1V1yD5z3xvm X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=UxcBbktD; dmarc=none; spf=pass (mx1.freebsd.org: domain of koobsfreebsd@gmail.com designates 2607:f8b0:4864:20::641 as permitted sender) smtp.mailfrom=koobsfreebsd@gmail.com X-Spamd-Result: default: False [-3.15 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[koobs@FreeBSD.org]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; FORGED_SENDER(0.30)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; IP_SCORE(-0.95)[ip: (-0.68), ipnet: 2607:f8b0::/32(-2.15), asn: 15169(-1.87), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_NEQ_ENVFROM(0.00)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_IN_DNSWL_NONE(0.00)[1.4.6.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 02:37:51 -0000 On 1/01/2020 5:58 am, Alexander Motin wrote: > Author: mav > Date: Tue Dec 31 18:58:29 2019 > New Revision: 356240 > URL: https://svnweb.freebsd.org/changeset/base/356240 > > Log: > Relax locking of carp_forus(). > > This fixes deadlock between CARP and bridge. Bridge calls this function > taking CARP lock while holding bridge lock. Same time CARP tries to send > its announcements via the bridge while holding CARP lock. > > Use of CARP_LOCK() here does not solve anything, since sc_addr is constant > while race on sc_state is harmless and use of the lock does not close it. > > Reviewed by: glebius > MFC after: 2 weeks > Sponsored by: iXsystems, Inc. > > Modified: > head/sys/netinet/ip_carp.c > > Modified: head/sys/netinet/ip_carp.c > ============================================================================== > --- head/sys/netinet/ip_carp.c Tue Dec 31 18:28:25 2019 (r356239) > +++ head/sys/netinet/ip_carp.c Tue Dec 31 18:58:29 2019 (r356240) > @@ -1230,14 +1230,15 @@ carp_forus(struct ifnet *ifp, u_char *dhost) > > CIF_LOCK(ifp->if_carp); > IFNET_FOREACH_CARP(ifp, sc) { > - CARP_LOCK(sc); > + /* > + * CARP_LOCK() is not here, since would protect nothing, but > + * cause deadlock with if_bridge, calling this under its lock. > + */ > if (sc->sc_state == MASTER && !bcmp(dhost, LLADDR(&sc->sc_addr), > ETHER_ADDR_LEN)) { > - CARP_UNLOCK(sc); > CIF_UNLOCK(ifp->if_carp); > return (1); > } > - CARP_UNLOCK(sc); > } > CIF_UNLOCK(ifp->if_carp); > > _______________________________________________ > 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" > Hi Alexander, Is this a only-head-impacted fix, or does the issue impact stable/12,11 too, warranting MFC ? From owner-svn-src-head@freebsd.org Wed Jan 1 02:41:57 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD0F01E3A3D; Wed, 1 Jan 2020 02:41:57 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-vk1-f169.google.com (mail-vk1-f169.google.com [209.85.221.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nb6F4yRPz3yKW; Wed, 1 Jan 2020 02:41:57 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-vk1-f169.google.com with SMTP id d17so9283428vke.5; Tue, 31 Dec 2019 18:41:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cJefTFrXNn8z6GgD+WAgy/8po+JjEM5SHqraUNEOU/M=; b=VXUA0pJCfwHD/odnv7Ehp7VN/ajM2xFwoKF2Pkgc+uJhpX1HVUlu+8jdgGxo1HDi0K Kgbnh7LVSYfR8UlbzwoBnJa2K2zZUQpbRq54j9U96Bc5PZwskwW4NRT4zT6CxOZ/13hf LuxeBZY3ylh/MESV3iid1506cWVYL3IkYr7veGnIg97OBEvkoAK9I6h5tPkHuHZi8z1Q qNTZSTjpIf3Y3YqeiIrroKQdthpCJDmVV9QfR2ZA5EEmStMskLzkQiibM3by9dOrGgvo pCbiuccaQgn3UCWPy1WMEDvm/7bjVbatNzLiFy1XrAKEjTXo9gTQcE8ONCsimVtGozMb +6dw== X-Gm-Message-State: APjAAAXfeM7+dGaiaSSl/v66dM8ZKivXaxxLBynIEsGK9wvSVy1tD6mW LddrMw+4Nb1YBJehOR1Gis80k954tJG+jhcIIlk8+w== X-Google-Smtp-Source: APXvYqxFIPJg11PdqGLDffT0ffvS/rZZAB5bc7mF1jfXIyu+U7dh/t7bqXXuVluOF+nWYNlQdEGXIX5f+7LCUojNck8= X-Received: by 2002:a1f:cec2:: with SMTP id e185mr43469059vkg.22.1577846516162; Tue, 31 Dec 2019 18:41:56 -0800 (PST) MIME-Version: 1.0 References: <201912311858.xBVIwUSh048909@repo.freebsd.org> In-Reply-To: From: Alexander Motin Date: Tue, 31 Dec 2019 21:41:46 -0500 Message-ID: Subject: Re: svn commit: r356240 - head/sys/netinet To: koobs@freebsd.org Cc: src-committers , svn-src-all , svn-src-head@freebsd.org X-Rspamd-Queue-Id: 47nb6F4yRPz3yKW X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 02:41:57 -0000 Hi, We hit it on 11.3. So I am going to MFC it. On Tue, Dec 31, 2019, 9:37 PM Kubilay Kocak wrote: > On 1/01/2020 5:58 am, Alexander Motin wrote: > > Author: mav > > Date: Tue Dec 31 18:58:29 2019 > > New Revision: 356240 > > URL: https://svnweb.freebsd.org/changeset/base/356240 > > > > Log: > > Relax locking of carp_forus(). > > > > This fixes deadlock between CARP and bridge. Bridge calls this > function > > taking CARP lock while holding bridge lock. Same time CARP tries to > send > > its announcements via the bridge while holding CARP lock. > > > > Use of CARP_LOCK() here does not solve anything, since sc_addr is > constant > > while race on sc_state is harmless and use of the lock does not close > it. > > > > Reviewed by: glebius > > MFC after: 2 weeks > > Sponsored by: iXsystems, Inc. > > > > Modified: > > head/sys/netinet/ip_carp.c > > > > Modified: head/sys/netinet/ip_carp.c > > > ============================================================================== > > --- head/sys/netinet/ip_carp.c Tue Dec 31 18:28:25 2019 > (r356239) > > +++ head/sys/netinet/ip_carp.c Tue Dec 31 18:58:29 2019 > (r356240) > > @@ -1230,14 +1230,15 @@ carp_forus(struct ifnet *ifp, u_char *dhost) > > > > CIF_LOCK(ifp->if_carp); > > IFNET_FOREACH_CARP(ifp, sc) { > > - CARP_LOCK(sc); > > + /* > > + * CARP_LOCK() is not here, since would protect nothing, > but > > + * cause deadlock with if_bridge, calling this under its > lock. > > + */ > > if (sc->sc_state == MASTER && !bcmp(dhost, > LLADDR(&sc->sc_addr), > > ETHER_ADDR_LEN)) { > > - CARP_UNLOCK(sc); > > CIF_UNLOCK(ifp->if_carp); > > return (1); > > } > > - CARP_UNLOCK(sc); > > } > > CIF_UNLOCK(ifp->if_carp); > > > > _______________________________________________ > > 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" > > > > Hi Alexander, > > Is this a only-head-impacted fix, or does the issue impact stable/12,11 > too, warranting MFC ? > From owner-svn-src-head@freebsd.org Wed Jan 1 03:59:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 032A51E4E9C; Wed, 1 Jan 2020 03:59:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ncrB5x1yz423Z; Wed, 1 Jan 2020 03:59:54 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5FA324A96; Wed, 1 Jan 2020 03:59:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0013xsKk070059; Wed, 1 Jan 2020 03:59:54 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0013xshs070057; Wed, 1 Jan 2020 03:59:54 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001010359.0013xshs070057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 1 Jan 2020 03:59:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356246 - head/usr.sbin/inetd X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/inetd X-SVN-Commit-Revision: 356246 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 03:59:55 -0000 Author: kevans Date: Wed Jan 1 03:59:54 2020 New Revision: 356246 URL: https://svnweb.freebsd.org/changeset/base/356246 Log: inetd: add some macros for checking child limits, NFC The main point here is capturing the maxchild > 0 check. A future change to inetd will start tracking all of the child pids so that it can give proper and consistent notification of process exit/signalling. Modified: head/usr.sbin/inetd/inetd.c head/usr.sbin/inetd/inetd.h Modified: head/usr.sbin/inetd/inetd.c ============================================================================== --- head/usr.sbin/inetd/inetd.c Wed Jan 1 00:35:02 2020 (r356245) +++ head/usr.sbin/inetd/inetd.c Wed Jan 1 03:59:54 2020 (r356246) @@ -925,14 +925,14 @@ addchild(struct servtab *sep, pid_t pid) if (sep->se_maxchild <= 0) return; #ifdef SANITY_CHECK - if (sep->se_numchild >= sep->se_maxchild) { + if (SERVTAB_EXCEEDS_LIMIT(sep)) { syslog(LOG_ERR, "%s: %d >= %d", __func__, sep->se_numchild, sep->se_maxchild); exit(EX_SOFTWARE); } #endif sep->se_pids[sep->se_numchild++] = pid; - if (sep->se_numchild == sep->se_maxchild) + if (SERVTAB_AT_LIMIT(sep)) disable(sep); } @@ -958,7 +958,7 @@ reapchild(void) break; if (k == sep->se_numchild) continue; - if (sep->se_numchild == sep->se_maxchild) + if (SERVTAB_AT_LIMIT(sep)) enable(sep); sep->se_pids[k] = sep->se_pids[--sep->se_numchild]; if (WIFSIGNALED(status) || WEXITSTATUS(status)) @@ -1049,8 +1049,7 @@ config(void) sep->se_bi = new->se_bi; /* might need to turn on or off service now */ if (sep->se_fd >= 0) { - if (sep->se_maxchild > 0 - && sep->se_numchild == sep->se_maxchild) { + if (SERVTAB_EXCEEDS_LIMIT(sep)) { if (FD_ISSET(sep->se_fd, &allsock)) disable(sep); } else { Modified: head/usr.sbin/inetd/inetd.h ============================================================================== --- head/usr.sbin/inetd/inetd.h Wed Jan 1 00:35:02 2020 (r356245) +++ head/usr.sbin/inetd/inetd.h Wed Jan 1 03:59:54 2020 (r356246) @@ -124,6 +124,11 @@ struct servtab { #define se_nomapped se_flags.se_nomapped #define se_reset se_flags.se_reset +#define SERVTAB_AT_LIMIT(sep) \ + ((sep)->se_maxchild > 0 && (sep)->se_numchild == (sep)->se_maxchild) +#define SERVTAB_EXCEEDS_LIMIT(sep) \ + ((sep)->se_maxchild > 0 && (sep)->se_numchild >= (sep)->se_maxchild) + int check_loop(const struct sockaddr *, const struct servtab *sep); void inetd_setproctitle(const char *, int); struct servtab *tcpmux(int); From owner-svn-src-head@freebsd.org Wed Jan 1 04:22:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BB5C1E5AA2; Wed, 1 Jan 2020 04:22:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ndKn0Rr0z438c; Wed, 1 Jan 2020 04:22:05 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A96124FCF; Wed, 1 Jan 2020 04:22:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0014M4XL085307; Wed, 1 Jan 2020 04:22:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0014M43i084894; Wed, 1 Jan 2020 04:22:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001010422.0014M43i084894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 1 Jan 2020 04:22:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356247 - head/usr.sbin/inetd X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/inetd X-SVN-Commit-Revision: 356247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 04:22:05 -0000 Author: kevans Date: Wed Jan 1 04:22:04 2020 New Revision: 356247 URL: https://svnweb.freebsd.org/changeset/base/356247 Log: inetd: track all child pids, regardless of maxchild spec Currently, child pids are only tracked if maxchildren is specified. As a consequence, without a maxchild limit we do not get a notice in syslog on children aborting abnormally. This turns out to be a great debugging aide at times. Children are now tracked in a LIST; the management interface is decidedly less painful when there's no upper bound on the number of entries we may have at the cost of one small allocation per connection. PR: 70335 Modified: head/usr.sbin/inetd/inetd.c head/usr.sbin/inetd/inetd.h Modified: head/usr.sbin/inetd/inetd.c ============================================================================== --- head/usr.sbin/inetd/inetd.c Wed Jan 1 03:59:54 2020 (r356246) +++ head/usr.sbin/inetd/inetd.c Wed Jan 1 04:22:04 2020 (r356247) @@ -922,8 +922,8 @@ flag_signal(int signo) static void addchild(struct servtab *sep, pid_t pid) { - if (sep->se_maxchild <= 0) - return; + struct stabchild *sc; + #ifdef SANITY_CHECK if (SERVTAB_EXCEEDS_LIMIT(sep)) { syslog(LOG_ERR, "%s: %d >= %d", @@ -931,7 +931,15 @@ addchild(struct servtab *sep, pid_t pid) exit(EX_SOFTWARE); } #endif - sep->se_pids[sep->se_numchild++] = pid; + sc = malloc(sizeof(*sc)); + if (sc == NULL) { + syslog(LOG_ERR, "malloc: %m"); + exit(EX_OSERR); + } + memset(sc, 0, sizeof(*sc)); + sc->sc_pid = pid; + LIST_INSERT_HEAD(&sep->se_children, sc, sc_link); + ++sep->se_numchild; if (SERVTAB_AT_LIMIT(sep)) disable(sep); } @@ -939,8 +947,9 @@ addchild(struct servtab *sep, pid_t pid) static void reapchild(void) { - int k, status; + int status; pid_t pid; + struct stabchild *sc; struct servtab *sep; for (;;) { @@ -953,14 +962,17 @@ reapchild(void) WIFEXITED(status) ? WEXITSTATUS(status) : WTERMSIG(status)); for (sep = servtab; sep; sep = sep->se_next) { - for (k = 0; k < sep->se_numchild; k++) - if (sep->se_pids[k] == pid) + LIST_FOREACH(sc, &sep->se_children, sc_link) { + if (sc->sc_pid == pid) break; - if (k == sep->se_numchild) + } + if (sc == NULL) continue; if (SERVTAB_AT_LIMIT(sep)) enable(sep); - sep->se_pids[k] = sep->se_pids[--sep->se_numchild]; + LIST_REMOVE(sc, sc_link); + free(sc); + --sep->se_numchild; if (WIFSIGNALED(status) || WEXITSTATUS(status)) syslog(LOG_WARNING, "%s[%d]: exited, %s %u", @@ -1032,18 +1044,14 @@ config(void) sep->se_nomapped = new->se_nomapped; sep->se_reset = 1; } - /* copy over outstanding child pids */ - if (sep->se_maxchild > 0 && new->se_maxchild > 0) { - new->se_numchild = sep->se_numchild; - if (new->se_numchild > new->se_maxchild) - new->se_numchild = new->se_maxchild; - memcpy(new->se_pids, sep->se_pids, - new->se_numchild * sizeof(*new->se_pids)); - } - SWAP(pid_t *, sep->se_pids, new->se_pids); - sep->se_maxchild = new->se_maxchild; - sep->se_numchild = new->se_numchild; + + /* + * The children tracked remain; we want numchild to + * still reflect how many jobs are running so we don't + * throw off our accounting. + */ sep->se_maxcpm = new->se_maxcpm; + sep->se_maxchild = new->se_maxchild; resize_conn(sep, new->se_maxperip); sep->se_maxperip = new->se_maxperip; sep->se_bi = new->se_bi; @@ -1949,13 +1957,7 @@ more: else sep->se_maxchild = 1; } - if (sep->se_maxchild > 0) { - sep->se_pids = malloc(sep->se_maxchild * sizeof(*sep->se_pids)); - if (sep->se_pids == NULL) { - syslog(LOG_ERR, "malloc: %m"); - exit(EX_OSERR); - } - } + LIST_INIT(&sep->se_children); argc = 0; for (arg = skip(&cp); cp; arg = skip(&cp)) if (argc < MAXARGV) { @@ -1980,6 +1982,7 @@ more: static void freeconfig(struct servtab *cp) { + struct stabchild *sc; int i; if (cp->se_service) @@ -1996,8 +1999,11 @@ freeconfig(struct servtab *cp) #endif if (cp->se_server) free(cp->se_server); - if (cp->se_pids) - free(cp->se_pids); + while (!LIST_EMPTY(&cp->se_children)) { + sc = LIST_FIRST(&cp->se_children); + LIST_REMOVE(sc, sc_link); + free(sc); + } for (i = 0; i < MAXARGV; i++) if (cp->se_argv[i]) free(cp->se_argv[i]); Modified: head/usr.sbin/inetd/inetd.h ============================================================================== --- head/usr.sbin/inetd/inetd.h Wed Jan 1 03:59:54 2020 (r356246) +++ head/usr.sbin/inetd/inetd.h Wed Jan 1 04:22:04 2020 (r356247) @@ -66,6 +66,11 @@ struct conninfo { #define PERIPSIZE 256 +struct stabchild { + LIST_ENTRY(stabchild) sc_link; + pid_t sc_pid; +}; + struct servtab { char *se_service; /* name of service */ int se_socktype; /* type of socket to use */ @@ -74,7 +79,6 @@ struct servtab { int se_maxchild; /* max number of children */ int se_maxcpm; /* max connects per IP per minute */ int se_numchild; /* current number of children */ - pid_t *se_pids; /* array of child pids */ char *se_user; /* user name to run as */ char *se_group; /* group name to run as */ #ifdef LOGIN_CAP @@ -119,6 +123,7 @@ struct servtab { } se_flags; int se_maxperip; /* max number of children per src */ LIST_HEAD(, conninfo) se_conn[PERIPSIZE]; + LIST_HEAD(, stabchild) se_children; }; #define se_nomapped se_flags.se_nomapped From owner-svn-src-head@freebsd.org Wed Jan 1 04:29:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 791751E5BE9; Wed, 1 Jan 2020 04:29:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ndTx2WZGz43M1; Wed, 1 Jan 2020 04:29:09 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51C3B24FFD; Wed, 1 Jan 2020 04:29:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0014T96s087621; Wed, 1 Jan 2020 04:29:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0014T9Qh087620; Wed, 1 Jan 2020 04:29:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001010429.0014T9Qh087620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 1 Jan 2020 04:29:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356248 - head/usr.sbin/inetd X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/inetd X-SVN-Commit-Revision: 356248 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 04:29:09 -0000 Author: kevans Date: Wed Jan 1 04:29:08 2020 New Revision: 356248 URL: https://svnweb.freebsd.org/changeset/base/356248 Log: inetd: convert remaining bzero(3) to memset(3), NFC This change is purely in the name of noise reduction from static analyzers that want to complain that bzero(3) is obsolete in favor of memset(3). With this, clang-analyze at least is now noise free. WARNS= 6 also appears to have been OK for some time now, so drop the current setting and opt for the default. Modified: head/usr.sbin/inetd/Makefile head/usr.sbin/inetd/inetd.c Modified: head/usr.sbin/inetd/Makefile ============================================================================== --- head/usr.sbin/inetd/Makefile Wed Jan 1 04:22:04 2020 (r356247) +++ head/usr.sbin/inetd/Makefile Wed Jan 1 04:29:08 2020 (r356248) @@ -9,7 +9,6 @@ MAN= inetd.8 MLINKS= inetd.8 inetd.conf.5 SRCS= inetd.c builtins.c -WARNS?= 3 CFLAGS+= -DLOGIN_CAP #CFLAGS+= -DSANITY_CHECK Modified: head/usr.sbin/inetd/inetd.c ============================================================================== --- head/usr.sbin/inetd/inetd.c Wed Jan 1 04:22:04 2020 (r356247) +++ head/usr.sbin/inetd/inetd.c Wed Jan 1 04:29:08 2020 (r356248) @@ -410,7 +410,7 @@ main(int argc, char **argv) */ servname = (hostname == NULL) ? "0" /* dummy */ : NULL; - bzero(&hints, sizeof(struct addrinfo)); + memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_flags = AI_PASSIVE; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; /* dummy */ @@ -2293,7 +2293,7 @@ cpmip(const struct servtab *sep, int ctrl) if (chBest->ch_Service) free(chBest->ch_Service); chBest->ch_Service = strdup(sep->se_service); - bzero(chBest->ch_Times, sizeof(chBest->ch_Times)); + memset(chBest->ch_Times, 0, sizeof(chBest->ch_Times)); } #ifdef INET6 if ((rss.ss_family == AF_INET6 && @@ -2307,7 +2307,7 @@ cpmip(const struct servtab *sep, int ctrl) if (chBest->ch_Service) free(chBest->ch_Service); chBest->ch_Service = strdup(sep->se_service); - bzero(chBest->ch_Times, sizeof(chBest->ch_Times)); + memset(chBest->ch_Times, 0, sizeof(chBest->ch_Times)); } #endif chBest->ch_LTime = t; From owner-svn-src-head@freebsd.org Wed Jan 1 07:43:10 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 012D61F6CD7; Wed, 1 Jan 2020 07:43:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47njnn71Vtz4dWX; Wed, 1 Jan 2020 07:43:09 +0000 (UTC) (envelope-from delphij@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1CF327483; Wed, 1 Jan 2020 07:43:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0017h9bp006505; Wed, 1 Jan 2020 07:43:09 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0017h8wB006498; Wed, 1 Jan 2020 07:43:08 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202001010743.0017h8wB006498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 1 Jan 2020 07:43:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356249 - head/sbin/fsck_msdosfs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/fsck_msdosfs X-SVN-Commit-Revision: 356249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 07:43:10 -0000 Author: delphij Date: Wed Jan 1 07:43:08 2020 New Revision: 356249 URL: https://svnweb.freebsd.org/changeset/base/356249 Log: Reduce memory footprint of fsck_msdosfs. This utility was initially written for FAT12/16, which were inherently small. When FAT32 support was added, the old data structure and algorithms remain used with minimal changes. With growing size of FAT32 media, the current data structure that requires 4 32-bit variables per each FAT32 table entry would consume up to 4 GiB of RAM, which can be too big for systems with limited RAM available. Address this by taking a different approach of validating the FAT. The FAT is essentially a set of linked lists of chains that was referenced by directory entries, and the checker needs to make sure that the linked chains of clusters do not have cross-linked chains, and every chain were referenced by one and only one directory entry. Instead of keeping track of the chain's 'head' cluster number, the size of the chain, the used status of the chain and the "next" pointer which is content of the FAT table, we create accessors for the FAT table data for the "next" pointer, and keep only one bit to indicate if the current cluster is a 'head' node of a cluster chain, in a bitmap. We further overhaul the FAT checker to find out the possible head nodes by excluding ones that are not (in other words, nodes that have some other nodes claiming them as the next node) instead of marking the head nodes for each node on the chain. This approach greatly reduced the complexiety of computation from O(N^2) worst case, to an O(N) scan for worst case. The file (cluster chain) length is not useful for the FAT checker, so don't bother to calculate them in the FAT checker and instead leave the task to the directory structure check, at which point we would have non-crossed cluster chains, and we are guaranteed that each cluster will be visited for at most one time. When checking the directory structures, we use the head node indicator to as the visited (used) flag: every cluster chain can only be referenced by one directory entry, so we clear them when calculating the length of the chain, and we can immediately tell if there are anomalies in the directory entry. As a result, the required RAM size is now 1 bit per each entry of the FAT table, plus memory needed to hold the FAT table in memory, instead of 16 bytes (=128 bits) per each entry. For FAT12 and FAT16, we will load the whole FAT table into memory as they are smaller than 128KiB, and for FAT32, we first attempt to mmap() it into memory, and when that fails, we would fall back to a simple LRU cache of 4 MiB of RAM. sbin/fsck_msdosfs/boot.c: - Added additional sanity checks for valid FAT32/FAT16/FAT12 cluster number. - FAT32: check if root directory starts with a valid cluster number, moved from dir.c. There is no point to proceed if the filesystem is already damaged beyond repair. sbin/fsck_msdosfs/check.c: - Combine phase 1 and phase 2, now that the readfat() is able to detect cross chains. sbin/fsck_msdosfs/dir.c: - Refactor code to use FAT accessor instead of accessing the internal representation of FAT table. - Make use of the cluster chain head bitmap. - Clarify and simplify directory entry check, remove unnecessary checks that are would be done at a later time (for example, whether the directory's second cluster is a valid one, which is examined more throughly in a later checkchain() and does not prevent us from proceeding further). sbin/fsck_msdosfs/dosfs.h: - Remove internal representation of FAT table, which is replaced by the head bitmap that is opaque to other code. - Added a special CLUST_DEAD cluster type to indicate errors. sbin/fsck_msdosfs/ext.h: - Added a flag that overrides mmap(2) setting. The corresponding command line option, -M is intentionally undocumented as we do not expect users to need it. - Added accessors for FAT table and convert existing interface to use it. sbin/fsck_msdosfs/fat.c: - Added head bitmap to represent whether a cluster is a head cluster. - Converted FAT internal representation to accessors. - Implemented a LRU cache for FAT32 when mmap(2) should not or can not be used. - _readfat: Attempt a mmap(2) and fall back to regular read for non-FAT32 file systems; use the LRU cache for FAT32 and prepopulate the cache with the first 4MiB of the entries. - readfat: Added support of head bitmap and use the population scan to detect bogus chains. - clusterdiff: removed, FATs are copied from the checked copy via writefat()/copyfat(). - checkchain: calculates the length of a cluster chain and make sure that it ends with a valid EOF marker. - clearchain: follow and clear a chain and maintain the free cluster count. - checklost: convert to use head bitmap. At the end of all other scans, the remaining 'head' nodes are leaders of lost cluster chains. sbin/fsck_msdosfs/fat.c: - Added a new -M option which is intentionally undocumented, to disable the use of mmap(). Reviewed by: kevlo MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D22965 Modified: head/sbin/fsck_msdosfs/boot.c head/sbin/fsck_msdosfs/check.c head/sbin/fsck_msdosfs/dir.c head/sbin/fsck_msdosfs/dosfs.h head/sbin/fsck_msdosfs/ext.h head/sbin/fsck_msdosfs/fat.c head/sbin/fsck_msdosfs/main.c Modified: head/sbin/fsck_msdosfs/boot.c ============================================================================== --- head/sbin/fsck_msdosfs/boot.c Wed Jan 1 04:29:08 2020 (r356248) +++ head/sbin/fsck_msdosfs/boot.c Wed Jan 1 07:43:08 2020 (r356249) @@ -152,9 +152,6 @@ readboot(int dosfs, struct bootblock *boot) boot->NumSectors = boot->bpbHugeSectors; } - - - if (boot->flags & FAT32) { /* If the OEM Name field is EXFAT, it's not FAT32, so bail */ if (!memcmp(&block[3], "EXFAT ", 8)) { @@ -272,13 +269,30 @@ readboot(int dosfs, struct bootblock *boot) boot->NumClusters = (boot->NumSectors - boot->FirstCluster) / boot->bpbSecPerClust + CLUST_FIRST; - if (boot->flags & FAT32) + if (boot->flags & FAT32) { + if (boot->NumClusters > (CLUST_RSRVD & CLUST32_MASK)) { + pfatal("Filesystem too big (%u clusters) for FAT32 partition", + boot->NumClusters); + return FSFATAL; + } + if (boot->NumClusters < (CLUST_RSRVD & CLUST16_MASK)) { + pfatal("Filesystem too small (%u clusters) for FAT32 partition", + boot->NumClusters); + return FSFATAL; + } boot->ClustMask = CLUST32_MASK; - else if (boot->NumClusters < (CLUST_RSRVD&CLUST12_MASK)) + + if (boot->bpbRootClust < CLUST_FIRST || + boot->bpbRootClust >= boot->NumClusters) { + pfatal("Root directory starts with cluster out of range(%u)", + boot->bpbRootClust); + return FSFATAL; + } + } else if (boot->NumClusters < (CLUST_RSRVD&CLUST12_MASK)) { boot->ClustMask = CLUST12_MASK; - else if (boot->NumClusters < (CLUST_RSRVD&CLUST16_MASK)) + } else if (boot->NumClusters < (CLUST_RSRVD&CLUST16_MASK)) { boot->ClustMask = CLUST16_MASK; - else { + } else { pfatal("Filesystem too big (%u clusters) for non-FAT32 partition", boot->NumClusters); return FSFATAL; Modified: head/sbin/fsck_msdosfs/check.c ============================================================================== --- head/sbin/fsck_msdosfs/check.c Wed Jan 1 04:29:08 2020 (r356248) +++ head/sbin/fsck_msdosfs/check.c Wed Jan 1 07:43:08 2020 (r356249) @@ -47,9 +47,8 @@ checkfilesys(const char *fname) { int dosfs; struct bootblock boot; - struct fatEntry *fat = NULL; + struct fat_descriptor *fat = NULL; int finish_dosdirsection=0; - u_int i; int mod = 0; int ret = 8; @@ -88,65 +87,39 @@ checkfilesys(const char *fname) } if (!preen) { - if (boot.ValidFat < 0) - printf("** Phase 1 - Read and Compare FATs\n"); - else - printf("** Phase 1 - Read FAT\n"); + printf("** Phase 1 - Read FAT and checking connectivity\n"); } - mod |= readfat(dosfs, &boot, boot.ValidFat >= 0 ? boot.ValidFat : 0, &fat); + mod |= readfat(dosfs, &boot, &fat); if (mod & FSFATAL) { close(dosfs); return 8; } - if (boot.ValidFat < 0) - for (i = 1; i < boot.bpbFATs; i++) { - struct fatEntry *currentFat; - - mod |= readfat(dosfs, &boot, i, ¤tFat); - - if (mod & FSFATAL) - goto out; - - mod |= comparefat(&boot, fat, currentFat, i); - free(currentFat); - if (mod & FSFATAL) - goto out; - } - if (!preen) - printf("** Phase 2 - Check Cluster Chains\n"); + printf("** Phase 2 - Checking Directories\n"); - mod |= checkfat(&boot, fat); - if (mod & FSFATAL) - goto out; - /* delay writing FATs */ - - if (!preen) - printf("** Phase 3 - Checking Directories\n"); - - mod |= resetDosDirSection(&boot, fat); + mod |= resetDosDirSection(fat); finish_dosdirsection = 1; if (mod & FSFATAL) goto out; /* delay writing FATs */ - mod |= handleDirTree(dosfs, &boot, fat); + mod |= handleDirTree(fat); if (mod & FSFATAL) goto out; if (!preen) - printf("** Phase 4 - Checking for Lost Files\n"); + printf("** Phase 3 - Checking for Lost Files\n"); - mod |= checklost(dosfs, &boot, fat); + mod |= checklost(fat); if (mod & FSFATAL) goto out; /* now write the FATs */ - if (mod & (FSFATMOD|FSFIXFAT)) { + if (mod & FSFATMOD) { if (ask(1, "Update FATs")) { - mod |= writefat(dosfs, &boot, fat, mod & FSFIXFAT); + mod |= writefat(fat); if (mod & FSFATAL) goto out; } else @@ -170,7 +143,7 @@ checkfilesys(const char *fname) if (mod & FSDIRTY) { pwarn("MARKING FILE SYSTEM CLEAN\n"); - mod |= writefat(dosfs, &boot, fat, 1); + mod |= writefat(fat); } else { pwarn("\n***** FILE SYSTEM IS LEFT MARKED AS DIRTY *****\n"); mod |= FSERROR; /* file system not clean */ Modified: head/sbin/fsck_msdosfs/dir.c ============================================================================== --- head/sbin/fsck_msdosfs/dir.c Wed Jan 1 04:29:08 2020 (r356248) +++ head/sbin/fsck_msdosfs/dir.c Wed Jan 1 07:43:08 2020 (r356249) @@ -1,6 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * + * Copyright (c) 2019 Google LLC * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank * Copyright (c) 1995 Martin Husemann * Some structure declaration borrowed from Paul Popelka @@ -95,14 +96,11 @@ static struct dirTodoNode *newDirTodo(void); static void freeDirTodo(struct dirTodoNode *); static char *fullpath(struct dosDirEntry *); static u_char calcShortSum(u_char *); -static int delete(int, struct bootblock *, struct fatEntry *, cl_t, int, - cl_t, int, int); -static int removede(int, struct bootblock *, struct fatEntry *, u_char *, - u_char *, cl_t, cl_t, cl_t, char *, int); -static int checksize(struct bootblock *, struct fatEntry *, u_char *, - struct dosDirEntry *); -static int readDosDirSection(int, struct bootblock *, struct fatEntry *, - struct dosDirEntry *); +static int delete(struct fat_descriptor *, cl_t, int, cl_t, int, int); +static int removede(struct fat_descriptor *, u_char *, u_char *, + cl_t, cl_t, cl_t, char *, int); +static int checksize(struct fat_descriptor *, u_char *, struct dosDirEntry *); +static int readDosDirSection(struct fat_descriptor *, struct dosDirEntry *); /* * Manage free dosDirEntry structures. @@ -116,7 +114,7 @@ newDosDirEntry(void) if (!(de = freede)) { if (!(de = malloc(sizeof *de))) - return 0; + return (NULL); } else freede = de->next; return de; @@ -193,7 +191,7 @@ fullpath(struct dosDirEntry *dir) /* * Calculate a checksum over an 8.3 alias name */ -static u_char +static inline u_char calcShortSum(u_char *p) { u_char sum = 0; @@ -221,21 +219,24 @@ static struct dosDirEntry *lostDir; * Init internal state for a new directory scan. */ int -resetDosDirSection(struct bootblock *boot, struct fatEntry *fat) +resetDosDirSection(struct fat_descriptor *fat) { - int b1, b2; + int rootdir_size, cluster_size; int ret = FSOK; size_t len; + struct bootblock *boot; - b1 = boot->bpbRootDirEnts * 32; - b2 = boot->bpbSecPerClust * boot->bpbBytesPerSec; + boot = fat_get_boot(fat); - if ((buffer = malloc(len = MAX(b1, b2))) == NULL) { + rootdir_size = boot->bpbRootDirEnts * 32; + cluster_size = boot->bpbSecPerClust * boot->bpbBytesPerSec; + + if ((buffer = malloc(len = MAX(rootdir_size, cluster_size))) == NULL) { perr("No space for directory buffer (%zu)", len); return FSFATAL; } - if ((delbuf = malloc(len = b2)) == NULL) { + if ((delbuf = malloc(len = cluster_size)) == NULL) { free(buffer); perr("No space for directory delbuf (%zu)", len); return FSFATAL; @@ -250,18 +251,10 @@ resetDosDirSection(struct bootblock *boot, struct fatE memset(rootDir, 0, sizeof *rootDir); if (boot->flags & FAT32) { - if (boot->bpbRootClust < CLUST_FIRST || - boot->bpbRootClust >= boot->NumClusters) { - pfatal("Root directory starts with cluster out of range(%u)", - boot->bpbRootClust); - return FSFATAL; - } - if (fat[boot->bpbRootClust].head != boot->bpbRootClust) { + if (!fat_is_cl_head(fat, boot->bpbRootClust)) { pfatal("Root directory doesn't start a cluster chain"); return FSFATAL; } - - fat[boot->bpbRootClust].flags |= FAT_USED; rootDir->head = boot->bpbRootClust; } @@ -302,16 +295,21 @@ finishDosDirSection(void) * Delete directory entries between startcl, startoff and endcl, endoff. */ static int -delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl, +delete(struct fat_descriptor *fat, cl_t startcl, int startoff, cl_t endcl, int endoff, int notlast) { u_char *s, *e; off_t off; - int clsz = boot->bpbSecPerClust * boot->bpbBytesPerSec; + int clsz, fd; + struct bootblock *boot; + boot = fat_get_boot(fat); + fd = fat_get_fd(fat); + clsz = boot->bpbSecPerClust * boot->bpbBytesPerSec; + s = delbuf + startoff; e = delbuf + clsz; - while (startcl >= CLUST_FIRST && startcl < boot->NumClusters) { + while (fat_is_valid_cl(fat, startcl)) { if (startcl == endcl) { if (notlast) break; @@ -320,11 +318,11 @@ delete(int f, struct bootblock *boot, struct fatEntry off = (startcl - CLUST_FIRST) * boot->bpbSecPerClust + boot->FirstCluster; off *= boot->bpbBytesPerSec; - if (lseek(f, off, SEEK_SET) != off) { + if (lseek(fd, off, SEEK_SET) != off) { perr("Unable to lseek to %" PRId64, off); return FSFATAL; } - if (read(f, delbuf, clsz) != clsz) { + if (read(fd, delbuf, clsz) != clsz) { perr("Unable to read directory"); return FSFATAL; } @@ -332,25 +330,26 @@ delete(int f, struct bootblock *boot, struct fatEntry *s = SLOT_DELETED; s += 32; } - if (lseek(f, off, SEEK_SET) != off) { + if (lseek(fd, off, SEEK_SET) != off) { perr("Unable to lseek to %" PRId64, off); return FSFATAL; } - if (write(f, delbuf, clsz) != clsz) { + if (write(fd, delbuf, clsz) != clsz) { perr("Unable to write directory"); return FSFATAL; } if (startcl == endcl) break; - startcl = fat[startcl].next; + startcl = fat_get_cl_next(fat, startcl); s = delbuf; } return FSOK; } static int -removede(int f, struct bootblock *boot, struct fatEntry *fat, u_char *start, - u_char *end, cl_t startcl, cl_t endcl, cl_t curcl, char *path, int type) +removede(struct fat_descriptor *fat, u_char *start, + u_char *end, cl_t startcl, cl_t endcl, cl_t curcl, + char *path, int type) { switch (type) { case 0: @@ -366,14 +365,14 @@ removede(int f, struct bootblock *boot, struct fatEntr } if (ask(0, "Remove")) { if (startcl != curcl) { - if (delete(f, boot, fat, + if (delete(fat, startcl, start - buffer, endcl, end - buffer, endcl == curcl) == FSFATAL) return FSFATAL; start = buffer; } - /* startcl is < CLUST_FIRST for !fat32 root */ + /* startcl is < CLUST_FIRST for !FAT32 root */ if ((endcl == curcl) || (startcl < CLUST_FIRST)) for (; start < end; start += 32) *start = SLOT_DELETED; @@ -386,23 +385,37 @@ removede(int f, struct bootblock *boot, struct fatEntr * Check an in-memory file entry */ static int -checksize(struct bootblock *boot, struct fatEntry *fat, u_char *p, - struct dosDirEntry *dir) +checksize(struct fat_descriptor *fat, u_char *p, struct dosDirEntry *dir) { + int ret = FSOK; + size_t physicalSize; + struct bootblock *boot; + + boot = fat_get_boot(fat); + /* * Check size on ordinary files */ - u_int32_t physicalSize; - - if (dir->head == CLUST_FREE) + if (dir->head == CLUST_FREE) { physicalSize = 0; - else { - if (dir->head < CLUST_FIRST || dir->head >= boot->NumClusters) + } else { + if (!fat_is_valid_cl(fat, dir->head)) return FSERROR; - physicalSize = fat[dir->head].length * boot->ClusterSize; + ret = checkchain(fat, dir->head, &physicalSize); + /* + * Upon return, physicalSize would hold the chain length + * that checkchain() was able to validate, but if the user + * refused the proposed repair, it would be unsafe to + * proceed with directory entry fix, so bail out in that + * case. + */ + if (ret == FSERROR) { + return (FSERROR); + } + physicalSize *= boot->ClusterSize; } if (physicalSize < dir->size) { - pwarn("size of %s is %u, should at most be %u\n", + pwarn("size of %s is %u, should at most be %zu\n", fullpath(dir), dir->size, physicalSize); if (ask(1, "Truncate")) { dir->size = physicalSize; @@ -422,11 +435,10 @@ checksize(struct bootblock *boot, struct fatEntry *fat for (cl = dir->head, len = sz = 0; (sz += boot->ClusterSize) < dir->size; len++) - cl = fat[cl].next; - clearchain(boot, fat, fat[cl].next); - fat[cl].next = CLUST_EOF; - fat[dir->head].length = len; - return FSFATMOD; + cl = fat_get_cl_next(fat, cl); + clearchain(fat, fat_get_cl_next(fat, cl)); + ret = fat_set_cl_next(fat, cl, CLUST_EOF); + return (FSFATMOD | ret); } else return FSERROR; } @@ -442,15 +454,20 @@ static const u_char dotdot_name[11] = ".. "; * when we traverse into it. */ static int -check_subdirectory(int f, struct bootblock *boot, struct dosDirEntry *dir) +check_subdirectory(struct fat_descriptor *fat, struct dosDirEntry *dir) { u_char *buf, *cp; off_t off; cl_t cl; int retval = FSOK; + int fd; + struct bootblock *boot; + boot = fat_get_boot(fat); + fd = fat_get_fd(fat); + cl = dir->head; - if (dir->parent && (cl < CLUST_FIRST || cl >= boot->NumClusters)) { + if (dir->parent && !fat_is_valid_cl(fat, cl)) { return FSERROR; } @@ -474,8 +491,8 @@ check_subdirectory(int f, struct bootblock *boot, stru } off *= boot->bpbBytesPerSec; - if (lseek(f, off, SEEK_SET) != off || - read(f, buf, boot->bpbBytesPerSec) != (ssize_t)boot->bpbBytesPerSec) { + if (lseek(fd, off, SEEK_SET) != off || + read(fd, buf, boot->bpbBytesPerSec) != (ssize_t)boot->bpbBytesPerSec) { perr("Unable to read directory"); free(buf); return FSFATAL; @@ -509,22 +526,27 @@ check_subdirectory(int f, struct bootblock *boot, stru * - push directories onto the todo-stack */ static int -readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat, - struct dosDirEntry *dir) +readDosDirSection(struct fat_descriptor *fat, struct dosDirEntry *dir) { + struct bootblock *boot; struct dosDirEntry dirent, *d; u_char *p, *vallfn, *invlfn, *empty; off_t off; - int i, j, k, last; + int fd, i, j, k, iosize, entries; + bool is_legacyroot; cl_t cl, valcl = ~0, invcl = ~0, empcl = ~0; char *t; u_int lidx = 0; int shortSum; int mod = FSOK; + size_t dirclusters; #define THISMOD 0x8000 /* Only used within this routine */ + boot = fat_get_boot(fat); + fd = fat_get_fd(fat); + cl = dir->head; - if (dir->parent && (cl < CLUST_FIRST || cl >= boot->NumClusters)) { + if (dir->parent && (!fat_is_valid_cl(fat, cl))) { /* * Already handled somewhere else. */ @@ -532,24 +554,50 @@ readDosDirSection(int f, struct bootblock *boot, struc } shortSum = -1; vallfn = invlfn = empty = NULL; + + /* + * If we are checking the legacy root (for FAT12/FAT16), + * we will operate on the whole directory; otherwise, we + * will operate on one cluster at a time, and also take + * this opportunity to examine the chain. + * + * Derive how many entries we are going to encounter from + * the I/O size. + */ + is_legacyroot = (dir->parent == NULL && !(boot->flags & FAT32)); + if (is_legacyroot) { + iosize = boot->bpbRootDirEnts * 32; + entries = boot->bpbRootDirEnts; + } else { + iosize = boot->bpbSecPerClust * boot->bpbBytesPerSec; + entries = iosize / 32; + mod |= checkchain(fat, dir->head, &dirclusters); + } + do { - if (!(boot->flags & FAT32) && !dir->parent) { - last = boot->bpbRootDirEnts * 32; + if (is_legacyroot) { + /* + * Special case for FAT12/FAT16 root -- read + * in the whole root directory. + */ off = boot->bpbResSectors + boot->bpbFATs * boot->FATsecs; } else { - last = boot->bpbSecPerClust * boot->bpbBytesPerSec; + /* + * Otherwise, read in a cluster of the + * directory. + */ off = (cl - CLUST_FIRST) * boot->bpbSecPerClust + boot->FirstCluster; } off *= boot->bpbBytesPerSec; - if (lseek(f, off, SEEK_SET) != off - || read(f, buffer, last) != last) { + if (lseek(fd, off, SEEK_SET) != off || + read(fd, buffer, iosize) != iosize) { perr("Unable to read directory"); return FSFATAL; } - last /= 32; - for (p = buffer, i = 0; i < last; i++, p += 32) { + + for (p = buffer, i = 0; i < entries; i++, p += 32) { if (dir->fsckflags & DIREMPWARN) { *p = SLOT_EMPTY; continue; @@ -572,7 +620,7 @@ readDosDirSection(int f, struct bootblock *boot, struc u_char *q; dir->fsckflags &= ~DIREMPTY; - if (delete(f, boot, fat, + if (delete(fat, empcl, empty - buffer, cl, p - buffer, 1) == FSFATAL) return FSFATAL; @@ -701,7 +749,7 @@ readDosDirSection(int f, struct bootblock *boot, struc if (dirent.flags & ATTR_VOLUME) { if (vallfn || invlfn) { - mod |= removede(f, boot, fat, + mod |= removede(fat, invlfn ? invlfn : vallfn, p, invlfn ? invcl : valcl, -1, 0, fullpath(dir), 2); @@ -741,7 +789,7 @@ readDosDirSection(int f, struct bootblock *boot, struc dirent.next = dir->child; if (invlfn) { - mod |= k = removede(f, boot, fat, + mod |= k = removede(fat, invlfn, vallfn ? vallfn : p, invcl, vallfn ? valcl : cl, cl, fullpath(&dirent), 0); @@ -757,74 +805,61 @@ readDosDirSection(int f, struct bootblock *boot, struc vallfn = NULL; /* not used any longer */ invlfn = NULL; - if (dirent.size == 0 && !(dirent.flags & ATTR_DIRECTORY)) { - if (dirent.head != 0) { - pwarn("%s has clusters, but size 0\n", - fullpath(&dirent)); - if (ask(1, "Drop allocated clusters")) { - p[26] = p[27] = 0; - if (boot->ClustMask == CLUST32_MASK) - p[20] = p[21] = 0; - clearchain(boot, fat, dirent.head); - dirent.head = 0; - mod |= THISMOD|FSDIRMOD|FSFATMOD; - } else - mod |= FSERROR; + /* + * Check if the directory entry is sane. + * + * '.' and '..' are skipped, their sanity is + * checked somewhere else. + * + * For everything else, check if we have a new, + * valid cluster chain (beginning of a file or + * directory that was never previously claimed + * by another file) when it's a non-empty file + * or a directory. The sanity of the cluster + * chain is checked at a later time when we + * traverse into the directory, or examine the + * file's directory entry. + * + * The only possible fix is to delete the entry + * if it's a directory; for file, we have to + * truncate the size to 0. + */ + if (!(dirent.flags & ATTR_DIRECTORY) || + (strcmp(dirent.name, ".") != 0 && + strcmp(dirent.name, "..") != 0)) { + if ((dirent.size != 0 || (dirent.flags & ATTR_DIRECTORY)) && + ((!fat_is_valid_cl(fat, dirent.head) || + !fat_is_cl_head(fat, dirent.head)))) { + if (!fat_is_valid_cl(fat, dirent.head)) { + pwarn("%s starts with cluster out of range(%u)\n", + fullpath(&dirent), + dirent.head); + } else { + pwarn("%s doesn't start a new cluster chain\n", + fullpath(&dirent)); + } + + if (dirent.flags & ATTR_DIRECTORY) { + if (ask(0, "Remove")) { + *p = SLOT_DELETED; + mod |= THISMOD|FSDIRMOD; + } else + mod |= FSERROR; + continue; + } else { + if (ask(1, "Truncate")) { + p[28] = p[29] = p[30] = p[31] = 0; + p[26] = p[27] = 0; + if (boot->ClustMask == CLUST32_MASK) + p[20] = p[21] = 0; + dirent.size = 0; + dirent.head = 0; + mod |= THISMOD|FSDIRMOD; + } else + mod |= FSERROR; + } } - } else if (dirent.head == 0 - && !strcmp(dirent.name, "..") - && dir->parent /* XXX */ - && !dir->parent->parent) { - /* - * Do nothing, the parent is the root - */ - } else if (dirent.head < CLUST_FIRST - || dirent.head >= boot->NumClusters - || fat[dirent.head].next == CLUST_FREE - || (fat[dirent.head].next >= CLUST_RSRVD - && fat[dirent.head].next < CLUST_EOFS) - || fat[dirent.head].head != dirent.head) { - if (dirent.head == 0) - pwarn("%s has no clusters\n", - fullpath(&dirent)); - else if (dirent.head < CLUST_FIRST - || dirent.head >= boot->NumClusters) - pwarn("%s starts with cluster out of range(%u)\n", - fullpath(&dirent), - dirent.head); - else if (fat[dirent.head].next == CLUST_FREE) - pwarn("%s starts with free cluster\n", - fullpath(&dirent)); - else if (fat[dirent.head].next >= CLUST_RSRVD) - pwarn("%s starts with cluster marked %s\n", - fullpath(&dirent), - rsrvdcltype(fat[dirent.head].next)); - else - pwarn("%s doesn't start a cluster chain\n", - fullpath(&dirent)); - if (dirent.flags & ATTR_DIRECTORY) { - if (ask(0, "Remove")) { - *p = SLOT_DELETED; - mod |= THISMOD|FSDIRMOD; - } else - mod |= FSERROR; - continue; - } else { - if (ask(1, "Truncate")) { - p[28] = p[29] = p[30] = p[31] = 0; - p[26] = p[27] = 0; - if (boot->ClustMask == CLUST32_MASK) - p[20] = p[21] = 0; - dirent.size = 0; - mod |= THISMOD|FSDIRMOD; - } else - mod |= FSERROR; - } } - - if (dirent.head >= CLUST_FIRST && dirent.head < boot->NumClusters) - fat[dirent.head].flags |= FAT_USED; - if (dirent.flags & ATTR_DIRECTORY) { /* * gather more info for directories @@ -861,8 +896,7 @@ readDosDirSection(int f, struct bootblock *boot, struc mod |= FSERROR; } continue; - } - if (strcmp(dirent.name, "..") == 0) { + } else if (strcmp(dirent.name, "..") == 0) { if (dir->parent) { /* XXX */ if (!dir->parent->parent) { if (dirent.head) { @@ -908,7 +942,7 @@ readDosDirSection(int f, struct bootblock *boot, struc } else mod |= FSERROR; continue; - } else if ((check_subdirectory(f, boot, + } else if ((check_subdirectory(fat, &dirent) & FSERROR) == FSERROR) { /* * A subdirectory should have @@ -944,39 +978,43 @@ readDosDirSection(int f, struct bootblock *boot, struc n->dir = d; pendingDirectories = n; } else { - mod |= k = checksize(boot, fat, p, &dirent); + mod |= k = checksize(fat, p, &dirent); if (k & FSDIRMOD) mod |= THISMOD; } boot->NumFiles++; } - if (!(boot->flags & FAT32) && !dir->parent) + if (is_legacyroot) { + /* + * Don't bother to write back right now because + * we may continue to make modification to the + * non-FAT32 root directory below. + */ break; - - if (mod & THISMOD) { - last *= 32; - if (lseek(f, off, SEEK_SET) != off - || write(f, buffer, last) != last) { + } else if (mod & THISMOD) { + if (lseek(fd, off, SEEK_SET) != off + || write(fd, buffer, iosize) != iosize) { perr("Unable to write directory"); return FSFATAL; } mod &= ~THISMOD; } - } while ((cl = fat[cl].next) >= CLUST_FIRST && cl < boot->NumClusters); + } while (fat_is_valid_cl(fat, (cl = fat_get_cl_next(fat, cl)))); if (invlfn || vallfn) - mod |= removede(f, boot, fat, + mod |= removede(fat, invlfn ? invlfn : vallfn, p, invlfn ? invcl : valcl, -1, 0, fullpath(dir), 1); - /* The root directory of non fat32 filesystems is in a special - * area and may have been modified above without being written out. + /* + * The root directory of non-FAT32 filesystems is in a special + * area and may have been modified above removede() without + * being written out. */ - if ((mod & FSDIRMOD) && !(boot->flags & FAT32) && !dir->parent) { - last *= 32; - if (lseek(f, off, SEEK_SET) != off - || write(f, buffer, last) != last) { + if ((mod & FSDIRMOD) && is_legacyroot) { + if (lseek(fd, off, SEEK_SET) != off + || write(fd, buffer, iosize) != iosize) { perr("Unable to write directory"); return FSFATAL; } @@ -986,11 +1024,11 @@ readDosDirSection(int f, struct bootblock *boot, struc } int -handleDirTree(int dosfs, struct bootblock *boot, struct fatEntry *fat) +handleDirTree(struct fat_descriptor *fat) { int mod; - mod = readDosDirSection(dosfs, boot, fat, rootDir); + mod = readDosDirSection(fat, rootDir); if (mod & FSFATAL) return FSFATAL; @@ -1011,7 +1049,7 @@ handleDirTree(int dosfs, struct bootblock *boot, struc /* * handle subdirectory */ - mod |= readDosDirSection(dosfs, boot, fat, dir); + mod |= readDosDirSection(fat, dir); if (mod & FSFATAL) return FSFATAL; } @@ -1027,12 +1065,15 @@ static cl_t lfcl; static off_t lfoff; int -reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head) +reconnect(struct fat_descriptor *fat, cl_t head, size_t length) { + struct bootblock *boot = fat_get_boot(fat); struct dosDirEntry d; - int len; + int len, dosfs; u_char *p; + dosfs = fat_get_fd(fat); + if (!ask(1, "Reconnect")) return FSERROR; @@ -1063,7 +1104,7 @@ reconnect(int dosfs, struct bootblock *boot, struct fa break; if (p && p < lfbuf + boot->ClusterSize) break; - lfcl = p ? fat[lfcl].next : lostDir->head; + lfcl = p ? fat_get_cl_next(fat, lfcl) : lostDir->head; if (lfcl < CLUST_FIRST || lfcl >= boot->NumClusters) { /* Extend LOSTDIR? XXX */ pwarn("No space in %s\n", LOSTDIR); @@ -1088,7 +1129,7 @@ reconnect(int dosfs, struct bootblock *boot, struct fa len = snprintf(d.name, sizeof(d.name), "%u", head); d.flags = 0; d.head = head; - d.size = fat[head].length * boot->ClusterSize; + d.size = length * boot->ClusterSize; memcpy(p, d.name, len); memset(p + len, ' ', 11 - len); @@ -1103,7 +1144,6 @@ reconnect(int dosfs, struct bootblock *boot, struct fa p[29] = (u_char)(d.size >> 8); p[30] = (u_char)(d.size >> 16); p[31] = (u_char)(d.size >> 24); - fat[head].flags |= FAT_USED; if (lseek(dosfs, lfoff, SEEK_SET) != lfoff || (size_t)write(dosfs, lfbuf, boot->ClusterSize) != boot->ClusterSize) { perr("could not write LOST.DIR"); Modified: head/sbin/fsck_msdosfs/dosfs.h ============================================================================== --- head/sbin/fsck_msdosfs/dosfs.h Wed Jan 1 04:29:08 2020 (r356248) +++ head/sbin/fsck_msdosfs/dosfs.h Wed Jan 1 07:43:08 2020 (r356249) @@ -83,19 +83,13 @@ struct bootblock { u_int NumBad; /* # of bad clusters */ }; -struct fatEntry { - cl_t next; /* pointer to next cluster */ - cl_t head; /* pointer to start of chain */ - u_int32_t length; /* number of clusters on chain */ - int flags; /* see below */ -}; - #define CLUST_FREE 0 /* 0 means cluster is free */ #define CLUST_FIRST 2 /* 2 is the minimum valid cluster number */ #define CLUST_RSRVD 0xfffffff6 /* start of reserved clusters */ #define CLUST_BAD 0xfffffff7 /* a cluster with a defect */ #define CLUST_EOFS 0xfffffff8 /* start of EOF indicators */ #define CLUST_EOF 0xffffffff /* standard value for last cluster */ +#define CLUST_DEAD 0xfdeadc0d /* error encountered */ /* * Masks for cluster values @@ -103,8 +97,6 @@ struct fatEntry { #define CLUST12_MASK 0xfff #define CLUST16_MASK 0xffff #define CLUST32_MASK 0xfffffff - -#define FAT_USED 1 /* This fat chain is used in a file */ #define DOSLONGNAMELEN 256 /* long name maximal length */ #define LRFIRST 0x40 /* first long name record */ Modified: head/sbin/fsck_msdosfs/ext.h ============================================================================== --- head/sbin/fsck_msdosfs/ext.h Wed Jan 1 04:29:08 2020 (r356248) +++ head/sbin/fsck_msdosfs/ext.h Wed Jan 1 07:43:08 2020 (r356249) @@ -32,6 +32,8 @@ #include +#include + #include "dosfs.h" #define LOSTDIR "LOST.DIR" @@ -44,6 +46,7 @@ extern int alwaysyes; /* assume "yes" for all question extern int preen; /* we are preening */ extern int rdonly; /* device is opened read only (supersedes above) */ extern int skipclean; /* skip clean file systems if preening */ +extern int allow_mmap; /* allow the use of mmap() */ /* * function declarations @@ -72,7 +75,6 @@ int checkfilesys(const char *); #define FSERROR 8 /* Some unrecovered error remains */ #define FSFATAL 16 /* Some unrecoverable error occurred */ #define FSDIRTY 32 /* File system is dirty */ -#define FSFIXFAT 64 /* Fix file system FAT */ /* * read a boot block in a machine independent fashion and translate @@ -85,46 +87,53 @@ int readboot(int, struct bootblock *); */ int writefsinfo(int, struct bootblock *); -/* - * Read one of the FAT copies and return a pointer to the new - * allocated array holding our description of it. - */ -int readfat(int, struct bootblock *, u_int, struct fatEntry **); +/* Opaque type */ +struct fat_descriptor; -/* - * Check two FAT copies for consistency and merge changes into the - * first if necessary. - */ -int comparefat(struct bootblock *, struct fatEntry *, struct fatEntry *, u_int); +void fat_clear_cl_head(struct fat_descriptor *, cl_t); +bool fat_is_cl_head(struct fat_descriptor *, cl_t); +cl_t fat_get_cl_next(struct fat_descriptor *, cl_t); + +int fat_set_cl_next(struct fat_descriptor *, cl_t, cl_t); + +cl_t fat_allocate_cluster(struct fat_descriptor *fat); + +struct bootblock* fat_get_boot(struct fat_descriptor *); +int fat_get_fd(struct fat_descriptor *); +bool fat_is_valid_cl(struct fat_descriptor *, cl_t); + /* - * Check a FAT + * Read the FAT 0 and return a pointer to the newly allocated + * descriptor of it. */ -int checkfat(struct bootblock *, struct fatEntry *); +int readfat(int, struct bootblock *, struct fat_descriptor **); /* * Write back FAT entries */ -int writefat(int, struct bootblock *, struct fatEntry *, int); +int writefat(struct fat_descriptor *); /* * Read a directory */ -int resetDosDirSection(struct bootblock *, struct fatEntry *); +int resetDosDirSection(struct fat_descriptor *); void finishDosDirSection(void); -int handleDirTree(int, struct bootblock *, struct fatEntry *); +int handleDirTree(struct fat_descriptor *); /* * Cross-check routines run after everything is completely in memory */ +int checkchain(struct fat_descriptor *, cl_t, size_t *); + /* * Check for lost cluster chains */ -int checklost(int, struct bootblock *, struct fatEntry *); +int checklost(struct fat_descriptor *); /* * Try to reconnect a lost cluster chain */ -int reconnect(int, struct bootblock *, struct fatEntry *, cl_t); +int reconnect(struct fat_descriptor *, cl_t, size_t); void finishlf(void); /* @@ -138,6 +147,6 @@ const char *rsrvdcltype(cl_t); /* * Clear a cluster chain in a FAT */ -void clearchain(struct bootblock *, struct fatEntry *, cl_t); +void clearchain(struct fat_descriptor *, cl_t); #endif Modified: head/sbin/fsck_msdosfs/fat.c ============================================================================== --- head/sbin/fsck_msdosfs/fat.c Wed Jan 1 04:29:08 2020 (r356248) +++ head/sbin/fsck_msdosfs/fat.c Wed Jan 1 07:43:08 2020 (r356249) @@ -1,6 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * + * Copyright (c) 2019 Google LLC * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank * Copyright (c) 1995 Martin Husemann * @@ -33,6 +34,14 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include +#include +#include +#include +#include + +#include +#include #include #include #include @@ -42,12 +51,517 @@ static const char rcsid[] = #include "ext.h" #include "fsutil.h" -static int checkclnum(struct bootblock *, u_int, cl_t, cl_t *); -static int clustdiffer(cl_t, cl_t *, cl_t *, u_int); -static int tryclear(struct bootblock *, struct fatEntry *, cl_t, cl_t *); -static int _readfat(int, struct bootblock *, u_int, u_char **); +static int _readfat(struct fat_descriptor *); +static inline struct bootblock* boot_of_(struct fat_descriptor *); +static inline int fd_of_(struct fat_descriptor *); +static inline bool valid_cl(struct fat_descriptor *, cl_t); -/*- + +/* + * Head bitmap for FAT scanning. + * + * FAT32 have up to 2^28 = 256M entries, and FAT16/12 have much less. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Jan 1 09:22:08 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 238811D1A2E; Wed, 1 Jan 2020 09:22:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nm000vj5z3GYS; Wed, 1 Jan 2020 09:22:08 +0000 (UTC) (envelope-from delphij@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18A536E2; Wed, 1 Jan 2020 09:22:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0019M8qM067979; Wed, 1 Jan 2020 09:22:08 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0019M7nD066842; Wed, 1 Jan 2020 09:22:07 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202001010922.0019M7nD066842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 1 Jan 2020 09:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356250 - head/sbin/fsck_msdosfs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/fsck_msdosfs X-SVN-Commit-Revision: 356250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 09:22:08 -0000 Author: delphij Date: Wed Jan 1 09:22:06 2020 New Revision: 356250 URL: https://svnweb.freebsd.org/changeset/base/356250 Log: Revert r356249 for now as it broke GCC builds. Modified: head/sbin/fsck_msdosfs/boot.c head/sbin/fsck_msdosfs/check.c head/sbin/fsck_msdosfs/dir.c head/sbin/fsck_msdosfs/dosfs.h head/sbin/fsck_msdosfs/ext.h head/sbin/fsck_msdosfs/fat.c head/sbin/fsck_msdosfs/main.c Modified: head/sbin/fsck_msdosfs/boot.c ============================================================================== --- head/sbin/fsck_msdosfs/boot.c Wed Jan 1 07:43:08 2020 (r356249) +++ head/sbin/fsck_msdosfs/boot.c Wed Jan 1 09:22:06 2020 (r356250) @@ -152,6 +152,9 @@ readboot(int dosfs, struct bootblock *boot) boot->NumSectors = boot->bpbHugeSectors; } + + + if (boot->flags & FAT32) { /* If the OEM Name field is EXFAT, it's not FAT32, so bail */ if (!memcmp(&block[3], "EXFAT ", 8)) { @@ -269,30 +272,13 @@ readboot(int dosfs, struct bootblock *boot) boot->NumClusters = (boot->NumSectors - boot->FirstCluster) / boot->bpbSecPerClust + CLUST_FIRST; - if (boot->flags & FAT32) { - if (boot->NumClusters > (CLUST_RSRVD & CLUST32_MASK)) { - pfatal("Filesystem too big (%u clusters) for FAT32 partition", - boot->NumClusters); - return FSFATAL; - } - if (boot->NumClusters < (CLUST_RSRVD & CLUST16_MASK)) { - pfatal("Filesystem too small (%u clusters) for FAT32 partition", - boot->NumClusters); - return FSFATAL; - } + if (boot->flags & FAT32) boot->ClustMask = CLUST32_MASK; - - if (boot->bpbRootClust < CLUST_FIRST || - boot->bpbRootClust >= boot->NumClusters) { - pfatal("Root directory starts with cluster out of range(%u)", - boot->bpbRootClust); - return FSFATAL; - } - } else if (boot->NumClusters < (CLUST_RSRVD&CLUST12_MASK)) { + else if (boot->NumClusters < (CLUST_RSRVD&CLUST12_MASK)) boot->ClustMask = CLUST12_MASK; - } else if (boot->NumClusters < (CLUST_RSRVD&CLUST16_MASK)) { + else if (boot->NumClusters < (CLUST_RSRVD&CLUST16_MASK)) boot->ClustMask = CLUST16_MASK; - } else { + else { pfatal("Filesystem too big (%u clusters) for non-FAT32 partition", boot->NumClusters); return FSFATAL; Modified: head/sbin/fsck_msdosfs/check.c ============================================================================== --- head/sbin/fsck_msdosfs/check.c Wed Jan 1 07:43:08 2020 (r356249) +++ head/sbin/fsck_msdosfs/check.c Wed Jan 1 09:22:06 2020 (r356250) @@ -47,8 +47,9 @@ checkfilesys(const char *fname) { int dosfs; struct bootblock boot; - struct fat_descriptor *fat = NULL; + struct fatEntry *fat = NULL; int finish_dosdirsection=0; + u_int i; int mod = 0; int ret = 8; @@ -87,39 +88,65 @@ checkfilesys(const char *fname) } if (!preen) { - printf("** Phase 1 - Read FAT and checking connectivity\n"); + if (boot.ValidFat < 0) + printf("** Phase 1 - Read and Compare FATs\n"); + else + printf("** Phase 1 - Read FAT\n"); } - mod |= readfat(dosfs, &boot, &fat); + mod |= readfat(dosfs, &boot, boot.ValidFat >= 0 ? boot.ValidFat : 0, &fat); if (mod & FSFATAL) { close(dosfs); return 8; } + if (boot.ValidFat < 0) + for (i = 1; i < boot.bpbFATs; i++) { + struct fatEntry *currentFat; + + mod |= readfat(dosfs, &boot, i, ¤tFat); + + if (mod & FSFATAL) + goto out; + + mod |= comparefat(&boot, fat, currentFat, i); + free(currentFat); + if (mod & FSFATAL) + goto out; + } + if (!preen) - printf("** Phase 2 - Checking Directories\n"); + printf("** Phase 2 - Check Cluster Chains\n"); - mod |= resetDosDirSection(fat); + mod |= checkfat(&boot, fat); + if (mod & FSFATAL) + goto out; + /* delay writing FATs */ + + if (!preen) + printf("** Phase 3 - Checking Directories\n"); + + mod |= resetDosDirSection(&boot, fat); finish_dosdirsection = 1; if (mod & FSFATAL) goto out; /* delay writing FATs */ - mod |= handleDirTree(fat); + mod |= handleDirTree(dosfs, &boot, fat); if (mod & FSFATAL) goto out; if (!preen) - printf("** Phase 3 - Checking for Lost Files\n"); + printf("** Phase 4 - Checking for Lost Files\n"); - mod |= checklost(fat); + mod |= checklost(dosfs, &boot, fat); if (mod & FSFATAL) goto out; /* now write the FATs */ - if (mod & FSFATMOD) { + if (mod & (FSFATMOD|FSFIXFAT)) { if (ask(1, "Update FATs")) { - mod |= writefat(fat); + mod |= writefat(dosfs, &boot, fat, mod & FSFIXFAT); if (mod & FSFATAL) goto out; } else @@ -143,7 +170,7 @@ checkfilesys(const char *fname) if (mod & FSDIRTY) { pwarn("MARKING FILE SYSTEM CLEAN\n"); - mod |= writefat(fat); + mod |= writefat(dosfs, &boot, fat, 1); } else { pwarn("\n***** FILE SYSTEM IS LEFT MARKED AS DIRTY *****\n"); mod |= FSERROR; /* file system not clean */ Modified: head/sbin/fsck_msdosfs/dir.c ============================================================================== --- head/sbin/fsck_msdosfs/dir.c Wed Jan 1 07:43:08 2020 (r356249) +++ head/sbin/fsck_msdosfs/dir.c Wed Jan 1 09:22:06 2020 (r356250) @@ -1,7 +1,6 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2019 Google LLC * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank * Copyright (c) 1995 Martin Husemann * Some structure declaration borrowed from Paul Popelka @@ -96,11 +95,14 @@ static struct dirTodoNode *newDirTodo(void); static void freeDirTodo(struct dirTodoNode *); static char *fullpath(struct dosDirEntry *); static u_char calcShortSum(u_char *); -static int delete(struct fat_descriptor *, cl_t, int, cl_t, int, int); -static int removede(struct fat_descriptor *, u_char *, u_char *, - cl_t, cl_t, cl_t, char *, int); -static int checksize(struct fat_descriptor *, u_char *, struct dosDirEntry *); -static int readDosDirSection(struct fat_descriptor *, struct dosDirEntry *); +static int delete(int, struct bootblock *, struct fatEntry *, cl_t, int, + cl_t, int, int); +static int removede(int, struct bootblock *, struct fatEntry *, u_char *, + u_char *, cl_t, cl_t, cl_t, char *, int); +static int checksize(struct bootblock *, struct fatEntry *, u_char *, + struct dosDirEntry *); +static int readDosDirSection(int, struct bootblock *, struct fatEntry *, + struct dosDirEntry *); /* * Manage free dosDirEntry structures. @@ -114,7 +116,7 @@ newDosDirEntry(void) if (!(de = freede)) { if (!(de = malloc(sizeof *de))) - return (NULL); + return 0; } else freede = de->next; return de; @@ -191,7 +193,7 @@ fullpath(struct dosDirEntry *dir) /* * Calculate a checksum over an 8.3 alias name */ -static inline u_char +static u_char calcShortSum(u_char *p) { u_char sum = 0; @@ -219,24 +221,21 @@ static struct dosDirEntry *lostDir; * Init internal state for a new directory scan. */ int -resetDosDirSection(struct fat_descriptor *fat) +resetDosDirSection(struct bootblock *boot, struct fatEntry *fat) { - int rootdir_size, cluster_size; + int b1, b2; int ret = FSOK; size_t len; - struct bootblock *boot; - boot = fat_get_boot(fat); + b1 = boot->bpbRootDirEnts * 32; + b2 = boot->bpbSecPerClust * boot->bpbBytesPerSec; - rootdir_size = boot->bpbRootDirEnts * 32; - cluster_size = boot->bpbSecPerClust * boot->bpbBytesPerSec; - - if ((buffer = malloc(len = MAX(rootdir_size, cluster_size))) == NULL) { + if ((buffer = malloc(len = MAX(b1, b2))) == NULL) { perr("No space for directory buffer (%zu)", len); return FSFATAL; } - if ((delbuf = malloc(len = cluster_size)) == NULL) { + if ((delbuf = malloc(len = b2)) == NULL) { free(buffer); perr("No space for directory delbuf (%zu)", len); return FSFATAL; @@ -251,10 +250,18 @@ resetDosDirSection(struct fat_descriptor *fat) memset(rootDir, 0, sizeof *rootDir); if (boot->flags & FAT32) { - if (!fat_is_cl_head(fat, boot->bpbRootClust)) { + if (boot->bpbRootClust < CLUST_FIRST || + boot->bpbRootClust >= boot->NumClusters) { + pfatal("Root directory starts with cluster out of range(%u)", + boot->bpbRootClust); + return FSFATAL; + } + if (fat[boot->bpbRootClust].head != boot->bpbRootClust) { pfatal("Root directory doesn't start a cluster chain"); return FSFATAL; } + + fat[boot->bpbRootClust].flags |= FAT_USED; rootDir->head = boot->bpbRootClust; } @@ -295,21 +302,16 @@ finishDosDirSection(void) * Delete directory entries between startcl, startoff and endcl, endoff. */ static int -delete(struct fat_descriptor *fat, cl_t startcl, +delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl, int startoff, cl_t endcl, int endoff, int notlast) { u_char *s, *e; off_t off; - int clsz, fd; - struct bootblock *boot; + int clsz = boot->bpbSecPerClust * boot->bpbBytesPerSec; - boot = fat_get_boot(fat); - fd = fat_get_fd(fat); - clsz = boot->bpbSecPerClust * boot->bpbBytesPerSec; - s = delbuf + startoff; e = delbuf + clsz; - while (fat_is_valid_cl(fat, startcl)) { + while (startcl >= CLUST_FIRST && startcl < boot->NumClusters) { if (startcl == endcl) { if (notlast) break; @@ -318,11 +320,11 @@ delete(struct fat_descriptor *fat, cl_t startcl, off = (startcl - CLUST_FIRST) * boot->bpbSecPerClust + boot->FirstCluster; off *= boot->bpbBytesPerSec; - if (lseek(fd, off, SEEK_SET) != off) { + if (lseek(f, off, SEEK_SET) != off) { perr("Unable to lseek to %" PRId64, off); return FSFATAL; } - if (read(fd, delbuf, clsz) != clsz) { + if (read(f, delbuf, clsz) != clsz) { perr("Unable to read directory"); return FSFATAL; } @@ -330,26 +332,25 @@ delete(struct fat_descriptor *fat, cl_t startcl, *s = SLOT_DELETED; s += 32; } - if (lseek(fd, off, SEEK_SET) != off) { + if (lseek(f, off, SEEK_SET) != off) { perr("Unable to lseek to %" PRId64, off); return FSFATAL; } - if (write(fd, delbuf, clsz) != clsz) { + if (write(f, delbuf, clsz) != clsz) { perr("Unable to write directory"); return FSFATAL; } if (startcl == endcl) break; - startcl = fat_get_cl_next(fat, startcl); + startcl = fat[startcl].next; s = delbuf; } return FSOK; } static int -removede(struct fat_descriptor *fat, u_char *start, - u_char *end, cl_t startcl, cl_t endcl, cl_t curcl, - char *path, int type) +removede(int f, struct bootblock *boot, struct fatEntry *fat, u_char *start, + u_char *end, cl_t startcl, cl_t endcl, cl_t curcl, char *path, int type) { switch (type) { case 0: @@ -365,14 +366,14 @@ removede(struct fat_descriptor *fat, u_char *start, } if (ask(0, "Remove")) { if (startcl != curcl) { - if (delete(fat, + if (delete(f, boot, fat, startcl, start - buffer, endcl, end - buffer, endcl == curcl) == FSFATAL) return FSFATAL; start = buffer; } - /* startcl is < CLUST_FIRST for !FAT32 root */ + /* startcl is < CLUST_FIRST for !fat32 root */ if ((endcl == curcl) || (startcl < CLUST_FIRST)) for (; start < end; start += 32) *start = SLOT_DELETED; @@ -385,37 +386,23 @@ removede(struct fat_descriptor *fat, u_char *start, * Check an in-memory file entry */ static int -checksize(struct fat_descriptor *fat, u_char *p, struct dosDirEntry *dir) +checksize(struct bootblock *boot, struct fatEntry *fat, u_char *p, + struct dosDirEntry *dir) { - int ret = FSOK; - size_t physicalSize; - struct bootblock *boot; - - boot = fat_get_boot(fat); - /* * Check size on ordinary files */ - if (dir->head == CLUST_FREE) { + u_int32_t physicalSize; + + if (dir->head == CLUST_FREE) physicalSize = 0; - } else { - if (!fat_is_valid_cl(fat, dir->head)) + else { + if (dir->head < CLUST_FIRST || dir->head >= boot->NumClusters) return FSERROR; - ret = checkchain(fat, dir->head, &physicalSize); - /* - * Upon return, physicalSize would hold the chain length - * that checkchain() was able to validate, but if the user - * refused the proposed repair, it would be unsafe to - * proceed with directory entry fix, so bail out in that - * case. - */ - if (ret == FSERROR) { - return (FSERROR); - } - physicalSize *= boot->ClusterSize; + physicalSize = fat[dir->head].length * boot->ClusterSize; } if (physicalSize < dir->size) { - pwarn("size of %s is %u, should at most be %zu\n", + pwarn("size of %s is %u, should at most be %u\n", fullpath(dir), dir->size, physicalSize); if (ask(1, "Truncate")) { dir->size = physicalSize; @@ -435,10 +422,11 @@ checksize(struct fat_descriptor *fat, u_char *p, struc for (cl = dir->head, len = sz = 0; (sz += boot->ClusterSize) < dir->size; len++) - cl = fat_get_cl_next(fat, cl); - clearchain(fat, fat_get_cl_next(fat, cl)); - ret = fat_set_cl_next(fat, cl, CLUST_EOF); - return (FSFATMOD | ret); + cl = fat[cl].next; + clearchain(boot, fat, fat[cl].next); + fat[cl].next = CLUST_EOF; + fat[dir->head].length = len; + return FSFATMOD; } else return FSERROR; } @@ -454,20 +442,15 @@ static const u_char dotdot_name[11] = ".. "; * when we traverse into it. */ static int -check_subdirectory(struct fat_descriptor *fat, struct dosDirEntry *dir) +check_subdirectory(int f, struct bootblock *boot, struct dosDirEntry *dir) { u_char *buf, *cp; off_t off; cl_t cl; int retval = FSOK; - int fd; - struct bootblock *boot; - boot = fat_get_boot(fat); - fd = fat_get_fd(fat); - cl = dir->head; - if (dir->parent && !fat_is_valid_cl(fat, cl)) { + if (dir->parent && (cl < CLUST_FIRST || cl >= boot->NumClusters)) { return FSERROR; } @@ -491,8 +474,8 @@ check_subdirectory(struct fat_descriptor *fat, struct } off *= boot->bpbBytesPerSec; - if (lseek(fd, off, SEEK_SET) != off || - read(fd, buf, boot->bpbBytesPerSec) != (ssize_t)boot->bpbBytesPerSec) { + if (lseek(f, off, SEEK_SET) != off || + read(f, buf, boot->bpbBytesPerSec) != (ssize_t)boot->bpbBytesPerSec) { perr("Unable to read directory"); free(buf); return FSFATAL; @@ -526,27 +509,22 @@ check_subdirectory(struct fat_descriptor *fat, struct * - push directories onto the todo-stack */ static int -readDosDirSection(struct fat_descriptor *fat, struct dosDirEntry *dir) +readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat, + struct dosDirEntry *dir) { - struct bootblock *boot; struct dosDirEntry dirent, *d; u_char *p, *vallfn, *invlfn, *empty; off_t off; - int fd, i, j, k, iosize, entries; - bool is_legacyroot; + int i, j, k, last; cl_t cl, valcl = ~0, invcl = ~0, empcl = ~0; char *t; u_int lidx = 0; int shortSum; int mod = FSOK; - size_t dirclusters; #define THISMOD 0x8000 /* Only used within this routine */ - boot = fat_get_boot(fat); - fd = fat_get_fd(fat); - cl = dir->head; - if (dir->parent && (!fat_is_valid_cl(fat, cl))) { + if (dir->parent && (cl < CLUST_FIRST || cl >= boot->NumClusters)) { /* * Already handled somewhere else. */ @@ -554,50 +532,24 @@ readDosDirSection(struct fat_descriptor *fat, struct d } shortSum = -1; vallfn = invlfn = empty = NULL; - - /* - * If we are checking the legacy root (for FAT12/FAT16), - * we will operate on the whole directory; otherwise, we - * will operate on one cluster at a time, and also take - * this opportunity to examine the chain. - * - * Derive how many entries we are going to encounter from - * the I/O size. - */ - is_legacyroot = (dir->parent == NULL && !(boot->flags & FAT32)); - if (is_legacyroot) { - iosize = boot->bpbRootDirEnts * 32; - entries = boot->bpbRootDirEnts; - } else { - iosize = boot->bpbSecPerClust * boot->bpbBytesPerSec; - entries = iosize / 32; - mod |= checkchain(fat, dir->head, &dirclusters); - } - do { - if (is_legacyroot) { - /* - * Special case for FAT12/FAT16 root -- read - * in the whole root directory. - */ + if (!(boot->flags & FAT32) && !dir->parent) { + last = boot->bpbRootDirEnts * 32; off = boot->bpbResSectors + boot->bpbFATs * boot->FATsecs; } else { - /* - * Otherwise, read in a cluster of the - * directory. - */ + last = boot->bpbSecPerClust * boot->bpbBytesPerSec; off = (cl - CLUST_FIRST) * boot->bpbSecPerClust + boot->FirstCluster; } off *= boot->bpbBytesPerSec; - if (lseek(fd, off, SEEK_SET) != off || - read(fd, buffer, iosize) != iosize) { + if (lseek(f, off, SEEK_SET) != off + || read(f, buffer, last) != last) { perr("Unable to read directory"); return FSFATAL; } - - for (p = buffer, i = 0; i < entries; i++, p += 32) { + last /= 32; + for (p = buffer, i = 0; i < last; i++, p += 32) { if (dir->fsckflags & DIREMPWARN) { *p = SLOT_EMPTY; continue; @@ -620,7 +572,7 @@ readDosDirSection(struct fat_descriptor *fat, struct d u_char *q; dir->fsckflags &= ~DIREMPTY; - if (delete(fat, + if (delete(f, boot, fat, empcl, empty - buffer, cl, p - buffer, 1) == FSFATAL) return FSFATAL; @@ -749,7 +701,7 @@ readDosDirSection(struct fat_descriptor *fat, struct d if (dirent.flags & ATTR_VOLUME) { if (vallfn || invlfn) { - mod |= removede(fat, + mod |= removede(f, boot, fat, invlfn ? invlfn : vallfn, p, invlfn ? invcl : valcl, -1, 0, fullpath(dir), 2); @@ -789,7 +741,7 @@ readDosDirSection(struct fat_descriptor *fat, struct d dirent.next = dir->child; if (invlfn) { - mod |= k = removede(fat, + mod |= k = removede(f, boot, fat, invlfn, vallfn ? vallfn : p, invcl, vallfn ? valcl : cl, cl, fullpath(&dirent), 0); @@ -805,61 +757,74 @@ readDosDirSection(struct fat_descriptor *fat, struct d vallfn = NULL; /* not used any longer */ invlfn = NULL; - /* - * Check if the directory entry is sane. - * - * '.' and '..' are skipped, their sanity is - * checked somewhere else. - * - * For everything else, check if we have a new, - * valid cluster chain (beginning of a file or - * directory that was never previously claimed - * by another file) when it's a non-empty file - * or a directory. The sanity of the cluster - * chain is checked at a later time when we - * traverse into the directory, or examine the - * file's directory entry. - * - * The only possible fix is to delete the entry - * if it's a directory; for file, we have to - * truncate the size to 0. - */ - if (!(dirent.flags & ATTR_DIRECTORY) || - (strcmp(dirent.name, ".") != 0 && - strcmp(dirent.name, "..") != 0)) { - if ((dirent.size != 0 || (dirent.flags & ATTR_DIRECTORY)) && - ((!fat_is_valid_cl(fat, dirent.head) || - !fat_is_cl_head(fat, dirent.head)))) { - if (!fat_is_valid_cl(fat, dirent.head)) { - pwarn("%s starts with cluster out of range(%u)\n", - fullpath(&dirent), - dirent.head); - } else { - pwarn("%s doesn't start a new cluster chain\n", - fullpath(&dirent)); - } - - if (dirent.flags & ATTR_DIRECTORY) { - if (ask(0, "Remove")) { - *p = SLOT_DELETED; - mod |= THISMOD|FSDIRMOD; - } else - mod |= FSERROR; - continue; - } else { - if (ask(1, "Truncate")) { - p[28] = p[29] = p[30] = p[31] = 0; - p[26] = p[27] = 0; - if (boot->ClustMask == CLUST32_MASK) - p[20] = p[21] = 0; - dirent.size = 0; - dirent.head = 0; - mod |= THISMOD|FSDIRMOD; - } else - mod |= FSERROR; - } + if (dirent.size == 0 && !(dirent.flags & ATTR_DIRECTORY)) { + if (dirent.head != 0) { + pwarn("%s has clusters, but size 0\n", + fullpath(&dirent)); + if (ask(1, "Drop allocated clusters")) { + p[26] = p[27] = 0; + if (boot->ClustMask == CLUST32_MASK) + p[20] = p[21] = 0; + clearchain(boot, fat, dirent.head); + dirent.head = 0; + mod |= THISMOD|FSDIRMOD|FSFATMOD; + } else + mod |= FSERROR; } + } else if (dirent.head == 0 + && !strcmp(dirent.name, "..") + && dir->parent /* XXX */ + && !dir->parent->parent) { + /* + * Do nothing, the parent is the root + */ + } else if (dirent.head < CLUST_FIRST + || dirent.head >= boot->NumClusters + || fat[dirent.head].next == CLUST_FREE + || (fat[dirent.head].next >= CLUST_RSRVD + && fat[dirent.head].next < CLUST_EOFS) + || fat[dirent.head].head != dirent.head) { + if (dirent.head == 0) + pwarn("%s has no clusters\n", + fullpath(&dirent)); + else if (dirent.head < CLUST_FIRST + || dirent.head >= boot->NumClusters) + pwarn("%s starts with cluster out of range(%u)\n", + fullpath(&dirent), + dirent.head); + else if (fat[dirent.head].next == CLUST_FREE) + pwarn("%s starts with free cluster\n", + fullpath(&dirent)); + else if (fat[dirent.head].next >= CLUST_RSRVD) + pwarn("%s starts with cluster marked %s\n", + fullpath(&dirent), + rsrvdcltype(fat[dirent.head].next)); + else + pwarn("%s doesn't start a cluster chain\n", + fullpath(&dirent)); + if (dirent.flags & ATTR_DIRECTORY) { + if (ask(0, "Remove")) { + *p = SLOT_DELETED; + mod |= THISMOD|FSDIRMOD; + } else + mod |= FSERROR; + continue; + } else { + if (ask(1, "Truncate")) { + p[28] = p[29] = p[30] = p[31] = 0; + p[26] = p[27] = 0; + if (boot->ClustMask == CLUST32_MASK) + p[20] = p[21] = 0; + dirent.size = 0; + mod |= THISMOD|FSDIRMOD; + } else + mod |= FSERROR; + } } + + if (dirent.head >= CLUST_FIRST && dirent.head < boot->NumClusters) + fat[dirent.head].flags |= FAT_USED; + if (dirent.flags & ATTR_DIRECTORY) { /* * gather more info for directories @@ -896,7 +861,8 @@ readDosDirSection(struct fat_descriptor *fat, struct d mod |= FSERROR; } continue; - } else if (strcmp(dirent.name, "..") == 0) { + } + if (strcmp(dirent.name, "..") == 0) { if (dir->parent) { /* XXX */ if (!dir->parent->parent) { if (dirent.head) { @@ -942,7 +908,7 @@ readDosDirSection(struct fat_descriptor *fat, struct d } else mod |= FSERROR; continue; - } else if ((check_subdirectory(fat, + } else if ((check_subdirectory(f, boot, &dirent) & FSERROR) == FSERROR) { /* * A subdirectory should have @@ -978,43 +944,39 @@ readDosDirSection(struct fat_descriptor *fat, struct d n->dir = d; pendingDirectories = n; } else { - mod |= k = checksize(fat, p, &dirent); + mod |= k = checksize(boot, fat, p, &dirent); if (k & FSDIRMOD) mod |= THISMOD; } boot->NumFiles++; } - if (is_legacyroot) { - /* - * Don't bother to write back right now because - * we may continue to make modification to the - * non-FAT32 root directory below. - */ + if (!(boot->flags & FAT32) && !dir->parent) break; - } else if (mod & THISMOD) { - if (lseek(fd, off, SEEK_SET) != off - || write(fd, buffer, iosize) != iosize) { + + if (mod & THISMOD) { + last *= 32; + if (lseek(f, off, SEEK_SET) != off + || write(f, buffer, last) != last) { perr("Unable to write directory"); return FSFATAL; } mod &= ~THISMOD; } - } while (fat_is_valid_cl(fat, (cl = fat_get_cl_next(fat, cl)))); + } while ((cl = fat[cl].next) >= CLUST_FIRST && cl < boot->NumClusters); if (invlfn || vallfn) - mod |= removede(fat, + mod |= removede(f, boot, fat, invlfn ? invlfn : vallfn, p, invlfn ? invcl : valcl, -1, 0, fullpath(dir), 1); - /* - * The root directory of non-FAT32 filesystems is in a special - * area and may have been modified above removede() without - * being written out. + /* The root directory of non fat32 filesystems is in a special + * area and may have been modified above without being written out. */ - if ((mod & FSDIRMOD) && is_legacyroot) { - if (lseek(fd, off, SEEK_SET) != off - || write(fd, buffer, iosize) != iosize) { + if ((mod & FSDIRMOD) && !(boot->flags & FAT32) && !dir->parent) { + last *= 32; + if (lseek(f, off, SEEK_SET) != off + || write(f, buffer, last) != last) { perr("Unable to write directory"); return FSFATAL; } @@ -1024,11 +986,11 @@ readDosDirSection(struct fat_descriptor *fat, struct d } int -handleDirTree(struct fat_descriptor *fat) +handleDirTree(int dosfs, struct bootblock *boot, struct fatEntry *fat) { int mod; - mod = readDosDirSection(fat, rootDir); + mod = readDosDirSection(dosfs, boot, fat, rootDir); if (mod & FSFATAL) return FSFATAL; @@ -1049,7 +1011,7 @@ handleDirTree(struct fat_descriptor *fat) /* * handle subdirectory */ - mod |= readDosDirSection(fat, dir); + mod |= readDosDirSection(dosfs, boot, fat, dir); if (mod & FSFATAL) return FSFATAL; } @@ -1065,15 +1027,12 @@ static cl_t lfcl; static off_t lfoff; int -reconnect(struct fat_descriptor *fat, cl_t head, size_t length) +reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head) { - struct bootblock *boot = fat_get_boot(fat); struct dosDirEntry d; - int len, dosfs; + int len; u_char *p; - dosfs = fat_get_fd(fat); - if (!ask(1, "Reconnect")) return FSERROR; @@ -1104,7 +1063,7 @@ reconnect(struct fat_descriptor *fat, cl_t head, size_ break; if (p && p < lfbuf + boot->ClusterSize) break; - lfcl = p ? fat_get_cl_next(fat, lfcl) : lostDir->head; + lfcl = p ? fat[lfcl].next : lostDir->head; if (lfcl < CLUST_FIRST || lfcl >= boot->NumClusters) { /* Extend LOSTDIR? XXX */ pwarn("No space in %s\n", LOSTDIR); @@ -1129,7 +1088,7 @@ reconnect(struct fat_descriptor *fat, cl_t head, size_ len = snprintf(d.name, sizeof(d.name), "%u", head); d.flags = 0; d.head = head; - d.size = length * boot->ClusterSize; + d.size = fat[head].length * boot->ClusterSize; memcpy(p, d.name, len); memset(p + len, ' ', 11 - len); @@ -1144,6 +1103,7 @@ reconnect(struct fat_descriptor *fat, cl_t head, size_ p[29] = (u_char)(d.size >> 8); p[30] = (u_char)(d.size >> 16); p[31] = (u_char)(d.size >> 24); + fat[head].flags |= FAT_USED; if (lseek(dosfs, lfoff, SEEK_SET) != lfoff || (size_t)write(dosfs, lfbuf, boot->ClusterSize) != boot->ClusterSize) { perr("could not write LOST.DIR"); Modified: head/sbin/fsck_msdosfs/dosfs.h ============================================================================== --- head/sbin/fsck_msdosfs/dosfs.h Wed Jan 1 07:43:08 2020 (r356249) +++ head/sbin/fsck_msdosfs/dosfs.h Wed Jan 1 09:22:06 2020 (r356250) @@ -83,13 +83,19 @@ struct bootblock { u_int NumBad; /* # of bad clusters */ }; +struct fatEntry { + cl_t next; /* pointer to next cluster */ + cl_t head; /* pointer to start of chain */ + u_int32_t length; /* number of clusters on chain */ + int flags; /* see below */ +}; + #define CLUST_FREE 0 /* 0 means cluster is free */ #define CLUST_FIRST 2 /* 2 is the minimum valid cluster number */ #define CLUST_RSRVD 0xfffffff6 /* start of reserved clusters */ #define CLUST_BAD 0xfffffff7 /* a cluster with a defect */ #define CLUST_EOFS 0xfffffff8 /* start of EOF indicators */ #define CLUST_EOF 0xffffffff /* standard value for last cluster */ -#define CLUST_DEAD 0xfdeadc0d /* error encountered */ /* * Masks for cluster values @@ -97,6 +103,8 @@ struct bootblock { #define CLUST12_MASK 0xfff #define CLUST16_MASK 0xffff #define CLUST32_MASK 0xfffffff + +#define FAT_USED 1 /* This fat chain is used in a file */ #define DOSLONGNAMELEN 256 /* long name maximal length */ #define LRFIRST 0x40 /* first long name record */ Modified: head/sbin/fsck_msdosfs/ext.h ============================================================================== --- head/sbin/fsck_msdosfs/ext.h Wed Jan 1 07:43:08 2020 (r356249) +++ head/sbin/fsck_msdosfs/ext.h Wed Jan 1 09:22:06 2020 (r356250) @@ -32,8 +32,6 @@ #include -#include - #include "dosfs.h" #define LOSTDIR "LOST.DIR" @@ -46,7 +44,6 @@ extern int alwaysyes; /* assume "yes" for all question extern int preen; /* we are preening */ extern int rdonly; /* device is opened read only (supersedes above) */ extern int skipclean; /* skip clean file systems if preening */ -extern int allow_mmap; /* allow the use of mmap() */ /* * function declarations @@ -75,6 +72,7 @@ int checkfilesys(const char *); #define FSERROR 8 /* Some unrecovered error remains */ #define FSFATAL 16 /* Some unrecoverable error occurred */ #define FSDIRTY 32 /* File system is dirty */ +#define FSFIXFAT 64 /* Fix file system FAT */ /* * read a boot block in a machine independent fashion and translate @@ -87,53 +85,46 @@ int readboot(int, struct bootblock *); */ int writefsinfo(int, struct bootblock *); -/* Opaque type */ -struct fat_descriptor; +/* + * Read one of the FAT copies and return a pointer to the new + * allocated array holding our description of it. + */ +int readfat(int, struct bootblock *, u_int, struct fatEntry **); -void fat_clear_cl_head(struct fat_descriptor *, cl_t); -bool fat_is_cl_head(struct fat_descriptor *, cl_t); +/* + * Check two FAT copies for consistency and merge changes into the + * first if necessary. + */ +int comparefat(struct bootblock *, struct fatEntry *, struct fatEntry *, u_int); -cl_t fat_get_cl_next(struct fat_descriptor *, cl_t); - -int fat_set_cl_next(struct fat_descriptor *, cl_t, cl_t); - -cl_t fat_allocate_cluster(struct fat_descriptor *fat); - -struct bootblock* fat_get_boot(struct fat_descriptor *); -int fat_get_fd(struct fat_descriptor *); -bool fat_is_valid_cl(struct fat_descriptor *, cl_t); - /* - * Read the FAT 0 and return a pointer to the newly allocated - * descriptor of it. + * Check a FAT */ -int readfat(int, struct bootblock *, struct fat_descriptor **); +int checkfat(struct bootblock *, struct fatEntry *); /* * Write back FAT entries */ -int writefat(struct fat_descriptor *); +int writefat(int, struct bootblock *, struct fatEntry *, int); /* * Read a directory */ -int resetDosDirSection(struct fat_descriptor *); +int resetDosDirSection(struct bootblock *, struct fatEntry *); void finishDosDirSection(void); -int handleDirTree(struct fat_descriptor *); +int handleDirTree(int, struct bootblock *, struct fatEntry *); /* * Cross-check routines run after everything is completely in memory */ -int checkchain(struct fat_descriptor *, cl_t, size_t *); - /* * Check for lost cluster chains */ -int checklost(struct fat_descriptor *); +int checklost(int, struct bootblock *, struct fatEntry *); /* * Try to reconnect a lost cluster chain */ -int reconnect(struct fat_descriptor *, cl_t, size_t); +int reconnect(int, struct bootblock *, struct fatEntry *, cl_t); void finishlf(void); /* @@ -147,6 +138,6 @@ const char *rsrvdcltype(cl_t); /* * Clear a cluster chain in a FAT */ -void clearchain(struct fat_descriptor *, cl_t); +void clearchain(struct bootblock *, struct fatEntry *, cl_t); #endif Modified: head/sbin/fsck_msdosfs/fat.c ============================================================================== --- head/sbin/fsck_msdosfs/fat.c Wed Jan 1 07:43:08 2020 (r356249) +++ head/sbin/fsck_msdosfs/fat.c Wed Jan 1 09:22:06 2020 (r356250) @@ -1,7 +1,6 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2019 Google LLC * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank * Copyright (c) 1995 Martin Husemann * @@ -34,14 +33,6 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -#include -#include -#include -#include -#include - -#include -#include #include #include #include @@ -51,517 +42,12 @@ static const char rcsid[] = #include "ext.h" #include "fsutil.h" -static int _readfat(struct fat_descriptor *); -static inline struct bootblock* boot_of_(struct fat_descriptor *); -static inline int fd_of_(struct fat_descriptor *); -static inline bool valid_cl(struct fat_descriptor *, cl_t); +static int checkclnum(struct bootblock *, u_int, cl_t, cl_t *); +static int clustdiffer(cl_t, cl_t *, cl_t *, u_int); +static int tryclear(struct bootblock *, struct fatEntry *, cl_t, cl_t *); +static int _readfat(int, struct bootblock *, u_int, u_char **); - -/* - * Head bitmap for FAT scanning. - * - * FAT32 have up to 2^28 = 256M entries, and FAT16/12 have much less. - * For each cluster, we use 1 bit to represent if it's a head cluster *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Jan 1 12:06:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 955811D4E3A; Wed, 1 Jan 2020 12:06:37 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nqdn3RhNz3NYc; Wed, 1 Jan 2020 12:06:37 +0000 (UTC) (envelope-from jilles@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7186723BF; Wed, 1 Jan 2020 12:06:37 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 001C6bdL063738; Wed, 1 Jan 2020 12:06:37 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 001C6boS063737; Wed, 1 Jan 2020 12:06:37 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <202001011206.001C6boS063737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Wed, 1 Jan 2020 12:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356251 - head/bin/sh X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/bin/sh X-SVN-Commit-Revision: 356251 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 12:06:37 -0000 Author: jilles Date: Wed Jan 1 12:06:37 2020 New Revision: 356251 URL: https://svnweb.freebsd.org/changeset/base/356251 Log: sh: Fix rare memory leak with SIGINT If getcwd() failed earlier on but later succeeded in the pwd builtin, there was no INTOFF protection between calling savestr() and storing its result. It is quite rare for getcwd() to fail, and rarer for it to succeed later in the same directory. Found via code inspection for changing ckmalloc() and similar to assert INTOFF protection instead of applying it directly (which protects against corrupting malloc's internal state but allows memory leaks or double frees). MFC after: 1 week Modified: head/bin/sh/cd.c Modified: head/bin/sh/cd.c ============================================================================== --- head/bin/sh/cd.c Wed Jan 1 09:22:06 2020 (r356250) +++ head/bin/sh/cd.c Wed Jan 1 12:06:37 2020 (r356251) @@ -376,8 +376,11 @@ getpwd(void) return curdir; p = getpwd2(); - if (p != NULL) + if (p != NULL) { + INTOFF; curdir = savestr(p); + INTON; + } return curdir; } From owner-svn-src-head@freebsd.org Wed Jan 1 17:31:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 646E81DB47B; Wed, 1 Jan 2020 17:31:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nyrw22vZz49Ck; Wed, 1 Jan 2020 17:31:44 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 417216102; Wed, 1 Jan 2020 17:31:44 +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 001HVi8V060782; Wed, 1 Jan 2020 17:31:44 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 001HVhP3060777; Wed, 1 Jan 2020 17:31:43 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202001011731.001HVhP3060777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 1 Jan 2020 17:31:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356252 - in head/sys: net netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: net netinet X-SVN-Commit-Revision: 356252 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 17:31:44 -0000 Author: glebius Date: Wed Jan 1 17:31:43 2020 New Revision: 356252 URL: https://svnweb.freebsd.org/changeset/base/356252 Log: In r343631 error code for a packet blocked by a firewall was changed from EACCES to EPERM. This change was not intentional, so fix that. Return EACCESS if a firewall forbids sending. Noticed by: ae Modified: head/sys/net/if_bridge.c head/sys/netinet/ip_output.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Wed Jan 1 12:06:37 2020 (r356251) +++ head/sys/net/if_bridge.c Wed Jan 1 17:31:43 2020 (r356252) @@ -3191,7 +3191,7 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru dir == PFIL_OUT && ifp != NULL) { switch (pfil_run_hooks(V_link_pfil_head, mp, ifp, dir, NULL)) { case PFIL_DROPPED: - return (EPERM); + return (EACCES); case PFIL_CONSUMED: return (0); } @@ -3312,7 +3312,7 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru case PFIL_CONSUMED: return (0); case PFIL_DROPPED: - return (EPERM); + return (EACCES); default: break; } Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Jan 1 12:06:37 2020 (r356251) +++ head/sys/netinet/ip_output.c Wed Jan 1 17:31:43 2020 (r356252) @@ -130,7 +130,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, in odst.s_addr = ip->ip_dst.s_addr; switch (pfil_run_hooks(V_inet_pfil_head, mp, ifp, pflags, inp)) { case PFIL_DROPPED: - *error = EPERM; + *error = EACCES; /* FALLTHROUGH */ case PFIL_CONSUMED: return 1; /* Finished */ From owner-svn-src-head@freebsd.org Wed Jan 1 17:32:20 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E08F51DB4F7; Wed, 1 Jan 2020 17:32:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47nysc5hxKz49PB; Wed, 1 Jan 2020 17:32:20 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF22B6247; Wed, 1 Jan 2020 17:32:20 +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 001HWKf0061801; Wed, 1 Jan 2020 17:32:20 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 001HWKxn061800; Wed, 1 Jan 2020 17:32:20 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202001011732.001HWKxn061800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 1 Jan 2020 17:32:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356253 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 356253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 17:32:20 -0000 Author: glebius Date: Wed Jan 1 17:32:20 2020 New Revision: 356253 URL: https://svnweb.freebsd.org/changeset/base/356253 Log: In r343631 error code for a packet blocked by a firewall was changed from EACCES to EPERM. This change was not intentional, so fix that. Return EACCESS if a firewall forbids sending. Noticed by: ae Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Wed Jan 1 17:31:43 2020 (r356252) +++ head/sys/netinet6/ip6_output.c Wed Jan 1 17:32:20 2020 (r356253) @@ -898,7 +898,7 @@ again: ip6 = mtod(m, struct ip6_hdr *); break; case PFIL_DROPPED: - error = EPERM; + error = EACCES; /* FALLTHROUGH */ case PFIL_CONSUMED: goto done; From owner-svn-src-head@freebsd.org Wed Jan 1 18:49:57 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFE611DCE46; Wed, 1 Jan 2020 18:49:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47p0b94T0Tz4DT2; Wed, 1 Jan 2020 18:49:57 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 908956F00; Wed, 1 Jan 2020 18:49:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 001InvF3007212; Wed, 1 Jan 2020 18:49:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 001Invwv007211; Wed, 1 Jan 2020 18:49:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001011849.001Invwv007211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 1 Jan 2020 18:49:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356254 - head/usr.sbin/inetd X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/inetd X-SVN-Commit-Revision: 356254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 18:49:57 -0000 Author: kevans Date: Wed Jan 1 18:49:57 2020 New Revision: 356254 URL: https://svnweb.freebsd.org/changeset/base/356254 Log: inetd: final round of trivial cleanup, NFC Highlights: - Use MAX() for maxsock raising; small readability improvement IMO - malloc(3) + memset(3) -> calloc(3) where appropriate - stop casting the return value of malloc(3) - mallloc(3) -> reallocarray(3) where appropriate A future change may enter capability mode when forking for some of the built-in handlers. Modified: head/usr.sbin/inetd/inetd.c Modified: head/usr.sbin/inetd/inetd.c ============================================================================== --- head/usr.sbin/inetd/inetd.c Wed Jan 1 17:32:20 2020 (r356253) +++ head/usr.sbin/inetd/inetd.c Wed Jan 1 18:49:57 2020 (r356254) @@ -564,10 +564,7 @@ main(int argc, char **argv) #ifdef SANITY_CHECK nsock++; #endif - if (signalpipe[0] > maxsock) - maxsock = signalpipe[0]; - if (signalpipe[1] > maxsock) - maxsock = signalpipe[1]; + maxsock = MAX(MAX(maxsock, signalpipe[0]), signalpipe[1]); for (;;) { int n, ctrl; @@ -931,12 +928,11 @@ addchild(struct servtab *sep, pid_t pid) exit(EX_SOFTWARE); } #endif - sc = malloc(sizeof(*sc)); + sc = calloc(1, sizeof(*sc)); if (sc == NULL) { - syslog(LOG_ERR, "malloc: %m"); + syslog(LOG_ERR, "calloc: %m"); exit(EX_OSERR); } - memset(sc, 0, sizeof(*sc)); sc->sc_pid = pid; LIST_INSERT_HEAD(&sep->se_children, sc, sc_link); ++sep->se_numchild; @@ -1501,8 +1497,8 @@ enter(struct servtab *cp) struct servtab *sep; long omask; - sep = (struct servtab *)malloc(sizeof (*sep)); - if (sep == (struct servtab *)0) { + sep = malloc(sizeof(*sep)); + if (sep == NULL) { syslog(LOG_ERR, "malloc: %m"); exit(EX_OSERR); } @@ -1540,8 +1536,7 @@ enable(struct servtab *sep) nsock++; #endif FD_SET(sep->se_fd, &allsock); - if (sep->se_fd > maxsock) - maxsock = sep->se_fd; + maxsock = MAX(maxsock, sep->se_fd); } static void @@ -1985,20 +1980,14 @@ freeconfig(struct servtab *cp) struct stabchild *sc; int i; - if (cp->se_service) - free(cp->se_service); - if (cp->se_proto) - free(cp->se_proto); - if (cp->se_user) - free(cp->se_user); - if (cp->se_group) - free(cp->se_group); + free(cp->se_service); + free(cp->se_proto); + free(cp->se_user); + free(cp->se_group); #ifdef LOGIN_CAP - if (cp->se_class) - free(cp->se_class); + free(cp->se_class); #endif - if (cp->se_server) - free(cp->se_server); + free(cp->se_server); while (!LIST_EMPTY(&cp->se_children)) { sc = LIST_FIRST(&cp->se_children); LIST_REMOVE(sc, sc_link); @@ -2009,8 +1998,7 @@ freeconfig(struct servtab *cp) free(cp->se_argv[i]); free_connlist(cp); #ifdef IPSEC - if (cp->se_policy) - free(cp->se_policy); + free(cp->se_policy); #endif } @@ -2290,8 +2278,7 @@ cpmip(const struct servtab *sep, int ctrl) strcmp(sep->se_service, chBest->ch_Service) != 0) { chBest->ch_Family = sin4->sin_family; chBest->ch_Addr4 = sin4->sin_addr; - if (chBest->ch_Service) - free(chBest->ch_Service); + free(chBest->ch_Service); chBest->ch_Service = strdup(sep->se_service); memset(chBest->ch_Times, 0, sizeof(chBest->ch_Times)); } @@ -2304,8 +2291,7 @@ cpmip(const struct servtab *sep, int ctrl) strcmp(sep->se_service, chBest->ch_Service) != 0) { chBest->ch_Family = sin6->sin6_family; chBest->ch_Addr6 = sin6->sin6_addr; - if (chBest->ch_Service) - free(chBest->ch_Service); + free(chBest->ch_Service); chBest->ch_Service = strdup(sep->se_service); memset(chBest->ch_Times, 0, sizeof(chBest->ch_Times)); } @@ -2398,9 +2384,10 @@ search_conn(struct servtab *sep, int ctrl) syslog(LOG_ERR, "malloc: %m"); exit(EX_OSERR); } - conn->co_proc = malloc(sep->se_maxperip * sizeof(*conn->co_proc)); + conn->co_proc = reallocarray(NULL, sep->se_maxperip, + sizeof(*conn->co_proc)); if (conn->co_proc == NULL) { - syslog(LOG_ERR, "malloc: %m"); + syslog(LOG_ERR, "reallocarray: %m"); exit(EX_OSERR); } memcpy(&conn->co_addr, (struct sockaddr *)&ss, sslen); @@ -2489,10 +2476,10 @@ resize_conn(struct servtab *sep, int maxpip) LIST_FOREACH(conn, &sep->se_conn[i], co_link) { for (j = maxpip; j < conn->co_numchild; ++j) free_proc(conn->co_proc[j]); - conn->co_proc = realloc(conn->co_proc, - maxpip * sizeof(*conn->co_proc)); + conn->co_proc = reallocarray(conn->co_proc, maxpip, + sizeof(*conn->co_proc)); if (conn->co_proc == NULL) { - syslog(LOG_ERR, "realloc: %m"); + syslog(LOG_ERR, "reallocarray: %m"); exit(EX_OSERR); } if (conn->co_numchild > maxpip) From owner-svn-src-head@freebsd.org Wed Jan 1 19:45:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EB3C1DE133; Wed, 1 Jan 2020 19:45:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47p1pj0Fqzz4HR2; Wed, 1 Jan 2020 19:45:01 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03E177A07; Wed, 1 Jan 2020 19:45:01 +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 001Jj0Z4043475; Wed, 1 Jan 2020 19:45:00 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 001Jj0Pc043473; Wed, 1 Jan 2020 19:45:00 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202001011945.001Jj0Pc043473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 1 Jan 2020 19:45:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356256 - head/contrib/llvm-project/llvm/lib/Target/X86 X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/llvm/lib/Target/X86 X-SVN-Commit-Revision: 356256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 19:45:01 -0000 Author: dim Date: Wed Jan 1 19:45:00 2020 New Revision: 356256 URL: https://svnweb.freebsd.org/changeset/base/356256 Log: Merge commit 468a0cb5f from llvm git (by Craig Topper): [X86] Add X87 FCMOV support to X86FlagsCopyLowering. Fixes PR44396 Merge commit 86f48999f from llvm git (by Craig Topper): [X86] Fix typo in getCMovOpcode. The 64-bit HasMemoryOperand line was using CMOV32rm instead of CMOV64rm. Not sure how to test this. We have no test coverage that passes true for HasMemoryOperand. This fixes 'Assertion failed: (MI.findRegisterDefOperand(X86::EFLAGS) && "Expected a def of EFLAGS for this instruction!"), function runOnMachineFunction' when compiling the misc/gpsim port for i386. Reported by: yuri Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=44396 MFC after: 1 week Modified: head/contrib/llvm-project/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp head/contrib/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp Modified: head/contrib/llvm-project/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp Wed Jan 1 19:25:20 2020 (r356255) +++ head/contrib/llvm-project/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp Wed Jan 1 19:45:00 2020 (r356256) @@ -115,6 +115,10 @@ class X86FlagsCopyLoweringPass : public MachineFunctio MachineBasicBlock::iterator TestPos, DebugLoc TestLoc, MachineInstr &CMovI, MachineOperand &FlagUse, CondRegArray &CondRegs); + void rewriteFCMov(MachineBasicBlock &TestMBB, + MachineBasicBlock::iterator TestPos, DebugLoc TestLoc, + MachineInstr &CMovI, MachineOperand &FlagUse, + CondRegArray &CondRegs); void rewriteCondJmp(MachineBasicBlock &TestMBB, MachineBasicBlock::iterator TestPos, DebugLoc TestLoc, MachineInstr &JmpI, CondRegArray &CondRegs); @@ -334,6 +338,28 @@ static MachineBasicBlock &splitBlock(MachineBasicBlock return NewMBB; } +static X86::CondCode getCondFromFCMOV(unsigned Opcode) { + switch (Opcode) { + default: return X86::COND_INVALID; + case X86::CMOVBE_Fp32: case X86::CMOVBE_Fp64: case X86::CMOVBE_Fp80: + return X86::COND_BE; + case X86::CMOVB_Fp32: case X86::CMOVB_Fp64: case X86::CMOVB_Fp80: + return X86::COND_B; + case X86::CMOVE_Fp32: case X86::CMOVE_Fp64: case X86::CMOVE_Fp80: + return X86::COND_E; + case X86::CMOVNBE_Fp32: case X86::CMOVNBE_Fp64: case X86::CMOVNBE_Fp80: + return X86::COND_A; + case X86::CMOVNB_Fp32: case X86::CMOVNB_Fp64: case X86::CMOVNB_Fp80: + return X86::COND_AE; + case X86::CMOVNE_Fp32: case X86::CMOVNE_Fp64: case X86::CMOVNE_Fp80: + return X86::COND_NE; + case X86::CMOVNP_Fp32: case X86::CMOVNP_Fp64: case X86::CMOVNP_Fp80: + return X86::COND_NP; + case X86::CMOVP_Fp32: case X86::CMOVP_Fp64: case X86::CMOVP_Fp80: + return X86::COND_P; + } +} + bool X86FlagsCopyLoweringPass::runOnMachineFunction(MachineFunction &MF) { LLVM_DEBUG(dbgs() << "********** " << getPassName() << " : " << MF.getName() << " **********\n"); @@ -593,6 +619,8 @@ bool X86FlagsCopyLoweringPass::runOnMachineFunction(Ma // Otherwise we can just rewrite in-place. if (X86::getCondFromCMov(MI) != X86::COND_INVALID) { rewriteCMov(*TestMBB, TestPos, TestLoc, MI, *FlagUse, CondRegs); + } else if (getCondFromFCMOV(MI.getOpcode()) != X86::COND_INVALID) { + rewriteFCMov(*TestMBB, TestPos, TestLoc, MI, *FlagUse, CondRegs); } else if (X86::getCondFromSETCC(MI) != X86::COND_INVALID) { rewriteSetCC(*TestMBB, TestPos, TestLoc, MI, *FlagUse, CondRegs); } else if (MI.getOpcode() == TargetOpcode::COPY) { @@ -849,6 +877,51 @@ void X86FlagsCopyLoweringPass::rewriteCMov(MachineBasi .setImm(Inverted ? X86::COND_E : X86::COND_NE); FlagUse.setIsKill(true); LLVM_DEBUG(dbgs() << " fixed cmov: "; CMovI.dump()); +} + +void X86FlagsCopyLoweringPass::rewriteFCMov(MachineBasicBlock &TestMBB, + MachineBasicBlock::iterator TestPos, + DebugLoc TestLoc, + MachineInstr &CMovI, + MachineOperand &FlagUse, + CondRegArray &CondRegs) { + // First get the register containing this specific condition. + X86::CondCode Cond = getCondFromFCMOV(CMovI.getOpcode()); + unsigned CondReg; + bool Inverted; + std::tie(CondReg, Inverted) = + getCondOrInverseInReg(TestMBB, TestPos, TestLoc, Cond, CondRegs); + + MachineBasicBlock &MBB = *CMovI.getParent(); + + // Insert a direct test of the saved register. + insertTest(MBB, CMovI.getIterator(), CMovI.getDebugLoc(), CondReg); + + auto getFCMOVOpcode = [](unsigned Opcode, bool Inverted) { + switch (Opcode) { + default: llvm_unreachable("Unexpected opcode!"); + case X86::CMOVBE_Fp32: case X86::CMOVNBE_Fp32: + case X86::CMOVB_Fp32: case X86::CMOVNB_Fp32: + case X86::CMOVE_Fp32: case X86::CMOVNE_Fp32: + case X86::CMOVP_Fp32: case X86::CMOVNP_Fp32: + return Inverted ? X86::CMOVE_Fp32 : X86::CMOVNE_Fp32; + case X86::CMOVBE_Fp64: case X86::CMOVNBE_Fp64: + case X86::CMOVB_Fp64: case X86::CMOVNB_Fp64: + case X86::CMOVE_Fp64: case X86::CMOVNE_Fp64: + case X86::CMOVP_Fp64: case X86::CMOVNP_Fp64: + return Inverted ? X86::CMOVE_Fp64 : X86::CMOVNE_Fp64; + case X86::CMOVBE_Fp80: case X86::CMOVNBE_Fp80: + case X86::CMOVB_Fp80: case X86::CMOVNB_Fp80: + case X86::CMOVE_Fp80: case X86::CMOVNE_Fp80: + case X86::CMOVP_Fp80: case X86::CMOVNP_Fp80: + return Inverted ? X86::CMOVE_Fp80 : X86::CMOVNE_Fp80; + } + }; + + // Rewrite the CMov to use the !ZF flag from the test. + CMovI.setDesc(TII->get(getFCMOVOpcode(CMovI.getOpcode(), Inverted))); + FlagUse.setIsKill(true); + LLVM_DEBUG(dbgs() << " fixed fcmov: "; CMovI.dump()); } void X86FlagsCopyLoweringPass::rewriteCondJmp( Modified: head/contrib/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp Wed Jan 1 19:25:20 2020 (r356255) +++ head/contrib/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp Wed Jan 1 19:45:00 2020 (r356256) @@ -2198,7 +2198,7 @@ unsigned X86::getCMovOpcode(unsigned RegBytes, bool Ha default: llvm_unreachable("Illegal register size!"); case 2: return HasMemoryOperand ? X86::CMOV16rm : X86::CMOV16rr; case 4: return HasMemoryOperand ? X86::CMOV32rm : X86::CMOV32rr; - case 8: return HasMemoryOperand ? X86::CMOV32rm : X86::CMOV64rr; + case 8: return HasMemoryOperand ? X86::CMOV64rm : X86::CMOV64rr; } } From owner-svn-src-head@freebsd.org Wed Jan 1 22:47:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E82AB1E2BA8; Wed, 1 Jan 2020 22:47:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47p5rh5f0Qz4T3D; Wed, 1 Jan 2020 22:47:00 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B89039ADE; Wed, 1 Jan 2020 22:47:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 001Ml0xT053213; Wed, 1 Jan 2020 22:47:00 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 001Ml0aZ053212; Wed, 1 Jan 2020 22:47:00 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202001012247.001Ml0aZ053212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 1 Jan 2020 22:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356259 - head/sys/fs/msdosfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/msdosfs X-SVN-Commit-Revision: 356259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 22:47:01 -0000 Author: mjg Date: Wed Jan 1 22:47:00 2020 New Revision: 356259 URL: https://svnweb.freebsd.org/changeset/base/356259 Log: msdosfs: add a missing MNT_VNODE_FOREACH_ALL_ABORT to msdosfs_sync Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vfsops.c Wed Jan 1 22:12:34 2020 (r356258) +++ head/sys/fs/msdosfs/msdosfs_vfsops.c Wed Jan 1 22:47:00 2020 (r356259) @@ -925,8 +925,10 @@ loop: } error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, td); if (error) { - if (error == ENOENT) + if (error == ENOENT) { + MNT_VNODE_FOREACH_ALL_ABORT(mp, nvp); goto loop; + } continue; } error = VOP_FSYNC(vp, waitfor, td); From owner-svn-src-head@freebsd.org Wed Jan 1 22:50:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 235A51E2D36; Wed, 1 Jan 2020 22:50:24 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47p5wc08qpz4TLZ; Wed, 1 Jan 2020 22:50:24 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00B199AE5; Wed, 1 Jan 2020 22:50:24 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 001MoNEt053567; Wed, 1 Jan 2020 22:50:23 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 001MoNkF053566; Wed, 1 Jan 2020 22:50:23 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202001012250.001MoNkF053566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 1 Jan 2020 22:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356260 - head/sys/fs/msdosfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/msdosfs X-SVN-Commit-Revision: 356260 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 22:50:24 -0000 Author: mjg Date: Wed Jan 1 22:50:23 2020 New Revision: 356260 URL: https://svnweb.freebsd.org/changeset/base/356260 Log: msdos: vgone unconstructed vnode before vputing it Otherwise someone else may race to start using it. Race window was opened by r351748 ("vfs: implement usecount implying holdcnt"). Noted by: kib Modified: head/sys/fs/msdosfs/msdosfs_denode.c Modified: head/sys/fs/msdosfs/msdosfs_denode.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_denode.c Wed Jan 1 22:47:00 2020 (r356259) +++ head/sys/fs/msdosfs/msdosfs_denode.c Wed Jan 1 22:50:23 2020 (r356260) @@ -230,7 +230,7 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_lon * Arrange for vput() to just forget about it. */ ldep->de_Name[0] = SLOT_DELETED; - + vgone(nvp); vput(nvp); *depp = NULL; return (error); From owner-svn-src-head@freebsd.org Wed Jan 1 22:51:18 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEA631E30F1; Wed, 1 Jan 2020 22:51:18 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47p5xf3yZHz4Tbf; Wed, 1 Jan 2020 22:51:18 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60F539B2E; Wed, 1 Jan 2020 22:51:18 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 001MpIYh055896; Wed, 1 Jan 2020 22:51:18 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 001MpIBf055895; Wed, 1 Jan 2020 22:51:18 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202001012251.001MpIBf055895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 1 Jan 2020 22:51:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356261 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 356261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 01 Jan 2020 22:51:19 -0000 Author: mjg Date: Wed Jan 1 22:51:17 2020 New Revision: 356261 URL: https://svnweb.freebsd.org/changeset/base/356261 Log: vfs: drop an always-false check from vlrureclaim The vnode gets held few lines prior, making the VI_FREE condition illegal. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Jan 1 22:50:23 2020 (r356260) +++ head/sys/kern/vfs_subr.c Wed Jan 1 22:51:17 2020 (r356261) @@ -1059,7 +1059,6 @@ vlrureclaim(struct mount *mp, bool reclaim_nc_src, int */ if (vp->v_usecount || (!reclaim_nc_src && !LIST_EMPTY(&vp->v_cache_src)) || - (vp->v_iflag & VI_FREE) != 0 || (vp->v_object != NULL && vp->v_object->resident_page_count > trigger)) { VOP_UNLOCK(vp, 0); From owner-svn-src-head@freebsd.org Thu Jan 2 01:23:43 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 983681E6494; Thu, 2 Jan 2020 01:23:43 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47p9KW3YB2z4cTq; Thu, 2 Jan 2020 01:23:43 +0000 (UTC) (envelope-from kaktus@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7530AB816; Thu, 2 Jan 2020 01:23:43 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0021NhHm049142; Thu, 2 Jan 2020 01:23:43 GMT (envelope-from kaktus@FreeBSD.org) Received: (from kaktus@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0021NhgC049141; Thu, 2 Jan 2020 01:23:43 GMT (envelope-from kaktus@FreeBSD.org) Message-Id: <202001020123.0021NhgC049141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kaktus set sender to kaktus@FreeBSD.org using -f From: Pawel Biernacki Date: Thu, 2 Jan 2020 01:23:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356262 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kaktus X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 356262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 01:23:43 -0000 Author: kaktus Date: Thu Jan 2 01:23:43 2020 New Revision: 356262 URL: https://svnweb.freebsd.org/changeset/base/356262 Log: sysctl: hide 2.x era compat node r23081 introduced kern.dummy oid as a semi ABI compat for kern.maxsockbuf that was moved to a new namespace. It never functioned as an alias of any kind and was just returning 0 unconditionally, hence it was probably provided to keep some 3rd party programmes happy about sysctl(3) not reporting an error because of non-existing oid. After nearly 23 years it seems reasonable to just hide it from sysctl(8) list not to cause unnecessary confusion as for its purpose. Reported by: Antranig Vartanian Reviewed by: kib (mentor) Approved by: kib (mentor) Differential Revision: https://reviews.freebsd.org/D22982 Modified: head/sys/kern/uipc_sockbuf.c Modified: head/sys/kern/uipc_sockbuf.c ============================================================================== --- head/sys/kern/uipc_sockbuf.c Wed Jan 1 22:51:17 2020 (r356261) +++ head/sys/kern/uipc_sockbuf.c Thu Jan 2 01:23:43 2020 (r356262) @@ -1522,7 +1522,7 @@ sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb) /* This takes the place of kern.maxsockbuf, which moved to kern.ipc. */ static int dummy; -SYSCTL_INT(_kern, KERN_DUMMY, dummy, CTLFLAG_RW, &dummy, 0, ""); +SYSCTL_INT(_kern, KERN_DUMMY, dummy, CTLFLAG_RW | CTLFLAG_SKIP, &dummy, 0, ""); SYSCTL_OID(_kern_ipc, KIPC_MAXSOCKBUF, maxsockbuf, CTLTYPE_ULONG|CTLFLAG_RW, &sb_max, 0, sysctl_handle_sb_max, "LU", "Maximum socket buffer size"); SYSCTL_ULONG(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW, From owner-svn-src-head@freebsd.org Thu Jan 2 03:25:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AC6F1E9D03; Thu, 2 Jan 2020 03:25:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pD1z3gLdz3FdW; Thu, 2 Jan 2020 03:25:27 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79444D00E; Thu, 2 Jan 2020 03:25:27 +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 0023PR6l021935; Thu, 2 Jan 2020 03:25:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0023PQSX021931; Thu, 2 Jan 2020 03:25:26 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202001020325.0023PQSX021931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 2 Jan 2020 03:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356263 - in head: . sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: . sys/sys X-SVN-Commit-Revision: 356263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 03:25:27 -0000 Author: imp Date: Thu Jan 2 03:25:26 2020 New Revision: 356263 URL: https://svnweb.freebsd.org/changeset/base/356263 Log: Remove arm/arm as a valid target. TARGET=arm now defaults to TARGET_ARCH=armv7 TARGET_ARCH=arm is no longer valid. Bump __FreeBSD_version to 1300073 Tested with make universe. Any stale LINT-V5 config files remaining in the tree will fail the universe build. However, LINT-V5 was removed in r355119. This retirement has been planned since last summer. The armv5 port is fragile: it works OK for some peeople, and fails badly for others. There's a number of subtle bugs in busdma, pmap and other MD parts of thee system that present themselves under load or in unusual circumstances (like fsck after a crash). stable/8, branched 10 years ago, was the last reliable release. Since the support burden is larger then the benefit, the consensus view is armv5 should be removed from the tree. Discussed with: arm@ mailing list and arm developer community. Modified: head/Makefile head/Makefile.inc1 head/UPDATING head/sys/sys/param.h Modified: head/Makefile ============================================================================== --- head/Makefile Thu Jan 2 01:23:43 2020 (r356262) +++ head/Makefile Thu Jan 2 03:25:26 2020 (r356263) @@ -276,7 +276,7 @@ MK_META_MODE= no # exceptions. .if !defined(TARGET_ARCH) && defined(TARGET) # T->TA mapping is usually TARGET with arm64 the odd man out -_TARGET_ARCH= ${TARGET:S/arm64/aarch64/:S/riscv/riscv64/} +_TARGET_ARCH= ${TARGET:S/arm64/aarch64/:S/riscv/riscv64/:S/arm/armv7} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} # TA->T mapping is accidentally CPUARCH with aarch64 the odd man out @@ -496,7 +496,6 @@ _OBSOLETE_GCC_TARGETS+=powerpc .endif TARGETS?=amd64 arm arm64 i386 riscv ${_OBSOLETE_GCC_TARGETS} _UNIVERSE_TARGETS= ${TARGETS} -# arm (armv5) excluded due to broken buildworld TARGET_ARCHES_arm?= armv6 armv7 TARGET_ARCHES_arm64?= aarch64 TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 mipselhf mipshf mips64elhf mips64hf Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Jan 2 01:23:43 2020 (r356262) +++ head/Makefile.inc1 Thu Jan 2 03:25:26 2020 (r356263) @@ -134,7 +134,6 @@ TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd13.0 KNOWN_ARCHES?= aarch64/arm64 \ amd64 \ - arm \ armv6/arm \ armv7/arm \ i386 \ Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Jan 2 01:23:43 2020 (r356262) +++ head/UPDATING Thu Jan 2 03:25:26 2020 (r356263) @@ -26,6 +26,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20200102: + Support for armv5 has been disconnected and is being removed. The + machine combination MACHINE=arm MACHINE_ARCH=arm is no longer valid. + You must now use a MACHINE_ARCH of armv6 or armv7. The default + MACHINE_ARCH for MACHINE=arm is now armv7. + 20191226: Clang/LLVM is now the default compiler for all powerpc architectures. LLD is now the default linker for powerpc64. The change for powerpc64 Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Jan 2 01:23:43 2020 (r356262) +++ head/sys/sys/param.h Thu Jan 2 03:25:26 2020 (r356263) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300072 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300073 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Thu Jan 2 03:25:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45DA11E9D28; Thu, 2 Jan 2020 03:25:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pD250S9hz3Fkj; Thu, 2 Jan 2020 03:25:33 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8C9BD00F; Thu, 2 Jan 2020 03:25:32 +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 0023PWTp021986; Thu, 2 Jan 2020 03:25:32 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0023PWaN021985; Thu, 2 Jan 2020 03:25:32 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202001020325.0023PWaN021985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 2 Jan 2020 03:25:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356264 - head/sys/arm/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/arm/conf X-SVN-Commit-Revision: 356264 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 03:25:33 -0000 Author: imp Date: Thu Jan 2 03:25:32 2020 New Revision: 356264 URL: https://svnweb.freebsd.org/changeset/base/356264 Log: Remove NOTES.armv5. It's no longer relevant. Deleted: head/sys/arm/conf/NOTES.armv5 From owner-svn-src-head@freebsd.org Thu Jan 2 03:25:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C06F31E9D6F; Thu, 2 Jan 2020 03:25:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pD294cXQz3Fnv; Thu, 2 Jan 2020 03:25:37 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 971DED012; Thu, 2 Jan 2020 03:25:37 +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 0023PbhM022039; Thu, 2 Jan 2020 03:25:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0023PbbT022038; Thu, 2 Jan 2020 03:25:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202001020325.0023PbbT022038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 2 Jan 2020 03:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356265 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 356265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 03:25:37 -0000 Author: imp Date: Thu Jan 2 03:25:37 2020 New Revision: 356265 URL: https://svnweb.freebsd.org/changeset/base/356265 Log: Remove MACHINE_ARCH arm where appropriate from the tables to reflect armv5's retirement. Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu Jan 2 03:25:32 2020 (r356264) +++ head/share/man/man7/arch.7 Thu Jan 2 03:25:37 2020 (r356265) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 20, 2019 +.Dd January 2, 2020 .Dt ARCH 7 .Os .Sh NAME @@ -199,8 +199,8 @@ Machine-dependent type sizes: .It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t .It aarch64 Ta 8 Ta 16 Ta 8 .It amd64 Ta 8 Ta 16 Ta 8 -.It arm Ta 4 Ta 8 Ta 8 .It armv6 Ta 4 Ta 8 Ta 8 +.It armv7 Ta 4 Ta 8 Ta 8 .It i386 Ta 4 Ta 12 Ta 4 .It mips Ta 4 Ta 8 Ta 8 .It mipsel Ta 4 Ta 8 Ta 8 @@ -226,7 +226,6 @@ is 8 bytes on all supported architectures except i386. .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness .It aarch64 Ta little Ta unsigned .It amd64 Ta little Ta signed -.It arm Ta little Ta unsigned .It armv6 Ta little Ta unsigned .It armv7 Ta little Ta unsigned .It i386 Ta little Ta signed @@ -251,7 +250,6 @@ is 8 bytes on all supported architectures except i386. .It Sy Architecture Ta Sy Page Sizes .It aarch64 Ta 4K, 2M, 1G .It amd64 Ta 4K, 2M, 1G -.It arm Ta 4K .It armv6 Ta 4K, 1M .It armv7 Ta 4K, 1M .It i386 Ta 4K, 2M (PAE), 4M @@ -276,7 +274,6 @@ is 8 bytes on all supported architectures except i386. .It Sy Architecture Ta Sy float, double Ta Sy long double .It aarch64 Ta hard Ta soft, quad precision .It amd64 Ta hard Ta hard, 80 bit -.It arm Ta soft Ta soft, double precision .It armv6 Ta hard Ta hard, double precision .It armv7 Ta hard Ta hard, double precision .It i386 Ta hard Ta hard, 80 bit @@ -313,7 +310,6 @@ This table shows the default tool chain for each archi .It Sy Architecture Ta Sy Compiler Ta Sy Linker .It aarch64 Ta Clang Ta lld .It amd64 Ta Clang Ta lld -.It arm Ta Clang Ta GNU ld 2.17.50 .It armv6 Ta Clang Ta lld .It armv7 Ta Clang Ta lld .It i386 Ta Clang Ta lld @@ -360,7 +356,7 @@ or similar things like boot sequences. .It Dv MACHINE Ta Dv MACHINE_CPUARCH Ta Dv MACHINE_ARCH .It arm64 Ta aarch64 Ta aarch64 .It amd64 Ta amd64 Ta amd64 -.It arm Ta arm Ta arm, armv6, armv7 +.It arm Ta arm Ta armv6, armv7 .It i386 Ta i386 Ta i386 .It mips Ta mips Ta mips, mipsel, mips64, mips64el, mipshf, mipselhf, mips64elhf, mipsn32 .It powerpc Ta powerpc Ta powerpc, powerpcspe, powerpc64 @@ -394,7 +390,6 @@ Architecture-specific macros: .It Sy Architecture Ta Sy Predefined macros .It aarch64 Ta Dv __aarch64__ .It amd64 Ta Dv __amd64__, Dv __x86_64__ -.It arm Ta Dv __arm__ .It armv6 Ta Dv __arm__, Dv __ARM_ARCH >= 6 .It armv7 Ta Dv __arm__, Dv __ARM_ARCH >= 7 .It i386 Ta Dv __i386__ @@ -484,7 +479,7 @@ combinations encoding pointer size, endian and hard ve all these). Generally, the plain CPU name specifies the most common (or at least first) variant of the CPU. -This is why mips and mips64 imply 'big endian' while 'arm' and 'armv7' +This is why mips and mips64 imply 'big endian' while 'armv6' and 'armv7' imply little endian. If we ever were to support the so-called x32 ABI (using 32-bit pointers on the amd64 architecture), it would most likely be encoded From owner-svn-src-head@freebsd.org Thu Jan 2 04:34:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A27171EB486; Thu, 2 Jan 2020 04:34:23 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pFYW3dMnz3JjG; Thu, 2 Jan 2020 04:34:23 +0000 (UTC) (envelope-from bdragon@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DB4BDD4D; Thu, 2 Jan 2020 04:34:23 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0024YNN7063131; Thu, 2 Jan 2020 04:34:23 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0024YMh5063126; Thu, 2 Jan 2020 04:34:22 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <202001020434.0024YMh5063126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Thu, 2 Jan 2020 04:34:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356266 - in head/stand: . libofw ofw powerpc/ofw sparc64/loader X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: in head/stand: . libofw ofw powerpc/ofw sparc64/loader X-SVN-Commit-Revision: 356266 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 04:34:23 -0000 Author: bdragon Date: Thu Jan 2 04:34:22 2020 New Revision: 356266 URL: https://svnweb.freebsd.org/changeset/base/356266 Log: Move stand/ofw/libofw to stand/libofw. Since rS330365, there has been no particular reason for libofw to be in a subdirectory of ofw. Move libofw up a level to make it fit in better with the other top level libraries. Also add a LIBOFWSRC to stand/defs.mk to match what all the other libraries are doing. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D23000 Added: head/stand/libofw/ - copied from r356265, head/stand/ofw/libofw/ Deleted: head/stand/ofw/ Modified: head/stand/Makefile head/stand/defs.mk head/stand/powerpc/ofw/Makefile head/stand/sparc64/loader/Makefile Modified: head/stand/Makefile ============================================================================== --- head/stand/Makefile Thu Jan 2 03:25:37 2020 (r356265) +++ head/stand/Makefile Thu Jan 2 04:34:22 2020 (r356266) @@ -16,7 +16,7 @@ S.${MK_FORTH}+= forth S.${MK_LOADER_LUA}+= liblua S.${MK_LOADER_LUA}+= lua S.${MK_FDT}+= fdt -S.${MK_LOADER_OFW}+= ofw +S.${MK_LOADER_OFW}+= libofw S.yes+= defaults S.yes+= man Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Thu Jan 2 03:25:37 2020 (r356265) +++ head/stand/defs.mk Thu Jan 2 04:34:22 2020 (r356266) @@ -28,6 +28,7 @@ FDTSRC= ${BOOTSRC}/fdt FICLSRC= ${BOOTSRC}/ficl LDRSRC= ${BOOTSRC}/common LIBLUASRC= ${BOOTSRC}/liblua +LIBOFWSRC= ${BOOTSRC}/libofw LUASRC= ${SRCTOP}/contrib/lua/src SASRC= ${BOOTSRC}/libsa SYSDIR= ${SRCTOP}/sys Modified: head/stand/powerpc/ofw/Makefile ============================================================================== --- head/stand/powerpc/ofw/Makefile Thu Jan 2 03:25:37 2020 (r356265) +++ head/stand/powerpc/ofw/Makefile Thu Jan 2 04:34:22 2020 (r356266) @@ -44,8 +44,8 @@ CFLAGS+= -DRELOC=${RELOC} -g LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc # Open Firmware standalone support library -LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a -CFLAGS+= -I${BOOTSRC}/ofw/libofw +LIBOFW= ${BOOTOBJ}/libofw/libofw.a +CFLAGS+= -I${BOOTSRC}/libofw DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA} LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA} Modified: head/stand/sparc64/loader/Makefile ============================================================================== --- head/stand/sparc64/loader/Makefile Thu Jan 2 03:25:37 2020 (r356265) +++ head/stand/sparc64/loader/Makefile Thu Jan 2 04:34:22 2020 (r356266) @@ -47,8 +47,8 @@ LINKS= ${BINDIR}/loader ${BINDIR}/zfsloader .endif # Open Firmware standalone support library -LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a -CFLAGS+= -I${BOOTSRC}/ofw/libofw/ +LIBOFW= ${BOOTOBJ}/libofw/libofw.a +CFLAGS+= -I${BOOTSRC}/libofw DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} From owner-svn-src-head@freebsd.org Thu Jan 2 06:56:29 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2255F1EEBAC; Thu, 2 Jan 2020 06:56:29 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pJjT08nRz3xHP; Thu, 2 Jan 2020 06:56:29 +0000 (UTC) (envelope-from scottl@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0501F777; Thu, 2 Jan 2020 06:56:28 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0026uSiQ046658; Thu, 2 Jan 2020 06:56:28 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0026uSUI046656; Thu, 2 Jan 2020 06:56:28 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <202001020656.0026uSUI046656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Thu, 2 Jan 2020 06:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356267 - head/usr.sbin/pciconf X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/usr.sbin/pciconf X-SVN-Commit-Revision: 356267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 06:56:29 -0000 Author: scottl Date: Thu Jan 2 06:56:28 2020 New Revision: 356267 URL: https://svnweb.freebsd.org/changeset/base/356267 Log: Add a compact columnar output format, available by specifying a second '-l' command line option. Thanks to the removal of unnecessary information and the organization into columns, this helps the output be more legible on both 80 column displays and non-80 column displays. imp@ provided the idea on this. Modified: head/usr.sbin/pciconf/pciconf.8 head/usr.sbin/pciconf/pciconf.c Modified: head/usr.sbin/pciconf/pciconf.8 ============================================================================== --- head/usr.sbin/pciconf/pciconf.8 Thu Jan 2 04:34:22 2020 (r356266) +++ head/usr.sbin/pciconf/pciconf.8 Thu Jan 2 06:56:28 2020 (r356267) @@ -110,6 +110,19 @@ in revision 2.1 of the standard. Note that they will be 0 for older cards. .Pp +Adding a second +.Fl l +option causes output to be in a compact columnar format, suitable for +80 column output: +.Bd -literal +drv selector class rev hdr vendor device subven subdev +foo0@pci0:0:4:0: 010000 01 00 1000 000f 0000 0000 +bar0@pci0:0:5:0: 000100 00 00 88c1 5333 0000 0000 +none0@pci0:0:6:0: 020000 00 00 10ec 8029 0000 0000 +.Ed +.Pp +All fields retain the same definition as with the non-compact form. +.Pp If the .Fl B option is supplied, Modified: head/usr.sbin/pciconf/pciconf.c ============================================================================== --- head/usr.sbin/pciconf/pciconf.c Thu Jan 2 04:34:22 2020 (r356266) +++ head/usr.sbin/pciconf/pciconf.c Thu Jan 2 06:56:28 2020 (r356267) @@ -76,7 +76,7 @@ static struct pcisel getsel(const char *str); static void list_bridge(int fd, struct pci_conf *p); static void list_bars(int fd, struct pci_conf *p); static void list_devs(const char *name, int verbose, int bars, int bridge, - int caps, int errors, int vpd); + int caps, int errors, int vpd, int listmode); static void list_verbose(struct pci_conf *p); static void list_vpd(int fd, struct pci_conf *p); static const char *guess_class(struct pci_conf *p); @@ -147,7 +147,7 @@ main(int argc, char **argv) break; case 'l': - listmode = 1; + listmode++; break; case 'r': @@ -185,7 +185,7 @@ main(int argc, char **argv) if (listmode) { list_devs(optind + 1 == argc ? argv[optind] : NULL, verbose, - bars, bridge, caps, errors, vpd); + bars, bridge, caps, errors, vpd, listmode); } else if (attachedmode) { chkattached(argv[optind]); } else if (readmode) { @@ -207,7 +207,7 @@ main(int argc, char **argv) static void list_devs(const char *name, int verbose, int bars, int bridge, int caps, - int errors, int vpd) + int errors, int vpd, int listmode) { int fd; struct pci_conf_io pc; @@ -260,21 +260,36 @@ list_devs(const char *name, int verbose, int bars, int close(fd); return; } + if (listmode == 2) + printf("drv\tselector\tclass rev hdr vendor device " + "subven subdev\n"); for (p = conf; p < &conf[pc.num_matches]; p++) { - printf("%s%d@pci%d:%d:%d:%d:" - "\tclass=0x%06x rev=0x%02x hdr=0x%02x " - "vendor=0x%04x device=0x%04x " - "subvendor=0x%04x subdevice=0x%04x\n", - *p->pd_name ? p->pd_name : - "none", - *p->pd_name ? (int)p->pd_unit : - none_count++, p->pc_sel.pc_domain, - p->pc_sel.pc_bus, p->pc_sel.pc_dev, - p->pc_sel.pc_func, (p->pc_class << 16) | - (p->pc_subclass << 8) | p->pc_progif, - p->pc_revid, p->pc_hdr, - p->pc_vendor, p->pc_device, - p->pc_subvendor, p->pc_subdevice); + if (listmode == 2) + printf("%s%d@pci%d:%d:%d:%d:" + "\t%06x %02x %02x %04x %04x %04x %04x\n", + *p->pd_name ? p->pd_name : "none", + *p->pd_name ? (int)p->pd_unit : + none_count++, p->pc_sel.pc_domain, + p->pc_sel.pc_bus, p->pc_sel.pc_dev, + p->pc_sel.pc_func, (p->pc_class << 16) | + (p->pc_subclass << 8) | p->pc_progif, + p->pc_revid, p->pc_hdr, + p->pc_vendor, p->pc_device, + p->pc_subvendor, p->pc_subdevice); + else + printf("%s%d@pci%d:%d:%d:%d:" + "\tclass=0x%06x rev=0x%02x hdr=0x%02x " + "vendor=0x%04x device=0x%04x " + "subvendor=0x%04x subdevice=0x%04x\n", + *p->pd_name ? p->pd_name : "none", + *p->pd_name ? (int)p->pd_unit : + none_count++, p->pc_sel.pc_domain, + p->pc_sel.pc_bus, p->pc_sel.pc_dev, + p->pc_sel.pc_func, (p->pc_class << 16) | + (p->pc_subclass << 8) | p->pc_progif, + p->pc_revid, p->pc_hdr, + p->pc_vendor, p->pc_device, + p->pc_subvendor, p->pc_subdevice); if (verbose) list_verbose(p); if (bars) From owner-svn-src-head@freebsd.org Thu Jan 2 09:08:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E503F1F1C30; Thu, 2 Jan 2020 09:08:45 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pMf55sDcz45y8; Thu, 2 Jan 2020 09:08:45 +0000 (UTC) (envelope-from melifaro@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C46BD18F30; Thu, 2 Jan 2020 09:08:45 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00298jpb026688; Thu, 2 Jan 2020 09:08:45 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00298jO2026687; Thu, 2 Jan 2020 09:08:45 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202001020908.00298jO2026687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 2 Jan 2020 09:08:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356268 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 356268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 09:08:46 -0000 Author: melifaro Date: Thu Jan 2 09:08:45 2020 New Revision: 356268 URL: https://svnweb.freebsd.org/changeset/base/356268 Log: Plug loopback idaddr refcount leak. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22980 Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Jan 2 06:56:28 2020 (r356267) +++ head/sys/net/if.c Thu Jan 2 09:08:45 2020 (r356268) @@ -1836,6 +1836,7 @@ ifa_maintain_loopback_route(int cmd, const char *otype struct rt_addrinfo info; struct sockaddr_dl null_sdl; struct ifnet *ifp; + struct ifaddr *rti_ifa = NULL; ifp = ifa->ifa_ifp; @@ -1846,9 +1847,10 @@ ifa_maintain_loopback_route(int cmd, const char *otype /* explicitly specify (loopback) ifa */ if (info.rti_ifp != NULL) { NET_EPOCH_ENTER(et); - info.rti_ifa = ifaof_ifpforaddr(ifa->ifa_addr, info.rti_ifp); - if (info.rti_ifa != NULL) - ifa_ref(info.rti_ifa); + rti_ifa = ifaof_ifpforaddr(ifa->ifa_addr, info.rti_ifp); + if (rti_ifa != NULL) + ifa_ref(rti_ifa); + info.rti_ifa = rti_ifa; NET_EPOCH_EXIT(et); } } @@ -1858,6 +1860,9 @@ ifa_maintain_loopback_route(int cmd, const char *otype link_init_sdl(ifp, (struct sockaddr *)&null_sdl, ifp->if_type); error = rtrequest1_fib(cmd, &info, NULL, ifp->if_fib); + + if (rti_ifa != NULL) + ifa_free(rti_ifa); if (error != 0 && !(cmd == RTM_ADD && error == EEXIST) && From owner-svn-src-head@freebsd.org Thu Jan 2 11:02:10 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C0E91F463D; Thu, 2 Jan 2020 11:02:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pQ8y1Mw9z4H3m; Thu, 2 Jan 2020 11:02:10 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A6A41A5C1; Thu, 2 Jan 2020 11:02:10 +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 002B2AHa096508; Thu, 2 Jan 2020 11:02:10 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002B2ANs096507; Thu, 2 Jan 2020 11:02:10 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202001021102.002B2ANs096507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 2 Jan 2020 11:02:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356269 - head X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 356269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 11:02:10 -0000 Author: andrew Date: Thu Jan 2 11:02:09 2020 New Revision: 356269 URL: https://svnweb.freebsd.org/changeset/base/356269 Log: Add the missing trailing '/' when setting TARGET_ARCH from TARGET This should fix the build when setting TARGET but not TARGET_ARCH. Sponsored by: DARPA, AFRL Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Thu Jan 2 09:08:45 2020 (r356268) +++ head/Makefile Thu Jan 2 11:02:09 2020 (r356269) @@ -276,7 +276,7 @@ MK_META_MODE= no # exceptions. .if !defined(TARGET_ARCH) && defined(TARGET) # T->TA mapping is usually TARGET with arm64 the odd man out -_TARGET_ARCH= ${TARGET:S/arm64/aarch64/:S/riscv/riscv64/:S/arm/armv7} +_TARGET_ARCH= ${TARGET:S/arm64/aarch64/:S/riscv/riscv64/:S/arm/armv7/} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} # TA->T mapping is accidentally CPUARCH with aarch64 the odd man out From owner-svn-src-head@freebsd.org Thu Jan 2 13:55:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 917F31F7C5D; Thu, 2 Jan 2020 13:55:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pV0b3DKVz4RPS; Thu, 2 Jan 2020 13:55:11 +0000 (UTC) (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65B1D1C54F; Thu, 2 Jan 2020 13:55:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002DtBts000427; Thu, 2 Jan 2020 13:55:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002DtBZC000426; Thu, 2 Jan 2020 13:55:11 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202001021355.002DtBZC000426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 2 Jan 2020 13:55:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356270 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 356270 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 13:55:11 -0000 Author: tuexen Date: Thu Jan 2 13:55:10 2020 New Revision: 356270 URL: https://svnweb.freebsd.org/changeset/base/356270 Log: Improve input validation of the spp_pathmtu field in the SCTP_PEER_ADDR_PARAMS socket option. The code in the stack assumes sane values for the MTU. This issue was found by running an instance of syzkaller. MFC after: 1 week Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Thu Jan 2 11:02:09 2020 (r356269) +++ head/sys/netinet/sctp.h Thu Jan 2 13:55:10 2020 (r356270) @@ -1,3 +1,4 @@ + /*- * SPDX-License-Identifier: BSD-3-Clause * @@ -585,8 +586,10 @@ struct sctp_error_auth_invalid_hmac { #define SCTP_MOBILITY_PRIM_DELETED 0x00000004 -#define SCTP_SMALLEST_PMTU 512 /* smallest pmtu allowed when disabling PMTU - * discovery */ +/* Smallest PMTU allowed when disabling PMTU discovery */ +#define SCTP_SMALLEST_PMTU 512 +/* Largest PMTU allowed when disabling PMTU discovery */ +#define SCTP_LARGEST_PMTU 65536 #undef SCTP_PACKED Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Thu Jan 2 11:02:09 2020 (r356269) +++ head/sys/netinet/sctp_usrreq.c Thu Jan 2 13:55:10 2020 (r356270) @@ -5363,6 +5363,14 @@ sctp_setopt(struct socket *so, int optname, void *optv SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } + if ((paddrp->spp_flags & SPP_PMTUD_DISABLE) && + ((paddrp->spp_pathmtu < SCTP_SMALLEST_PMTU) || + (paddrp->spp_pathmtu > SCTP_LARGEST_PMTU))) { + if (stcb) + SCTP_TCB_UNLOCK(stcb); + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + return (EINVAL); + } if (stcb != NULL) { /************************TCB SPECIFIC SET ******************/ @@ -5394,7 +5402,7 @@ sctp_setopt(struct socket *so, int optname, void *optv sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net); } } - if ((paddrp->spp_flags & SPP_PMTUD_DISABLE) && (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU)) { + if (paddrp->spp_flags & SPP_PMTUD_DISABLE) { if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net, SCTP_FROM_SCTP_USRREQ + SCTP_LOC_11); @@ -5536,7 +5544,7 @@ sctp_setopt(struct socket *so, int optname, void *optv } sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT); } - if ((paddrp->spp_flags & SPP_PMTUD_DISABLE) && (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU)) { + if (paddrp->spp_flags & SPP_PMTUD_DISABLE) { TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net, @@ -5635,9 +5643,7 @@ sctp_setopt(struct socket *so, int optname, void *optv inp->sctp_ep.default_mtu = 0; sctp_feature_off(inp, SCTP_PCB_FLAGS_DO_NOT_PMTUD); } else if (paddrp->spp_flags & SPP_PMTUD_DISABLE) { - if (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU) { - inp->sctp_ep.default_mtu = paddrp->spp_pathmtu; - } + inp->sctp_ep.default_mtu = paddrp->spp_pathmtu; sctp_feature_on(inp, SCTP_PCB_FLAGS_DO_NOT_PMTUD); } if (paddrp->spp_flags & SPP_DSCP) { From owner-svn-src-head@freebsd.org Thu Jan 2 14:04:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A5DF1D01F0; Thu, 2 Jan 2020 14:04:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pVC50nKlz4S9D; Thu, 2 Jan 2020 14:04:17 +0000 (UTC) (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 160391C71E; Thu, 2 Jan 2020 14:04:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002E4GXs006406; Thu, 2 Jan 2020 14:04:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002E4Gik006405; Thu, 2 Jan 2020 14:04:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202001021404.002E4Gik006405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 2 Jan 2020 14:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356271 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 356271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 14:04:17 -0000 Author: tuexen Date: Thu Jan 2 14:04:16 2020 New Revision: 356271 URL: https://svnweb.freebsd.org/changeset/base/356271 Log: Remove empty line which was added in r356270 by accident. MFC after: 1 week Modified: head/sys/netinet/sctp.h Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Thu Jan 2 13:55:10 2020 (r356270) +++ head/sys/netinet/sctp.h Thu Jan 2 14:04:16 2020 (r356271) @@ -1,4 +1,3 @@ - /*- * SPDX-License-Identifier: BSD-3-Clause * From owner-svn-src-head@freebsd.org Thu Jan 2 15:38:18 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47DDF1D2788; Thu, 2 Jan 2020 15:38:18 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pXHZ0fVrz4XrX; Thu, 2 Jan 2020 15:38:18 +0000 (UTC) (envelope-from ian@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0ECD01D7AA; Thu, 2 Jan 2020 15:38:18 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002FcHTG059914; Thu, 2 Jan 2020 15:38:17 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002FcHFM059913; Thu, 2 Jan 2020 15:38:17 GMT (envelope-from ian@FreeBSD.org) Message-Id: <202001021538.002FcHFM059913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 2 Jan 2020 15:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356273 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 356273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 15:38:18 -0000 Author: ian Date: Thu Jan 2 15:38:17 2020 New Revision: 356273 URL: https://svnweb.freebsd.org/changeset/base/356273 Log: Since arm/unwind.c s conditionally compiled, only call functions in it when one of those conditions is true. Fixes build failure on kernel configs with no debugging options active. Modified: head/sys/arm/arm/elf_machdep.c Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Thu Jan 2 14:39:37 2020 (r356272) +++ head/sys/arm/arm/elf_machdep.c Thu Jan 2 15:38:17 2020 (r356273) @@ -52,6 +52,10 @@ __FBSDID("$FreeBSD$"); #include #endif +#include "opt_ddb.h" /* for OPT_DDB */ +#include "opt_global.h" /* for OPT_KDTRACE_HOOKS */ +#include "opt_stack.h" /* for OPT_STACK */ + static boolean_t elf32_arm_abi_supported(struct image_params *); u_long elf_hwcap; @@ -311,11 +315,13 @@ elf_cpu_load_file(linker_file_t lf) cpu_icache_sync_range((vm_offset_t)lf->address, (vm_size_t)lf->size); #endif +#if defined(DDB) || defined(KDTRACE_HOOKS) || defined(STACK) /* * Inform the stack(9) code of the new module, so it can acquire its * per-module unwind data. */ unwind_module_loaded(lf); +#endif return (0); } From owner-svn-src-head@freebsd.org Thu Jan 2 16:27:16 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B5DF1D3BD2; Thu, 2 Jan 2020 16:27:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pYN42SmGz4cZV; Thu, 2 Jan 2020 16:27: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FEDE1E116; Thu, 2 Jan 2020 16:27:16 +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 002GRGnB091492; Thu, 2 Jan 2020 16:27:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002GRGsT091491; Thu, 2 Jan 2020 16:27:16 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202001021627.002GRGsT091491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 2 Jan 2020 16:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356274 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 356274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 16:27:16 -0000 Author: jhb Date: Thu Jan 2 16:27:15 2020 New Revision: 356274 URL: https://svnweb.freebsd.org/changeset/base/356274 Log: Some minor tweaks to arch(7). - Drop mention of _LP64. FreeBSD's source generally uses __LP64__ instead of _LP64, and the relevant macros are better covered in the "Predefined Macros" section. - Fix a noun/verb disagreement. Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22975 Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu Jan 2 15:38:17 2020 (r356273) +++ head/share/man/man7/arch.7 Thu Jan 2 16:27:15 2020 (r356274) @@ -140,12 +140,6 @@ and are 8 bytes. .El .Pp -Compilers define the -.Dv _LP64 -symbol when compiling for an -.Dv LP64 -ABI. -.Pp Some machines support more than one .Fx ABI. @@ -421,7 +415,7 @@ These variables are not otherwise documented and are u in the build system. .Bl -tag -width "MACHINE_CPUARCH" .It Dv MACHINE -Represent the hardware platform. +Represents the hardware platform. This is the same as the native platform's .Xr uname 1 .Fl m From owner-svn-src-head@freebsd.org Thu Jan 2 17:39:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8A741D5062; Thu, 2 Jan 2020 17:39:21 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pZzF3mwFz3CSD; Thu, 2 Jan 2020 17:39:21 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CC5F1EE3F; Thu, 2 Jan 2020 17:39:21 +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 002HdLY4033956; Thu, 2 Jan 2020 17:39:21 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002HdLSf033955; Thu, 2 Jan 2020 17:39:21 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202001021739.002HdLSf033955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 2 Jan 2020 17:39:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356276 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 356276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 17:39:21 -0000 Author: manu Date: Thu Jan 2 17:39:21 2020 New Revision: 356276 URL: https://svnweb.freebsd.org/changeset/base/356276 Log: arm: allwinner: aw_spi: Call bus_generic_attach This is needed when the driver is compiled into the kernel. When compiled as a module this will be called from another code path as we also depend on ofw_spibus. MFC after: 1 week Modified: head/sys/arm/allwinner/aw_spi.c Modified: head/sys/arm/allwinner/aw_spi.c ============================================================================== --- head/sys/arm/allwinner/aw_spi.c Thu Jan 2 17:27:27 2020 (r356275) +++ head/sys/arm/allwinner/aw_spi.c Thu Jan 2 17:39:21 2020 (r356276) @@ -242,7 +242,7 @@ aw_spi_attach(device_t dev) sc->spibus = device_add_child(dev, "spibus", -1); - return (0); + return (bus_generic_attach(dev)); fail: aw_spi_detach(dev); From owner-svn-src-head@freebsd.org Thu Jan 2 17:44:42 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B34061D52BC; Thu, 2 Jan 2020 17:44:42 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pb5Q4DLqz3CsT; Thu, 2 Jan 2020 17:44:42 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C7281F021; Thu, 2 Jan 2020 17:44:42 +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 002Higo2039628; Thu, 2 Jan 2020 17:44:42 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002HigNr039625; Thu, 2 Jan 2020 17:44:42 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202001021744.002HigNr039625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 2 Jan 2020 17:44:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356277 - in head/sys: arm64/rockchip modules/rockchip modules/rockchip/rk_spi X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm64/rockchip modules/rockchip modules/rockchip/rk_spi X-SVN-Commit-Revision: 356277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 17:44:42 -0000 Author: manu Date: Thu Jan 2 17:44:41 2020 New Revision: 356277 URL: https://svnweb.freebsd.org/changeset/base/356277 Log: arm64: rockchip: Add a module for rk_spi The spi node doesn't lives under a simple-bus compatible node so we need OFWBUS_PNP_INFO instead of SIMPLEBUS_PNP_INFO. Added: head/sys/modules/rockchip/rk_spi/ head/sys/modules/rockchip/rk_spi/Makefile (contents, props changed) Modified: head/sys/arm64/rockchip/rk_spi.c head/sys/modules/rockchip/Makefile Modified: head/sys/arm64/rockchip/rk_spi.c ============================================================================== --- head/sys/arm64/rockchip/rk_spi.c Thu Jan 2 17:39:21 2020 (r356276) +++ head/sys/arm64/rockchip/rk_spi.c Thu Jan 2 17:44:41 2020 (r356277) @@ -480,4 +480,4 @@ static devclass_t rk_spi_devclass; DRIVER_MODULE(rk_spi, simplebus, rk_spi_driver, rk_spi_devclass, 0, 0); DRIVER_MODULE(ofw_spibus, rk_spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); MODULE_DEPEND(rk_spi, ofw_spibus, 1, 1, 1); -SIMPLEBUS_PNP_INFO(compat_data); +OFWBUS_PNP_INFO(compat_data); Modified: head/sys/modules/rockchip/Makefile ============================================================================== --- head/sys/modules/rockchip/Makefile Thu Jan 2 17:39:21 2020 (r356276) +++ head/sys/modules/rockchip/Makefile Thu Jan 2 17:44:41 2020 (r356277) @@ -4,6 +4,7 @@ SUBDIR = \ rk_i2c \ rk805 \ - rk_dwmmc + rk_dwmmc \ + rk_spi .include Added: head/sys/modules/rockchip/rk_spi/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/rockchip/rk_spi/Makefile Thu Jan 2 17:44:41 2020 (r356277) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/arm64/rockchip + +KMOD= rk_spi +SRCS= rk_spi.c + +SRCS+= \ + bus_if.h \ + clknode_if.h \ + device_if.h \ + ofw_bus_if.h \ + spibus_if.h \ + +.include From owner-svn-src-head@freebsd.org Thu Jan 2 17:51:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E8FF1D56F7; Thu, 2 Jan 2020 17:51:52 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pbFh1f36z3DPF; Thu, 2 Jan 2020 17:51:52 +0000 (UTC) (envelope-from ian@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3252A1F1A4; Thu, 2 Jan 2020 17:51:52 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002Hpq2U042306; Thu, 2 Jan 2020 17:51:52 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002HpoEf042296; Thu, 2 Jan 2020 17:51:50 GMT (envelope-from ian@FreeBSD.org) Message-Id: <202001021751.002HpoEf042296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 2 Jan 2020 17:51:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356278 - in head: share/man/man4 sys/conf sys/dev/iicbus sys/dev/iicbus/mux sys/modules/i2c sys/modules/i2c/mux sys/modules/i2c/mux/iic_gpiomux sys/modules/i2c/mux/iicmux sys/modules/i... X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/dev/iicbus sys/dev/iicbus/mux sys/modules/i2c sys/modules/i2c/mux sys/modules/i2c/mux/iic_gpiomux sys/modules/i2c/mux/iicmux sys/modules/i2c/mux/ltc430x X-SVN-Commit-Revision: 356278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 17:51:52 -0000 Author: ian Date: Thu Jan 2 17:51:49 2020 New Revision: 356278 URL: https://svnweb.freebsd.org/changeset/base/356278 Log: Add support for i2c bus mux hardware. An i2c bus can be divided into segments which can be selectively connected and disconnected from the main bus. This is usually done to enable using multiple slave devices having the same address, by isolating the devices onto separate bus segments, only one of which is connected to the main bus at once. There are several types of i2c bus muxes, which break down into two general categories... - Muxes which are themselves i2c slaves. These devices respond to i2c commands on their upstream bus, and based on those commands, connect various downstream buses to the upstream. In newbus terms, they are both a child of an iicbus and the parent of one or more iicbus instances. - Muxes which are not i2c devices themselves. Such devices are part of the i2c bus electrically, but in newbus terms their parent is some other bus. The association with the upstream bus must be established by separate metadata (such as FDT data). In both cases, the mux driver has one or more iicbus child instances representing the downstream buses. The mux driver implements the iicbus_if interface, as if it were an iichb host bridge/i2c controller driver. It services the IO requests sent to it by forwarding them to the iicbus instance representing the upstream bus, after electrically connecting the upstream bus to the downstream bus that hosts the i2c slave device which made the IO request. The net effect is automatic mux switching which is transparent to slaves on the downstream buses. They just do i2c IO they way they normally do, and the bus is electrically connected for the duration of the IO and then idled when it is complete. The existing iicbus_if callback() method is enhanced so that the parameter passed to it can be a struct which contains a device_t for the requesting bus and slave devices. This change is done by adding a flag that indicates the extra values are present, and making the flags field the first field of a new args struct. If the flag is set, the iichb or mux driver can recast the pointer-to-flags into a pointer-to-struct and access the extra fields. Thus abi compatibility with older drivers is retained (but a mux cannot exist on the bus with the older iicbus driver in use.) A new set of core support routines exists in iicbus.c. This code will help implement mux drivers for any type of mux hardware by supplying all the boilerplate code that forwards IO requests upstream. It also has code for parsing metadata and instantiating the child iicbus instances based on it. Two new hardware mux drivers are added. The ltc430x driver supports the LTC4305/4306 mux chips which are controlled via i2c commands. The iic_gpiomux driver supports any mux hardware which is controlled by manipulating the state of one or more gpio pins. Test Plan Tested locally using a variety of mux'd bus configurations involving both ltc4305 and a homebrew gpio-controlled mux. Tested configurations included cascaded muxes (unlikely in the real world, but useful to prove that 'it all just works' in terms of the automatic switching and upstream forwarding of IO requests). Added: head/share/man/man4/iic_gpiomux.4 (contents, props changed) head/share/man/man4/iicmux.4 (contents, props changed) head/share/man/man4/ltc430x.4 (contents, props changed) head/sys/dev/iicbus/mux/ head/sys/dev/iicbus/mux/iic_gpiomux.c (contents, props changed) head/sys/dev/iicbus/mux/iicmux.c (contents, props changed) head/sys/dev/iicbus/mux/iicmux.h (contents, props changed) head/sys/dev/iicbus/mux/iicmux_if.m (contents, props changed) head/sys/dev/iicbus/mux/ltc430x.c (contents, props changed) head/sys/modules/i2c/mux/ head/sys/modules/i2c/mux/Makefile (contents, props changed) head/sys/modules/i2c/mux/iic_gpiomux/ head/sys/modules/i2c/mux/iic_gpiomux/Makefile (contents, props changed) head/sys/modules/i2c/mux/iicmux/ head/sys/modules/i2c/mux/iicmux/Makefile (contents, props changed) head/sys/modules/i2c/mux/ltc430x/ head/sys/modules/i2c/mux/ltc430x/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/conf/NOTES head/sys/conf/files head/sys/dev/iicbus/iiconf.c head/sys/dev/iicbus/iiconf.h head/sys/modules/i2c/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Jan 2 17:44:41 2020 (r356277) +++ head/share/man/man4/Makefile Thu Jan 2 17:51:49 2020 (r356278) @@ -204,8 +204,10 @@ MAN= aac.4 \ ig4.4 \ igmp.4 \ iic.4 \ + iic_gpiomux.4 \ iicbb.4 \ iicbus.4 \ + iicmux.4 \ iicsmb.4 \ iir.4 \ ${_imcsmb.4} \ @@ -258,6 +260,7 @@ MAN= aac.4 \ lp.4 \ lpbb.4 \ lpt.4 \ + ltc430x.4 \ mac.4 \ mac_biba.4 \ mac_bsdextended.4 \ Added: head/share/man/man4/iic_gpiomux.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/iic_gpiomux.4 Thu Jan 2 17:51:49 2020 (r356278) @@ -0,0 +1,88 @@ +.\"- +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2019 Ian Lepore +.\" +.\" 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 January 1, 2020 +.Dt IIC_GPIOMUX 4 +.Os +.Sh NAME +.Nm iic_gpiomux +.Nd driver for I2C mux hardware controlled via GPIO +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device iic_gpiomux" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +iic_gpiomux_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver supports any type of I2C bus multiplexer (mux) hardware that +is controlled by manipulating the state of one or more GPIO pins. +It automatically connects an upstream I2C bus to one of the downstream +buses as needed when slave devices on the downstream buses initiate I/O. +More information on the automatic switching behavior is available in +.Xr iicmux 4 . +.Pp +.Sh FDT CONFIGURATION +On an +.Xr fdt 4 +based system, an +.Nm +device node may be defined as a child node of any arbitrary bus +in the FDT data. +The +.Va i2c-parent +property indicates the connection to the upstream I2C bus. +The children of the +.Nm +node are additional i2c buses, which will have their own i2c slave +devices described in their child nodes. +.Pp +The +.Nm +driver conforms to the standard +.Bk -words +.Li i2c/i2c-mux-gpio.txt +.Ek +bindings document. +.Sh SEE ALSO +.Xr iicbus 4 , +.Xr iicmux 4 , +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0 . Added: head/share/man/man4/iicmux.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/iicmux.4 Thu Jan 2 17:51:49 2020 (r356278) @@ -0,0 +1,148 @@ +.\"- +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2019 Ian Lepore +.\" +.\" 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 January 1, 2020 +.Dt IICMUX 4 +.Os +.Sh NAME +.Nm iicmux +.Nd I2C bus mulitiplexer framework +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device iicmux" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +iicmux_load="YES" +.Ed +.Pp +Note that it is usually not necessary to explicitly load the +driver module, as it will be loaded automatically along with +the driver for the specific mux hardware in use. +.Sh DESCRIPTION +The +.Nm +framework provides support code to help implement drivers for various +I2C bus multiplexer (mux) hardware. +.Nm +is not a standalone driver, +it is a collection of support functions and driver methods which are +used by individual mux hardware drivers. +It will be loaded automatically when needed by a mux hardware driver. +This manual page provides an overview of the I2C mux framework and its +behavior. +.Pp +Generally speaking, an I2C mux is connected to an upstream I2C bus, and to +one or more downstream I2C buses, and it can be commanded to connect +any one of the downstream buses to the upstream bus. +Some hardware may be able to connect multiple downstream buses at the +same time, but that concept is not supported by +.Nm . +.Pp +The +.Nm +framework operates automatically when I2C slave devices initiate I/O. +It does not require (or even allow for) any external control to select +the active downstream bus. +.Pp +When there is no I/O in progress, the mux is said to be in the +.Dq idle +state. +Some mux hardware has the ability to disconnect all downstream buses +when in an idle state. +Other hardware must always have one of the downstream buses connected. +Individual mux hardware drivers typically provide a way to select which +downstream bus (if any) should be connected while in the idle state. +In the absence of such configuration, whichever downstream bus was +last used remains connected to the upstream bus. +.Pp +When an I2C slave device on a bus downstream of a mux initiates I/O, +it first requests exclusive use of the bus by calling +.Fn iicbus_request_bus . +This request is communicated to the bus's parent, which is the +.Nm +framework +mux driver. +Once exclusive bus ownership is obtained, the mux driver +connects the upstream I2C bus to the downstream bus which hosts the +slave device that requested bus ownership. +The mux hardware maintains that upstream-to-downstream connection until +the slave device calls +.Fn iicbus_release_bus . +Before releasing ownership, the mux driver returns the mux hardware to +the idle state. +.Sh FDT CONFIGURATION +On an +.Xr fdt 4 +based system, an I2C mux device node is defined as a child node of its +upstream I2C bus when the mux device is an I2C slave itself. +It may be defined as a child node of any other bus or device in the +system when it is not an I2C slave, in which case the +.Va i2c-parent +property indicates which upstream bus the mux is attached to. +In either case, the children of the mux node are additional I2C buses, which +will have one or more I2C slave devices described in their child nodes. +.Pp +Drivers using the +.Nm +framework conform to the standard +.Bk -words +.Li i2c/i2c-mux.txt +.Ek +bindings document. +.Sh HINTS CONFIGURATION +On a +.Xr device.hints 5 +based system, these values are configurable for +.Nm +framework drivers : +.Bl -tag -width indent +.It Va hint...at +The upstream +.Xr iicbus 4 +the +.Nm +instance is attached to. +.El +.Pp +When configured via hints, the driver automatically adds an iicbus +instance for every downstream bus supported by the chip. +There is currently no way to indicate used versus unused downstream buses. +.Sh SEE ALSO +.Xr iicbus 4 , +.Sh HISTORY +The +.Nm +framework first appeared in +.Fx 13.0 . Added: head/share/man/man4/ltc430x.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ltc430x.4 Thu Jan 2 17:51:49 2020 (r356278) @@ -0,0 +1,112 @@ +.\"- +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2019 Ian Lepore +.\" +.\" 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 January 1, 2020 +.Dt LTC430X 4 +.Os +.Sh NAME +.Nm ltc430x +.Nd driver for LTC4305 and LTC4306 I2C mux chips +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ltc430x" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ltc430x_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver supports the LTC4305 and LTC4306 I2C bus multiplexer (mux) chips. +It automatically connects an upstream I2C bus to one of several downstream +buses as needed when slave devices on the downstream buses initiate I/O. +More information on the automatic switching behavior is available in +.Xr iicmux 4 . +.Sh FDT CONFIGURATION +On an +.Xr fdt 4 +based system, an +.Nm +device node is defined as a child node of its upstream i2c bus. +The children of the +.Nm +node are additional i2c buses, which will have their own i2c slave +devices described in their child nodes. +.Pp +The +.Nm +driver conforms to the standard +.Bk -words +.Li i2c/i2c-mux-ltc4306.txt +.Ek +bindings document, except that the following optional properties +are not currently supported and will be ignored if present: +.Bl -bullet -compact -inset -offset indent +.It +enable-gpios +.It +gpio-controller +.It +#gpio-cells +.It +ltc,downstream-accelerators-enable +.It +ltc,upstream-accelerators-enable +.El +.Sh HINTS CONFIGURATION +On a +.Xr device.hints 5 +based system, these values are configurable for +.Nm : +.Bl -tag -width indent +.It Va hint.ltc430x..at +The upstream +.Xr iicbus 4 +the +.Nm +instance is attached to. +.El +.Pp +When configured via hints, the driver automatically adds an iicbus +instance for every downstream bus supported by the chip. +There is currently no way to indicate used versus unused channels. +.Sh SEE ALSO +.Xr iicbus 4 , +.Xr iicmux 4 , +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0 . Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Jan 2 17:44:41 2020 (r356277) +++ head/sys/conf/NOTES Thu Jan 2 17:51:49 2020 (r356278) @@ -2329,6 +2329,11 @@ device iic # userland access to i2c slave devices vi device iicsmb # smb over i2c bridge device iicoc # OpenCores I2C controller support +# I2C bus multiplexer (mux) devices +device iicmux # i2c mux core driver +device iic_gpiomux # i2c mux hardware controlled via gpio pins +device ltc430x # LTC4305 and LTC4306 i2c mux chips + # I2C peripheral devices # device ad7418 # Analog Devices temp and voltage sensor Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Jan 2 17:44:41 2020 (r356277) +++ head/sys/conf/files Thu Jan 2 17:51:49 2020 (r356278) @@ -1801,6 +1801,10 @@ dev/iicbus/iicoc_fdt.c optional iicoc fdt dev/iicbus/iicoc_pci.c optional iicoc pci dev/iicbus/isl12xx.c optional isl12xx dev/iicbus/lm75.c optional lm75 +dev/iicbus/mux/iicmux.c optional iicmux +dev/iicbus/mux/iicmux_if.m optional iicmux +dev/iicbus/mux/iic_gpiomux.c optional iic_gpiomux fdt +dev/iicbus/mux/ltc430x.c optional ltc430x dev/iicbus/nxprtc.c optional nxprtc | pcf8563 dev/iicbus/ofw_iicbus.c optional fdt iicbus dev/iicbus/rtc8583.c optional rtc8583 Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Thu Jan 2 17:44:41 2020 (r356277) +++ head/sys/dev/iicbus/iiconf.c Thu Jan 2 17:51:49 2020 (r356278) @@ -137,6 +137,7 @@ iicbus_poll(struct iicbus_softc *sc, int how) int iicbus_request_bus(device_t bus, device_t dev, int how) { + struct iic_reqbus_data reqdata; struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); int error = 0; @@ -175,8 +176,11 @@ iicbus_request_bus(device_t bus, device_t dev, int how */ IICBUS_UNLOCK(sc); /* Ask the underlying layers if the request is ok */ + reqdata.dev = dev; + reqdata.bus = bus; + reqdata.flags = how | IIC_REQBUS_DEV; error = IICBUS_CALLBACK(device_get_parent(bus), - IIC_REQUEST_BUS, (caddr_t)&how); + IIC_REQUEST_BUS, (caddr_t)&reqdata); IICBUS_LOCK(sc); if (error != 0) { @@ -201,6 +205,7 @@ iicbus_request_bus(device_t bus, device_t dev, int how int iicbus_release_bus(device_t bus, device_t dev) { + struct iic_reqbus_data reqdata; struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); IICBUS_LOCK(sc); @@ -213,7 +218,11 @@ iicbus_release_bus(device_t bus, device_t dev) if (--sc->owncount == 0) { /* Drop the lock while informing the low-level driver. */ IICBUS_UNLOCK(sc); - IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS, NULL); + reqdata.dev = dev; + reqdata.bus = bus; + reqdata.flags = IIC_REQBUS_DEV; + IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS, + (caddr_t)&reqdata); IICBUS_LOCK(sc); sc->owner = NULL; wakeup_one(sc); Modified: head/sys/dev/iicbus/iiconf.h ============================================================================== --- head/sys/dev/iicbus/iiconf.h Thu Jan 2 17:44:41 2020 (r356277) +++ head/sys/dev/iicbus/iiconf.h Thu Jan 2 17:51:49 2020 (r356278) @@ -47,6 +47,25 @@ #define IIC_INTR 0x2 #define IIC_INTRWAIT (IIC_INTR | IIC_WAIT) #define IIC_RECURSIVE 0x4 +#define IIC_REQBUS_DEV 0x8 /* See struct iic_reqbus_data, below. */ + +/* + * The original iicbus->bridge callback api took a pointer to an int containing + * flags. The new api allows a pointer to this struct, with IIC_REQBUS_DEV set + * in the flags to let the implementation know the pointer is actually to this + * struct which has the flags word first, followed by the device_t of the + * requesting bus and device. + * + * Note that the requesting device may not be a i2c slave device which is a + * child of the requested bus -- it may be a mux device which is electrically + * part of the bus hierarchy, but whose driver belongs to some other bus + * hierarchy such as gpio. + */ +struct iic_reqbus_data { + int flags; /* Flags from the set defined above. */ + device_t bus; /* The iicbus being requested. */ + device_t dev; /* The device requesting the bus. */ +}; /* * i2c modes Added: head/sys/dev/iicbus/mux/iic_gpiomux.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/mux/iic_gpiomux.c Thu Jan 2 17:51:49 2020 (r356278) @@ -0,0 +1,249 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Ian Lepore + * + * 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. + */ + +/* + * Driver for i2c bus muxes controlled by one or more gpio pins. + * + * This driver has #ifdef FDT sections in it, as if it supports both fdt and + * hinted attachment, but there is currently no support for hinted attachment. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#ifdef FDT +#include +#include +#include + +static struct ofw_compat_data compat_data[] = { + {"i2c-mux-gpio", true}, + {NULL, false} +}; +OFWBUS_PNP_INFO(compat_data); +SIMPLEBUS_PNP_INFO(compat_data); +#endif /* FDT */ + +#include +#include "iicmux.h" +#include "iicmux_if.h" + +struct gpiomux_softc { + struct iicmux_softc mux; + int idleidx; + int numpins; + gpio_pin_t pins[IICMUX_MAX_BUSES]; +}; + +#define IDLE_NOOP (-1) /* When asked to idle the bus, do nothing. */ + +static int +gpiomux_bus_select(device_t dev, int busidx, struct iic_reqbus_data *rd) +{ + struct gpiomux_softc *sc = device_get_softc(dev); + int i; + + /* + * The iicmux caller ensures busidx is between 0 and the number of buses + * we passed to iicmux_init_softc(), no need for validation here. The + * bits in the index number are transcribed to the state of the pins, + * except when we're asked to idle the bus. In that case, we transcribe + * sc->idleidx to the pins, unless that is IDLE_NOOP (leave the current + * bus selected), in which case we just bail. + */ + if (busidx == IICMUX_SELECT_IDLE) { + if (sc->idleidx == IDLE_NOOP) + return (0); + busidx = sc->idleidx; + } + + for (i = 0; i < sc->numpins; ++i) + gpio_pin_set_active(sc->pins[i], busidx & (1u << i)); + + return (0); +} + +static int +gpiomux_probe(device_t dev) +{ + int rv; + + rv = ENXIO; + +#ifdef FDT + if (ofw_bus_status_okay(dev) && + ofw_bus_search_compatible(dev, compat_data)->ocd_data) + rv = BUS_PROBE_DEFAULT; +#endif + + device_set_desc(dev, "I2C GPIO Mux"); + + return (rv); +} + +static int +gpiomux_attach(device_t dev) +{ + struct gpiomux_softc *sc = device_get_softc(dev); + ssize_t len; + device_t busdev; + int err, i, idlebits, numchannels; + pcell_t propval; + phandle_t node; + + node = ofw_bus_get_node(dev); + + /* + * Locate the gpio pin(s) that control the mux hardware. There can be + * multiple pins, but there must be at least one. + */ + for (i = 0; ; ++i) { + err = gpio_pin_get_by_ofw_propidx(dev, node, "mux-gpios", i, + &sc->pins[i]); + if (err != 0) { + break; + } + } + sc->numpins = i; + if (sc->numpins == 0) { + device_printf(dev, "cannot acquire pins listed in mux-gpios\n"); + return ((err == 0) ? ENXIO : err); + } + numchannels = 1u << sc->numpins; + if (numchannels > IICMUX_MAX_BUSES) { + device_printf(dev, "too many mux-gpios pins for max %d buses\n", + IICMUX_MAX_BUSES); + return (EINVAL); + } + + /* + * We don't have a parent/child relationship to the upstream bus, we + * have to locate it via the i2c-parent property. Explicitly tell the + * user which upstream we're associated with, since the normal attach + * message is going to mention only our actual parent. + */ + len = OF_getencprop(node, "i2c-parent", &propval, sizeof(propval)); + if (len != sizeof(propval)) { + device_printf(dev, "cannot obtain i2c-parent property\n"); + return (ENXIO); + } + busdev = OF_device_from_xref((phandle_t)propval); + if (busdev == NULL) { + device_printf(dev, + "cannot find device referenced by i2c-parent property\n"); + return (ENXIO); + } + device_printf(dev, "upstream bus is %s\n", device_get_nameunit(busdev)); + + /* + * If there is an idle-state property, that is the value we set the pins + * to when the bus is idle, otherwise idling the bus is a no-op + * (whichever bus was last accessed remains active). + */ + len = OF_getencprop(node, "idle-state", &propval, sizeof(propval)); + if (len == sizeof(propval)) { + if ((int)propval >= numchannels) { + device_printf(dev, + "idle-state property %d exceeds channel count\n", + propval); + } + sc->idleidx = (int)propval; + idlebits = sc->idleidx; + } else { + sc->idleidx = IDLE_NOOP; + idlebits = 0; + } + + /* Preset the mux to the idle state to get things started. */ + for (i = 0; i < sc->numpins; ++i) { + gpio_pin_setflags(sc->pins[i], GPIO_PIN_OUTPUT); + gpio_pin_set_active(sc->pins[i], idlebits & (1u << i)); + } + + /* Init the core driver, have it add our child downstream buses. */ + if ((err = iicmux_attach(dev, busdev, numchannels)) == 0) + bus_generic_attach(dev); + + return (err); +} + +static int +gpiomux_detach(device_t dev) +{ + struct gpiomux_softc *sc = device_get_softc(dev); + int err, i; + + if ((err = iicmux_detach(dev)) != 0) + return (err); + + for (i = 0; i < sc->numpins; ++i) + gpio_pin_release(sc->pins[i]); + + return (0); +} + +static device_method_t gpiomux_methods[] = { + /* device methods */ + DEVMETHOD(device_probe, gpiomux_probe), + DEVMETHOD(device_attach, gpiomux_attach), + DEVMETHOD(device_detach, gpiomux_detach), + + /* iicmux methods */ + DEVMETHOD(iicmux_bus_select, gpiomux_bus_select), + + DEVMETHOD_END +}; + +static devclass_t gpiomux_devclass; + +DEFINE_CLASS_1(iic_gpiomux, iic_gpiomux_driver, gpiomux_methods, + sizeof(struct gpiomux_softc), iicmux_driver); +DRIVER_MODULE(iic_gpiomux, simplebus, iic_gpiomux_driver, gpiomux_devclass, 0, 0); +DRIVER_MODULE(iic_gpiomux, ofw_simplebus, iic_gpiomux_driver, gpiomux_devclass, 0, 0); + +#ifdef FDT +DRIVER_MODULE(ofw_iicbus, iic_gpiomux, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); +#else +DRIVER_MODULE(iicbus, iic_gpiomux, iicbus_driver, iicbus_devclass, 0, 0); +#endif + +MODULE_DEPEND(iic_gpiomux, iicmux, 1, 1, 1); +MODULE_DEPEND(iic_gpiomux, iicbus, 1, 1, 1); Added: head/sys/dev/iicbus/mux/iicmux.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/mux/iicmux.c Thu Jan 2 17:51:49 2020 (r356278) @@ -0,0 +1,387 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Ian Lepore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include + +#ifdef FDT +#include +#include +#include +#endif + +#include +#include "iicbus_if.h" +#include "iicmux_if.h" +#include "iicmux.h" + +/*------------------------------------------------------------------------------ + * iicbus methods, called by the iicbus functions in iiconf.c. + * + * All these functions return an IIC adapter-layer error code (because we are + * pretending to be a host bridge/i2c controller). Standard errno values + * returned from these must be encoded using iic2errno(). + *----------------------------------------------------------------------------*/ + +static int +iicmux_callback(device_t dev, int index, caddr_t data) +{ + struct iicmux_softc *sc = device_get_softc(dev); + struct iic_reqbus_data *rd; + int err, i; + + /* If it's not one of the operations we know about, bail early. */ + if (index != IIC_REQUEST_BUS && index != IIC_RELEASE_BUS) + return (iic2errno(EOPNOTSUPP)); + + /* + * Ensure that the data passed to us includes the device_t of the child + * bus and device. If missing, someone bypassed iicbus_request_bus() + * and called this method directly using the old calling standard. If + * present, find the index of the child bus that called us. + */ + rd = (struct iic_reqbus_data *)data; + if (!(rd->flags & IIC_REQBUS_DEV)) + return (iic2errno(EINVAL)); + + for (i = 0; i <= sc->maxbus && sc->childdevs[i] != rd->bus; ++i) + continue; + if (i > sc->maxbus) + return (iic2errno(ENOENT)); + + /* + * If the operation is a release it "cannot fail". Idle the downstream + * bus, then release exclusive use of the upstream bus, and we're done. + */ + if (index == IIC_RELEASE_BUS) { + if (sc->debugmux > 0) { + device_printf(dev, "idle the bus for %s on bus %s\n", + device_get_nameunit(rd->dev), + device_get_nameunit(rd->bus)); + } + IICMUX_BUS_SELECT(dev, IICMUX_SELECT_IDLE, rd); + iicbus_release_bus(sc->busdev, dev); + return (IIC_NOERR); + } + + if (sc->debugmux > 0) { + device_printf(dev, "select bus idx %d for %s on bus %s\n", i, + device_get_nameunit(rd->dev), device_get_nameunit(rd->bus)); + } + + /* + * The operation is a request for exclusive use. First we have to + * request exclusive use of our upstream bus. If multiple slave devices + * from our different child buses attempt to do IO at the same time, + * this is what ensures that they don't switch the bus out from under + * each other. The first one in proceeds and others wait here (or get an + * EWOULDBLOCK return if they're using IIC_DONTWAIT). + */ + if ((err = iicbus_request_bus(sc->busdev, dev, rd->flags)) != 0) + return (err); /* Already an IIC error code. */ + + /* + * Now that we own exclusive use of the upstream bus, connect it to the + * downstream bus where the request came from. + */ + if ((err = IICMUX_BUS_SELECT(dev, i, rd)) != 0) + iicbus_release_bus(sc->busdev, dev); + + return (err); +} + +static u_int +iicmux_get_frequency(device_t dev, u_char speed) +{ + struct iicmux_softc *sc = device_get_softc(dev); + + return (IICBUS_GET_FREQUENCY(sc->busdev, speed)); +} + +#ifdef FDT +static phandle_t +iicmux_get_node(device_t dev, device_t child) +{ + struct iicmux_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i <= sc->maxbus; ++i) { + if (sc->childdevs[i] == child) + return (sc->childnodes[i]); + } + return (0); /* null handle */ +} +#endif + +static int +iicmux_intr(device_t dev, int event, char *buf) +{ + struct iicmux_softc *sc = device_get_softc(dev); + + /* XXX iicbus_intr() in iiconf.c should return status. */ + + iicbus_intr(sc->busdev, event, buf); + return (0); +} + +static int +iicmux_read(device_t dev, char *buf, int len, int *bytes, int last, int delay) +{ + struct iicmux_softc *sc = device_get_softc(dev); + + return (iicbus_read(sc->busdev, buf, len, bytes, last, delay)); +} + +static int +iicmux_repeated_start(device_t dev, u_char slave, int timeout) +{ + struct iicmux_softc *sc = device_get_softc(dev); + + return (iicbus_repeated_start(sc->busdev, slave, timeout)); +} + +static int +iicmux_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) +{ + struct iicmux_softc *sc = device_get_softc(dev); + + return (iicbus_reset(sc->busdev, speed, addr, oldaddr)); +} + +static int +iicmux_start(device_t dev, u_char slave, int timeout) +{ + struct iicmux_softc *sc = device_get_softc(dev); + + return (iicbus_start(sc->busdev, slave, timeout)); +} + +static int +iicmux_stop(device_t dev) +{ + struct iicmux_softc *sc = device_get_softc(dev); + + return (iicbus_stop(sc->busdev)); +} + +static int +iicmux_transfer( device_t dev, struct iic_msg *msgs, uint32_t nmsgs) +{ + struct iicmux_softc *sc = device_get_softc(dev); + + return (iicbus_transfer(sc->busdev, msgs, nmsgs)); +} + +static int +iicmux_write(device_t dev, const char *buf, int len, int *bytes, int timeout) +{ + struct iicmux_softc *sc = device_get_softc(dev); + + return (iicbus_write(sc->busdev, buf, len, bytes, timeout)); +} + +/*------------------------------------------------------------------------------ + * iicmux helper functions, called by hardware-specific drivers. + * All these functions return a standard errno value. + *----------------------------------------------------------------------------*/ + +int +iicmux_add_child(device_t dev, device_t child, int busidx) +{ + struct iicmux_softc *sc = device_get_softc(dev); + + KASSERT(busidx < sc->numbuses, + ("iicmux_add_child: bus idx %d too big", busidx)); + KASSERT(sc->childdevs[busidx] == NULL, + ("iicmux_add_child: bus idx %d already added", busidx)); + + sc->childdevs[busidx] = child; + if (sc->maxbus < busidx) + sc->maxbus = busidx; + + return (0); +} + +int +iicmux_attach(device_t dev, device_t busdev, int numbuses) +{ + struct iicmux_softc *sc = device_get_softc(dev); + int i, numadded; + + /* + * Init the softc... + */ + KASSERT(numbuses <= IICMUX_MAX_BUSES, + ("iicmux_attach: numbuses %d exceeds max %d\n", + numbuses, IICMUX_MAX_BUSES)); + + sc->dev = dev; + sc->busdev = busdev; + sc->numbuses = numbuses; + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), OID_AUTO, + "debugmux", CTLFLAG_RWTUN, &sc->debugmux, 0, "debug mux operations"); + + /* + * Add children... + */ + numadded = 0; + +#ifdef FDT + phandle_t child, node, parent; + pcell_t idx; + + /* + * Find our FDT node. Child nodes within our node will become our *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Jan 2 17:53:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 839C81D57B5 for ; Thu, 2 Jan 2020 17:53:56 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47pbJ41FpMz3DZk for ; Thu, 2 Jan 2020 17:53:56 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1577987634; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=exce+8vW3vpwTafLQa7sbIqLIDjFDwMz8mVFIPriv9gSpgYELUn42/EeD9e/EIguUSOUHGhvwEcv8 FedTNWpAWwzLd2uBN7QeHp6MwHlEm68q7NsorBvzfkDFiZwtwJXiYe1hpyAj2EmXsFYbHh1W0l9n2s zbl6xo6w3xw0Bvuw55rQNgJANSn83RmEwCQ/Coy9HoHre23q6rTGUjLmpegYcQYHDFK6+0MzjbOlx7 rkKPU2auq0c9Q4T6TtwrKtlGjrAkSweoHEyvu72sQQz5RxX9iv2/5UDu8ILX2G7zQ4ikqivea7JKiR GMWPqNlrLQyaU2w3eHIrzb0qVUAp6DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=qpp6lPMXU6i99pmzG1Ge+8gzMhhgccpshLB021Hrb4A=; b=q92rd/NLBw02Ek3ALhxTEu0rcf+Vr+BH+eTIrAVl7x4j8AyV/aYBsxd69qUTsnuHgHnU8g94K3+rg 1ConHGu1uaREwGijX4kPBnPdlQJzD9T7ShRqoEhsalC+pplxpyp8bU0/czQYoKigf5DbrpXVKgpcfB G976gJhg/94V0/kXE3ke57kTmC8HCQELkZUEQyb0r0oDhfunSlv3vqG+DmIWK/hjah/e+TGl1gDh3w DZRxIazGTVRV7ymI6CulLsbOPmjOTNu7J9aS71v0pVlFXlPvAo1f5QV38mOZ/587HHndjFLsWt7Vjr 44WgJMvSqWC9X+ndCURnfbtm1NgO/hg== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=qpp6lPMXU6i99pmzG1Ge+8gzMhhgccpshLB021Hrb4A=; b=nxcypNt2VwInxAo8j1mG1ZgPWbxWgDyvKT+CZp1QeUX/+54aDpbuq7sxZYi53TOi9jS/Q0+q1RzuU s0uYHWDP+D6mFVQlqFnqnRW738xqd+qEg1lpDXBGopn00dextXEAhSTQL0InaJNcDx+OGcsuy6tpem h831WGn5peeZMDEkCgl2KJOeVkfv46/RR+aoI5601l8Rs1+O3pmgTnTiOeb1wMTithbx8zTPZhZMrE hQnyohAcQgEqstyoGGiFxpimMcyL4J0H8BF1t6lBDdyamZjXVAJcN3P2usXDdZYxg366u2QsSWEjog 6I+dlskUVpmDUt22dcFeRA1T+gLpg9g== X-MHO-RoutePath: aGlwcGll X-MHO-User: d683ce89-2d88-11ea-b80d-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id d683ce89-2d88-11ea-b80d-052b4a66b6b2; Thu, 02 Jan 2020 17:53:53 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 002Hrqog012832; Thu, 2 Jan 2020 10:53:52 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r356278 - in head: share/man/man4 sys/conf sys/dev/iicbus sys/dev/iicbus/mux sys/modules/i2c sys/modules/i2c/mux sys/modules/i2c/mux/iic_gpiomux sys/modules/i2c/mux/iicmux sys/modules/i... From: Ian Lepore To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Thu, 02 Jan 2020 10:53:52 -0700 In-Reply-To: <202001021751.002HpoEf042296@repo.freebsd.org> References: <202001021751.002HpoEf042296@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47pbJ41FpMz3DZk X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.98 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-0.996,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 17:53:56 -0000 On Thu, 2020-01-02 at 17:51 +0000, Ian Lepore wrote: > Author: ian > Date: Thu Jan 2 17:51:49 2020 > New Revision: 356278 > URL: https://svnweb.freebsd.org/changeset/base/356278 > > Log: > Add support for i2c bus mux hardware. > As usual, forgot to add: Differential Revision: https://reviews.freebsd.org/D22891 -- Ian From owner-svn-src-head@freebsd.org Thu Jan 2 18:46:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 189321D675C; Thu, 2 Jan 2020 18:46:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pcSq09qyz3H5m; Thu, 2 Jan 2020 18:46:35 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 010691FB7B; Thu, 2 Jan 2020 18:46:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002IkY7p075511; Thu, 2 Jan 2020 18:46:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002IkYuN075507; Thu, 2 Jan 2020 18:46:34 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001021846.002IkYuN075507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 2 Jan 2020 18:46:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356279 - in head: lib/libbe sbin/bectl/tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: lib/libbe sbin/bectl/tests X-SVN-Commit-Revision: 356279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 18:46:35 -0000 Author: kevans Date: Thu Jan 2 18:46:33 2020 New Revision: 356279 URL: https://svnweb.freebsd.org/changeset/base/356279 Log: libbe(3): promote dependent clones when destroying an environment When removing a boot environment iterate over the dependents and process the snapshots by grabbing any clones. Promote the clones we found and then remove the target environment. This fixes the ability to destroy a boot environment when it has been used to spawn one or more other boot environments. PR: 242592 Submitted by: Wes Maag (with changes by myself) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22953 Modified: head/lib/libbe/be.c head/lib/libbe/be.h head/lib/libbe/be_error.c head/sbin/bectl/tests/bectl_test.sh Modified: head/lib/libbe/be.c ============================================================================== --- head/lib/libbe/be.c Thu Jan 2 17:51:49 2020 (r356278) +++ head/lib/libbe/be.c Thu Jan 2 18:46:33 2020 (r356279) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include - +#include #include #include @@ -48,9 +48,16 @@ __FBSDID("$FreeBSD$"); #include "be.h" #include "be_impl.h" +struct promote_entry { + char name[BE_MAXPATHLEN]; + SLIST_ENTRY(promote_entry) link; +}; + struct be_destroy_data { - libbe_handle_t *lbh; - char *snapname; + libbe_handle_t *lbh; + char target_name[BE_MAXPATHLEN]; + char *snapname; + SLIST_HEAD(, promote_entry) promotelist; }; #if SOON @@ -194,7 +201,153 @@ be_nicenum(uint64_t num, char *buf, size_t buflen) zfs_nicenum(num, buf, buflen); } +static bool +be_should_promote_clones(zfs_handle_t *zfs_hdl, struct be_destroy_data *bdd) +{ + char *atpos; + + if (zfs_get_type(zfs_hdl) != ZFS_TYPE_SNAPSHOT) + return (false); + + /* + * If we're deleting a snapshot, we need to make sure we only promote + * clones that are derived from one of the snapshots we're deleting, + * rather than that of a snapshot we're not touching. This keeps stuff + * in a consistent state, making sure that we don't error out unless + * we really need to. + */ + if (bdd->snapname == NULL) + return (true); + + atpos = strchr(zfs_get_name(zfs_hdl), '@'); + return (strcmp(atpos + 1, bdd->snapname) == 0); +} + +/* + * This is executed from be_promote_dependent_clones via zfs_iter_dependents, + * It checks if the dependent type is a snapshot then attempts to find any + * clones associated with it. Any clones not related to the destroy target are + * added to the promote list. + */ static int +be_dependent_clone_cb(zfs_handle_t *zfs_hdl, void *data) +{ + int err; + bool found; + char *name; + struct nvlist *nvl; + struct nvpair *nvp; + struct be_destroy_data *bdd; + struct promote_entry *entry, *newentry; + + nvp = NULL; + err = 0; + bdd = (struct be_destroy_data *)data; + + if (be_should_promote_clones(zfs_hdl, bdd) && + (nvl = zfs_get_clones_nvl(zfs_hdl)) != NULL) { + while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) { + name = nvpair_name(nvp); + + /* + * Skip if the clone is equal to, or a child of, the + * destroy target. + */ + if (strncmp(name, bdd->target_name, + strlen(bdd->target_name)) == 0 || + strstr(name, bdd->target_name) == name) { + continue; + } + + found = false; + SLIST_FOREACH(entry, &bdd->promotelist, link) { + if (strcmp(entry->name, name) == 0) { + found = true; + break; + } + } + + if (found) + continue; + + newentry = malloc(sizeof(struct promote_entry)); + if (newentry == NULL) { + err = ENOMEM; + break; + } + +#define BE_COPY_NAME(entry, src) \ + strlcpy((entry)->name, (src), sizeof((entry)->name)) + if (BE_COPY_NAME(newentry, name) >= + sizeof(newentry->name)) { + /* Shouldn't happen. */ + free(newentry); + err = ENAMETOOLONG; + break; + } +#undef BE_COPY_NAME + + /* + * We're building up a SLIST here to make sure both that + * we get the order right and so that we don't + * inadvertently observe the wrong state by promoting + * datasets while we're still walking the tree. The + * latter can lead to situations where we promote a BE + * then effectively demote it again. + */ + SLIST_INSERT_HEAD(&bdd->promotelist, newentry, link); + } + nvlist_free(nvl); + } + zfs_close(zfs_hdl); + return (err); +} + +/* + * This is called before a destroy, so that any datasets(environments) that are + * dependent on this one get promoted before destroying the target. + */ +static int +be_promote_dependent_clones(zfs_handle_t *zfs_hdl, struct be_destroy_data *bdd) +{ + int err; + zfs_handle_t *clone; + struct promote_entry *entry; + + snprintf(bdd->target_name, BE_MAXPATHLEN, "%s/", zfs_get_name(zfs_hdl)); + err = zfs_iter_dependents(zfs_hdl, true, be_dependent_clone_cb, bdd); + + /* + * Drain the list and walk away from it if we're only deleting a + * snapshot. + */ + if (bdd->snapname != NULL && !SLIST_EMPTY(&bdd->promotelist)) + err = BE_ERR_HASCLONES; + while (!SLIST_EMPTY(&bdd->promotelist)) { + entry = SLIST_FIRST(&bdd->promotelist); + SLIST_REMOVE_HEAD(&bdd->promotelist, link); + +#define ZFS_GRAB_CLONE() \ + zfs_open(bdd->lbh->lzh, entry->name, ZFS_TYPE_FILESYSTEM) + /* + * Just skip this part on error, we still want to clean up the + * promotion list after the first error. We'll then preserve it + * all the way back. + */ + if (err == 0 && (clone = ZFS_GRAB_CLONE()) != NULL) { + err = zfs_promote(clone); + if (err != 0) + err = BE_ERR_DESTROYMNT; + zfs_close(clone); + } +#undef ZFS_GRAB_CLONE + free(entry); + } + + return (err); +} + +static int be_destroy_cb(zfs_handle_t *zfs_hdl, void *data) { char path[BE_MAXPATHLEN]; @@ -239,8 +392,9 @@ be_destroy_cb(zfs_handle_t *zfs_hdl, void *data) * BE_DESTROY_FORCE : forces operation on mounted datasets * BE_DESTROY_ORIGIN: destroy the origin snapshot as well */ -int -be_destroy(libbe_handle_t *lbh, const char *name, int options) +static int +be_destroy_internal(libbe_handle_t *lbh, const char *name, int options, + bool odestroyer) { struct be_destroy_data bdd; char origin[BE_MAXPATHLEN], path[BE_MAXPATHLEN]; @@ -251,6 +405,7 @@ be_destroy(libbe_handle_t *lbh, const char *name, int bdd.lbh = lbh; bdd.snapname = NULL; + SLIST_INIT(&bdd.promotelist); force = options & BE_DESTROY_FORCE; *origin = '\0'; @@ -268,25 +423,6 @@ be_destroy(libbe_handle_t *lbh, const char *name, int if (fs == NULL) return (set_error(lbh, BE_ERR_ZFSOPEN)); - if ((options & BE_DESTROY_WANTORIGIN) != 0 && - zfs_prop_get(fs, ZFS_PROP_ORIGIN, origin, sizeof(origin), - NULL, NULL, 0, 1) != 0 && - (options & BE_DESTROY_ORIGIN) != 0) - return (set_error(lbh, BE_ERR_NOORIGIN)); - - /* - * If the caller wants auto-origin destruction and the origin - * name matches one of our automatically created snapshot names - * (i.e. strftime("%F-%T") with a serial at the end), then - * we'll set the DESTROY_ORIGIN flag and nuke it - * be_is_auto_snapshot_name is exported from libbe(3) so that - * the caller can determine if it needs to warn about the origin - * not being destroyed or not. - */ - if ((options & BE_DESTROY_AUTOORIGIN) != 0 && *origin != '\0' && - be_is_auto_snapshot_name(lbh, origin)) - options |= BE_DESTROY_ORIGIN; - /* Don't destroy a mounted dataset unless force is specified */ if ((mounted = zfs_is_mounted(fs, NULL)) != 0) { if (force) { @@ -297,6 +433,14 @@ be_destroy(libbe_handle_t *lbh, const char *name, int } } } else { + /* + * If we're initially destroying a snapshot, origin options do + * not make sense. If we're destroying the origin snapshot of + * a BE, we want to maintain the options in case we need to + * fake success after failing to promote. + */ + if (!odestroyer) + options &= ~BE_DESTROY_WANTORIGIN; if (!zfs_dataset_exists(lbh->lzh, path, ZFS_TYPE_SNAPSHOT)) return (set_error(lbh, BE_ERR_NOENT)); @@ -311,6 +455,49 @@ be_destroy(libbe_handle_t *lbh, const char *name, int } } + /* + * Whether we're destroying a BE or a single snapshot, we need to walk + * the tree of what we're going to destroy and promote everything in our + * path so that we can make it happen. + */ + if ((err = be_promote_dependent_clones(fs, &bdd)) != 0) { + free(bdd.snapname); + + /* + * If we're just destroying the origin of some other dataset + * we were invoked to destroy, then we just ignore + * BE_ERR_HASCLONES and return success unless the caller wanted + * to force the issue. + */ + if (odestroyer && err == BE_ERR_HASCLONES && + (options & BE_DESTROY_AUTOORIGIN) != 0) + return (0); + return (set_error(lbh, err)); + } + + /* + * This was deferred until after we promote all of the derivatives so + * that we grab the new origin after everything's settled down. + */ + if ((options & BE_DESTROY_WANTORIGIN) != 0 && + zfs_prop_get(fs, ZFS_PROP_ORIGIN, origin, sizeof(origin), + NULL, NULL, 0, 1) != 0 && + (options & BE_DESTROY_ORIGIN) != 0) + return (set_error(lbh, BE_ERR_NOORIGIN)); + + /* + * If the caller wants auto-origin destruction and the origin + * name matches one of our automatically created snapshot names + * (i.e. strftime("%F-%T") with a serial at the end), then + * we'll set the DESTROY_ORIGIN flag and nuke it + * be_is_auto_snapshot_name is exported from libbe(3) so that + * the caller can determine if it needs to warn about the origin + * not being destroyed or not. + */ + if ((options & BE_DESTROY_AUTOORIGIN) != 0 && *origin != '\0' && + be_is_auto_snapshot_name(lbh, origin)) + options |= BE_DESTROY_ORIGIN; + err = be_destroy_cb(fs, &bdd); zfs_close(fs); free(bdd.snapname); @@ -337,8 +524,23 @@ be_destroy(libbe_handle_t *lbh, const char *name, int if (strncmp(origin, lbh->root, rootlen) != 0 || origin[rootlen] != '/') return (0); - return (be_destroy(lbh, origin + rootlen + 1, - options & ~BE_DESTROY_ORIGIN)); + return (be_destroy_internal(lbh, origin + rootlen + 1, + options & ~BE_DESTROY_ORIGIN, true)); +} + +int +be_destroy(libbe_handle_t *lbh, const char *name, int options) +{ + + /* + * The consumer must not set both BE_DESTROY_AUTOORIGIN and + * BE_DESTROY_ORIGIN. Internally, we'll set the latter from the former. + * The latter should imply that we must succeed at destroying the + * origin, or complain otherwise. + */ + if ((options & BE_DESTROY_WANTORIGIN) == BE_DESTROY_WANTORIGIN) + return (set_error(lbh, BE_ERR_UNKNOWN)); + return (be_destroy_internal(lbh, name, options, false)); } static void Modified: head/lib/libbe/be.h ============================================================================== --- head/lib/libbe/be.h Thu Jan 2 17:51:49 2020 (r356278) +++ head/lib/libbe/be.h Thu Jan 2 18:46:33 2020 (r356279) @@ -60,6 +60,7 @@ typedef enum be_error { BE_ERR_NOMEM, /* insufficient memory */ BE_ERR_UNKNOWN, /* unknown error */ BE_ERR_INVORIGIN, /* invalid origin */ + BE_ERR_HASCLONES, /* snapshot has clones */ } be_error_t; Modified: head/lib/libbe/be_error.c ============================================================================== --- head/lib/libbe/be_error.c Thu Jan 2 17:51:49 2020 (r356278) +++ head/lib/libbe/be_error.c Thu Jan 2 18:46:33 2020 (r356279) @@ -108,6 +108,9 @@ libbe_error_description(libbe_handle_t *lbh) case BE_ERR_INVORIGIN: return ("invalid origin"); + case BE_ERR_HASCLONES: + return ("snapshot has clones"); + default: assert(lbh->error == BE_ERR_SUCCESS); return ("no error"); Modified: head/sbin/bectl/tests/bectl_test.sh ============================================================================== --- head/sbin/bectl/tests/bectl_test.sh Thu Jan 2 17:51:49 2020 (r356278) +++ head/sbin/bectl/tests/bectl_test.sh Thu Jan 2 18:46:33 2020 (r356279) @@ -162,6 +162,51 @@ bectl_destroy_body() atf_check bectl -r ${zpool}/ROOT create -e default default3 atf_check bectl -r ${zpool}/ROOT destroy -o default3 atf_check bectl -r ${zpool}/ROOT unmount default + + # create two be from the same parent and destroy the parent + atf_check bectl -r ${zpool}/ROOT create -e default default2 + atf_check bectl -r ${zpool}/ROOT create -e default default3 + atf_check bectl -r ${zpool}/ROOT destroy default + atf_check bectl -r ${zpool}/ROOT destroy default2 + atf_check bectl -r ${zpool}/ROOT rename default3 default + + # Create a BE, have it be the parent for another and repeat, then start + # deleting environments. Arbitrarily chose default3 as the first. + # Sleeps are required to prevent conflicting snapshots- libbe will + # use the time with a serial at the end as needed to prevent collisions, + # but as BEs get promoted the snapshot names will convert and conflict + # anyways. libbe should perhaps consider adding something extra to the + # default name to prevent collisions like this, but the default name + # includes down to the second and creating BEs this rapidly is perhaps + # uncommon enough. + atf_check bectl -r ${zpool}/ROOT create -e default default2 + sleep 1 + atf_check bectl -r ${zpool}/ROOT create -e default2 default3 + sleep 1 + atf_check bectl -r ${zpool}/ROOT create -e default3 default4 + atf_check bectl -r ${zpool}/ROOT destroy default3 + atf_check bectl -r ${zpool}/ROOT destroy default2 + atf_check bectl -r ${zpool}/ROOT destroy default4 + + # Create two BEs, then create an unrelated snapshot on the originating + # BE and destroy it. We shouldn't have promoted the second BE, and it's + # only possible to tell if we promoted it by making sure we didn't + # demote the first BE at some point -- if we did, it's origin will no + # longer be empty. + atf_check bectl -r ${zpool}/ROOT create -e default default2 + atf_check bectl -r ${zpool}/ROOT create default@test + + atf_check bectl -r ${zpool}/ROOT destroy default@test + atf_check -o inline:"-\n" zfs get -Ho value origin ${zpool}/ROOT/default + atf_check bectl -r ${zpool}/ROOT destroy default2 + + # As observed by beadm, if we explicitly try to destroy a snapshot that + # leads to clones, we shouldn't have allowed it. + atf_check bectl -r ${zpool}/ROOT create default@test + atf_check bectl -r ${zpool}/ROOT create -e default@test default2 + + atf_check -e not-empty -s not-exit:0 bectl -r ${zpool}/ROOT destroy \ + default@test } bectl_destroy_cleanup() { From owner-svn-src-head@freebsd.org Thu Jan 2 19:26:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE9B51D7A43; Thu, 2 Jan 2020 19:26:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pdLN4kH0z3Kht; Thu, 2 Jan 2020 19:26:04 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D44D2035B; Thu, 2 Jan 2020 19:26:04 +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 002JQ4dT000109; Thu, 2 Jan 2020 19:26:04 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002JQ4hK000108; Thu, 2 Jan 2020 19:26:04 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202001021926.002JQ4hK000108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 2 Jan 2020 19:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356280 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 19:26:04 -0000 Author: markj Date: Thu Jan 2 19:26:04 2020 New Revision: 356280 URL: https://svnweb.freebsd.org/changeset/base/356280 Log: Clear queue operation flags when migrating a page to another queue. The page daemon loops may move pages back to the active queue if references are detected. In this case we must take care to clear existing queue operation flags. In particular, PGA_REQUEUE_HEAD may be set, and that flag is only valid if the page belongs to the inactive queue. Also fix a bug in the active queue scan where we were updating "old" instead of "new". This would only have been hit in rare cases where the page moved out of the active queue after the beginning of the scan. Reported by: Bob Prohaska, Idwer Vollering Tested by: Idwer Vollering Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D23001 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Thu Jan 2 18:46:33 2020 (r356279) +++ head/sys/vm/vm_pageout.c Thu Jan 2 19:26:04 2020 (r356280) @@ -834,6 +834,7 @@ scan: if (new.act_count > ACT_MAX) new.act_count = ACT_MAX; + new.flags &= ~PGA_QUEUE_OP_MASK; new.flags |= PGA_REQUEUE; new.queue = PQ_ACTIVE; if (!vm_page_pqstate_commit(m, &old, new)) @@ -1313,8 +1314,9 @@ act_scan: */ ps_delta = 0; if (old.queue != PQ_ACTIVE) { - old.queue = PQ_ACTIVE; - old.flags |= PGA_REQUEUE; + new.flags &= ~PGA_QUEUE_OP_MASK; + new.flags |= PGA_REQUEUE; + new.queue = PQ_ACTIVE; } } else { /* @@ -1350,6 +1352,7 @@ act_scan: ps_delta = 1; } + new.flags &= ~PGA_QUEUE_OP_MASK; new.flags |= PGA_REQUEUE; new.queue = nqueue; } @@ -1560,6 +1563,7 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int sh if (new.act_count > ACT_MAX) new.act_count = ACT_MAX; + new.flags &= ~PGA_QUEUE_OP_MASK; new.flags |= PGA_REQUEUE; new.queue = PQ_ACTIVE; if (!vm_page_pqstate_commit(m, &old, new)) From owner-svn-src-head@freebsd.org Thu Jan 2 19:29:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23EE51D7B68; Thu, 2 Jan 2020 19:29:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pdQ308fNz3Kt7; Thu, 2 Jan 2020 19:29:15 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F088920362; Thu, 2 Jan 2020 19:29:14 +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 002JTEmS000312; Thu, 2 Jan 2020 19:29:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002JTEbt000311; Thu, 2 Jan 2020 19:29:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202001021929.002JTEbt000311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 2 Jan 2020 19:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356281 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 356281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 19:29:15 -0000 Author: markj Date: Thu Jan 2 19:29:14 2020 New Revision: 356281 URL: https://svnweb.freebsd.org/changeset/base/356281 Log: Remove set_page_dirty_lock(). Its use of the page lock is incorrect, and it is not used by the DRM modules. Reviewed by: hselasky MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D23002 Modified: head/sys/compat/linuxkpi/common/include/linux/mm.h Modified: head/sys/compat/linuxkpi/common/include/linux/mm.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/mm.h Thu Jan 2 19:26:04 2020 (r356280) +++ head/sys/compat/linuxkpi/common/include/linux/mm.h Thu Jan 2 19:29:14 2020 (r356281) @@ -211,14 +211,6 @@ set_page_dirty(struct vm_page *page) } static inline void -set_page_dirty_lock(struct vm_page *page) -{ - vm_page_lock(page); - vm_page_dirty(page); - vm_page_unlock(page); -} - -static inline void mark_page_accessed(struct vm_page *page) { vm_page_reference(page); From owner-svn-src-head@freebsd.org Thu Jan 2 20:30:54 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DC2D1D99B6; Thu, 2 Jan 2020 20:30:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pfnB00mtz3PTw; Thu, 2 Jan 2020 20:30:54 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF76A20EDE; Thu, 2 Jan 2020 20:30:53 +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 002KUrU3037048; Thu, 2 Jan 2020 20:30:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002KUrFW037047; Thu, 2 Jan 2020 20:30:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202001022030.002KUrFW037047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 2 Jan 2020 20:30:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356284 - head/sys/geom/eli X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom/eli X-SVN-Commit-Revision: 356284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 20:30:54 -0000 Author: mav Date: Thu Jan 2 20:30:53 2020 New Revision: 356284 URL: https://svnweb.freebsd.org/changeset/base/356284 Log: Remove extra check for provider being closed. We already checked for that earlier, and since we hold topology lock it could not change. MFC after: 1 week Modified: head/sys/geom/eli/g_eli.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Thu Jan 2 19:55:09 2020 (r356283) +++ head/sys/geom/eli/g_eli.c Thu Jan 2 20:30:53 2020 (r356284) @@ -1048,8 +1048,7 @@ g_eli_destroy(struct g_eli_softc *sc, boolean_t force) bzero(sc, sizeof(*sc)); free(sc, M_ELI); - if (pp == NULL || (pp->acr == 0 && pp->acw == 0 && pp->ace == 0)) - G_ELI_DEBUG(0, "Device %s destroyed.", gp->name); + G_ELI_DEBUG(0, "Device %s destroyed.", gp->name); g_wither_geom_close(gp, ENXIO); return (0); From owner-svn-src-head@freebsd.org Thu Jan 2 21:34:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7166D1DB482; Thu, 2 Jan 2020 21:34:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47phBs2QHlz3yKT; Thu, 2 Jan 2020 21:34:45 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E2E721C17; Thu, 2 Jan 2020 21:34:45 +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 002LYjVv079258; Thu, 2 Jan 2020 21:34:45 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002LYj7M079257; Thu, 2 Jan 2020 21:34:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202001022134.002LYj7M079257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 2 Jan 2020 21:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356289 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 356289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 21:34:45 -0000 Author: jhb Date: Thu Jan 2 21:34:44 2020 New Revision: 356289 URL: https://svnweb.freebsd.org/changeset/base/356289 Log: Look for cross toolchain makefiles in /usr/share/toolchains. The freebsd-binutils and freebsd-gcc* packages install toolchain makefiles to /usr/share/toolchains rather than LOCALBASE. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D22985 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Jan 2 21:13:22 2020 (r356288) +++ head/Makefile.inc1 Thu Jan 2 21:34:44 2020 (r356289) @@ -62,6 +62,8 @@ LOCALBASE?= /usr/local .if defined(CROSS_TOOLCHAIN) .if exists(${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk) .include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" +.elif exists(/usr/share/toolchains/${CROSS_TOOLCHAIN}.mk) +.include "/usr/share/toolchains/${CROSS_TOOLCHAIN}.mk" .elif exists(${CROSS_TOOLCHAIN}) .include "${CROSS_TOOLCHAIN}" .else From owner-svn-src-head@freebsd.org Thu Jan 2 21:41:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B16ED1DB914; Thu, 2 Jan 2020 21:41:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47phLC4CTqz4021; Thu, 2 Jan 2020 21:41:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-7.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 2A139CF75; Thu, 2 Jan 2020 21:41:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r356289 - head From: John Baldwin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202001022134.002LYj7M079257@repo.freebsd.org> Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <29f0fef1-d4e9-38f6-4441-55b397f6fe1f@FreeBSD.org> Date: Thu, 2 Jan 2020 13:41:02 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <202001022134.002LYj7M079257@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 21:41:07 -0000 On 1/2/20 1:34 PM, John Baldwin wrote: > Author: jhb > Date: Thu Jan 2 21:34:44 2020 > New Revision: 356289 > URL: https://svnweb.freebsd.org/changeset/base/356289 > > Log: > Look for cross toolchain makefiles in /usr/share/toolchains. > > The freebsd-binutils and freebsd-gcc* packages install toolchain > makefiles to /usr/share/toolchains rather than LOCALBASE. The short version is that you can do something like this to use GCC as the system compiler (/usr/bin/cc): cd /usr/ports/base/binutils ; make install clean cd ../gcc6 ; make install clean Then 'make CROSS_TOOLCHAIN=freebsd-gcc6 buildworld', etc. If you aren't planning on doing cross-builds you can set CROSS_TOOLCHAIN in /etc/src.conf. As described elsewhere, the base/* packages can be cross-built (along with pkg), so for any architectures not yet using clang we could fairly easily provide a cross-built package repo (though that architecture list is becoming rather small). I will probably add a base/gcc9 port once we can build a full system with gcc9. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Jan 2 22:07:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C4AE1DC1C3; Thu, 2 Jan 2020 22:07:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47phw82F7jz41M2; Thu, 2 Jan 2020 22:07:04 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F4F022202; Thu, 2 Jan 2020 22:07:04 +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 002M731o098564; Thu, 2 Jan 2020 22:07:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002M73Lh098563; Thu, 2 Jan 2020 22:07:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202001022207.002M73Lh098563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 2 Jan 2020 22:07:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356292 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 356292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 22:07:04 -0000 Author: kib Date: Thu Jan 2 22:07:03 2020 New Revision: 356292 URL: https://svnweb.freebsd.org/changeset/base/356292 Log: Style: remove trailing spaces/tabs. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Thu Jan 2 21:58:34 2020 (r356291) +++ head/sys/kern/kern_umtx.c Thu Jan 2 22:07:03 2020 (r356292) @@ -95,7 +95,7 @@ struct umtx_pi { /* Reference count */ int pi_refcount; - /* List entry to link umtx holding by thread */ + /* List entry to link umtx holding by thread */ TAILQ_ENTRY(umtx_pi) pi_link; /* List entry in hash */ @@ -138,7 +138,7 @@ struct umtx_q { /* Inherited priority from PP mutex */ u_char uq_inherited_pri; - + /* Spare queue ready to be reused */ struct umtxq_queue *uq_spare_queue; @@ -180,7 +180,7 @@ struct umtxq_chain { TAILQ_HEAD(,umtx_pi) uc_pi_list; #ifdef UMTX_PROFILING - u_int length; + u_int length; u_int max_length; #endif }; @@ -292,7 +292,7 @@ static struct mtx umtx_lock; #ifdef UMTX_PROFILING static void -umtx_init_profiling(void) +umtx_init_profiling(void) { struct sysctl_oid *chain_oid; char chain_name[10]; @@ -300,8 +300,8 @@ umtx_init_profiling(void) for (i = 0; i < UMTX_CHAINS; ++i) { snprintf(chain_name, sizeof(chain_name), "%d", i); - chain_oid = SYSCTL_ADD_NODE(NULL, - SYSCTL_STATIC_CHILDREN(_debug_umtx_chains), OID_AUTO, + chain_oid = SYSCTL_ADD_NODE(NULL, + SYSCTL_STATIC_CHILDREN(_debug_umtx_chains), OID_AUTO, chain_name, CTLFLAG_RD, NULL, "umtx hash stats"); SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(chain_oid), OID_AUTO, "max_length0", CTLFLAG_RD, &umtxq_chains[0][i].max_length, 0, NULL); @@ -406,7 +406,7 @@ sysctl_debug_umtx_chains_clear(SYSCTL_HANDLER_ARGS) uc = &umtxq_chains[i][j]; mtx_lock(&uc->uc_lock); uc->length = 0; - uc->max_length = 0; + uc->max_length = 0; mtx_unlock(&uc->uc_lock); } } @@ -441,7 +441,7 @@ umtxq_sysinit(void *arg __unused) umtxq_chains[i][j].uc_waiters = 0; #ifdef UMTX_PROFILING umtxq_chains[i][j].length = 0; - umtxq_chains[i][j].max_length = 0; + umtxq_chains[i][j].max_length = 0; #endif } } @@ -613,7 +613,7 @@ umtxq_insert_queue(struct umtx_q *uq, int q) if (uc->length > uc->max_length) { uc->max_length = uc->length; if (uc->max_length > max_length) - max_length = uc->max_length; + max_length = uc->max_length; } #endif } @@ -770,7 +770,7 @@ umtxq_signal_thread(struct umtx_q *uq) wakeup(uq); } -static inline int +static inline int tstohz(const struct timespec *tsp) { struct timeval tv; @@ -825,7 +825,7 @@ abs_timeout_gethz(struct abs_timeout *timo) struct timespec tts; if (timespeccmp(&timo->end, &timo->cur, <=)) - return (-1); + return (-1); timespecsub(&timo->end, &timo->cur, &tts); return (tstohz(&tts)); } @@ -1009,7 +1009,7 @@ kern_umtx_wake(struct thread *td, void *uaddr, int n_w { struct umtx_key key; int ret; - + if ((ret = umtx_key_get(uaddr, TYPE_SIMPLE_WAIT, is_private ? THREAD_SHARE : AUTO_SHARE, &key)) != 0) return (ret); @@ -1522,7 +1522,7 @@ umtx_pi_check_loop(struct umtx_pi *pi) /* * Propagate priority when a thread is blocked on POSIX * PI mutex. - */ + */ static void umtx_propagate_priority(struct thread *td) { @@ -1773,7 +1773,7 @@ umtx_pi_ref(struct umtx_pi *pi) /* * Decrease reference count for a PI mutex, if the counter * is decreased to zero, its memory space is freed. - */ + */ static void umtx_pi_unref(struct umtx_pi *pi) { @@ -1972,7 +1972,7 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 */ if (error != 0) break; - + umtxq_lock(&uq->uq_key); umtxq_busy(&uq->uq_key); umtxq_unlock(&uq->uq_key); @@ -2099,7 +2099,7 @@ usrloop: umtx_pi_disown(pi); /* get highest priority thread which is still sleeping. */ uq_first = TAILQ_FIRST(&pi->pi_blocked); - while (uq_first != NULL && + while (uq_first != NULL && (uq_first->uq_flags & UQF_UMTXQ) == 0) { uq_first = TAILQ_NEXT(uq_first, uq_lockq); } @@ -2624,7 +2624,7 @@ do_cv_wait(struct thread *td, struct ucond *cv, struct if (timeout != NULL) abs_timeout_init(&timo, clockid, (wflags & CVWAIT_ABSTIME) != 0, timeout); - + umtxq_lock(&uq->uq_key); if (error == 0) { error = umtxq_sleep(uq, "ucond", timeout == NULL ? @@ -2673,7 +2673,7 @@ do_cv_signal(struct thread *td, struct ucond *cv) if (error == -1) return (EFAULT); if ((error = umtx_key_get(cv, TYPE_CV, GET_SHARE(flags), &key)) != 0) - return (error); + return (error); umtxq_lock(&key); umtxq_busy(&key); cnt = umtxq_count(&key); @@ -2702,7 +2702,7 @@ do_cv_broadcast(struct thread *td, struct ucond *cv) if (error == -1) return (EFAULT); if ((error = umtx_key_get(cv, TYPE_CV, GET_SHARE(flags), &key)) != 0) - return (error); + return (error); umtxq_lock(&key); umtxq_busy(&key); @@ -3124,7 +3124,7 @@ do_rw_unlock(struct thread *td, struct urwlock *rwlock } if (state & URWLOCK_WRITE_OWNER) { for (;;) { - rv = casueword32(&rwlock->rw_state, state, + rv = casueword32(&rwlock->rw_state, state, &oldstate, state & ~URWLOCK_WRITE_OWNER); if (rv == -1) { error = EFAULT; @@ -3279,7 +3279,7 @@ do_sem_wake(struct thread *td, struct _usem *sem) if (error == -1) return (EFAULT); if ((error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &key)) != 0) - return (error); + return (error); umtxq_lock(&key); umtxq_busy(&key); cnt = umtxq_count(&key); @@ -3400,7 +3400,7 @@ do_sem2_wake(struct thread *td, struct _usem2 *sem) if (rv == -1) return (EFAULT); if ((error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &key)) != 0) - return (error); + return (error); umtxq_lock(&key); umtxq_busy(&key); cnt = umtxq_count(&key); @@ -3456,12 +3456,12 @@ static inline int umtx_copyin_umtx_time(const void *addr, size_t size, struct _umtx_time *tp) { int error; - + if (size <= sizeof(struct timespec)) { tp->_clockid = CLOCK_REALTIME; tp->_flags = 0; error = copyin(addr, &tp->_timeout, sizeof(struct timespec)); - } else + } else error = copyin(addr, tp, sizeof(struct _umtx_time)); if (error != 0) return (error); @@ -3695,7 +3695,7 @@ __umtx_op_rw_wrlock(struct thread *td, struct _umtx_op if (uap->uaddr2 == NULL) { error = do_rw_wrlock(td, uap->obj, 0); } else { - error = umtx_copyin_umtx_time(uap->uaddr2, + error = umtx_copyin_umtx_time(uap->uaddr2, (size_t)uap->uaddr1, &timeout); if (error != 0) return (error); @@ -4203,12 +4203,12 @@ umtx_copyin_umtx_time32(const void *addr, size_t size, { struct umtx_time32 t32; int error; - + t32.clockid = CLOCK_REALTIME; t32.flags = 0; if (size <= sizeof(struct timespec32)) error = copyin(addr, &t32.timeout, sizeof(struct timespec32)); - else + else error = copyin(addr, &t32, sizeof(struct umtx_time32)); if (error != 0) return (error); @@ -4269,7 +4269,7 @@ __umtx_op_wait_umutex_compat32(struct thread *td, stru if (uap->uaddr2 == NULL) tm_p = NULL; else { - error = umtx_copyin_umtx_time32(uap->uaddr2, + error = umtx_copyin_umtx_time32(uap->uaddr2, (size_t)uap->uaddr1, &timeout); if (error != 0) return (error); From owner-svn-src-head@freebsd.org Thu Jan 2 22:14:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A66C41DC714; Thu, 2 Jan 2020 22:14:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pj483k1jz424g; Thu, 2 Jan 2020 22:14: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AD40223FC; Thu, 2 Jan 2020 22:14: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 002ME054004364; Thu, 2 Jan 2020 22:14:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002MDxs0004357; Thu, 2 Jan 2020 22:13:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202001022213.002MDxs0004357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 2 Jan 2020 22:13:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356293 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 356293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 22:14:00 -0000 Author: kib Date: Thu Jan 2 22:13:59 2020 New Revision: 356293 URL: https://svnweb.freebsd.org/changeset/base/356293 Log: Rename umtxq_check_susp() to thread_check_susp() and make it usable outside of kern_umtx.c. To be used in several future changes. Discussed with: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_thread.c head/sys/kern/kern_umtx.c head/sys/sys/proc.h Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Thu Jan 2 22:07:03 2020 (r356292) +++ head/sys/kern/kern_thread.c Thu Jan 2 22:13:59 2020 (r356293) @@ -1074,6 +1074,49 @@ thread_suspend_check(int return_instead) return (0); } +/* + * Check for possible stops and suspensions while executing a + * casueword or similar transiently failing operation. + * + * The sleep argument controls whether the function can handle a stop + * request itself or it should return ERESTART and the request is + * proceed at the kernel/user boundary in ast. + * + * Typically, when retrying due to casueword(9) failure (rv == 1), we + * should handle the stop requests there, with exception of cases when + * the thread owns a kernel resource, for instance busied the umtx + * key, or when functions return immediately if casueword_check_susp() + * returned non-zero. On the other hand, retrying the whole lock + * operation, we better not stop there but delegate the handling to + * ast. + * + * If the request is for thread termination P_SINGLE_EXIT, we cannot + * handle it at all, and simply return EINTR. + */ +int +thread_check_susp(struct thread *td, bool sleep) +{ + struct proc *p; + int error; + + /* + * The check for TDF_NEEDSUSPCHK is racy, but it is enough to + * eventually break the lockstep loop. + */ + if ((td->td_flags & TDF_NEEDSUSPCHK) == 0) + return (0); + error = 0; + p = td->td_proc; + PROC_LOCK(p); + if (p->p_flag & P_SINGLE_EXIT) + error = EINTR; + else if (P_SHOULDSTOP(p) || + ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) + error = sleep ? thread_suspend_check(0) : ERESTART; + PROC_UNLOCK(p); + return (error); +} + void thread_suspend_switch(struct thread *td, struct proc *p) { Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Thu Jan 2 22:07:03 2020 (r356292) +++ head/sys/kern/kern_umtx.c Thu Jan 2 22:13:59 2020 (r356293) @@ -691,48 +691,6 @@ umtxq_count_pi(struct umtx_key *key, struct umtx_q **f } /* - * Check for possible stops and suspensions while executing a umtx - * locking operation. - * - * The sleep argument controls whether the function can handle a stop - * request itself or it should return ERESTART and the request is - * proceed at the kernel/user boundary in ast. - * - * Typically, when retrying due to casueword(9) failure (rv == 1), we - * should handle the stop requests there, with exception of cases when - * the thread busied the umtx key, or when functions return - * immediately if umtxq_check_susp() returned non-zero. On the other - * hand, retrying the whole lock operation, we better not stop there - * but delegate the handling to ast. - * - * If the request is for thread termination P_SINGLE_EXIT, we cannot - * handle it at all, and simply return EINTR. - */ -static int -umtxq_check_susp(struct thread *td, bool sleep) -{ - struct proc *p; - int error; - - /* - * The check for TDF_NEEDSUSPCHK is racy, but it is enough to - * eventually break the lockstep loop. - */ - if ((td->td_flags & TDF_NEEDSUSPCHK) == 0) - return (0); - error = 0; - p = td->td_proc; - PROC_LOCK(p); - if (p->p_flag & P_SINGLE_EXIT) - error = EINTR; - else if (P_SHOULDSTOP(p) || - ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) - error = sleep ? thread_suspend_check(0) : ERESTART; - PROC_UNLOCK(p); - return (error); -} - -/* * Wake up threads waiting on an userland object. */ @@ -1070,7 +1028,7 @@ do_lock_normal(struct thread *td, struct umutex *m, ui return (EOWNERDEAD); /* success */ } MPASS(rv == 1); - rv = umtxq_check_susp(td, false); + rv = thread_check_susp(td, false); if (rv != 0) return (rv); continue; @@ -1111,7 +1069,7 @@ do_lock_normal(struct thread *td, struct umutex *m, ui return (0); } if (rv == 1) { - rv = umtxq_check_susp(td, false); + rv = thread_check_susp(td, false); if (rv != 0) return (rv); } @@ -1124,7 +1082,7 @@ do_lock_normal(struct thread *td, struct umutex *m, ui } /* rv == 1 but not contested, likely store failure */ - rv = umtxq_check_susp(td, false); + rv = thread_check_susp(td, false); if (rv != 0) return (rv); } @@ -1167,7 +1125,7 @@ do_lock_normal(struct thread *td, struct umutex *m, ui if (rv == -1) return (EFAULT); if (rv == 1) { - rv = umtxq_check_susp(td, false); + rv = thread_check_susp(td, false); if (rv != 0) return (rv); } @@ -1189,7 +1147,7 @@ do_lock_normal(struct thread *td, struct umutex *m, ui umtx_key_release(&uq->uq_key); if (error == 0) - error = umtxq_check_susp(td, false); + error = thread_check_susp(td, false); } return (0); @@ -1224,7 +1182,7 @@ again: if (error == -1) return (EFAULT); if (error == 1) { - error = umtxq_check_susp(td, false); + error = thread_check_susp(td, false); if (error != 0) return (error); goto again; @@ -1261,7 +1219,7 @@ again: if (error == 1) { if (old != owner) return (EINVAL); - error = umtxq_check_susp(td, false); + error = thread_check_susp(td, false); if (error != 0) return (error); goto again; @@ -1316,7 +1274,7 @@ again: umtxq_unbusy(&key); umtxq_unlock(&key); umtx_key_release(&key); - error = umtxq_check_susp(td, false); + error = thread_check_susp(td, false); if (error != 0) return (error); goto again; @@ -1400,7 +1358,7 @@ do_wake2_umutex(struct thread *td, struct umutex *m, u break; } owner = old; - error = umtxq_check_susp(td, false); + error = thread_check_susp(td, false); } umtxq_lock(&key); @@ -1905,7 +1863,7 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 * to the pending signal with suspension check result. */ if (error == 0) { - error = umtxq_check_susp(td, true); + error = thread_check_susp(td, true); if (error != 0) break; } @@ -1922,7 +1880,7 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 } if (rv == 1) { if (error == 0) { - error = umtxq_check_susp(td, true); + error = thread_check_susp(td, true); if (error != 0) break; } @@ -1994,7 +1952,7 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 } if (rv == 1) { umtxq_unbusy_unlocked(&uq->uq_key); - error = umtxq_check_susp(td, true); + error = thread_check_susp(td, true); if (error != 0) break; @@ -2017,7 +1975,7 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 if (error != 0) continue; - error = umtxq_check_susp(td, false); + error = thread_check_susp(td, false); if (error != 0) break; } @@ -2063,7 +2021,7 @@ usrloop: if (error == -1) return (EFAULT); if (error == 1) { - error = umtxq_check_susp(td, true); + error = thread_check_susp(td, true); if (error != 0) return (error); goto usrloop; @@ -2150,7 +2108,7 @@ usrloop: again: error = casueword32(&m->m_owner, owner, &old, new_owner); if (error == 1) { - error = umtxq_check_susp(td, false); + error = thread_check_susp(td, false); if (error == 0) goto again; } @@ -2255,7 +2213,7 @@ do_lock_pp(struct thread *td, struct umutex *m, uint32 * error to not skip the last loop iteration. */ if (error == 0) { - error = umtxq_check_susp(td, false); + error = thread_check_susp(td, false); if (error == 0) { if (try != 0) error = EBUSY; @@ -2770,7 +2728,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock umtx_key_release(&uq->uq_key); return (0); } - error = umtxq_check_susp(td, true); + error = thread_check_susp(td, true); if (error != 0) break; state = oldstate; @@ -2806,7 +2764,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock goto sleep; } state = oldstate; - error = umtxq_check_susp(td, false); + error = thread_check_susp(td, false); if (error != 0) break; } @@ -2818,7 +2776,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock /* state is changed while setting flags, restart */ if (!(state & wrflags)) { umtxq_unbusy_unlocked(&uq->uq_key); - error = umtxq_check_susp(td, true); + error = thread_check_susp(td, true); if (error != 0) break; continue; @@ -2886,7 +2844,7 @@ sleep: break; } state = oldstate; - error1 = umtxq_check_susp(td, false); + error1 = thread_check_susp(td, false); if (error1 != 0) { if (error == 0) error = error1; @@ -2948,7 +2906,7 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock return (0); } state = oldstate; - error = umtxq_check_susp(td, true); + error = thread_check_susp(td, true); if (error != 0) break; } @@ -2995,7 +2953,7 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock goto sleep; } state = oldstate; - error = umtxq_check_susp(td, false); + error = thread_check_susp(td, false); if (error != 0) break; } @@ -3007,7 +2965,7 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock if ((state & URWLOCK_WRITE_OWNER) == 0 && URWLOCK_READER_COUNT(state) == 0) { umtxq_unbusy_unlocked(&uq->uq_key); - error = umtxq_check_susp(td, false); + error = thread_check_susp(td, false); if (error != 0) break; continue; @@ -3070,7 +3028,7 @@ sleep: break; } state = oldstate; - error1 = umtxq_check_susp(td, false); + error1 = thread_check_susp(td, false); /* * We are leaving the URWLOCK_WRITE_WAITERS * behind, but this should not harm the @@ -3136,7 +3094,7 @@ do_rw_unlock(struct thread *td, struct urwlock *rwlock error = EPERM; goto out; } - error = umtxq_check_susp(td, true); + error = thread_check_susp(td, true); if (error != 0) goto out; } else @@ -3156,7 +3114,7 @@ do_rw_unlock(struct thread *td, struct urwlock *rwlock error = EPERM; goto out; } - error = umtxq_check_susp(td, true); + error = thread_check_susp(td, true); if (error != 0) goto out; } else @@ -3234,7 +3192,7 @@ again: umtxq_remove(uq); umtxq_unlock(&uq->uq_key); if (rv == 1) { - rv = umtxq_check_susp(td, true); + rv = thread_check_susp(td, true); if (rv == 0) goto again; error = rv; @@ -3356,7 +3314,7 @@ again: umtx_key_release(&uq->uq_key); if (rv == -1) return (EFAULT); - rv = umtxq_check_susp(td, true); + rv = thread_check_susp(td, true); if (rv != 0) return (rv); goto again; @@ -3416,7 +3374,7 @@ do_sem2_wake(struct thread *td, struct _usem2 *sem) rv = casueword32(&sem->_count, count, &count, count & ~USEM_HAS_WAITERS); if (rv == 1) { - rv = umtxq_check_susp(td, true); + rv = thread_check_susp(td, true); if (rv != 0) break; } Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Thu Jan 2 22:07:03 2020 (r356292) +++ head/sys/sys/proc.h Thu Jan 2 22:13:59 2020 (r356293) @@ -1144,6 +1144,7 @@ void cpu_thread_swapin(struct thread *); void cpu_thread_swapout(struct thread *); struct thread *thread_alloc(int pages); int thread_alloc_stack(struct thread *, int pages); +int thread_check_susp(struct thread *td, bool sleep); void thread_cow_get_proc(struct thread *newtd, struct proc *p); void thread_cow_get(struct thread *newtd, struct thread *td); void thread_cow_free(struct thread *td); From owner-svn-src-head@freebsd.org Thu Jan 2 22:14:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A0431DC7D7; Thu, 2 Jan 2020 22:14:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pj5135tCz42Dh; Thu, 2 Jan 2020 22:14:45 +0000 (UTC) (envelope-from ian@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64BBC223FE; Thu, 2 Jan 2020 22:14:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002MEjqE004441; Thu, 2 Jan 2020 22:14:45 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002MEj3l004440; Thu, 2 Jan 2020 22:14:45 GMT (envelope-from ian@FreeBSD.org) Message-Id: <202001022214.002MEj3l004440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 2 Jan 2020 22:14:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356294 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 356294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 22:14:45 -0000 Author: ian Date: Thu Jan 2 22:14:44 2020 New Revision: 356294 URL: https://svnweb.freebsd.org/changeset/base/356294 Log: Explicitly include sys/rman.h instead of relying on getting it via some other header. Modified: head/sys/dev/flash/cqspi.c Modified: head/sys/dev/flash/cqspi.c ============================================================================== --- head/sys/dev/flash/cqspi.c Thu Jan 2 22:13:59 2020 (r356293) +++ head/sys/dev/flash/cqspi.c Thu Jan 2 22:14:44 2020 (r356294) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-svn-src-head@freebsd.org Thu Jan 2 22:26:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 568641DCD3C; Thu, 2 Jan 2020 22:26:55 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pjM31jF3z432K; Thu, 2 Jan 2020 22:26:55 +0000 (UTC) (envelope-from ian@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 357A3225F9; Thu, 2 Jan 2020 22:26:55 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002MQtQA010783; Thu, 2 Jan 2020 22:26:55 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002MQs0o010781; Thu, 2 Jan 2020 22:26:54 GMT (envelope-from ian@FreeBSD.org) Message-Id: <202001022226.002MQs0o010781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 2 Jan 2020 22:26:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356295 - in head/sys: arm/conf arm64/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: arm/conf arm64/conf X-SVN-Commit-Revision: 356295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 22:26:55 -0000 Author: ian Date: Thu Jan 2 22:26:54 2020 New Revision: 356295 URL: https://svnweb.freebsd.org/changeset/base/356295 Log: Add the xdma framework and pl330 dma drivers to arm and arm64 lint builds. Modified: head/sys/arm/conf/NOTES head/sys/arm64/conf/NOTES Modified: head/sys/arm/conf/NOTES ============================================================================== --- head/sys/arm/conf/NOTES Thu Jan 2 22:14:44 2020 (r356294) +++ head/sys/arm/conf/NOTES Thu Jan 2 22:26:54 2020 (r356295) @@ -28,3 +28,7 @@ nodevice mps # Add devices which are specific to various arm platforms... device twsi # i2c controller on Marvel and Allwinner + +device pl330 # ARM PL330 dma controller +device xdma # xDMA framework for SoC on-chip dma controllers + Modified: head/sys/arm64/conf/NOTES ============================================================================== --- head/sys/arm64/conf/NOTES Thu Jan 2 22:14:44 2020 (r356294) +++ head/sys/arm64/conf/NOTES Thu Jan 2 22:26:54 2020 (r356295) @@ -189,6 +189,10 @@ device regulator device syscon device aw_syscon +# Misc devices. +device pl330 # ARM PL330 dma controller +device xdma # xDMA framework for SoC on-chip dma controllers + # Chip-specific errata options THUNDERX_PASS_1_1_ERRATA From owner-svn-src-head@freebsd.org Thu Jan 2 22:37:06 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B7D71DD345; Thu, 2 Jan 2020 22:37:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pjZn6XfZz43nv; Thu, 2 Jan 2020 22:37:05 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBACD227F2; Thu, 2 Jan 2020 22:37:05 +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 002Mb59B016784; Thu, 2 Jan 2020 22:37:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002Mb5NG016780; Thu, 2 Jan 2020 22:37:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202001022237.002Mb5NG016780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 2 Jan 2020 22:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356296 - in head/sys/amd64: include vmm vmm/io X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/amd64: include vmm vmm/io X-SVN-Commit-Revision: 356296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 22:37:06 -0000 Author: kib Date: Thu Jan 2 22:37:04 2020 New Revision: 356296 URL: https://svnweb.freebsd.org/changeset/base/356296 Log: bhyve: terminate waiting loops if thread suspension is requested. PR: 242724 Reviewed by: markj Reported and tested by: Aleksandr Fedorov (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22881 Modified: head/sys/amd64/include/vmm.h head/sys/amd64/vmm/io/vioapic.c head/sys/amd64/vmm/vmm.c head/sys/amd64/vmm/vmm_dev.c Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Thu Jan 2 22:26:54 2020 (r356295) +++ head/sys/amd64/include/vmm.h Thu Jan 2 22:37:04 2020 (r356296) @@ -289,7 +289,7 @@ void vm_exit_reqidle(struct vm *vm, int vcpuid, uint64 * forward progress when the rendezvous is in progress. */ typedef void (*vm_rendezvous_func_t)(struct vm *vm, int vcpuid, void *arg); -void vm_smp_rendezvous(struct vm *vm, int vcpuid, cpuset_t dest, +int vm_smp_rendezvous(struct vm *vm, int vcpuid, cpuset_t dest, vm_rendezvous_func_t func, void *arg); cpuset_t vm_active_cpus(struct vm *vm); cpuset_t vm_debug_cpus(struct vm *vm); Modified: head/sys/amd64/vmm/io/vioapic.c ============================================================================== --- head/sys/amd64/vmm/io/vioapic.c Thu Jan 2 22:26:54 2020 (r356295) +++ head/sys/amd64/vmm/io/vioapic.c Thu Jan 2 22:37:04 2020 (r356296) @@ -353,7 +353,7 @@ vioapic_write(struct vioapic *vioapic, int vcpuid, uin "vlapic trigger-mode register", pin); VIOAPIC_UNLOCK(vioapic); allvcpus = vm_active_cpus(vioapic->vm); - vm_smp_rendezvous(vioapic->vm, vcpuid, allvcpus, + (void)vm_smp_rendezvous(vioapic->vm, vcpuid, allvcpus, vioapic_update_tmr, NULL); VIOAPIC_LOCK(vioapic); } Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Thu Jan 2 22:26:54 2020 (r356295) +++ head/sys/amd64/vmm/vmm.c Thu Jan 2 22:37:04 2020 (r356296) @@ -1243,13 +1243,17 @@ vcpu_require_state_locked(struct vm *vm, int vcpuid, e VM_CTR0(vm, fmt); \ } while (0) -static void +static int vm_handle_rendezvous(struct vm *vm, int vcpuid) { + struct thread *td; + int error; KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < vm->maxcpus), ("vm_handle_rendezvous: invalid vcpuid %d", vcpuid)); + error = 0; + td = curthread; mtx_lock(&vm->rendezvous_mtx); while (vm->rendezvous_func != NULL) { /* 'rendezvous_req_cpus' must be a subset of 'active_cpus' */ @@ -1271,9 +1275,17 @@ vm_handle_rendezvous(struct vm *vm, int vcpuid) } RENDEZVOUS_CTR0(vm, vcpuid, "Wait for rendezvous completion"); mtx_sleep(&vm->rendezvous_func, &vm->rendezvous_mtx, 0, - "vmrndv", 0); + "vmrndv", hz); + if ((td->td_flags & TDF_NEEDSUSPCHK) != 0) { + mtx_unlock(&vm->rendezvous_mtx); + error = thread_check_susp(td, true); + if (error != 0) + return (error); + mtx_lock(&vm->rendezvous_mtx); + } } mtx_unlock(&vm->rendezvous_mtx); + return (0); } /* @@ -1284,13 +1296,16 @@ vm_handle_hlt(struct vm *vm, int vcpuid, bool intr_dis { struct vcpu *vcpu; const char *wmesg; - int t, vcpu_halted, vm_halted; + struct thread *td; + int error, t, vcpu_halted, vm_halted; KASSERT(!CPU_ISSET(vcpuid, &vm->halted_cpus), ("vcpu already halted")); vcpu = &vm->vcpu[vcpuid]; vcpu_halted = 0; vm_halted = 0; + error = 0; + td = curthread; vcpu_lock(vcpu); while (1) { @@ -1351,6 +1366,13 @@ vm_handle_hlt(struct vm *vm, int vcpuid, bool intr_dis msleep_spin(vcpu, &vcpu->mtx, wmesg, hz); vcpu_require_state_locked(vm, vcpuid, VCPU_FROZEN); vmm_stat_incr(vm, vcpuid, VCPU_IDLE_TICKS, ticks - t); + if ((td->td_flags & TDF_NEEDSUSPCHK) != 0) { + vcpu_unlock(vcpu); + error = thread_check_susp(td, false); + if (error != 0) + return (error); + vcpu_lock(vcpu); + } } if (vcpu_halted) @@ -1487,11 +1509,13 @@ vm_handle_inst_emul(struct vm *vm, int vcpuid, bool *r static int vm_handle_suspend(struct vm *vm, int vcpuid, bool *retu) { - int i, done; + int error, i; struct vcpu *vcpu; + struct thread *td; - done = 0; + error = 0; vcpu = &vm->vcpu[vcpuid]; + td = curthread; CPU_SET_ATOMIC(vcpuid, &vm->suspended_cpus); @@ -1503,7 +1527,7 @@ vm_handle_suspend(struct vm *vm, int vcpuid, bool *ret * handler while we are waiting to prevent a deadlock. */ vcpu_lock(vcpu); - while (1) { + while (error == 0) { if (CPU_CMP(&vm->suspended_cpus, &vm->active_cpus) == 0) { VCPU_CTR0(vm, vcpuid, "All vcpus suspended"); break; @@ -1514,10 +1538,15 @@ vm_handle_suspend(struct vm *vm, int vcpuid, bool *ret vcpu_require_state_locked(vm, vcpuid, VCPU_SLEEPING); msleep_spin(vcpu, &vcpu->mtx, "vmsusp", hz); vcpu_require_state_locked(vm, vcpuid, VCPU_FROZEN); + if ((td->td_flags & TDF_NEEDSUSPCHK) != 0) { + vcpu_unlock(vcpu); + error = thread_check_susp(td, false); + vcpu_lock(vcpu); + } } else { VCPU_CTR0(vm, vcpuid, "Rendezvous during suspend"); vcpu_unlock(vcpu); - vm_handle_rendezvous(vm, vcpuid); + error = vm_handle_rendezvous(vm, vcpuid); vcpu_lock(vcpu); } } @@ -1533,7 +1562,7 @@ vm_handle_suspend(struct vm *vm, int vcpuid, bool *ret } *retu = true; - return (0); + return (error); } static int @@ -1707,8 +1736,7 @@ restart: vme->u.ioapic_eoi.vector); break; case VM_EXITCODE_RENDEZVOUS: - vm_handle_rendezvous(vm, vcpuid); - error = 0; + error = vm_handle_rendezvous(vm, vcpuid); break; case VM_EXITCODE_HLT: intr_disabled = ((vme->u.hlt.rflags & PSL_I) == 0); @@ -2486,11 +2514,11 @@ vm_apicid2vcpuid(struct vm *vm, int apicid) return (apicid); } -void +int vm_smp_rendezvous(struct vm *vm, int vcpuid, cpuset_t dest, vm_rendezvous_func_t func, void *arg) { - int i; + int error, i; /* * Enforce that this function is called without any locks @@ -2509,7 +2537,9 @@ restart: */ RENDEZVOUS_CTR0(vm, vcpuid, "Rendezvous already in progress"); mtx_unlock(&vm->rendezvous_mtx); - vm_handle_rendezvous(vm, vcpuid); + error = vm_handle_rendezvous(vm, vcpuid); + if (error != 0) + return (error); goto restart; } KASSERT(vm->rendezvous_func == NULL, ("vm_smp_rendezvous: previous " @@ -2531,7 +2561,7 @@ restart: vcpu_notify_event(vm, i, false); } - vm_handle_rendezvous(vm, vcpuid); + return (vm_handle_rendezvous(vm, vcpuid)); } struct vatpic * Modified: head/sys/amd64/vmm/vmm_dev.c ============================================================================== --- head/sys/amd64/vmm/vmm_dev.c Thu Jan 2 22:26:54 2020 (r356295) +++ head/sys/amd64/vmm/vmm_dev.c Thu Jan 2 22:37:04 2020 (r356296) @@ -795,8 +795,12 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da vcpu_unlock_all(sc); done: - /* Make sure that no handler returns a bogus value like ERESTART */ - KASSERT(error >= 0, ("vmmdev_ioctl: invalid error return %d", error)); + /* + * Make sure that no handler returns a kernel-internal + * error value to userspace. + */ + KASSERT(error == ERESTART || error >= 0, + ("vmmdev_ioctl: invalid error return %d", error)); return (error); } From owner-svn-src-head@freebsd.org Thu Jan 2 22:48:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 646321DDA67; Thu, 2 Jan 2020 22:48:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pjqY22lFz44wv; Thu, 2 Jan 2020 22:48:09 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 408EE229EA; Thu, 2 Jan 2020 22:48:09 +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 002Mm9BK022702; Thu, 2 Jan 2020 22:48:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002Mm9Ir022701; Thu, 2 Jan 2020 22:48:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202001022248.002Mm9Ir022701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 2 Jan 2020 22:48:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356300 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 356300 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 22:48:09 -0000 Author: kib Date: Thu Jan 2 22:48:08 2020 New Revision: 356300 URL: https://svnweb.freebsd.org/changeset/base/356300 Log: Fix AT_EXECPATH for direct exec mode. When activated in direct exec mode, kernel-provided AT_EXECPATH points to the interpreter. We need to recalculate auxv to point to the string with the path to the executable which is actually executed. The somewhat problematic case is when the executable path is relative and either $PATH use is not enabled or it contains '/' so $PATH search is not performed. In this case resulting AT_EXECPATH is relative, I might fix this later. Reported and reviewed by: rstone Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22894 Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Thu Jan 2 22:47:10 2020 (r356299) +++ head/libexec/rtld-elf/rtld.c Thu Jan 2 22:48:08 2020 (r356300) @@ -134,7 +134,8 @@ static void objlist_push_head(Objlist *, Obj_Entry *); static void objlist_push_tail(Objlist *, Obj_Entry *); static void objlist_put_after(Objlist *, Obj_Entry *, Obj_Entry *); static void objlist_remove(Objlist *, Obj_Entry *); -static int open_binary_fd(const char *argv0, bool search_in_path); +static int open_binary_fd(const char *argv0, bool search_in_path, + const char **binpath_res); static int parse_args(char* argv[], int argc, bool *use_pathp, int *fdp); static int parse_integer(const char *); static void *path_enumerate(const char *, path_enum_proc, const char *, void *); @@ -378,7 +379,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr struct stat st; Elf_Addr *argcp; char **argv, **env, **envp, *kexecpath, *library_path_rpath; - const char *argv0; + const char *argv0, *binpath; caddr_t imgentry; char buf[MAXPATHLEN]; int argc, fd, i, phnum, rtld_argc; @@ -464,8 +465,9 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr rtld_argc = parse_args(argv, argc, &search_in_path, &fd); argv0 = argv[rtld_argc]; explicit_fd = (fd != -1); + binpath = NULL; if (!explicit_fd) - fd = open_binary_fd(argv0, search_in_path); + fd = open_binary_fd(argv0, search_in_path, &binpath); if (fstat(fd, &st) == -1) { _rtld_error("Failed to fstat FD %d (%s): %s", fd, explicit_fd ? "user-provided descriptor" : argv0, @@ -518,6 +520,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr } while (*envp != NULL); aux = auxp = (Elf_Auxinfo *)envp; auxpf = (Elf_Auxinfo *)(envp + rtld_argc); + /* XXXKIB insert place for AT_EXECPATH if not present */ for (;; auxp++, auxpf++) { *auxp = *auxpf; if (auxp->a_type == AT_NULL) @@ -530,6 +533,18 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr if (auxp->a_type < AT_COUNT) aux_info[auxp->a_type] = auxp; } + + /* Point AT_EXECPATH auxv and aux_info to the binary path. */ + if (binpath == NULL) { + aux_info[AT_EXECPATH] = NULL; + } else { + if (aux_info[AT_EXECPATH] == NULL) { + aux_info[AT_EXECPATH] = xmalloc(sizeof(Elf_Auxinfo)); + aux_info[AT_EXECPATH]->a_type = AT_EXECPATH; + } + aux_info[AT_EXECPATH]->a_un.a_ptr = __DECONST(void *, + binpath); + } } else { _rtld_error("No binary"); rtld_die(); @@ -5494,12 +5509,14 @@ symlook_init_from_req(SymLook *dst, const SymLook *src } static int -open_binary_fd(const char *argv0, bool search_in_path) +open_binary_fd(const char *argv0, bool search_in_path, + const char **binpath_res) { - char *pathenv, *pe, binpath[PATH_MAX]; + char *pathenv, *pe, *binpath; int fd; if (search_in_path && strchr(argv0, '/') == NULL) { + binpath = xmalloc(PATH_MAX); pathenv = getenv("PATH"); if (pathenv == NULL) { _rtld_error("-p and no PATH environment variable"); @@ -5524,13 +5541,17 @@ open_binary_fd(const char *argv0, bool search_in_path) sizeof(binpath)) continue; fd = open(binpath, O_RDONLY | O_CLOEXEC | O_VERIFY); - if (fd != -1 || errno != ENOENT) + if (fd != -1 || errno != ENOENT) { + *binpath_res = binpath; break; + } } free(pathenv); } else { fd = open(argv0, O_RDONLY | O_CLOEXEC | O_VERIFY); + *binpath_res = argv0; } + /* XXXKIB Use getcwd() to resolve relative binpath to absolute. */ if (fd == -1) { _rtld_error("Cannot open %s: %s", argv0, rtld_strerror(errno)); From owner-svn-src-head@freebsd.org Thu Jan 2 22:52:32 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87F961DDD08; Thu, 2 Jan 2020 22:52:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pjwc3476z45Nk; Thu, 2 Jan 2020 22:52:32 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6486D22BAB; Thu, 2 Jan 2020 22:52:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002MqW7Y028557; Thu, 2 Jan 2020 22:52:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002MqWKg028556; Thu, 2 Jan 2020 22:52:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001022252.002MqWKg028556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 2 Jan 2020 22:52:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356301 - head/sys/dev/cfe X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/cfe X-SVN-Commit-Revision: 356301 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 22:52:32 -0000 Author: kevans Date: Thu Jan 2 22:52:31 2020 New Revision: 356301 URL: https://svnweb.freebsd.org/changeset/base/356301 Log: sys/dev/cfi: include sys/types.h as well This will soon be a dependency for machine/atomic.h on mips with the introduction of 64-bit atomics; the scope here is pretty narrow, so throw it here in the header just before systm.h, which includes machine/atomic.h Modified: head/sys/dev/cfe/cfe_api.h Modified: head/sys/dev/cfe/cfe_api.h ============================================================================== --- head/sys/dev/cfe/cfe_api.h Thu Jan 2 22:48:08 2020 (r356300) +++ head/sys/dev/cfe/cfe_api.h Thu Jan 2 22:52:31 2020 (r356301) @@ -63,6 +63,7 @@ * CFE_API_* can be defined here as desired. */ /* Begin customization. */ +#include #include /* All of the typedefs. */ #include /* strlen() prototype. */ From owner-svn-src-head@freebsd.org Thu Jan 2 23:00:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 923591DDFAB; Thu, 2 Jan 2020 23:00:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pk6F3PSXz45rd; Thu, 2 Jan 2020 23:00:53 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FD5C22CFE; Thu, 2 Jan 2020 23:00:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002N0rYZ032419; Thu, 2 Jan 2020 23:00:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002N0rZF032418; Thu, 2 Jan 2020 23:00:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001022300.002N0rZF032418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 2 Jan 2020 23:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356303 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 356303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 23:00:53 -0000 Author: kevans Date: Thu Jan 2 23:00:52 2020 New Revision: 356303 URL: https://svnweb.freebsd.org/changeset/base/356303 Log: iicoc: limit fdt attachment to EXT_RESOURCES platforms The fdt attachment for this heavily relies on extres for clk work. This unbreaks the build for mips XLPN32/XLP, which have pci/fdt but no need for this fdt attachment. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Jan 2 22:57:21 2020 (r356302) +++ head/sys/conf/files Thu Jan 2 23:00:52 2020 (r356303) @@ -1797,7 +1797,7 @@ dev/iicbus/iiconf.c optional iicbus dev/iicbus/iicsmb.c optional iicsmb \ dependency "iicbus_if.h" dev/iicbus/iicoc.c optional iicoc -dev/iicbus/iicoc_fdt.c optional iicoc fdt +dev/iicbus/iicoc_fdt.c optional iicoc ext_resources fdt dev/iicbus/iicoc_pci.c optional iicoc pci dev/iicbus/isl12xx.c optional isl12xx dev/iicbus/lm75.c optional lm75 From owner-svn-src-head@freebsd.org Thu Jan 2 23:07:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32F231DE31B; Thu, 2 Jan 2020 23:07:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pkGB0dWTz46b1; Thu, 2 Jan 2020 23:07:46 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C73E22D97; Thu, 2 Jan 2020 23:07:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002N7jFM035160; Thu, 2 Jan 2020 23:07:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002N7jDn035157; Thu, 2 Jan 2020 23:07:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001022307.002N7jDn035157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 2 Jan 2020 23:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356305 - head/lib/libcapsicum X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libcapsicum X-SVN-Commit-Revision: 356305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 23:07:46 -0000 Author: kevans Date: Thu Jan 2 23:07:45 2020 New Revision: 356305 URL: https://svnweb.freebsd.org/changeset/base/356305 Log: capsicum_helpers: split stream cap bits out of caph_limit_stream() The goal here is to make it so applications can take the rights one would normally get by calling caph_limit_stream() on a descriptor and build on them as needed. The tentatively planned use-case is an application that takes a socket and hooks it up to std{err,out,in} for a fork()d child. It may be feasible to apply limitations to such descriptors as long as it's a superset of those normally applied to stdio. Reviewed by: markj, oshobo (prior version; sans manpage addition) Differential Revision: https://reviews.freebsd.org/D22993 Modified: head/lib/libcapsicum/Makefile head/lib/libcapsicum/capsicum_helpers.3 head/lib/libcapsicum/capsicum_helpers.h Modified: head/lib/libcapsicum/Makefile ============================================================================== --- head/lib/libcapsicum/Makefile Thu Jan 2 23:05:48 2020 (r356304) +++ head/lib/libcapsicum/Makefile Thu Jan 2 23:07:45 2020 (r356305) @@ -6,6 +6,7 @@ MAN+= capsicum_helpers.3 MLINKS+=capsicum_helpers.3 caph_enter.3 MLINKS+=capsicum_helpers.3 caph_enter_casper.3 +MLINKS+=capsicum_helpers.3 caph_stream_rights.3 MLINKS+=capsicum_helpers.3 caph_rights_limit.3 MLINKS+=capsicum_helpers.3 caph_fcntls_limit.3 MLINKS+=capsicum_helpers.3 caph_ioctls_limit.3 Modified: head/lib/libcapsicum/capsicum_helpers.3 ============================================================================== --- head/lib/libcapsicum/capsicum_helpers.3 Thu Jan 2 23:05:48 2020 (r356304) +++ head/lib/libcapsicum/capsicum_helpers.3 Thu Jan 2 23:07:45 2020 (r356305) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2019 +.Dd January 2, 2020 .Dt CAPSICUM_HELPERS 3 .Os .Sh NAME @@ -33,6 +33,7 @@ .Nm caph_limit_stderr , .Nm caph_limit_stdout , .Nm caph_limit_stdio , +.Nm caph_stream_rights , .Nm caph_cache_tzdata , .Nm caph_cache_catpages , .Nm caph_enter , @@ -50,7 +51,7 @@ .Ft int .Fn caph_enter_casper "void" .Ft int -.Fn caph_rights_limit "int fd" "const cap_righst_t *rights" +.Fn caph_rights_limit "int fd" "const cap_rights_t *rights" .Ft int .Fn caph_ioctls_limit "int fd" "const unsigned long *cmds" "size_t ncmds" .Ft int @@ -66,6 +67,8 @@ .Ft int .Fn caph_limit_stdio "void" .Ft void +.Fn caph_stream_rights "cap_rights_t *" "int flags" +.Ft void .Fn caph_cache_tzdata "void" .Ft void .Fn caph_cache_catpages "void" @@ -128,6 +131,14 @@ function. .Pp .Fn caph_limit_stdio limits stdin, stderr and stdout. +.Pp +.Nm caph_stream_rights +may be used to initialize +.Fa rights +with the same rights that a stream would be limited to, as if +.Fn caph_limit_stream +had been invoked using the same +.Fa flags . .Pp .Fn caph_cache_tzdata precaches all timezone data needed to use Modified: head/lib/libcapsicum/capsicum_helpers.h ============================================================================== --- head/lib/libcapsicum/capsicum_helpers.h Thu Jan 2 23:05:48 2020 (r356304) +++ head/lib/libcapsicum/capsicum_helpers.h Thu Jan 2 23:07:45 2020 (r356305) @@ -48,32 +48,42 @@ __BEGIN_DECLS -static __inline int -caph_limit_stream(int fd, int flags) +static const unsigned long caph_stream_cmds[] = + { TIOCGETA, TIOCGWINSZ, FIODTYPE }; +static const uint32_t caph_stream_fcntls = CAP_FCNTL_GETFL; + +static __inline void +caph_stream_rights(cap_rights_t *rights, int flags) { - cap_rights_t rights; - unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ, FIODTYPE }; - cap_rights_init(&rights, CAP_EVENT, CAP_FCNTL, CAP_FSTAT, + cap_rights_init(rights, CAP_EVENT, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL, CAP_SEEK); if ((flags & CAPH_READ) != 0) - cap_rights_set(&rights, CAP_READ); + cap_rights_set(rights, CAP_READ); if ((flags & CAPH_WRITE) != 0) - cap_rights_set(&rights, CAP_WRITE); + cap_rights_set(rights, CAP_WRITE); if ((flags & CAPH_LOOKUP) != 0) - cap_rights_set(&rights, CAP_LOOKUP); + cap_rights_set(rights, CAP_LOOKUP); +} +static __inline int +caph_limit_stream(int fd, int flags) +{ + cap_rights_t rights; + + caph_stream_rights(&rights, flags); if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) { if (errno == EBADF && (flags & CAPH_IGNORE_EBADF) != 0) return (0); return (-1); } - if (cap_ioctls_limit(fd, cmds, nitems(cmds)) < 0 && errno != ENOSYS) + if (cap_ioctls_limit(fd, caph_stream_cmds, + nitems(caph_stream_cmds)) < 0 && errno != ENOSYS) return (-1); - if (cap_fcntls_limit(fd, CAP_FCNTL_GETFL) < 0 && errno != ENOSYS) + if (cap_fcntls_limit(fd, caph_stream_fcntls) < 0 && errno != ENOSYS) return (-1); return (0); From owner-svn-src-head@freebsd.org Thu Jan 2 23:20:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CD041DE796; Thu, 2 Jan 2020 23:20:40 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pkY36Hhcz47Hj; Thu, 2 Jan 2020 23:20:39 +0000 (UTC) (envelope-from bdragon@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAF4B22FC8; Thu, 2 Jan 2020 23:20:39 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002NKdbA041444; Thu, 2 Jan 2020 23:20:39 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002NKcio041437; Thu, 2 Jan 2020 23:20:38 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <202001022320.002NKcio041437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Thu, 2 Jan 2020 23:20:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356308 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys conf kern mips/include powerpc/include sys X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys conf kern mips/include powerpc/include sys X-SVN-Commit-Revision: 356308 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 23:20:40 -0000 Author: bdragon Date: Thu Jan 2 23:20:37 2020 New Revision: 356308 URL: https://svnweb.freebsd.org/changeset/base/356308 Log: [PowerPC] [MIPS] Implement 32-bit kernel emulation of atomic64 operations This is a lock-based emulation of 64-bit atomics for kernel use, split off from an earlier patch by jhibbits. This is needed to unblock future improvements that reduce the need for locking on 64-bit platforms by using atomic updates. The implementation allows for future integration with userland atomic64, but as that implies going through sysarch for every use, the current status quo of userland doing its own locking may be for the best. Submitted by: jhibbits (original patch), kevans (mips bits) Reviewed by: jhibbits, jeff, kevans Differential Revision: https://reviews.freebsd.org/D22976 Added: head/sys/kern/subr_atomic64.c (contents, props changed) head/sys/sys/_atomic64e.h (contents, props changed) Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c head/sys/cddl/compat/opensolaris/sys/atomic.h head/sys/conf/files.mips head/sys/conf/files.powerpc head/sys/mips/include/atomic.h head/sys/powerpc/include/atomic.h Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Thu Jan 2 23:18:43 2020 (r356307) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Thu Jan 2 23:20:37 2020 (r356308) @@ -33,7 +33,8 @@ __FBSDID("$FreeBSD$"); #include #if !defined(__LP64__) && !defined(__mips_n32) && \ - !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) + !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) && \ + !defined(HAS_EMULATED_ATOMIC64) #ifdef _KERNEL #include Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/atomic.h Thu Jan 2 23:18:43 2020 (r356307) +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Thu Jan 2 23:20:37 2020 (r356308) @@ -42,7 +42,8 @@ #endif #if !defined(__LP64__) && !defined(__mips_n32) && \ - !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) + !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) && \ + !defined(HAS_EMULATED_ATOMIC64) extern void atomic_add_64(volatile uint64_t *target, int64_t delta); extern void atomic_dec_64(volatile uint64_t *target); extern uint64_t atomic_swap_64(volatile uint64_t *a, uint64_t value); @@ -109,7 +110,8 @@ atomic_cas_32(volatile uint32_t *target, uint32_t cmp, #endif #if defined(__LP64__) || defined(__mips_n32) || \ - defined(ARM_HAVE_ATOMIC64) || defined(I386_HAVE_ATOMIC64) + defined(ARM_HAVE_ATOMIC64) || defined(I386_HAVE_ATOMIC64) || \ + defined(HAS_EMULATED_ATOMIC64) static __inline void atomic_dec_64(volatile uint64_t *target) { Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Thu Jan 2 23:18:43 2020 (r356307) +++ head/sys/conf/files.mips Thu Jan 2 23:20:37 2020 (r356308) @@ -50,6 +50,7 @@ mips/mips/vm_machdep.c standard # misc opt-in bits kern/kern_clocksource.c standard kern/link_elf_obj.c standard +kern/subr_atomic64.c optional mips | mipsel | mipshf | mipselhf kern/subr_busdma_bufalloc.c standard kern/subr_dummy_vdso_tc.c standard kern/subr_sfbuf.c optional mips | mipsel | mipsn32 Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Thu Jan 2 23:18:43 2020 (r356307) +++ head/sys/conf/files.powerpc Thu Jan 2 23:20:37 2020 (r356308) @@ -76,6 +76,7 @@ dev/uart/uart_cpu_powerpc.c optional uart dev/usb/controller/ehci_fsl.c optional ehci mpc85xx dev/vt/hw/ofwfb/ofwfb.c optional vt aim kern/kern_clocksource.c standard +kern/subr_atomic64.c optional powerpc | powerpcspe kern/subr_dummy_vdso_tc.c standard kern/syscalls.c optional ktr kern/subr_sfbuf.c standard Added: head/sys/kern/subr_atomic64.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/subr_atomic64.c Thu Jan 2 23:20:37 2020 (r356308) @@ -0,0 +1,140 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Justin Hibbits + * + * 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$ + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +enum { + ATOMIC64_ADD, + ATOMIC64_CLEAR, + ATOMIC64_CMPSET, + ATOMIC64_FCMPSET, + ATOMIC64_FETCHADD, + ATOMIC64_LOAD, + ATOMIC64_SET, + ATOMIC64_SUBTRACT, + ATOMIC64_STORE, + ATOMIC64_SWAP +}; + +#ifdef _KERNEL +#define A64_POOL_SIZE MAXCPU +/* Estimated size of a cacheline */ +#define CACHE_ALIGN CACHE_LINE_SIZE + +#define GET_MUTEX(p) \ + (&a64_mtx_pool[(pmap_kextract((vm_offset_t)p) / CACHE_ALIGN) % (A64_POOL_SIZE)]) + +#define LOCK_A64() \ + struct mtx *_amtx = GET_MUTEX(p); \ + if (smp_started) mtx_lock(_amtx) + +#define UNLOCK_A64() if (smp_started) mtx_unlock(_amtx) + +#define ATOMIC64_EMU_UN(op, rt, block, ret) \ + rt \ + atomic_##op##_64(volatile u_int64_t *p) { \ + u_int64_t tmp __unused; \ + LOCK_A64(); \ + block; \ + UNLOCK_A64(); \ + ret; } struct hack + +#define ATOMIC64_EMU_BIN(op, rt, block, ret) \ + rt \ + atomic_##op##_64(volatile u_int64_t *p, u_int64_t v) { \ + u_int64_t tmp __unused; \ + LOCK_A64(); \ + block; \ + UNLOCK_A64(); \ + ret; } struct hack + +static struct mtx a64_mtx_pool[A64_POOL_SIZE]; + +ATOMIC64_EMU_BIN(add, void, (*p = *p + v), return); +ATOMIC64_EMU_BIN(clear, void, *p &= ~v, return); +ATOMIC64_EMU_BIN(fetchadd, u_int64_t, (*p = *p + v, v = *p - v), return (v)); +ATOMIC64_EMU_UN(load, u_int64_t, (tmp = *p), return (tmp)); +ATOMIC64_EMU_BIN(set, void, *p |= v, return); +ATOMIC64_EMU_BIN(subtract, void, (*p = *p - v), return); +ATOMIC64_EMU_BIN(store, void, *p = v, return); +ATOMIC64_EMU_BIN(swap, u_int64_t, tmp = *p; *p = v; v = tmp, return(v)); + +int atomic_cmpset_64(volatile u_int64_t *p, u_int64_t old, u_int64_t new) +{ + u_int64_t tmp; + + LOCK_A64(); + tmp = *p; + if (tmp == old) + *p = new; + UNLOCK_A64(); + + return (tmp == old); +} + +int atomic_fcmpset_64(volatile u_int64_t *p, u_int64_t *old, u_int64_t new) +{ + u_int64_t tmp, tmp_old; + + LOCK_A64(); + tmp = *p; + tmp_old = *old; + if (tmp == tmp_old) + *p = new; + else + *old = tmp; + UNLOCK_A64(); + + return (tmp == tmp_old); +} + +static void +atomic64_mtxinit(void *x __unused) +{ + int i; + + for (i = 0; i < A64_POOL_SIZE; i++) + mtx_init(&a64_mtx_pool[i], "atomic64 mutex", NULL, MTX_DEF); +} + +SYSINIT(atomic64_mtxinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, atomic64_mtxinit, NULL); + +#endif /* _KERNEL */ Modified: head/sys/mips/include/atomic.h ============================================================================== --- head/sys/mips/include/atomic.h Thu Jan 2 23:18:43 2020 (r356307) +++ head/sys/mips/include/atomic.h Thu Jan 2 23:20:37 2020 (r356308) @@ -38,6 +38,10 @@ #include +#if !defined(__mips_n64) && !defined(__mips_n32) +#include +#endif + /* * Note: All the 64-bit atomic operations are only atomic when running * in 64-bit mode. It is assumed that code compiled for n32 and n64 Modified: head/sys/powerpc/include/atomic.h ============================================================================== --- head/sys/powerpc/include/atomic.h Thu Jan 2 23:18:43 2020 (r356307) +++ head/sys/powerpc/include/atomic.h Thu Jan 2 23:20:37 2020 (r356308) @@ -40,6 +40,10 @@ #include +#ifndef __powerpc64__ +#include +#endif + /* * The __ATOMIC_REL/ACQ() macros provide memory barriers only in conjunction * with the atomic lXarx/stXcx. sequences below. They are not exposed outside Added: head/sys/sys/_atomic64e.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/_atomic64e.h Thu Jan 2 23:20:37 2020 (r356308) @@ -0,0 +1,80 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Justin Hibbits + * + * 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 _SYS_ATOMIC64E_H_ +#define _SYS_ATOMIC64E_H_ + +#ifndef _MACHINE_ATOMIC_H_ +#error "This should not be included directly. Include " +#endif + +#ifdef _KERNEL +#define HAS_EMULATED_ATOMIC64 + +/* Emulated versions of 64-bit atomic operations. */ + +void atomic_add_64(volatile u_int64_t *, u_int64_t); +#define atomic_add_acq_64 atomic_add_64 +#define atomic_add_rel_64 atomic_add_64 + +int atomic_cmpset_64(volatile u_int64_t *, u_int64_t, u_int64_t); +#define atomic_cmpset_acq_64 atomic_cmpset_64 +#define atomic_cmpset_rel_64 atomic_cmpset_64 + +void atomic_clear_64(volatile u_int64_t *, u_int64_t); +#define atomic_clear_acq_64 atomic_clear_64 +#define atomic_clear_rel_64 atomic_clear_64 + +int atomic_fcmpset_64(volatile u_int64_t *, u_int64_t *, u_int64_t); +#define atomic_fcmpset_acq_64 atomic_fcmpset_64 +#define atomic_fcmpset_rel_64 atomic_fcmpset_64 + +u_int64_t atomic_fetchadd_64(volatile u_int64_t *, u_int64_t); + +u_int64_t atomic_load_64(volatile u_int64_t *); +#define atomic_load_acq_64 atomic_load_64 + +void atomic_readandclear_64(volatile u_int64_t *); + +void atomic_set_64(volatile u_int64_t *, u_int64_t); +#define atomic_set_acq_64 atomic_set_64 +#define atomic_set_rel_64 atomic_set_64 + +void atomic_subtract_64(volatile u_int64_t *, u_int64_t); +#define atomic_subtract_acq_64 atomic_subtract_64 +#define atomic_subtract_rel_64 atomic_subtract_64 + +void atomic_store_64(volatile u_int64_t *, u_int64_t); +#define atomic_store_rel_64 atomic_store_64 + +u_int64_t atomic_swap_64(volatile u_int64_t *, u_int64_t); + +#endif /* _KERNEL */ +#endif /* _SYS_ATOMIC64E_H_ */ From owner-svn-src-head@freebsd.org Thu Jan 2 23:24:58 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C33D41DE9E5; Thu, 2 Jan 2020 23:24:58 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pkf24SQbz47gs; Thu, 2 Jan 2020 23:24:58 +0000 (UTC) (envelope-from erj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9452D23191; Thu, 2 Jan 2020 23:24:58 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002NOwLF046830; Thu, 2 Jan 2020 23:24:58 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002NOweE046828; Thu, 2 Jan 2020 23:24:58 GMT (envelope-from erj@FreeBSD.org) Message-Id: <202001022324.002NOweE046828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 2 Jan 2020 23:24:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356309 - head/sys/dev/ixl X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixl X-SVN-Commit-Revision: 356309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 23:24:58 -0000 Author: erj Date: Thu Jan 2 23:24:57 2020 New Revision: 356309 URL: https://svnweb.freebsd.org/changeset/base/356309 Log: ixl: prevent non-privileged access to NVM update interface Add a privilege check to the ixl_handle_nvmupd_cmd function, ensuring that only privileged users are allowed to access the NVM update interface. Signed-off-by: Jacob Keller Submitted by: Jacob Keller Reported by: markj@ Reviewed by: markj@, erj@, jeffrey.e.pieper@intel.com MFC after: 3 days Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D22870 Modified: head/sys/dev/ixl/if_ixl.c head/sys/dev/ixl/ixl.h Modified: head/sys/dev/ixl/if_ixl.c ============================================================================== --- head/sys/dev/ixl/if_ixl.c Thu Jan 2 23:20:37 2020 (r356308) +++ head/sys/dev/ixl/if_ixl.c Thu Jan 2 23:24:57 2020 (r356309) @@ -1624,11 +1624,29 @@ ixl_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_ struct ifdrv *ifd = (struct ifdrv *)data; int error = 0; - /* NVM update command */ - if (ifd->ifd_cmd == I40E_NVM_ACCESS) - error = ixl_handle_nvmupd_cmd(pf, ifd); - else - error = EINVAL; + /* + * The iflib_if_ioctl forwards SIOCxDRVSPEC and SIOGPRIVATE_0 without + * performing privilege checks. It is important that this function + * perform the necessary checks for commands which should only be + * executed by privileged threads. + */ + + switch(command) { + case SIOCGDRVSPEC: + case SIOCSDRVSPEC: + /* NVM update command */ + if (ifd->ifd_cmd == I40E_NVM_ACCESS) { + error = priv_check(curthread, PRIV_DRIVER); + if (error) + break; + error = ixl_handle_nvmupd_cmd(pf, ifd); + } else { + error = EINVAL; + } + break; + default: + error = EOPNOTSUPP; + } return (error); } Modified: head/sys/dev/ixl/ixl.h ============================================================================== --- head/sys/dev/ixl/ixl.h Thu Jan 2 23:20:37 2020 (r356308) +++ head/sys/dev/ixl/ixl.h Thu Jan 2 23:24:57 2020 (r356309) @@ -52,6 +52,7 @@ #include #include #include +#include #include #include From owner-svn-src-head@freebsd.org Thu Jan 2 23:35:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C4051DF149; Thu, 2 Jan 2020 23:35:07 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pksk6SYgz48jT; Thu, 2 Jan 2020 23:35:06 +0000 (UTC) (envelope-from erj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D92F4233A6; Thu, 2 Jan 2020 23:35:06 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 002NZ6Xi053255; Thu, 2 Jan 2020 23:35:06 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 002NZ6D0053254; Thu, 2 Jan 2020 23:35:06 GMT (envelope-from erj@FreeBSD.org) Message-Id: <202001022335.002NZ6D0053254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 2 Jan 2020 23:35:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356310 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 356310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 02 Jan 2020 23:35:07 -0000 Author: erj Date: Thu Jan 2 23:35:06 2020 New Revision: 356310 URL: https://svnweb.freebsd.org/changeset/base/356310 Log: iflib: Prevent watchdog from resetting idle queues While changing link state in iflib_link_state_change(), queues are marked as IFLIB_QUEUE_IDLE to disable watchdog. Currently, iflib_timer() watchdog does not check for previous queue status before marking it as IFLIB_QUEUE_HUNG. This patch adds check of queue status before marking it as hung. Signed-off-by: Piotr Pietruszewski PR: 239240 Submitted by: Piotr Pietruszewski Reported by: ultima@ Reviewed by: gallatin@, erj@ MFC after: 3 days Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21712 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Jan 2 23:24:57 2020 (r356309) +++ head/sys/net/iflib.c Thu Jan 2 23:35:06 2020 (r356310) @@ -2263,8 +2263,11 @@ iflib_timer(void *arg) (sctx->isc_pause_frames == 0))) goto hung; - if (ifmp_ring_is_stalled(txq->ift_br)) + if (txq->ift_qstatus != IFLIB_QUEUE_IDLE && + ifmp_ring_is_stalled(txq->ift_br)) { + KASSERT(ctx->ifc_link_state == LINK_STATE_UP, ("queue can't be marked as hung if interface is down")); txq->ift_qstatus = IFLIB_QUEUE_HUNG; + } txq->ift_cleaned_prev = txq->ift_cleaned; } #ifdef DEV_NETMAP From owner-svn-src-head@freebsd.org Fri Jan 3 00:31:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 416FA1E0CC2; Fri, 3 Jan 2020 00:31:50 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47pm7B1KvSz4CtN; Fri, 3 Jan 2020 00:31:50 +0000 (UTC) (envelope-from delphij@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1068123E67; Fri, 3 Jan 2020 00:31:50 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0030VoDh087667; Fri, 3 Jan 2020 00:31:50 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0030VmBv087660; Fri, 3 Jan 2020 00:31:48 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202001030031.0030VmBv087660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 3 Jan 2020 00:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356313 - head/sbin/fsck_msdosfs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/fsck_msdosfs X-SVN-Commit-Revision: 356313 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 00:31:50 -0000 Author: delphij Date: Fri Jan 3 00:31:48 2020 New Revision: 356313 URL: https://svnweb.freebsd.org/changeset/base/356313 Log: Reduce memory footprint of fsck_msdosfs. This is a re-apply r356249 with changes to make GCC happy. This utility was initially written for FAT12/16, which were inherently small. When FAT32 support was added, the old data structure and algorithms remain used with minimal changes. With growing size of FAT32 media, the current data structure that requires 4 32-bit variables per each FAT32 table entry would consume up to 4 GiB of RAM, which can be too big for systems with limited RAM available. Address this by taking a different approach of validating the FAT. The FAT is essentially a set of linked lists of chains that was referenced by directory entries, and the checker needs to make sure that the linked chains of clusters do not have cross-linked chains, and every chain were referenced by one and only one directory entry. Instead of keeping track of the chain's 'head' cluster number, the size of the chain, the used status of the chain and the "next" pointer which is content of the FAT table, we create accessors for the FAT table data for the "next" pointer, and keep only one bit to indicate if the current cluster is a 'head' node of a cluster chain, in a bitmap. We further overhaul the FAT checker to find out the possible head nodes by excluding ones that are not (in other words, nodes that have some other nodes claiming them as the next node) instead of marking the head nodes for each node on the chain. This approach greatly reduced the complexiety of computation from O(N^2) worst case, to an O(N) scan for worst case. The file (cluster chain) length is not useful for the FAT checker, so don't bother to calculate them in the FAT checker and instead leave the task to the directory structure check, at which point we would have non-crossed cluster chains, and we are guaranteed that each cluster will be visited for at most one time. When checking the directory structures, we use the head node indicator to as the visited (used) flag: every cluster chain can only be referenced by one directory entry, so we clear them when calculating the length of the chain, and we can immediately tell if there are anomalies in the directory entry. As a result, the required RAM size is now 1 bit per each entry of the FAT table, plus memory needed to hold the FAT table in memory, instead of 16 bytes (=128 bits) per each entry. For FAT12 and FAT16, we will load the whole FAT table into memory as they are smaller than 128KiB, and for FAT32, we first attempt to mmap() it into memory, and when that fails, we would fall back to a simple LRU cache of 4 MiB of RAM. sbin/fsck_msdosfs/boot.c: - Added additional sanity checks for valid FAT32/FAT16/FAT12 cluster number. - FAT32: check if root directory starts with a valid cluster number, moved from dir.c. There is no point to proceed if the filesystem is already damaged beyond repair. sbin/fsck_msdosfs/check.c: - Combine phase 1 and phase 2, now that the readfat() is able to detect cross chains. sbin/fsck_msdosfs/dir.c: - Refactor code to use FAT accessor instead of accessing the internal representation of FAT table. - Make use of the cluster chain head bitmap. - Clarify and simplify directory entry check, remove unnecessary checks that are would be done at a later time (for example, whether the directory's second cluster is a valid one, which is examined more throughly in a later checkchain() and does not prevent us from proceeding further). sbin/fsck_msdosfs/dosfs.h: - Remove internal representation of FAT table, which is replaced by the head bitmap that is opaque to other code. - Added a special CLUST_DEAD cluster type to indicate errors. sbin/fsck_msdosfs/ext.h: - Added a flag that overrides mmap(2) setting. The corresponding command line option, -M is intentionally undocumented as we do not expect users to need it. - Added accessors for FAT table and convert existing interface to use it. sbin/fsck_msdosfs/fat.c: - Added head bitmap to represent whether a cluster is a head cluster. - Converted FAT internal representation to accessors. - Implemented a LRU cache for FAT32 when mmap(2) should not or can not be used. - _readfat: Attempt a mmap(2) and fall back to regular read for non-FAT32 file systems; use the LRU cache for FAT32 and prepopulate the cache with the first 4MiB of the entries. - readfat: Added support of head bitmap and use the population scan to detect bogus chains. - clusterdiff: removed, FATs are copied from the checked copy via writefat()/copyfat(). - checkchain: calculates the length of a cluster chain and make sure that it ends with a valid EOF marker. - clearchain: follow and clear a chain and maintain the free cluster count. - checklost: convert to use head bitmap. At the end of all other scans, the remaining 'head' nodes are leaders of lost cluster chains. sbin/fsck_msdosfs/fat.c: - Added a new -M option which is intentionally undocumented, to disable the use of mmap(). Reviewed by: kevlo MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D22965 Modified: head/sbin/fsck_msdosfs/boot.c head/sbin/fsck_msdosfs/check.c head/sbin/fsck_msdosfs/dir.c head/sbin/fsck_msdosfs/dosfs.h head/sbin/fsck_msdosfs/ext.h head/sbin/fsck_msdosfs/fat.c head/sbin/fsck_msdosfs/main.c Modified: head/sbin/fsck_msdosfs/boot.c ============================================================================== --- head/sbin/fsck_msdosfs/boot.c Fri Jan 3 00:29:09 2020 (r356312) +++ head/sbin/fsck_msdosfs/boot.c Fri Jan 3 00:31:48 2020 (r356313) @@ -152,9 +152,6 @@ readboot(int dosfs, struct bootblock *boot) boot->NumSectors = boot->bpbHugeSectors; } - - - if (boot->flags & FAT32) { /* If the OEM Name field is EXFAT, it's not FAT32, so bail */ if (!memcmp(&block[3], "EXFAT ", 8)) { @@ -272,13 +269,30 @@ readboot(int dosfs, struct bootblock *boot) boot->NumClusters = (boot->NumSectors - boot->FirstCluster) / boot->bpbSecPerClust + CLUST_FIRST; - if (boot->flags & FAT32) + if (boot->flags & FAT32) { + if (boot->NumClusters > (CLUST_RSRVD & CLUST32_MASK)) { + pfatal("Filesystem too big (%u clusters) for FAT32 partition", + boot->NumClusters); + return FSFATAL; + } + if (boot->NumClusters < (CLUST_RSRVD & CLUST16_MASK)) { + pfatal("Filesystem too small (%u clusters) for FAT32 partition", + boot->NumClusters); + return FSFATAL; + } boot->ClustMask = CLUST32_MASK; - else if (boot->NumClusters < (CLUST_RSRVD&CLUST12_MASK)) + + if (boot->bpbRootClust < CLUST_FIRST || + boot->bpbRootClust >= boot->NumClusters) { + pfatal("Root directory starts with cluster out of range(%u)", + boot->bpbRootClust); + return FSFATAL; + } + } else if (boot->NumClusters < (CLUST_RSRVD&CLUST12_MASK)) { boot->ClustMask = CLUST12_MASK; - else if (boot->NumClusters < (CLUST_RSRVD&CLUST16_MASK)) + } else if (boot->NumClusters < (CLUST_RSRVD&CLUST16_MASK)) { boot->ClustMask = CLUST16_MASK; - else { + } else { pfatal("Filesystem too big (%u clusters) for non-FAT32 partition", boot->NumClusters); return FSFATAL; Modified: head/sbin/fsck_msdosfs/check.c ============================================================================== --- head/sbin/fsck_msdosfs/check.c Fri Jan 3 00:29:09 2020 (r356312) +++ head/sbin/fsck_msdosfs/check.c Fri Jan 3 00:31:48 2020 (r356313) @@ -47,9 +47,8 @@ checkfilesys(const char *fname) { int dosfs; struct bootblock boot; - struct fatEntry *fat = NULL; + struct fat_descriptor *fat = NULL; int finish_dosdirsection=0; - u_int i; int mod = 0; int ret = 8; @@ -88,65 +87,39 @@ checkfilesys(const char *fname) } if (!preen) { - if (boot.ValidFat < 0) - printf("** Phase 1 - Read and Compare FATs\n"); - else - printf("** Phase 1 - Read FAT\n"); + printf("** Phase 1 - Read FAT and checking connectivity\n"); } - mod |= readfat(dosfs, &boot, boot.ValidFat >= 0 ? boot.ValidFat : 0, &fat); + mod |= readfat(dosfs, &boot, &fat); if (mod & FSFATAL) { close(dosfs); return 8; } - if (boot.ValidFat < 0) - for (i = 1; i < boot.bpbFATs; i++) { - struct fatEntry *currentFat; - - mod |= readfat(dosfs, &boot, i, ¤tFat); - - if (mod & FSFATAL) - goto out; - - mod |= comparefat(&boot, fat, currentFat, i); - free(currentFat); - if (mod & FSFATAL) - goto out; - } - if (!preen) - printf("** Phase 2 - Check Cluster Chains\n"); + printf("** Phase 2 - Checking Directories\n"); - mod |= checkfat(&boot, fat); - if (mod & FSFATAL) - goto out; - /* delay writing FATs */ - - if (!preen) - printf("** Phase 3 - Checking Directories\n"); - - mod |= resetDosDirSection(&boot, fat); + mod |= resetDosDirSection(fat); finish_dosdirsection = 1; if (mod & FSFATAL) goto out; /* delay writing FATs */ - mod |= handleDirTree(dosfs, &boot, fat); + mod |= handleDirTree(fat); if (mod & FSFATAL) goto out; if (!preen) - printf("** Phase 4 - Checking for Lost Files\n"); + printf("** Phase 3 - Checking for Lost Files\n"); - mod |= checklost(dosfs, &boot, fat); + mod |= checklost(fat); if (mod & FSFATAL) goto out; /* now write the FATs */ - if (mod & (FSFATMOD|FSFIXFAT)) { + if (mod & FSFATMOD) { if (ask(1, "Update FATs")) { - mod |= writefat(dosfs, &boot, fat, mod & FSFIXFAT); + mod |= writefat(fat); if (mod & FSFATAL) goto out; } else @@ -170,7 +143,7 @@ checkfilesys(const char *fname) if (mod & FSDIRTY) { pwarn("MARKING FILE SYSTEM CLEAN\n"); - mod |= writefat(dosfs, &boot, fat, 1); + mod |= writefat(fat); } else { pwarn("\n***** FILE SYSTEM IS LEFT MARKED AS DIRTY *****\n"); mod |= FSERROR; /* file system not clean */ Modified: head/sbin/fsck_msdosfs/dir.c ============================================================================== --- head/sbin/fsck_msdosfs/dir.c Fri Jan 3 00:29:09 2020 (r356312) +++ head/sbin/fsck_msdosfs/dir.c Fri Jan 3 00:31:48 2020 (r356313) @@ -1,6 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * + * Copyright (c) 2019 Google LLC * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank * Copyright (c) 1995 Martin Husemann * Some structure declaration borrowed from Paul Popelka @@ -95,14 +96,11 @@ static struct dirTodoNode *newDirTodo(void); static void freeDirTodo(struct dirTodoNode *); static char *fullpath(struct dosDirEntry *); static u_char calcShortSum(u_char *); -static int delete(int, struct bootblock *, struct fatEntry *, cl_t, int, - cl_t, int, int); -static int removede(int, struct bootblock *, struct fatEntry *, u_char *, - u_char *, cl_t, cl_t, cl_t, char *, int); -static int checksize(struct bootblock *, struct fatEntry *, u_char *, - struct dosDirEntry *); -static int readDosDirSection(int, struct bootblock *, struct fatEntry *, - struct dosDirEntry *); +static int delete(struct fat_descriptor *, cl_t, int, cl_t, int, int); +static int removede(struct fat_descriptor *, u_char *, u_char *, + cl_t, cl_t, cl_t, char *, int); +static int checksize(struct fat_descriptor *, u_char *, struct dosDirEntry *); +static int readDosDirSection(struct fat_descriptor *, struct dosDirEntry *); /* * Manage free dosDirEntry structures. @@ -116,7 +114,7 @@ newDosDirEntry(void) if (!(de = freede)) { if (!(de = malloc(sizeof *de))) - return 0; + return (NULL); } else freede = de->next; return de; @@ -193,7 +191,7 @@ fullpath(struct dosDirEntry *dir) /* * Calculate a checksum over an 8.3 alias name */ -static u_char +static inline u_char calcShortSum(u_char *p) { u_char sum = 0; @@ -221,21 +219,24 @@ static struct dosDirEntry *lostDir; * Init internal state for a new directory scan. */ int -resetDosDirSection(struct bootblock *boot, struct fatEntry *fat) +resetDosDirSection(struct fat_descriptor *fat) { - int b1, b2; + int rootdir_size, cluster_size; int ret = FSOK; size_t len; + struct bootblock *boot; - b1 = boot->bpbRootDirEnts * 32; - b2 = boot->bpbSecPerClust * boot->bpbBytesPerSec; + boot = fat_get_boot(fat); - if ((buffer = malloc(len = MAX(b1, b2))) == NULL) { + rootdir_size = boot->bpbRootDirEnts * 32; + cluster_size = boot->bpbSecPerClust * boot->bpbBytesPerSec; + + if ((buffer = malloc(len = MAX(rootdir_size, cluster_size))) == NULL) { perr("No space for directory buffer (%zu)", len); return FSFATAL; } - if ((delbuf = malloc(len = b2)) == NULL) { + if ((delbuf = malloc(len = cluster_size)) == NULL) { free(buffer); perr("No space for directory delbuf (%zu)", len); return FSFATAL; @@ -250,18 +251,10 @@ resetDosDirSection(struct bootblock *boot, struct fatE memset(rootDir, 0, sizeof *rootDir); if (boot->flags & FAT32) { - if (boot->bpbRootClust < CLUST_FIRST || - boot->bpbRootClust >= boot->NumClusters) { - pfatal("Root directory starts with cluster out of range(%u)", - boot->bpbRootClust); - return FSFATAL; - } - if (fat[boot->bpbRootClust].head != boot->bpbRootClust) { + if (!fat_is_cl_head(fat, boot->bpbRootClust)) { pfatal("Root directory doesn't start a cluster chain"); return FSFATAL; } - - fat[boot->bpbRootClust].flags |= FAT_USED; rootDir->head = boot->bpbRootClust; } @@ -302,16 +295,21 @@ finishDosDirSection(void) * Delete directory entries between startcl, startoff and endcl, endoff. */ static int -delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl, +delete(struct fat_descriptor *fat, cl_t startcl, int startoff, cl_t endcl, int endoff, int notlast) { u_char *s, *e; off_t off; - int clsz = boot->bpbSecPerClust * boot->bpbBytesPerSec; + int clsz, fd; + struct bootblock *boot; + boot = fat_get_boot(fat); + fd = fat_get_fd(fat); + clsz = boot->bpbSecPerClust * boot->bpbBytesPerSec; + s = delbuf + startoff; e = delbuf + clsz; - while (startcl >= CLUST_FIRST && startcl < boot->NumClusters) { + while (fat_is_valid_cl(fat, startcl)) { if (startcl == endcl) { if (notlast) break; @@ -320,11 +318,11 @@ delete(int f, struct bootblock *boot, struct fatEntry off = (startcl - CLUST_FIRST) * boot->bpbSecPerClust + boot->FirstCluster; off *= boot->bpbBytesPerSec; - if (lseek(f, off, SEEK_SET) != off) { + if (lseek(fd, off, SEEK_SET) != off) { perr("Unable to lseek to %" PRId64, off); return FSFATAL; } - if (read(f, delbuf, clsz) != clsz) { + if (read(fd, delbuf, clsz) != clsz) { perr("Unable to read directory"); return FSFATAL; } @@ -332,25 +330,26 @@ delete(int f, struct bootblock *boot, struct fatEntry *s = SLOT_DELETED; s += 32; } - if (lseek(f, off, SEEK_SET) != off) { + if (lseek(fd, off, SEEK_SET) != off) { perr("Unable to lseek to %" PRId64, off); return FSFATAL; } - if (write(f, delbuf, clsz) != clsz) { + if (write(fd, delbuf, clsz) != clsz) { perr("Unable to write directory"); return FSFATAL; } if (startcl == endcl) break; - startcl = fat[startcl].next; + startcl = fat_get_cl_next(fat, startcl); s = delbuf; } return FSOK; } static int -removede(int f, struct bootblock *boot, struct fatEntry *fat, u_char *start, - u_char *end, cl_t startcl, cl_t endcl, cl_t curcl, char *path, int type) +removede(struct fat_descriptor *fat, u_char *start, + u_char *end, cl_t startcl, cl_t endcl, cl_t curcl, + char *path, int type) { switch (type) { case 0: @@ -366,14 +365,14 @@ removede(int f, struct bootblock *boot, struct fatEntr } if (ask(0, "Remove")) { if (startcl != curcl) { - if (delete(f, boot, fat, + if (delete(fat, startcl, start - buffer, endcl, end - buffer, endcl == curcl) == FSFATAL) return FSFATAL; start = buffer; } - /* startcl is < CLUST_FIRST for !fat32 root */ + /* startcl is < CLUST_FIRST for !FAT32 root */ if ((endcl == curcl) || (startcl < CLUST_FIRST)) for (; start < end; start += 32) *start = SLOT_DELETED; @@ -386,23 +385,37 @@ removede(int f, struct bootblock *boot, struct fatEntr * Check an in-memory file entry */ static int -checksize(struct bootblock *boot, struct fatEntry *fat, u_char *p, - struct dosDirEntry *dir) +checksize(struct fat_descriptor *fat, u_char *p, struct dosDirEntry *dir) { + int ret = FSOK; + size_t physicalSize; + struct bootblock *boot; + + boot = fat_get_boot(fat); + /* * Check size on ordinary files */ - u_int32_t physicalSize; - - if (dir->head == CLUST_FREE) + if (dir->head == CLUST_FREE) { physicalSize = 0; - else { - if (dir->head < CLUST_FIRST || dir->head >= boot->NumClusters) + } else { + if (!fat_is_valid_cl(fat, dir->head)) return FSERROR; - physicalSize = fat[dir->head].length * boot->ClusterSize; + ret = checkchain(fat, dir->head, &physicalSize); + /* + * Upon return, physicalSize would hold the chain length + * that checkchain() was able to validate, but if the user + * refused the proposed repair, it would be unsafe to + * proceed with directory entry fix, so bail out in that + * case. + */ + if (ret == FSERROR) { + return (FSERROR); + } + physicalSize *= boot->ClusterSize; } if (physicalSize < dir->size) { - pwarn("size of %s is %u, should at most be %u\n", + pwarn("size of %s is %u, should at most be %zu\n", fullpath(dir), dir->size, physicalSize); if (ask(1, "Truncate")) { dir->size = physicalSize; @@ -422,11 +435,10 @@ checksize(struct bootblock *boot, struct fatEntry *fat for (cl = dir->head, len = sz = 0; (sz += boot->ClusterSize) < dir->size; len++) - cl = fat[cl].next; - clearchain(boot, fat, fat[cl].next); - fat[cl].next = CLUST_EOF; - fat[dir->head].length = len; - return FSFATMOD; + cl = fat_get_cl_next(fat, cl); + clearchain(fat, fat_get_cl_next(fat, cl)); + ret = fat_set_cl_next(fat, cl, CLUST_EOF); + return (FSFATMOD | ret); } else return FSERROR; } @@ -442,15 +454,20 @@ static const u_char dotdot_name[11] = ".. "; * when we traverse into it. */ static int -check_subdirectory(int f, struct bootblock *boot, struct dosDirEntry *dir) +check_subdirectory(struct fat_descriptor *fat, struct dosDirEntry *dir) { u_char *buf, *cp; off_t off; cl_t cl; int retval = FSOK; + int fd; + struct bootblock *boot; + boot = fat_get_boot(fat); + fd = fat_get_fd(fat); + cl = dir->head; - if (dir->parent && (cl < CLUST_FIRST || cl >= boot->NumClusters)) { + if (dir->parent && !fat_is_valid_cl(fat, cl)) { return FSERROR; } @@ -474,8 +491,8 @@ check_subdirectory(int f, struct bootblock *boot, stru } off *= boot->bpbBytesPerSec; - if (lseek(f, off, SEEK_SET) != off || - read(f, buf, boot->bpbBytesPerSec) != (ssize_t)boot->bpbBytesPerSec) { + if (lseek(fd, off, SEEK_SET) != off || + read(fd, buf, boot->bpbBytesPerSec) != (ssize_t)boot->bpbBytesPerSec) { perr("Unable to read directory"); free(buf); return FSFATAL; @@ -509,22 +526,27 @@ check_subdirectory(int f, struct bootblock *boot, stru * - push directories onto the todo-stack */ static int -readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat, - struct dosDirEntry *dir) +readDosDirSection(struct fat_descriptor *fat, struct dosDirEntry *dir) { + struct bootblock *boot; struct dosDirEntry dirent, *d; u_char *p, *vallfn, *invlfn, *empty; off_t off; - int i, j, k, last; + int fd, i, j, k, iosize, entries; + bool is_legacyroot; cl_t cl, valcl = ~0, invcl = ~0, empcl = ~0; char *t; u_int lidx = 0; int shortSum; int mod = FSOK; + size_t dirclusters; #define THISMOD 0x8000 /* Only used within this routine */ + boot = fat_get_boot(fat); + fd = fat_get_fd(fat); + cl = dir->head; - if (dir->parent && (cl < CLUST_FIRST || cl >= boot->NumClusters)) { + if (dir->parent && (!fat_is_valid_cl(fat, cl))) { /* * Already handled somewhere else. */ @@ -532,24 +554,50 @@ readDosDirSection(int f, struct bootblock *boot, struc } shortSum = -1; vallfn = invlfn = empty = NULL; + + /* + * If we are checking the legacy root (for FAT12/FAT16), + * we will operate on the whole directory; otherwise, we + * will operate on one cluster at a time, and also take + * this opportunity to examine the chain. + * + * Derive how many entries we are going to encounter from + * the I/O size. + */ + is_legacyroot = (dir->parent == NULL && !(boot->flags & FAT32)); + if (is_legacyroot) { + iosize = boot->bpbRootDirEnts * 32; + entries = boot->bpbRootDirEnts; + } else { + iosize = boot->bpbSecPerClust * boot->bpbBytesPerSec; + entries = iosize / 32; + mod |= checkchain(fat, dir->head, &dirclusters); + } + do { - if (!(boot->flags & FAT32) && !dir->parent) { - last = boot->bpbRootDirEnts * 32; + if (is_legacyroot) { + /* + * Special case for FAT12/FAT16 root -- read + * in the whole root directory. + */ off = boot->bpbResSectors + boot->bpbFATs * boot->FATsecs; } else { - last = boot->bpbSecPerClust * boot->bpbBytesPerSec; + /* + * Otherwise, read in a cluster of the + * directory. + */ off = (cl - CLUST_FIRST) * boot->bpbSecPerClust + boot->FirstCluster; } off *= boot->bpbBytesPerSec; - if (lseek(f, off, SEEK_SET) != off - || read(f, buffer, last) != last) { + if (lseek(fd, off, SEEK_SET) != off || + read(fd, buffer, iosize) != iosize) { perr("Unable to read directory"); return FSFATAL; } - last /= 32; - for (p = buffer, i = 0; i < last; i++, p += 32) { + + for (p = buffer, i = 0; i < entries; i++, p += 32) { if (dir->fsckflags & DIREMPWARN) { *p = SLOT_EMPTY; continue; @@ -572,7 +620,7 @@ readDosDirSection(int f, struct bootblock *boot, struc u_char *q; dir->fsckflags &= ~DIREMPTY; - if (delete(f, boot, fat, + if (delete(fat, empcl, empty - buffer, cl, p - buffer, 1) == FSFATAL) return FSFATAL; @@ -701,7 +749,7 @@ readDosDirSection(int f, struct bootblock *boot, struc if (dirent.flags & ATTR_VOLUME) { if (vallfn || invlfn) { - mod |= removede(f, boot, fat, + mod |= removede(fat, invlfn ? invlfn : vallfn, p, invlfn ? invcl : valcl, -1, 0, fullpath(dir), 2); @@ -741,7 +789,7 @@ readDosDirSection(int f, struct bootblock *boot, struc dirent.next = dir->child; if (invlfn) { - mod |= k = removede(f, boot, fat, + mod |= k = removede(fat, invlfn, vallfn ? vallfn : p, invcl, vallfn ? valcl : cl, cl, fullpath(&dirent), 0); @@ -757,74 +805,61 @@ readDosDirSection(int f, struct bootblock *boot, struc vallfn = NULL; /* not used any longer */ invlfn = NULL; - if (dirent.size == 0 && !(dirent.flags & ATTR_DIRECTORY)) { - if (dirent.head != 0) { - pwarn("%s has clusters, but size 0\n", - fullpath(&dirent)); - if (ask(1, "Drop allocated clusters")) { - p[26] = p[27] = 0; - if (boot->ClustMask == CLUST32_MASK) - p[20] = p[21] = 0; - clearchain(boot, fat, dirent.head); - dirent.head = 0; - mod |= THISMOD|FSDIRMOD|FSFATMOD; - } else - mod |= FSERROR; + /* + * Check if the directory entry is sane. + * + * '.' and '..' are skipped, their sanity is + * checked somewhere else. + * + * For everything else, check if we have a new, + * valid cluster chain (beginning of a file or + * directory that was never previously claimed + * by another file) when it's a non-empty file + * or a directory. The sanity of the cluster + * chain is checked at a later time when we + * traverse into the directory, or examine the + * file's directory entry. + * + * The only possible fix is to delete the entry + * if it's a directory; for file, we have to + * truncate the size to 0. + */ + if (!(dirent.flags & ATTR_DIRECTORY) || + (strcmp(dirent.name, ".") != 0 && + strcmp(dirent.name, "..") != 0)) { + if ((dirent.size != 0 || (dirent.flags & ATTR_DIRECTORY)) && + ((!fat_is_valid_cl(fat, dirent.head) || + !fat_is_cl_head(fat, dirent.head)))) { + if (!fat_is_valid_cl(fat, dirent.head)) { + pwarn("%s starts with cluster out of range(%u)\n", + fullpath(&dirent), + dirent.head); + } else { + pwarn("%s doesn't start a new cluster chain\n", + fullpath(&dirent)); + } + + if (dirent.flags & ATTR_DIRECTORY) { + if (ask(0, "Remove")) { + *p = SLOT_DELETED; + mod |= THISMOD|FSDIRMOD; + } else + mod |= FSERROR; + continue; + } else { + if (ask(1, "Truncate")) { + p[28] = p[29] = p[30] = p[31] = 0; + p[26] = p[27] = 0; + if (boot->ClustMask == CLUST32_MASK) + p[20] = p[21] = 0; + dirent.size = 0; + dirent.head = 0; + mod |= THISMOD|FSDIRMOD; + } else + mod |= FSERROR; + } } - } else if (dirent.head == 0 - && !strcmp(dirent.name, "..") - && dir->parent /* XXX */ - && !dir->parent->parent) { - /* - * Do nothing, the parent is the root - */ - } else if (dirent.head < CLUST_FIRST - || dirent.head >= boot->NumClusters - || fat[dirent.head].next == CLUST_FREE - || (fat[dirent.head].next >= CLUST_RSRVD - && fat[dirent.head].next < CLUST_EOFS) - || fat[dirent.head].head != dirent.head) { - if (dirent.head == 0) - pwarn("%s has no clusters\n", - fullpath(&dirent)); - else if (dirent.head < CLUST_FIRST - || dirent.head >= boot->NumClusters) - pwarn("%s starts with cluster out of range(%u)\n", - fullpath(&dirent), - dirent.head); - else if (fat[dirent.head].next == CLUST_FREE) - pwarn("%s starts with free cluster\n", - fullpath(&dirent)); - else if (fat[dirent.head].next >= CLUST_RSRVD) - pwarn("%s starts with cluster marked %s\n", - fullpath(&dirent), - rsrvdcltype(fat[dirent.head].next)); - else - pwarn("%s doesn't start a cluster chain\n", - fullpath(&dirent)); - if (dirent.flags & ATTR_DIRECTORY) { - if (ask(0, "Remove")) { - *p = SLOT_DELETED; - mod |= THISMOD|FSDIRMOD; - } else - mod |= FSERROR; - continue; - } else { - if (ask(1, "Truncate")) { - p[28] = p[29] = p[30] = p[31] = 0; - p[26] = p[27] = 0; - if (boot->ClustMask == CLUST32_MASK) - p[20] = p[21] = 0; - dirent.size = 0; - mod |= THISMOD|FSDIRMOD; - } else - mod |= FSERROR; - } } - - if (dirent.head >= CLUST_FIRST && dirent.head < boot->NumClusters) - fat[dirent.head].flags |= FAT_USED; - if (dirent.flags & ATTR_DIRECTORY) { /* * gather more info for directories @@ -861,8 +896,7 @@ readDosDirSection(int f, struct bootblock *boot, struc mod |= FSERROR; } continue; - } - if (strcmp(dirent.name, "..") == 0) { + } else if (strcmp(dirent.name, "..") == 0) { if (dir->parent) { /* XXX */ if (!dir->parent->parent) { if (dirent.head) { @@ -908,7 +942,7 @@ readDosDirSection(int f, struct bootblock *boot, struc } else mod |= FSERROR; continue; - } else if ((check_subdirectory(f, boot, + } else if ((check_subdirectory(fat, &dirent) & FSERROR) == FSERROR) { /* * A subdirectory should have @@ -944,39 +978,43 @@ readDosDirSection(int f, struct bootblock *boot, struc n->dir = d; pendingDirectories = n; } else { - mod |= k = checksize(boot, fat, p, &dirent); + mod |= k = checksize(fat, p, &dirent); if (k & FSDIRMOD) mod |= THISMOD; } boot->NumFiles++; } - if (!(boot->flags & FAT32) && !dir->parent) + if (is_legacyroot) { + /* + * Don't bother to write back right now because + * we may continue to make modification to the + * non-FAT32 root directory below. + */ break; - - if (mod & THISMOD) { - last *= 32; - if (lseek(f, off, SEEK_SET) != off - || write(f, buffer, last) != last) { + } else if (mod & THISMOD) { + if (lseek(fd, off, SEEK_SET) != off + || write(fd, buffer, iosize) != iosize) { perr("Unable to write directory"); return FSFATAL; } mod &= ~THISMOD; } - } while ((cl = fat[cl].next) >= CLUST_FIRST && cl < boot->NumClusters); + } while (fat_is_valid_cl(fat, (cl = fat_get_cl_next(fat, cl)))); if (invlfn || vallfn) - mod |= removede(f, boot, fat, + mod |= removede(fat, invlfn ? invlfn : vallfn, p, invlfn ? invcl : valcl, -1, 0, fullpath(dir), 1); - /* The root directory of non fat32 filesystems is in a special - * area and may have been modified above without being written out. + /* + * The root directory of non-FAT32 filesystems is in a special + * area and may have been modified above removede() without + * being written out. */ - if ((mod & FSDIRMOD) && !(boot->flags & FAT32) && !dir->parent) { - last *= 32; - if (lseek(f, off, SEEK_SET) != off - || write(f, buffer, last) != last) { + if ((mod & FSDIRMOD) && is_legacyroot) { + if (lseek(fd, off, SEEK_SET) != off + || write(fd, buffer, iosize) != iosize) { perr("Unable to write directory"); return FSFATAL; } @@ -986,11 +1024,11 @@ readDosDirSection(int f, struct bootblock *boot, struc } int -handleDirTree(int dosfs, struct bootblock *boot, struct fatEntry *fat) +handleDirTree(struct fat_descriptor *fat) { int mod; - mod = readDosDirSection(dosfs, boot, fat, rootDir); + mod = readDosDirSection(fat, rootDir); if (mod & FSFATAL) return FSFATAL; @@ -1011,7 +1049,7 @@ handleDirTree(int dosfs, struct bootblock *boot, struc /* * handle subdirectory */ - mod |= readDosDirSection(dosfs, boot, fat, dir); + mod |= readDosDirSection(fat, dir); if (mod & FSFATAL) return FSFATAL; } @@ -1027,12 +1065,15 @@ static cl_t lfcl; static off_t lfoff; int -reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head) +reconnect(struct fat_descriptor *fat, cl_t head, size_t length) { + struct bootblock *boot = fat_get_boot(fat); struct dosDirEntry d; - int len; + int len, dosfs; u_char *p; + dosfs = fat_get_fd(fat); + if (!ask(1, "Reconnect")) return FSERROR; @@ -1063,7 +1104,7 @@ reconnect(int dosfs, struct bootblock *boot, struct fa break; if (p && p < lfbuf + boot->ClusterSize) break; - lfcl = p ? fat[lfcl].next : lostDir->head; + lfcl = p ? fat_get_cl_next(fat, lfcl) : lostDir->head; if (lfcl < CLUST_FIRST || lfcl >= boot->NumClusters) { /* Extend LOSTDIR? XXX */ pwarn("No space in %s\n", LOSTDIR); @@ -1088,7 +1129,7 @@ reconnect(int dosfs, struct bootblock *boot, struct fa len = snprintf(d.name, sizeof(d.name), "%u", head); d.flags = 0; d.head = head; - d.size = fat[head].length * boot->ClusterSize; + d.size = length * boot->ClusterSize; memcpy(p, d.name, len); memset(p + len, ' ', 11 - len); @@ -1103,7 +1144,6 @@ reconnect(int dosfs, struct bootblock *boot, struct fa p[29] = (u_char)(d.size >> 8); p[30] = (u_char)(d.size >> 16); p[31] = (u_char)(d.size >> 24); - fat[head].flags |= FAT_USED; if (lseek(dosfs, lfoff, SEEK_SET) != lfoff || (size_t)write(dosfs, lfbuf, boot->ClusterSize) != boot->ClusterSize) { perr("could not write LOST.DIR"); Modified: head/sbin/fsck_msdosfs/dosfs.h ============================================================================== --- head/sbin/fsck_msdosfs/dosfs.h Fri Jan 3 00:29:09 2020 (r356312) +++ head/sbin/fsck_msdosfs/dosfs.h Fri Jan 3 00:31:48 2020 (r356313) @@ -83,19 +83,13 @@ struct bootblock { u_int NumBad; /* # of bad clusters */ }; -struct fatEntry { - cl_t next; /* pointer to next cluster */ - cl_t head; /* pointer to start of chain */ - u_int32_t length; /* number of clusters on chain */ - int flags; /* see below */ -}; - #define CLUST_FREE 0 /* 0 means cluster is free */ #define CLUST_FIRST 2 /* 2 is the minimum valid cluster number */ #define CLUST_RSRVD 0xfffffff6 /* start of reserved clusters */ #define CLUST_BAD 0xfffffff7 /* a cluster with a defect */ #define CLUST_EOFS 0xfffffff8 /* start of EOF indicators */ #define CLUST_EOF 0xffffffff /* standard value for last cluster */ +#define CLUST_DEAD 0xfdeadc0d /* error encountered */ /* * Masks for cluster values @@ -103,8 +97,6 @@ struct fatEntry { #define CLUST12_MASK 0xfff #define CLUST16_MASK 0xffff #define CLUST32_MASK 0xfffffff - -#define FAT_USED 1 /* This fat chain is used in a file */ #define DOSLONGNAMELEN 256 /* long name maximal length */ #define LRFIRST 0x40 /* first long name record */ Modified: head/sbin/fsck_msdosfs/ext.h ============================================================================== --- head/sbin/fsck_msdosfs/ext.h Fri Jan 3 00:29:09 2020 (r356312) +++ head/sbin/fsck_msdosfs/ext.h Fri Jan 3 00:31:48 2020 (r356313) @@ -32,6 +32,8 @@ #include +#include + #include "dosfs.h" #define LOSTDIR "LOST.DIR" @@ -44,6 +46,7 @@ extern int alwaysyes; /* assume "yes" for all question extern int preen; /* we are preening */ extern int rdonly; /* device is opened read only (supersedes above) */ extern int skipclean; /* skip clean file systems if preening */ +extern int allow_mmap; /* allow the use of mmap() */ /* * function declarations @@ -72,7 +75,6 @@ int checkfilesys(const char *); #define FSERROR 8 /* Some unrecovered error remains */ #define FSFATAL 16 /* Some unrecoverable error occurred */ #define FSDIRTY 32 /* File system is dirty */ -#define FSFIXFAT 64 /* Fix file system FAT */ /* * read a boot block in a machine independent fashion and translate @@ -85,46 +87,53 @@ int readboot(int, struct bootblock *); */ int writefsinfo(int, struct bootblock *); -/* - * Read one of the FAT copies and return a pointer to the new - * allocated array holding our description of it. - */ -int readfat(int, struct bootblock *, u_int, struct fatEntry **); +/* Opaque type */ +struct fat_descriptor; -/* - * Check two FAT copies for consistency and merge changes into the - * first if necessary. - */ -int comparefat(struct bootblock *, struct fatEntry *, struct fatEntry *, u_int); +void fat_clear_cl_head(struct fat_descriptor *, cl_t); +bool fat_is_cl_head(struct fat_descriptor *, cl_t); +cl_t fat_get_cl_next(struct fat_descriptor *, cl_t); + +int fat_set_cl_next(struct fat_descriptor *, cl_t, cl_t); + +cl_t fat_allocate_cluster(struct fat_descriptor *fat); + +struct bootblock* fat_get_boot(struct fat_descriptor *); +int fat_get_fd(struct fat_descriptor *); +bool fat_is_valid_cl(struct fat_descriptor *, cl_t); + /* - * Check a FAT + * Read the FAT 0 and return a pointer to the newly allocated + * descriptor of it. */ -int checkfat(struct bootblock *, struct fatEntry *); +int readfat(int, struct bootblock *, struct fat_descriptor **); /* * Write back FAT entries */ -int writefat(int, struct bootblock *, struct fatEntry *, int); +int writefat(struct fat_descriptor *); /* * Read a directory */ -int resetDosDirSection(struct bootblock *, struct fatEntry *); +int resetDosDirSection(struct fat_descriptor *); void finishDosDirSection(void); -int handleDirTree(int, struct bootblock *, struct fatEntry *); +int handleDirTree(struct fat_descriptor *); /* * Cross-check routines run after everything is completely in memory */ +int checkchain(struct fat_descriptor *, cl_t, size_t *); + /* * Check for lost cluster chains */ -int checklost(int, struct bootblock *, struct fatEntry *); +int checklost(struct fat_descriptor *); /* * Try to reconnect a lost cluster chain */ -int reconnect(int, struct bootblock *, struct fatEntry *, cl_t); +int reconnect(struct fat_descriptor *, cl_t, size_t); void finishlf(void); /* @@ -138,6 +147,6 @@ const char *rsrvdcltype(cl_t); /* * Clear a cluster chain in a FAT */ -void clearchain(struct bootblock *, struct fatEntry *, cl_t); +void clearchain(struct fat_descriptor *, cl_t); #endif Modified: head/sbin/fsck_msdosfs/fat.c ============================================================================== --- head/sbin/fsck_msdosfs/fat.c Fri Jan 3 00:29:09 2020 (r356312) +++ head/sbin/fsck_msdosfs/fat.c Fri Jan 3 00:31:48 2020 (r356313) @@ -1,6 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * + * Copyright (c) 2019 Google LLC * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank * Copyright (c) 1995 Martin Husemann * @@ -33,6 +34,14 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include +#include +#include +#include +#include + +#include +#include #include #include #include @@ -42,12 +51,517 @@ static const char rcsid[] = #include "ext.h" #include "fsutil.h" -static int checkclnum(struct bootblock *, u_int, cl_t, cl_t *); -static int clustdiffer(cl_t, cl_t *, cl_t *, u_int); -static int tryclear(struct bootblock *, struct fatEntry *, cl_t, cl_t *); -static int _readfat(int, struct bootblock *, u_int, u_char **); +static int _readfat(struct fat_descriptor *); +static inline struct bootblock* boot_of_(struct fat_descriptor *); +static inline int fd_of_(struct fat_descriptor *); +static inline bool valid_cl(struct fat_descriptor *, cl_t); -/*- + +/* + * Head bitmap for FAT scanning. + * + * FAT32 have up to 2^28 = 256M entries, and FAT16/12 have much less. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jan 3 00:35:58 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C50291E0F82; Fri, 3 Jan 2020 00:35:58 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (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 47pmCx4zxVz4D4w; Fri, 3 Jan 2020 00:35:57 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 44E733C0199; Fri, 3 Jan 2020 00:35:51 +0000 (UTC) Date: Fri, 3 Jan 2020 00:35:51 +0000 From: Brooks Davis To: Kyle Evans Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r355936 - in head/sys: arm/broadcom/bcm2835 arm/freescale/imx arm/ti/am335x arm/versatile powerpc/ofw Message-ID: <20200103003551.GH91104@spindle.one-eyed-alien.net> References: <201912201622.xBKGMEdl019516@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 47pmCx4zxVz4D4w X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-6.52 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; IP_SCORE(-3.62)[ip: (-9.48), ipnet: 199.48.128.0/22(-4.73), asn: 36236(-3.84), country: US(-0.05)]; TO_DN_ALL(0.00)[]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 00:35:58 -0000 --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 23, 2019 at 03:14:07PM -0600, Kyle Evans wrote: > On Fri, Dec 20, 2019 at 10:22 AM Kyle Evans wrote: > > > > Author: kevans > > Date: Fri Dec 20 16:22:14 2019 > > New Revision: 355936 > > URL: https://svnweb.freebsd.org/changeset/base/355936 > > > > Log: > > Kill off dummy kbd drivers > > > > As far as I can tell, these are an artifact of times when linker sets > > couldn't be empty, otherwise the kernel build would fail due to unres= olved > > symbols. hselasky fixed this in r268138, and I've audited the kbd por= tions > > to make sure nothing would blow up due to the empty linker set and > > successfully compiled+ran a kernel with no keyboard support at all. > > > > Kill them off now since they're no longer required. > > > > MFC after: 1 week > > >=20 > It turns out that I missed one of these in > ^/sys/dev/terasic/mtl/terasic_mtl_syscons.c, which has the following > note that shows my analysis to be not inaccurate but incorrect: >=20 > /* > * XXXRW: For historical reasons, syscons can't register video consoles > * without a keyboard implementation. Provide a dummy. > */ >=20 > As far as I can tell, this isn't the case anymore as sckbdprobe's > return value is ignored and other references to the keyboard appear to > be properly gated on sc->keyboard being valid. >=20 > I only have a single machine that can run syscons, but I built a > kernel with the same modifications to remove all of the keyboard > drivers (-ukbd, kbdmux, hyperv) for that machine and encountered no > problems in practice. >=20 > I will proceed with removing the last dummy driver and MFC as scheduled. That's fine. I doubt anyone but us (CHERI) uses the Terasic MTL driver. -- Brooks --x+6KMIRAuhnl3hBn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJeDoxmAAoJEKzQXbSebgfApPoH/3WQNDoh8GXo0cH9HA2fnsdw i8AB+7iOiF+py2UootR3zTRJczhk1CrgOmbeo3I8NR1skdqi7m9Pw/FYNjTiUkeJ 50gdMQCSj0xUnt3/csqh5aAasQUiKiuvucG3xSfypbRIR4fVzFj/YbgkuWT+/1Q2 Nn81KCTOj1dKh1JZcFvvXTaCLg6poj8KhukoFreiqjohxYSieEwEm49/DJAr9am1 TUoE4JNd5LtorQp2vnTZQAkvwz4fNT//ycphUAlI4JdQEoffuzN0N+57JJTNt0cw XEzJYCuS2j2lqRxnhDvARcoHhINH+32c7UkEfuT63FO0Wh4Ig1KM7vumLKh8uxM= =zWS3 -----END PGP SIGNATURE----- --x+6KMIRAuhnl3hBn-- From owner-svn-src-head@freebsd.org Fri Jan 3 02:39:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A3C61E3569 for ; Fri, 3 Jan 2020 02:39:24 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ppyM0nQdz4Jjn for ; Fri, 3 Jan 2020 02:39:22 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by mail-pg1-x542.google.com with SMTP id 6so22784775pgk.0 for ; Thu, 02 Jan 2020 18:39:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jroberson-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=pxUVZkl/lLnQnaIfsoM5GUj+0CtVho0erFlLc4mpfDM=; b=T4K3Pqepd5E7R7k0GXIFY8czUrKe8dkdJgxkYCeoAGd3AOQ/85wEPIc0GsXI47ofQp WP57xkhNTtkAiWcCF0o5qQsVBg63mC4QqN1kI5N4KE7YLfHjwBl7XGXW40e8bPwinCbB XpBYbQ5byx84jYS0AH4Y4ptV/pwbvlU4TiPVUt+I1odSwdLPhlHHKynF+26RYPcFxywR TopDA1lFt0j2cZ+tNecoV1d5SEszqjNXL2h8kUS40NTmgFDbaHzR0NkYdGxHWvKNpoOL 5vXcRa1MfsK7XQzkcds+am3BlpDbEDkp6I6CbbcLAoQnuaSRKxqPVqbqmC1f+NNeS3HU Vexg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=pxUVZkl/lLnQnaIfsoM5GUj+0CtVho0erFlLc4mpfDM=; b=DNEehyFQ1RJZVHI0cf8P0Nj/X4PTa9JgL/xVGf8Fgt8dfuoOWKu5QtyYELeLgWQYi0 fKke8KIn79Xt2gwuimL799w+mzSwcf2zOS0AnRml5/pTsLu3ox0y8qDTF4jEbLPr+qv2 bUay5sv1qBZaRiIwewwgPvNrfEjmm7WuwE7ouFJJw6vDOyjG7sQ0dvV5bGaKCLqNr7H2 NQmQkSr31bGLRT8uZnwS/ETuRmW9MlO2XZxfqYFhYvi6bB/gMH+KS+N9KWHjBsbTwDEO jc/zIlo0mzLhv8fMg/QVFd9d49mo2rRSz/9MYgg/sQhMZ6v2N4B3Cs+RXwU4R3S6oKXG URIQ== X-Gm-Message-State: APjAAAUFyKOagKWUPjVIIcobAUbTzJKUuitjY+yHtg6do+ausCnGIFxj KWblorVGMqz6Py9x2Pg4615Iyg== X-Google-Smtp-Source: APXvYqzDBEeatPWUVTBgIhXswPmE49b5v8yiWu5pF+a15GF1y+T5fkM74NjxHqGfKAiQ/Cysd0mLFQ== X-Received: by 2002:a65:66d7:: with SMTP id c23mr95530270pgw.40.1578019161252; Thu, 02 Jan 2020 18:39:21 -0800 (PST) Received: from rrcs-76-81-105-82.west.biz.rr.com (rrcs-76-81-105-82.west.biz.rr.com. [76.81.105.82]) by smtp.gmail.com with ESMTPSA id u10sm61007414pgg.41.2020.01.02.18.39.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jan 2020 18:39:20 -0800 (PST) Date: Thu, 2 Jan 2020 16:39:18 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Brandon Bergren cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r356308 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys conf kern mips/include powerpc/include sys In-Reply-To: <202001022320.002NKcio041437@repo.freebsd.org> Message-ID: References: <202001022320.002NKcio041437@repo.freebsd.org> User-Agent: Alpine 2.21.9999 (BSF 287 2018-06-16) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 47ppyM0nQdz4Jjn X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=jroberson-net.20150623.gappssmtp.com header.s=20150623 header.b=T4K3Pqep; dmarc=none; spf=none (mx1.freebsd.org: domain of jroberson@jroberson.net has no SPF policy when checking 2607:f8b0:4864:20::542) smtp.mailfrom=jroberson@jroberson.net X-Spamd-Result: default: False [-2.76 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[jroberson-net.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[jroberson.net]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[jroberson-net.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2.4.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-0.96)[ip: (-0.72), ipnet: 2607:f8b0::/32(-2.14), asn: 15169(-1.87), country: US(-0.05)] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 02:39:24 -0000 Thank you to everyone involved. This will make a lot of MI code much simpler. Jeff On Thu, 2 Jan 2020, Brandon Bergren wrote: > Author: bdragon > Date: Thu Jan 2 23:20:37 2020 > New Revision: 356308 > URL: https://svnweb.freebsd.org/changeset/base/356308 > > Log: > [PowerPC] [MIPS] Implement 32-bit kernel emulation of atomic64 operations > > This is a lock-based emulation of 64-bit atomics for kernel use, split off > from an earlier patch by jhibbits. > > This is needed to unblock future improvements that reduce the need for > locking on 64-bit platforms by using atomic updates. > > The implementation allows for future integration with userland atomic64, > but as that implies going through sysarch for every use, the current > status quo of userland doing its own locking may be for the best. > > Submitted by: jhibbits (original patch), kevans (mips bits) > Reviewed by: jhibbits, jeff, kevans > Differential Revision: https://reviews.freebsd.org/D22976 > > Added: > head/sys/kern/subr_atomic64.c (contents, props changed) > head/sys/sys/_atomic64e.h (contents, props changed) > Modified: > head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c > head/sys/cddl/compat/opensolaris/sys/atomic.h > head/sys/conf/files.mips > head/sys/conf/files.powerpc > head/sys/mips/include/atomic.h > head/sys/powerpc/include/atomic.h > > Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c > ============================================================================== > --- head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Thu Jan 2 23:18:43 2020 (r356307) > +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Thu Jan 2 23:20:37 2020 (r356308) > @@ -33,7 +33,8 @@ __FBSDID("$FreeBSD$"); > #include > > #if !defined(__LP64__) && !defined(__mips_n32) && \ > - !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) > + !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) && \ > + !defined(HAS_EMULATED_ATOMIC64) > > #ifdef _KERNEL > #include > > Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h > ============================================================================== > --- head/sys/cddl/compat/opensolaris/sys/atomic.h Thu Jan 2 23:18:43 2020 (r356307) > +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Thu Jan 2 23:20:37 2020 (r356308) > @@ -42,7 +42,8 @@ > #endif > > #if !defined(__LP64__) && !defined(__mips_n32) && \ > - !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) > + !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) && \ > + !defined(HAS_EMULATED_ATOMIC64) > extern void atomic_add_64(volatile uint64_t *target, int64_t delta); > extern void atomic_dec_64(volatile uint64_t *target); > extern uint64_t atomic_swap_64(volatile uint64_t *a, uint64_t value); > @@ -109,7 +110,8 @@ atomic_cas_32(volatile uint32_t *target, uint32_t cmp, > #endif > > #if defined(__LP64__) || defined(__mips_n32) || \ > - defined(ARM_HAVE_ATOMIC64) || defined(I386_HAVE_ATOMIC64) > + defined(ARM_HAVE_ATOMIC64) || defined(I386_HAVE_ATOMIC64) || \ > + defined(HAS_EMULATED_ATOMIC64) > static __inline void > atomic_dec_64(volatile uint64_t *target) > { > > Modified: head/sys/conf/files.mips > ============================================================================== > --- head/sys/conf/files.mips Thu Jan 2 23:18:43 2020 (r356307) > +++ head/sys/conf/files.mips Thu Jan 2 23:20:37 2020 (r356308) > @@ -50,6 +50,7 @@ mips/mips/vm_machdep.c standard > # misc opt-in bits > kern/kern_clocksource.c standard > kern/link_elf_obj.c standard > +kern/subr_atomic64.c optional mips | mipsel | mipshf | mipselhf > kern/subr_busdma_bufalloc.c standard > kern/subr_dummy_vdso_tc.c standard > kern/subr_sfbuf.c optional mips | mipsel | mipsn32 > > Modified: head/sys/conf/files.powerpc > ============================================================================== > --- head/sys/conf/files.powerpc Thu Jan 2 23:18:43 2020 (r356307) > +++ head/sys/conf/files.powerpc Thu Jan 2 23:20:37 2020 (r356308) > @@ -76,6 +76,7 @@ dev/uart/uart_cpu_powerpc.c optional uart > dev/usb/controller/ehci_fsl.c optional ehci mpc85xx > dev/vt/hw/ofwfb/ofwfb.c optional vt aim > kern/kern_clocksource.c standard > +kern/subr_atomic64.c optional powerpc | powerpcspe > kern/subr_dummy_vdso_tc.c standard > kern/syscalls.c optional ktr > kern/subr_sfbuf.c standard > > Added: head/sys/kern/subr_atomic64.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/kern/subr_atomic64.c Thu Jan 2 23:20:37 2020 (r356308) > @@ -0,0 +1,140 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2019 Justin Hibbits > + * > + * 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$ > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include > +#include > + > +enum { > + ATOMIC64_ADD, > + ATOMIC64_CLEAR, > + ATOMIC64_CMPSET, > + ATOMIC64_FCMPSET, > + ATOMIC64_FETCHADD, > + ATOMIC64_LOAD, > + ATOMIC64_SET, > + ATOMIC64_SUBTRACT, > + ATOMIC64_STORE, > + ATOMIC64_SWAP > +}; > + > +#ifdef _KERNEL > +#define A64_POOL_SIZE MAXCPU > +/* Estimated size of a cacheline */ > +#define CACHE_ALIGN CACHE_LINE_SIZE > + > +#define GET_MUTEX(p) \ > + (&a64_mtx_pool[(pmap_kextract((vm_offset_t)p) / CACHE_ALIGN) % (A64_POOL_SIZE)]) > + > +#define LOCK_A64() \ > + struct mtx *_amtx = GET_MUTEX(p); \ > + if (smp_started) mtx_lock(_amtx) > + > +#define UNLOCK_A64() if (smp_started) mtx_unlock(_amtx) > + > +#define ATOMIC64_EMU_UN(op, rt, block, ret) \ > + rt \ > + atomic_##op##_64(volatile u_int64_t *p) { \ > + u_int64_t tmp __unused; \ > + LOCK_A64(); \ > + block; \ > + UNLOCK_A64(); \ > + ret; } struct hack > + > +#define ATOMIC64_EMU_BIN(op, rt, block, ret) \ > + rt \ > + atomic_##op##_64(volatile u_int64_t *p, u_int64_t v) { \ > + u_int64_t tmp __unused; \ > + LOCK_A64(); \ > + block; \ > + UNLOCK_A64(); \ > + ret; } struct hack > + > +static struct mtx a64_mtx_pool[A64_POOL_SIZE]; > + > +ATOMIC64_EMU_BIN(add, void, (*p = *p + v), return); > +ATOMIC64_EMU_BIN(clear, void, *p &= ~v, return); > +ATOMIC64_EMU_BIN(fetchadd, u_int64_t, (*p = *p + v, v = *p - v), return (v)); > +ATOMIC64_EMU_UN(load, u_int64_t, (tmp = *p), return (tmp)); > +ATOMIC64_EMU_BIN(set, void, *p |= v, return); > +ATOMIC64_EMU_BIN(subtract, void, (*p = *p - v), return); > +ATOMIC64_EMU_BIN(store, void, *p = v, return); > +ATOMIC64_EMU_BIN(swap, u_int64_t, tmp = *p; *p = v; v = tmp, return(v)); > + > +int atomic_cmpset_64(volatile u_int64_t *p, u_int64_t old, u_int64_t new) > +{ > + u_int64_t tmp; > + > + LOCK_A64(); > + tmp = *p; > + if (tmp == old) > + *p = new; > + UNLOCK_A64(); > + > + return (tmp == old); > +} > + > +int atomic_fcmpset_64(volatile u_int64_t *p, u_int64_t *old, u_int64_t new) > +{ > + u_int64_t tmp, tmp_old; > + > + LOCK_A64(); > + tmp = *p; > + tmp_old = *old; > + if (tmp == tmp_old) > + *p = new; > + else > + *old = tmp; > + UNLOCK_A64(); > + > + return (tmp == tmp_old); > +} > + > +static void > +atomic64_mtxinit(void *x __unused) > +{ > + int i; > + > + for (i = 0; i < A64_POOL_SIZE; i++) > + mtx_init(&a64_mtx_pool[i], "atomic64 mutex", NULL, MTX_DEF); > +} > + > +SYSINIT(atomic64_mtxinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, atomic64_mtxinit, NULL); > + > +#endif /* _KERNEL */ > > Modified: head/sys/mips/include/atomic.h > ============================================================================== > --- head/sys/mips/include/atomic.h Thu Jan 2 23:18:43 2020 (r356307) > +++ head/sys/mips/include/atomic.h Thu Jan 2 23:20:37 2020 (r356308) > @@ -38,6 +38,10 @@ > > #include > > +#if !defined(__mips_n64) && !defined(__mips_n32) > +#include > +#endif > + > /* > * Note: All the 64-bit atomic operations are only atomic when running > * in 64-bit mode. It is assumed that code compiled for n32 and n64 > > Modified: head/sys/powerpc/include/atomic.h > ============================================================================== > --- head/sys/powerpc/include/atomic.h Thu Jan 2 23:18:43 2020 (r356307) > +++ head/sys/powerpc/include/atomic.h Thu Jan 2 23:20:37 2020 (r356308) > @@ -40,6 +40,10 @@ > > #include > > +#ifndef __powerpc64__ > +#include > +#endif > + > /* > * The __ATOMIC_REL/ACQ() macros provide memory barriers only in conjunction > * with the atomic lXarx/stXcx. sequences below. They are not exposed outside > > Added: head/sys/sys/_atomic64e.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/sys/_atomic64e.h Thu Jan 2 23:20:37 2020 (r356308) > @@ -0,0 +1,80 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2019 Justin Hibbits > + * > + * 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 _SYS_ATOMIC64E_H_ > +#define _SYS_ATOMIC64E_H_ > + > +#ifndef _MACHINE_ATOMIC_H_ > +#error "This should not be included directly. Include " > +#endif > + > +#ifdef _KERNEL > +#define HAS_EMULATED_ATOMIC64 > + > +/* Emulated versions of 64-bit atomic operations. */ > + > +void atomic_add_64(volatile u_int64_t *, u_int64_t); > +#define atomic_add_acq_64 atomic_add_64 > +#define atomic_add_rel_64 atomic_add_64 > + > +int atomic_cmpset_64(volatile u_int64_t *, u_int64_t, u_int64_t); > +#define atomic_cmpset_acq_64 atomic_cmpset_64 > +#define atomic_cmpset_rel_64 atomic_cmpset_64 > + > +void atomic_clear_64(volatile u_int64_t *, u_int64_t); > +#define atomic_clear_acq_64 atomic_clear_64 > +#define atomic_clear_rel_64 atomic_clear_64 > + > +int atomic_fcmpset_64(volatile u_int64_t *, u_int64_t *, u_int64_t); > +#define atomic_fcmpset_acq_64 atomic_fcmpset_64 > +#define atomic_fcmpset_rel_64 atomic_fcmpset_64 > + > +u_int64_t atomic_fetchadd_64(volatile u_int64_t *, u_int64_t); > + > +u_int64_t atomic_load_64(volatile u_int64_t *); > +#define atomic_load_acq_64 atomic_load_64 > + > +void atomic_readandclear_64(volatile u_int64_t *); > + > +void atomic_set_64(volatile u_int64_t *, u_int64_t); > +#define atomic_set_acq_64 atomic_set_64 > +#define atomic_set_rel_64 atomic_set_64 > + > +void atomic_subtract_64(volatile u_int64_t *, u_int64_t); > +#define atomic_subtract_acq_64 atomic_subtract_64 > +#define atomic_subtract_rel_64 atomic_subtract_64 > + > +void atomic_store_64(volatile u_int64_t *, u_int64_t); > +#define atomic_store_rel_64 atomic_store_64 > + > +u_int64_t atomic_swap_64(volatile u_int64_t *, u_int64_t); > + > +#endif /* _KERNEL */ > +#endif /* _SYS_ATOMIC64E_H_ */ > From owner-svn-src-head@freebsd.org Fri Jan 3 04:37:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D6C71E5BFF; Fri, 3 Jan 2020 04:37:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47psb00Rwvz4P63; Fri, 3 Jan 2020 04:37:48 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A7F326AC5; Fri, 3 Jan 2020 04:37:48 +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 0034bl84033232; Fri, 3 Jan 2020 04:37:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0034blv7033231; Fri, 3 Jan 2020 04:37:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202001030437.0034blv7033231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 3 Jan 2020 04:37:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356315 - head/sys/dev/md X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/md X-SVN-Commit-Revision: 356315 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 04:37:48 -0000 Author: mav Date: Fri Jan 3 04:37:47 2020 New Revision: 356315 URL: https://svnweb.freebsd.org/changeset/base/356315 Log: Avoid duplicate I/O statistics accounting. Alike to geom_disk free the provider statistics structure and point GEOM toward local statistics. It allows to save some CPU time. MFC after: 2 weeks Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Fri Jan 3 01:21:15 2020 (r356314) +++ head/sys/dev/md/md.c Fri Jan 3 04:37:47 2020 (r356315) @@ -1295,6 +1295,8 @@ mdinit(struct md_s *sc) gp = g_new_geomf(&g_md_class, "md%d", sc->unit); gp->softc = sc; pp = g_new_providerf(gp, "md%d", sc->unit); + devstat_remove_entry(pp->stat); + pp->stat = NULL; pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE; pp->mediasize = sc->mediasize; pp->sectorsize = sc->sectorsize; @@ -1310,10 +1312,11 @@ mdinit(struct md_s *sc) } sc->gp = gp; sc->pp = pp; - g_error_provider(pp, 0); - g_topology_unlock(); sc->devstat = devstat_new_entry("md", sc->unit, sc->sectorsize, DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); + sc->devstat->id = pp; + g_error_provider(pp, 0); + g_topology_unlock(); } static int From owner-svn-src-head@freebsd.org Fri Jan 3 10:03:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC94C1ECF26; Fri, 3 Jan 2020 10:03:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47q0pw5ZJNz4dYB; Fri, 3 Jan 2020 10:03: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA79C2A634; Fri, 3 Jan 2020 10:03: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 003A3amh030515; Fri, 3 Jan 2020 10:03:36 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003A3akg030514; Fri, 3 Jan 2020 10:03:36 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202001031003.003A3akg030514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 3 Jan 2020 10:03:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356316 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 356316 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 10:03:36 -0000 Author: andrew Date: Fri Jan 3 10:03:36 2020 New Revision: 356316 URL: https://svnweb.freebsd.org/changeset/base/356316 Log: Add the 8 and 16 bit atomic load/store functions with a barrier on arm64. Reviewed by: cem MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22966 Modified: head/sys/arm64/include/atomic.h Modified: head/sys/arm64/include/atomic.h ============================================================================== --- head/sys/arm64/include/atomic.h Fri Jan 3 04:37:47 2020 (r356315) +++ head/sys/arm64/include/atomic.h Fri Jan 3 10:03:36 2020 (r356316) @@ -448,6 +448,34 @@ atomic_swap_64(volatile uint64_t *p, uint64_t val) return (ret); } +static __inline uint8_t +atomic_load_acq_8(volatile uint8_t *p) +{ + uint8_t ret; + + __asm __volatile( + "ldarb %w0, [%1] \n" + : "=&r" (ret) + : "r" (p) + : "memory"); + + return (ret); +} + +static __inline uint16_t +atomic_load_acq_16(volatile uint16_t *p) +{ + uint16_t ret; + + __asm __volatile( + "ldarh %w0, [%1] \n" + : "=&r" (ret) + : "r" (p) + : "memory"); + + return (ret); +} + static __inline uint32_t atomic_load_acq_32(volatile uint32_t *p) { @@ -474,6 +502,28 @@ atomic_load_acq_64(volatile uint64_t *p) : "memory"); return (ret); +} + +static __inline void +atomic_store_rel_8(volatile uint8_t *p, uint8_t val) +{ + + __asm __volatile( + "stlrb %w0, [%1] \n" + : + : "r" (val), "r" (p) + : "memory"); +} + +static __inline void +atomic_store_rel_16(volatile uint16_t *p, uint16_t val) +{ + + __asm __volatile( + "stlrh %w0, [%1] \n" + : + : "r" (val), "r" (p) + : "memory"); } static __inline void From owner-svn-src-head@freebsd.org Fri Jan 3 10:35:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 078531ED92E for ; Fri, 3 Jan 2020 10:35:04 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic301-21.consmr.mail.gq1.yahoo.com (sonic301-21.consmr.mail.gq1.yahoo.com [98.137.64.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47q1WB4zcVz3BnY for ; Fri, 3 Jan 2020 10:35:02 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: z3J9ZlUVM1lvNDj60HXH5QK4ld3yhWT2aM8Vb5abyAZ3kAeoMTehAQvTce0rQzk X8CHW3EF3c4pq1Bwdd2oIlsY_QGluHc70Nf1Kq05wBh9T38MQRV_gpiY9S_.u60X6A3xdprs_QHY IjCoNM_HuHJVoC.kWtZ8NCtxJl7kf.NGSiEVaMrMOrfKI7Lh3Sny1O.NNgOYpY8ph3rIHD9aDRHE 4AZmhEze0BCSmu0mpDLydpZuwUhztqHYy1PjiC4sUD8keM8A3h00IYa57bQSkjwFiV7aPKJS7MkE I7wa21rONO7rwLZU576xdtg9o37tbDGme0noCgW10RCKMMq3GqCVK42vMHg3Cgm8qIrDCw26zItl ttdkcDH4WtH._atN9TPQraZkfyEaCrm1h5ZdN38EIihC_PA.jOmsnQ_Fd7qbzqW3AUUgGvColUKq 7_mu.YoMJg2mYZJ370sGGWbtxfGlFEGboP3QCwHYp38BaUPtgb1nOanc4kYcFybQKUlVuI2LJnmH KrwRk3DnxSzAt1wllqsxgFjk7XAxA7k5EUYajwE3h.L5GTNVIA7NNiG8zKG2dzuYQV0gFfZimZbM Iw.KNTvBZIWI31wVxTVDlM2UQFYr0VN0.9fIDMMSLxgNHtAUDjIwF3iloMd_tbKmO_WopluzRe8. iLhkWoD.QHhhQkuAZ5SM.DJNTkcIccF_V82_nnCOaUGqxHrVvRYtlkod6qMK.AKUIihwLwAHFbO9 MC30izMAQZB2I1BdJcE4VkzEJG_EKf0KUJBOMCqfvD4cRgbBaSo7Os4DBhfTRV7liySVRFKZQg_T gSYkDCji42zEVOXJvwtMPwcu9oA4Jpd9Pxw9UyDBe4woSfi_gU_rWw..tCENRNvHU0Ym4vSan8Bk 59OwuJRN0dUOZt7eeH9vH6wzn3cqQ_QRk.BgyCpL2nRPnQuG98.yYx00hU4O8HBc3BWzJACepTlu yYMjHI9ivaI4rZZnHJsoUEHhOI7NNrZKmKKzXu8uYikIVV3KweaYfuK2qmiGUKp0ueLwYra1w37k xW2zTnBh3TSyPGrcbEYjScKWwuTIDbinKvvQB2wOIlDs6.WOoV4r416wGo60Z5nT.m_SWHjzDDVy DoKFs3E9_OH4Jm_qzB1mD4BBH_7wCP7R7mfWr.ym6WrtOM_z1DmUZAEoPrWDP_qRmjXCGC6zJVxH CZD11a88T2gUSUjSs5a4jrikIY76L5p3MV2zcpUsYmQt_fiH.K7l7qH8nVGQ6oeOgICeY_NVi7Sl LCdBDwcROl5G6jPORmPFaZiGAEILzFrRVbbACEG0J9hcP7xgW0q_F.7kRiuyZKKI2XzTeyH.M3CS PQYHBHAe5XC8.UxAzAvdMxLkS.qkerEhflBjGhkbJHZ.ZL8JHinU_y5wXWwJzkmrpC_TOqhOOotS dY7X4ooPvf2kIqwNHSHPDJO7RB1V4N574EHplXr5V Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.gq1.yahoo.com with HTTP; Fri, 3 Jan 2020 10:35:00 +0000 Received: by smtp430.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID c999ce3654d1cbc9969140fa1871acef; Fri, 03 Jan 2020 10:34:58 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: svn commit: r356289 - head Message-Id: Date: Fri, 3 Jan 2020 02:34:56 -0800 Cc: FreeBSD Toolchain To: John Baldwin , svn-src-head@freebsd.org X-Mailer: Apple Mail (2.3608.40.2.2.4) References: X-Rspamd-Queue-Id: 47q1WB4zcVz3BnY X-Spamd-Bar: - X-Spamd-Result: default: False [-1.23 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.39)[-0.389,0]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; FREEMAIL_FROM(0.00)[yahoo.com]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-0.34)[-0.337,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCVD_IN_DNSWL_NONE(0.00)[147.64.137.98.list.dnswl.org : 127.0.5.0]; RCVD_TLS_LAST(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.00)[ip: (5.65), ipnet: 98.137.64.0/21(0.88), asn: 36647(0.70), country: US(-0.05)]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 10:35:04 -0000 John Baldwin jhb at FreeBSD.org wrote on Thu Jan 2 21:41:07 UTC 2020 : > On 1/2/20 1:34 PM, John Baldwin wrote: > > Author: jhb > > Date: Thu Jan 2 21:34:44 2020 > > New Revision: 356289 > > URL: https://svnweb.freebsd.org/changeset/base/356289 > >=20 > > Log: > > Look for cross toolchain makefiles in /usr/share/toolchains. > > =20 > > The freebsd-binutils and freebsd-gcc* packages install toolchain > > makefiles to /usr/share/toolchains rather than LOCALBASE. >=20 > The short version is that you can do something like this to use GCC > as the system compiler (/usr/bin/cc): >=20 > cd /usr/ports/base/binutils ; make install clean > cd ../gcc6 ; make install clean >=20 > Then 'make CROSS_TOOLCHAIN=3Dfreebsd-gcc6 buildworld', etc. If you = aren't > planning on doing cross-builds you can set CROSS_TOOLCHAIN in = /etc/src.conf. >=20 > As described elsewhere, the base/* packages can be cross-built (along > with pkg), so for any architectures not yet using clang we could = fairly > easily provide a cross-built package repo (though that architecture = list > is becoming rather small). I will probably add a base/gcc9 port once = we > can build a full system with gcc9. Just an FYI from some experiments that I did recently: devel/binutils@powerpc and devel/binutils@powerpc64 and base/binutils@powerpc and base_binutils@powerpc64 do not put out the same content as lld or the old toolchain's ld (still used normally for 32-bit powerpc). buildkernel runs to completion but the result crashes from the kernel sseflf-loading and what was produced not matching. For example, binutils put out very few ABS symbols compared to lld/old-ld and classifies the kernel as ET_EXEC, not ET_DYN, because of the non-zero VirtAddr in: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg = Align . . . LOAD 0x000000 0x00100000 0x00100000 0xd9786c 0x1083648 RWE = 0x10000 . . . (I'm not claiming that is all there is that matters.) These points are true using system-clang as the compiler. (I've only cross-built so far.) I do not know if other architectures have similar issues or not. But, it appears that in some cases, there is more work to allowing the GNU linker to be used, for at least buildkernel . I do not know if there is an intent to support a (modern) GNU binutils ld (in addition to lld) or not. So it may be that the effort would not be put in. (I'm not claiming which side(s) would change if the effort was put in.) =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Fri Jan 3 12:54:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DAE61F1476; Fri, 3 Jan 2020 12:54:15 +0000 (UTC) (envelope-from arrowd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47q4bq3bMXz3Knb; Fri, 3 Jan 2020 12:54:15 +0000 (UTC) (envelope-from arrowd@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7683A2C543; Fri, 3 Jan 2020 12:54:15 +0000 (UTC) (envelope-from arrowd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 003CsFcj032508; Fri, 3 Jan 2020 12:54:15 GMT (envelope-from arrowd@FreeBSD.org) Received: (from arrowd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003CsFRH032507; Fri, 3 Jan 2020 12:54:15 GMT (envelope-from arrowd@FreeBSD.org) Message-Id: <202001031254.003CsFRH032507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arrowd set sender to arrowd@FreeBSD.org using -f From: Gleb Popov Date: Fri, 3 Jan 2020 12:54:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356317 - head/contrib/smbfs/lib/smb X-SVN-Group: head X-SVN-Commit-Author: arrowd X-SVN-Commit-Paths: head/contrib/smbfs/lib/smb X-SVN-Commit-Revision: 356317 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 12:54:15 -0000 Author: arrowd (ports committer) Date: Fri Jan 3 12:54:14 2020 New Revision: 356317 URL: https://svnweb.freebsd.org/changeset/base/356317 Log: mount_smbfs: Issue a warning when .nsmbrc section name contains lowercase characters. PR: 231656 Approved by: bapt MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D22289 Modified: head/contrib/smbfs/lib/smb/rcfile.c Modified: head/contrib/smbfs/lib/smb/rcfile.c ============================================================================== --- head/contrib/smbfs/lib/smb/rcfile.c Fri Jan 3 10:03:36 2020 (r356316) +++ head/contrib/smbfs/lib/smb/rcfile.c Fri Jan 3 12:54:14 2020 (r356317) @@ -156,11 +156,19 @@ static struct rcsection * rc_addsect(struct rcfile *rcp, const char *sectname) { struct rcsection *p; + const char* sectletter = sectname; p = rc_findsect(rcp, sectname); if (p) return p; p = malloc(sizeof(*p)); if (!p) return NULL; + for(sectletter = sectname; *sectletter; sectletter++) { + if (islower(*sectletter)) { + if (strcmp(sectname, "default")) + dprintf(STDERR_FILENO, "warning: section name [%s] contains lower-case letters\n", sectname); + break; + } + } p->rs_name = strdup(sectname); SLIST_INIT(&p->rs_keys); SLIST_INSERT_HEAD(&rcp->rf_sect, p, rs_next); From owner-svn-src-head@freebsd.org Fri Jan 3 15:29:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 081901F3F58; Fri, 3 Jan 2020 15:29:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47q8305wbfz3xjg; Fri, 3 Jan 2020 15:29:32 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C24482E10A; Fri, 3 Jan 2020 15:29:32 +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 003FTWo2022581; Fri, 3 Jan 2020 15:29:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003FTW2L022580; Fri, 3 Jan 2020 15:29:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202001031529.003FTW2L022580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 3 Jan 2020 15:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356318 - head/usr.sbin/inetd X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/inetd X-SVN-Commit-Revision: 356318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 15:29:33 -0000 Author: emaste Date: Fri Jan 3 15:29:32 2020 New Revision: 356318 URL: https://svnweb.freebsd.org/changeset/base/356318 Log: inetd: fix WITHOUT_TCP_WRAPPERS build after r356248 After increasing WARNS, building WITHOUT_TCP_WRAPPERS failed because of some unused variables. Reported by: Cirrus-CI (against my WIP branch) MFC with: r356248 Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/inetd/inetd.c Modified: head/usr.sbin/inetd/inetd.c ============================================================================== --- head/usr.sbin/inetd/inetd.c Fri Jan 3 12:54:14 2020 (r356317) +++ head/usr.sbin/inetd/inetd.c Fri Jan 3 15:29:32 2020 (r356318) @@ -250,9 +250,11 @@ static char *sskip(char **); static char *newstr(const char *); static void print_service(const char *, const struct servtab *); +#ifdef LIBWRAP /* tcpd.h */ int allow_severity; int deny_severity; +#endif static int wrap_ex = 0; static int wrap_bi = 0; From owner-svn-src-head@freebsd.org Fri Jan 3 16:06:42 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26D831F49CF; Fri, 3 Jan 2020 16:06:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47q8st0DFLz40TV; Fri, 3 Jan 2020 16:06:42 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F17082E886; Fri, 3 Jan 2020 16:06:41 +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 003G6fD7045981; Fri, 3 Jan 2020 16:06:41 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003G6fIM045980; Fri, 3 Jan 2020 16:06:41 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202001031606.003G6fIM045980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 3 Jan 2020 16:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356319 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 356319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 16:06:42 -0000 Author: emaste Date: Fri Jan 3 16:06:41 2020 New Revision: 356319 URL: https://svnweb.freebsd.org/changeset/base/356319 Log: src.opts.mk: simplify after arm/arm retirement There were a few special cases for arm v5, such as disabling LLDB due to the lack of 64-bit atomic operations. Now that arm has been retired (as of r356263) we can simplify the options logic somewhat. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Jan 3 15:29:32 2020 (r356318) +++ head/share/mk/src.opts.mk Fri Jan 3 16:06:41 2020 (r356319) @@ -285,10 +285,6 @@ __LLVM_TARGET_FILT= C/(amd64|i386)/x86/:S/sparc64/spar # Default enable the given TARGET's LLVM_TARGET support .if ${__TT:${__LLVM_TARGET_FILT}} == ${__llt} __DEFAULT_YES_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu} -# Disable other targets for arm, to work around "relocation truncated -# to fit" errors with BFD ld, since libllvm.a will get too large to link. -.elif ${__T} == "arm" -__DEFAULT_NO_OPTIONS+=LLVM_TARGET_${__llt:tu} # aarch64 needs arm for -m32 support. .elif ${__TT} == "arm64" && ${__llt} == "arm" __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_ARM/LLVM_TARGET_AARCH64 @@ -328,8 +324,7 @@ BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BO .if ${__T:Mriscv*} != "" BROKEN_OPTIONS+=OFED .endif -.if ${__T} != "arm" && ${__T} != "armv6" && ${__T} != "armv7" && \ - ${__T} != "sparc64" +.if ${__T} != "armv6" && ${__T} != "armv7" && ${__T} != "sparc64" __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND .else __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND @@ -344,10 +339,6 @@ __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD __DEFAULT_YES_OPTIONS+=LLDB .else __DEFAULT_NO_OPTIONS+=LLDB -.endif -# LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5 -.if ${__T} == "arm" -BROKEN_OPTIONS+=LLDB .endif # GDB in base is generally less functional than GDB in ports. Ports GDB # sparc64 kernel support has not been tested. From owner-svn-src-head@freebsd.org Fri Jan 3 16:28:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB8061F4E49; Fri, 3 Jan 2020 16:28:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47q9Lh49l0z41NS; Fri, 3 Jan 2020 16:28:12 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 621CA2EC25; Fri, 3 Jan 2020 16:28:11 +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 003GSBVi058199; Fri, 3 Jan 2020 16:28:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003GSBUl058198; Fri, 3 Jan 2020 16:28:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202001031628.003GSBUl058198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 3 Jan 2020 16:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356320 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 356320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 16:28:12 -0000 Author: emaste Date: Fri Jan 3 16:28:10 2020 New Revision: 356320 URL: https://svnweb.freebsd.org/changeset/base/356320 Log: src.opts.mk: switch LLD_BOOTSTRAP and LLD_IS_LD to opt-out More MACHINE_CPUARCH/MACHINE_ARCH cases enable these options than disable them, and several of them have work in progress to switch over. Thus, invert the sense of the test and list cases not using LLD as the exceptions. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Jan 3 16:06:41 2020 (r356319) +++ head/share/mk/src.opts.mk Fri Jan 3 16:28:10 2020 (r356320) @@ -329,8 +329,8 @@ __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND .else __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif -.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "armv6" || \ - ${__T} == "armv7" || ${__T} == "i386" || ${__T} == "powerpc64" +.if ${__TT} != "mips" && ${__T} != "powerpc" && ${__T} != "powerpcspe" && \ + ${__TT} != "riscv" && ${__T} != "sparc64" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .else __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD From owner-svn-src-head@freebsd.org Fri Jan 3 17:03:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CF811F599E; Fri, 3 Jan 2020 17:03:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qB73393Sz43c4; Fri, 3 Jan 2020 17:03:11 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6796B2F426; Fri, 3 Jan 2020 17:03:11 +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 003H3BBe082039; Fri, 3 Jan 2020 17:03:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003H3BE7082038; Fri, 3 Jan 2020 17:03:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202001031703.003H3BE7082038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 3 Jan 2020 17:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356321 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 356321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 17:03:11 -0000 Author: markj Date: Fri Jan 3 17:03:10 2020 New Revision: 356321 URL: https://svnweb.freebsd.org/changeset/base/356321 Log: Take the ifnet's address lock in igmp_v3_cancel_link_timers(). inm_rele_locked() may remove the multicast address associated with inm. Reported by: syzbot+871c5d1fd5fac6c28f52@syzkaller.appspotmail.com Reviewed by: hselasky MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23009 Modified: head/sys/netinet/igmp.c Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Fri Jan 3 16:28:10 2020 (r356320) +++ head/sys/netinet/igmp.c Fri Jan 3 17:03:10 2020 (r356321) @@ -1981,7 +1981,7 @@ igmp_set_version(struct igmp_ifsoftc *igi, const int v static void igmp_v3_cancel_link_timers(struct igmp_ifsoftc *igi) { - struct ifmultiaddr *ifma; + struct ifmultiaddr *ifma, *ifmatmp; struct ifnet *ifp; struct in_multi *inm; struct in_multi_head inm_free_tmp; @@ -2007,7 +2007,8 @@ igmp_v3_cancel_link_timers(struct igmp_ifsoftc *igi) * for all memberships scoped to this link. */ ifp = igi->igi_ifp; - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + IF_ADDR_WLOCK(ifp); + CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, ifmatmp) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; @@ -2051,6 +2052,7 @@ igmp_v3_cancel_link_timers(struct igmp_ifsoftc *igi) inm->inm_timer = 0; mbufq_drain(&inm->inm_scq); } + IF_ADDR_WUNLOCK(ifp); inm_release_list_deferred(&inm_free_tmp); } From owner-svn-src-head@freebsd.org Fri Jan 3 17:26:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16E281F60AC; Fri, 3 Jan 2020 17:26:37 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (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 47qBf36bz0z44r4; Fri, 3 Jan 2020 17:26:35 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id EE9243C0199; Fri, 3 Jan 2020 17:26:34 +0000 (UTC) Date: Fri, 3 Jan 2020 17:26:34 +0000 From: Brooks Davis To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r356108 - head/sys/geom/vinum Message-ID: <20200103172634.GI91104@spindle.one-eyed-alien.net> References: <201912270136.xBR1aruf065831@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="neYutvxvOLaeuPCA" Content-Disposition: inline In-Reply-To: <201912270136.xBR1aruf065831@repo.freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 47qBf36bz0z44r4 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-6.52 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-3.62)[ip: (-9.48), ipnet: 199.48.128.0/22(-4.73), asn: 36236(-3.84), country: US(-0.05)]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 17:26:37 -0000 --neYutvxvOLaeuPCA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 27, 2019 at 01:36:53AM +0000, Alexander Motin wrote: > Author: mav > Date: Fri Dec 27 01:36:53 2019 > New Revision: 356108 > URL: https://svnweb.freebsd.org/changeset/base/356108 >=20 > Log: > Reimplement gvinum orphanization. > =20 > gvinum was the only GEOM class, using consumer nstart/nend fields. Maki= ng > it do its own accounting for orphanization purposes allows in perspecti= ve > to remove burden of that expensive for SMP accounting from GEOM. > =20 > Also the previous implementation spinned in a tight event loop, waiting > for all active BIOs to complete, while the new one knows exactly when it > is possible to close the consumer. Do you know if there are other cases of gvinum being a weird GEOM class? If it's going to require more rounds of major refactoring, maybe we should look into deprecating it for 14. -- Brooks --neYutvxvOLaeuPCA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJeD3lKAAoJEKzQXbSebgfAkyIH/0kUhBfE23sEEd+7NGkySTTX xBKK+WqgMLVUb6AUscJjbxTbbUAaYPL1c1tmJKIvWvEbdHAzOlwV9H+ySprAeCkS w24vHYKfTtEg2z0aClFk6S8UPM1xMMXle6jwkjgkGQamsO+NmU8i0/bGktvZrojW 3+6/sZ3hxxLuIZhXg+OTF//AambbH5+4JOsaFuup0RD/AlQnt3XlVGxtl2MMsKyd JKZAfIOe7a8nkHH9KqhgtYqdhAb90aTKaUS7duiQ/ghyPGx4KooNSJEvxkGBQUz+ LoY452pB0p517vVMx2eDE54aEHw/lz3KFXQ+juCF3+J+x8WzcRVUtZJK26Ej6ZY= =KiDG -----END PGP SIGNATURE----- --neYutvxvOLaeuPCA-- From owner-svn-src-head@freebsd.org Fri Jan 3 17:40:25 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD2631F65B3; Fri, 3 Jan 2020 17:40:25 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (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 47qBy10sVyz45XZ; Fri, 3 Jan 2020 17:40:25 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 4B9AF3C0199; Fri, 3 Jan 2020 17:40:24 +0000 (UTC) Date: Fri, 3 Jan 2020 17:40:24 +0000 From: Brooks Davis To: Justin Hibbits Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r356113 - in head: libexec/rtld-elf sys/kern sys/sys Message-ID: <20200103174024.GJ91104@spindle.one-eyed-alien.net> References: <201912270407.xBR473Zh054687@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/e2eDi0V/xtL+Mc8" Content-Disposition: inline In-Reply-To: <201912270407.xBR473Zh054687@repo.freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 47qBy10sVyz45XZ X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-6.52 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[freebsd.org]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-3.62)[ip: (-9.49), ipnet: 199.48.128.0/22(-4.73), asn: 36236(-3.84), country: US(-0.05)]; R_SPF_NA(0.00)[]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 17:40:25 -0000 --/e2eDi0V/xtL+Mc8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 27, 2019 at 04:07:03AM +0000, Justin Hibbits wrote: > Author: jhibbits > Date: Fri Dec 27 04:07:03 2019 > New Revision: 356113 > URL: https://svnweb.freebsd.org/changeset/base/356113 >=20 > Log: > Eliminate the last MI difference in AT_* definitions (for powerpc). > =20 > Summary: > As a transition aide, implement an alternative elfN_freebsd_fixup which > is called for old powerpc binaries. Similarly, add a translation to rt= ld to > convert old values to new ones (as expected by a new rtld). > =20 > Translation of old<->new values is incomplete, but sufficient to allow= an > installworld of a new userspace from an old one when a new kernel is ru= nning. Thanks! I glad you could arrange to combine flagdays. A bit of background for those following along: once upon a time we followed other platforms (Linux, Solaris, etc) and made the AT_* macro values machine-dependent and took the actual values from those platforms. We then started adding FreeBSD specific values so our lists didn't match other OSes. This lead to almost-but-no-quite identical values between architectures that didn't provide compatibility with other OSes. John Baldwin started cleaning them up and I centralized the definitions, but powerpc had some critical values that were not identical, this change fixes that with a binary flagday. Thanks to Brandon Bergren for testing and providing the missing rtld compatibility. -- Brooks --/e2eDi0V/xtL+Mc8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJeD3yHAAoJEKzQXbSebgfARsQH/iSKnnsI37F9A7lqg8/OCB+I Tz97Gkq62UDFHC9aTwsdpI9X3CuU8yEWw3Kjjwn4AhvLZ67q0JxPyU62hBmTTniY XAtsiBTSsNO0fhbZbLvMOG60ezXfbXFCFuabVGYkxJoBBtSuLMDr2qYfKyfs1lte eREZ8ZQ2GN/Py4j081YLPCMue4MarnPzh4buLtV6JTxC8RVSdTFWSQQdgieg6Cwr T6maFADcMDF7btmc/KgCvuTK0RYN1em9Qubsp9r8fmBmMNXrdlw+vGUgNRxZZNtz k2OgxgErBJ80kNYStzk6O9MCK5Os41Ld40rNgfDn5FHUtU+c9Z3PnpbBPWFozkk= =DMgX -----END PGP SIGNATURE----- --/e2eDi0V/xtL+Mc8-- From owner-svn-src-head@freebsd.org Fri Jan 3 17:50:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABEC11F691E; Fri, 3 Jan 2020 17:50:17 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yw1-xc29.google.com (mail-yw1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qC9N3gHSz46Js; Fri, 3 Jan 2020 17:50:16 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yw1-xc29.google.com with SMTP id b186so18843979ywc.1; Fri, 03 Jan 2020 09:50:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Am7rIcCl271IOuoM5jzfeQdc/I4Y1YZKOOrxnBeJSTs=; b=YzUD62OHMZVC3viMQ34/tDiKIbnUOPulCv+4qT+qtWcLzThxO/tzsdcsEwczMNzFF4 W3tw/dG/dgYUO9+EG+VX8eo5udjLVqPl4t0pMyT0bPUVIwIvCXI5DHDv1VdXZGEem/Dq RMFfOB58cLrjmrjSYyrBIdb+HXIUdOviEe3ecaeB6ijEJEmFS3PkOCUizmFbX/kZoDbf LxRrjL4TZAS5Wkdw1d2hSEmV0G/dZiX9iNVESQWTrdz5iagH5B4kZh7kTUFX1KjDUvI6 7f6lj1UxIYPm0bEZDaA+YErjHdLofYlmyrIGL+suQQ0013JCRgvFfP33VKHh7LUGSN5I jRPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Am7rIcCl271IOuoM5jzfeQdc/I4Y1YZKOOrxnBeJSTs=; b=iN4lVTRPIxRlj+HgpKzw9Rnmu7+uXa4/m8dZzLHEzBq2wTIQ2CdLYtIDuM8CAbuKA/ RTcgJB+W42YJLBfd66FGIkHDnb2nj70Yodrcs/zAdqYpJJ7+sT3cheBpw3dax9Y0B524 +ahQ6JwtIFYxPqi7yMvik5jdLt0hSqTDJlALdQwCq0FvMcrjtzeW8uz26a2S/XWq2TyR Up3l2fxUJM2geB5LOggMvGt6y042diS8lg18KH8LnBAirPFqdO5TE50uLC6Yiyf38OT3 49rKXE+JcXI1vEZJYkbui+zpQRthStB121m7iD3SFLtskc5i3QUoI8crCAthOIGo1GPb zzeA== X-Gm-Message-State: APjAAAUhxhGFPF98MrJkwiNyvXdqjmuzwUhdCCd2Ayb+qcrwWpwCCRNr 0VJIRsM8389rd6OLq8BKXHtuXX3U X-Google-Smtp-Source: APXvYqzvuQLC3TwhocLaNITWRAk/t7VMPavFM4yDpFD1w9m0FV9Oh3vwSXS9J7W2+oBUqs/14TTabw== X-Received: by 2002:a0d:eb88:: with SMTP id u130mr67197964ywe.326.1578073815046; Fri, 03 Jan 2020 09:50:15 -0800 (PST) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id q185sm23971169ywh.61.2020.01.03.09.50.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Jan 2020 09:50:14 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r356108 - head/sys/geom/vinum To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912270136.xBR1aruf065831@repo.freebsd.org> <20200103172634.GI91104@spindle.one-eyed-alien.net> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: Date: Fri, 3 Jan 2020 12:50:09 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20200103172634.GI91104@spindle.one-eyed-alien.net> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 47qC9N3gHSz46Js X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=YzUD62OH; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::c29 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-4.86 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.66)[ip: (-9.23), ipnet: 2607:f8b0::/32(-2.14), asn: 15169(-1.86), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[9.2.c.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 17:50:17 -0000 On 03.01.2020 12:26, Brooks Davis wrote: > On Fri, Dec 27, 2019 at 01:36:53AM +0000, Alexander Motin wrote: >> Author: mav >> Date: Fri Dec 27 01:36:53 2019 >> New Revision: 356108 >> URL: https://svnweb.freebsd.org/changeset/base/356108 >> >> Log: >> Reimplement gvinum orphanization. >> >> gvinum was the only GEOM class, using consumer nstart/nend fields. Making >> it do its own accounting for orphanization purposes allows in perspective >> to remove burden of that expensive for SMP accounting from GEOM. >> >> Also the previous implementation spinned in a tight event loop, waiting >> for all active BIOs to complete, while the new one knows exactly when it >> is possible to close the consumer. > > Do you know if there are other cases of gvinum being a weird GEOM class? > If it's going to require more rounds of major refactoring, maybe we > should look into deprecating it for 14. I've never used it myself, so may not know all of its issues. From what I briefly saw I have no other major objections about its code quality, other than it probably being not very fast, considering it is single-threaded and does not support unmapped I/O. It does not support resize, but not sure it is a big issue for its use case. But mostly the same, just a bit lighter, I can say about graid too, so gvinum does not look particularly bad for me, other than unlike graid I don't have any specific use case for it. -- Alexander Motin From owner-svn-src-head@freebsd.org Fri Jan 3 18:11:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AC661D0CBA; Fri, 3 Jan 2020 18:11:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qCfN1Vqpz482d; Fri, 3 Jan 2020 18:11:56 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CD01204; Fri, 3 Jan 2020 18:11:56 +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 003IBt3p019823; Fri, 3 Jan 2020 18:11:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003IBtqt019822; Fri, 3 Jan 2020 18:11:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202001031811.003IBtqt019822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 3 Jan 2020 18:11:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356322 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 356322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 18:11:56 -0000 Author: emaste Date: Fri Jan 3 18:11:55 2020 New Revision: 356322 URL: https://svnweb.freebsd.org/changeset/base/356322 Log: src.opts.mk: GOOGLETEST requires CXX Reported by: Build Options Survey run by Michael Dexter Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Jan 3 17:03:10 2020 (r356321) +++ head/share/mk/src.opts.mk Fri Jan 3 18:11:55 2020 (r356322) @@ -476,6 +476,7 @@ MK_KERBEROS:= no .if ${MK_CXX} == "no" MK_CLANG:= no MK_GNUCXX:= no +MK_GOOGLETEST:= no MK_TESTS:= no .endif From owner-svn-src-head@freebsd.org Fri Jan 3 18:20:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEBF91D429A; Fri, 3 Jan 2020 18:20:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qCql4hctz49LV; Fri, 3 Jan 2020 18:20:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 979B6253; Fri, 3 Jan 2020 18:20:03 +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 003IK3Tx024040; Fri, 3 Jan 2020 18:20:03 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003IK3En024039; Fri, 3 Jan 2020 18:20:03 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202001031820.003IK3En024039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 3 Jan 2020 18:20:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356323 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 356323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 18:20:04 -0000 Author: emaste Date: Fri Jan 3 18:20:03 2020 New Revision: 356323 URL: https://svnweb.freebsd.org/changeset/base/356323 Log: src.opts.mk: SVNLITE requires FILE Reported by: Build Options Survey run by Michael Dexter Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Jan 3 18:11:55 2020 (r356322) +++ head/share/mk/src.opts.mk Fri Jan 3 18:20:03 2020 (r356323) @@ -484,6 +484,10 @@ MK_TESTS:= no MK_BSDINSTALL:= no .endif +.if ${MK_FILE} == "no" +MK_SVNLITE:= no +.endif + .if ${MK_MAIL} == "no" MK_MAILWRAPPER:= no MK_SENDMAIL:= no From owner-svn-src-head@freebsd.org Fri Jan 3 18:21:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E3501D47D2; Fri, 3 Jan 2020 18:21:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qCrs10kJz49cG; Fri, 3 Jan 2020 18:21:01 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DB30276; Fri, 3 Jan 2020 18:21:01 +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 003IL0KV024768; Fri, 3 Jan 2020 18:21:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003IL0BE024767; Fri, 3 Jan 2020 18:21:00 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202001031821.003IL0BE024767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 3 Jan 2020 18:21:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356324 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 356324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 18:21:01 -0000 Author: emaste Date: Fri Jan 3 18:21:00 2020 New Revision: 356324 URL: https://svnweb.freebsd.org/changeset/base/356324 Log: src.conf.5: regen after r356322 and r356323 For SVNLITE dependency on FILE and GOOGLETEST dependency on CXX. Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Fri Jan 3 18:20:03 2020 (r356323) +++ head/share/man/man5/src.conf.5 Fri Jan 3 18:21:00 2020 (r356324) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd December 28, 2019 +.Dd January 3, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -524,6 +524,8 @@ When set, it enforces these options: .It .Va WITHOUT_GNUCXX .It +.Va WITHOUT_GOOGLETEST +.It .Va WITHOUT_LLVM_COV .It .Va WITHOUT_TESTS @@ -686,6 +688,12 @@ This includes the device tree compiler (dtc) and libfd Set to not build .Xr file 1 and related programs. +When set, it enforces these options: +.Pp +.Bl -item -compact +.It +.Va WITHOUT_SVNLITE +.El .It Va WITHOUT_FINGER Set to not build or install .Xr finger 1 From owner-svn-src-head@freebsd.org Fri Jan 3 18:29:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 876071D81A2; Fri, 3 Jan 2020 18:29:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qD2T24SVz4Bgy; Fri, 3 Jan 2020 18:29:21 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D4C6425; Fri, 3 Jan 2020 18:29:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 003ITLjA029913; Fri, 3 Jan 2020 18:29:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003ITL6K029912; Fri, 3 Jan 2020 18:29:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001031829.003ITL6K029912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 3 Jan 2020 18:29:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356325 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 356325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 18:29:21 -0000 Author: kevans Date: Fri Jan 3 18:29:20 2020 New Revision: 356325 URL: https://svnweb.freebsd.org/changeset/base/356325 Log: emulated atomic64: disable interrupts as the lock mechanism on !SMP Reviewed by: jhibbits, bdragon Differential Revision: https://reviews.freebsd.org/D23015 Modified: head/sys/kern/subr_atomic64.c Modified: head/sys/kern/subr_atomic64.c ============================================================================== --- head/sys/kern/subr_atomic64.c Fri Jan 3 18:21:00 2020 (r356324) +++ head/sys/kern/subr_atomic64.c Fri Jan 3 18:29:20 2020 (r356325) @@ -55,9 +55,12 @@ enum { }; #ifdef _KERNEL +#ifdef SMP + #define A64_POOL_SIZE MAXCPU /* Estimated size of a cacheline */ #define CACHE_ALIGN CACHE_LINE_SIZE +static struct mtx a64_mtx_pool[A64_POOL_SIZE]; #define GET_MUTEX(p) \ (&a64_mtx_pool[(pmap_kextract((vm_offset_t)p) / CACHE_ALIGN) % (A64_POOL_SIZE)]) @@ -68,6 +71,13 @@ enum { #define UNLOCK_A64() if (smp_started) mtx_unlock(_amtx) +#else /* !SMP */ + +#define LOCK_A64() { register_t s = intr_disable() +#define UNLOCK_A64() intr_restore(s); } + +#endif /* SMP */ + #define ATOMIC64_EMU_UN(op, rt, block, ret) \ rt \ atomic_##op##_64(volatile u_int64_t *p) { \ @@ -86,8 +96,6 @@ enum { UNLOCK_A64(); \ ret; } struct hack -static struct mtx a64_mtx_pool[A64_POOL_SIZE]; - ATOMIC64_EMU_BIN(add, void, (*p = *p + v), return); ATOMIC64_EMU_BIN(clear, void, *p &= ~v, return); ATOMIC64_EMU_BIN(fetchadd, u_int64_t, (*p = *p + v, v = *p - v), return (v)); @@ -126,6 +134,7 @@ int atomic_fcmpset_64(volatile u_int64_t *p, u_int64_t return (tmp == tmp_old); } +#ifdef SMP static void atomic64_mtxinit(void *x __unused) { @@ -136,5 +145,6 @@ atomic64_mtxinit(void *x __unused) } SYSINIT(atomic64_mtxinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, atomic64_mtxinit, NULL); +#endif /* SMP */ #endif /* _KERNEL */ From owner-svn-src-head@freebsd.org Fri Jan 3 18:48:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A48ED1DA3D4; Fri, 3 Jan 2020 18:48:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qDT13ysXz4CkW; Fri, 3 Jan 2020 18:48:53 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 836CA7FC; Fri, 3 Jan 2020 18:48:53 +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 003Imr3Z041911; Fri, 3 Jan 2020 18:48:53 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003ImrTs041910; Fri, 3 Jan 2020 18:48:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202001031848.003ImrTs041910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 3 Jan 2020 18:48:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356326 - head/sys/dev/md X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/md X-SVN-Commit-Revision: 356326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 18:48:53 -0000 Author: markj Date: Fri Jan 3 18:48:53 2020 New Revision: 356326 URL: https://svnweb.freebsd.org/changeset/base/356326 Log: Fix a page leak in the md(4) swap I/O path. r356147 removed a vm_page_activate() call, but this is required to ensure that pages end up in the page queues in the first place. Restore the pre-r356157 logic. Now, without the page lock, the vm_page_active() check is racy, but this race is harmless. Reviewed by: alc, kib Reported and tested by: pho Differential Revision: https://reviews.freebsd.org/D23024 Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Fri Jan 3 18:29:20 2020 (r356325) +++ head/sys/dev/md/md.c Fri Jan 3 18:48:53 2020 (r356326) @@ -1142,7 +1142,16 @@ mdstart_swap(struct md_s *sc, struct bio *bp) } if (m != NULL) { vm_page_xunbusy(m); - vm_page_reference(m); + + /* + * The page may be deactivated prior to setting + * PGA_REFERENCED, but in this case it will be + * reactivated by the page daemon. + */ + if (vm_page_active(m)) + vm_page_reference(m); + else + vm_page_activate(m); } /* Actions on further pages start at offset 0 */ From owner-svn-src-head@freebsd.org Fri Jan 3 19:23:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADAFC1DD678; Fri, 3 Jan 2020 19:23:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-ua1-x930.google.com (mail-ua1-x930.google.com [IPv6:2607:f8b0:4864:20::930]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qFFN2trvz4FRS; Fri, 3 Jan 2020 19:23:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-ua1-x930.google.com with SMTP id 73so15038642uac.6; Fri, 03 Jan 2020 11:23:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uTGH3zvkTZoXlMhg/SfCFEibweYKvGdfB/cj4kRUt5Q=; b=cjt0765xBIVcp2NV9q79E2+55vM0W59LweAmXVXPo8vyA+x2a3t6ytkpjTrjTkBVHv EMLqqNU76Wtws+UO0uwXLjp2HBRccB7hhB4AWhQ+NE42xqwLs6xxhuS0k+Y8vF9LCd16 732YV5sSKUNh9RbNp80aDUJf+t9+Pxrfio/n5qJArQNK04zhrABQSeXINrI8gEm5rDgU Yj+5xzWD1mbD62ahZYb6Sz3H16KaafM0w+8urD4zVorA5GosfRNFJc+wKk6YI3gmT5Ke VkxFfuoRvTvfZ17xkqHcxxPnbIWseErUmujQ1mQpMUCSz4IJovL6qIbjDZbCeghFGBNg SXmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uTGH3zvkTZoXlMhg/SfCFEibweYKvGdfB/cj4kRUt5Q=; b=euSfYVaHjAT7OFxu7wh+leEu8qjkaq5jGMHGWJZThWyYDUPZt2Ql33qlSkGTDJkvMg wA9CbAlc4LnSw6HYrkcRWggUydLIXgy87pe2heyN23JEy9Hl2ciVvdjJIk5wfZ7VLJWm AjKV7V5o+L9hvNK3W0wvxWvQynTPRshDClk+LBxuAaOgo74XzeGXFq6Tz6ZlGuwG0j9e 6/L+VxyzoqLyCJWtG5c1zy5QJx+HwuQO7iZ2DSSGvObOX2bsg/NCNtSld2IjQWTcBqrs ZDP8bf9fPu++mvCnauGAuN74VixnN3dbIqefojj9AibWLmncfZkLBNsCSTMd3mSU5K1o qvow== X-Gm-Message-State: APjAAAXg3Z7xLpI7XtVgUWP2jMZBWmcmyf+QsXhoE+yEgf9qhWOiynqj UTqLeTCZp3ze8GspvtoSfOjlSrSigqzBF6aNO4WD9g== X-Google-Smtp-Source: APXvYqxx4/byJp1/YK016o3d/ViV5eTcwtEgP+tp3rV1ViTzTVZZAG9ZqSAAE1iTvvniPNEBnEpHyIocYu2CEFIlYHw= X-Received: by 2002:ab0:2b85:: with SMTP id q5mr37536624uar.24.1578079430849; Fri, 03 Jan 2020 11:23:50 -0800 (PST) MIME-Version: 1.0 References: <202001031811.003IBtqt019822@repo.freebsd.org> In-Reply-To: <202001031811.003IBtqt019822@repo.freebsd.org> From: Enji Cooper Date: Fri, 3 Jan 2020 11:23:39 -0800 Message-ID: Subject: Re: svn commit: r356322 - head/share/mk To: Ed Maste Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47qFFN2trvz4FRS X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 19:23:52 -0000 On Fri, Jan 3, 2020 at 10:12 AM Ed Maste wrote: > > Author: emaste > Date: Fri Jan 3 18:11:55 2020 > New Revision: 356322 > URL: https://svnweb.freebsd.org/changeset/base/356322 > > Log: > src.opts.mk: GOOGLETEST requires CXX > > Reported by: Build Options Survey run by Michael Dexter Thank you for doing this <3. FWIW, MK_TESTS:= no should have also covered this, but no real harm nor foul in making it explicit. -Enji From owner-svn-src-head@freebsd.org Fri Jan 3 19:59:42 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE42A1E1719; Fri, 3 Jan 2020 19:59:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qG2k4vR5z4HPT; Fri, 3 Jan 2020 19:59:42 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3A581524; Fri, 3 Jan 2020 19:59:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 003Jxg9a083926; Fri, 3 Jan 2020 19:59:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003JxgEX083925; Fri, 3 Jan 2020 19:59:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001031959.003JxgEX083925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 3 Jan 2020 19:59:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356327 - head/lib/csu/mips X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/csu/mips X-SVN-Commit-Revision: 356327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 19:59:42 -0000 Author: kevans Date: Fri Jan 3 19:59:42 2020 New Revision: 356327 URL: https://svnweb.freebsd.org/changeset/base/356327 Log: mips: csu: fix compilation w/ LLVM GCC issues the warning, but with LLVM it is fatal- no matching .cprestore with .cpload. Reserve some place on the stack and and add the proper .cprestore to pair it with. nop added in the !o32 branch to fill out delay slot instruction, just in case. Reviewed by: arichardson Differential Revision: https://reviews.freebsd.org/D21697 Modified: head/lib/csu/mips/crt.h Modified: head/lib/csu/mips/crt.h ============================================================================== --- head/lib/csu/mips/crt.h Fri Jan 3 18:48:53 2020 (r356326) +++ head/lib/csu/mips/crt.h Fri Jan 3 19:59:42 2020 (r356327) @@ -34,10 +34,14 @@ "bal 1f \n" \ "nop \n" \ "1: \n" \ - ".cpload $ra \n" \ + ".cpload $ra \n" \ + "addu $sp, $sp, -8 \n" \ ".set reorder \n" \ + ".cprestore 4 \n" \ ".local " __STRING(func) "\n" \ - "jal " __STRING(func) + "jal " __STRING(func) "\n" \ + "nop \n" \ + "addu $sp, $sp, 8 \n" #else #define INIT_CALL_SEQ(func) \ ".set noreorder \n" \ @@ -48,6 +52,7 @@ ".cpsetup $ra, $v0, 1b \n" \ ".local " __STRING(func) "\n" \ "jal " __STRING(func) + "nop \n" \ #endif #endif From owner-svn-src-head@freebsd.org Fri Jan 3 20:01:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D6311E1A81; Fri, 3 Jan 2020 20:01:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qG4x0WNlz4HqX; Fri, 3 Jan 2020 20:01:37 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CF9F1596; Fri, 3 Jan 2020 20:01:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 003K1aRl085712; Fri, 3 Jan 2020 20:01:36 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003K1aKf085711; Fri, 3 Jan 2020 20:01:36 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001032001.003K1aKf085711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 3 Jan 2020 20:01:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356328 - head/lib/csu/mips X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/csu/mips X-SVN-Commit-Revision: 356328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 20:01:37 -0000 Author: kevans Date: Fri Jan 3 20:01:36 2020 New Revision: 356328 URL: https://svnweb.freebsd.org/changeset/base/356328 Log: mips !o32: fix csu build Pointy hat to: kevans Modified: head/lib/csu/mips/crt.h Modified: head/lib/csu/mips/crt.h ============================================================================== --- head/lib/csu/mips/crt.h Fri Jan 3 19:59:42 2020 (r356327) +++ head/lib/csu/mips/crt.h Fri Jan 3 20:01:36 2020 (r356328) @@ -51,8 +51,8 @@ ".set reorder \n" \ ".cpsetup $ra, $v0, 1b \n" \ ".local " __STRING(func) "\n" \ - "jal " __STRING(func) - "nop \n" \ + "jal " __STRING(func) "\n" \ + "nop \n" #endif #endif From owner-svn-src-head@freebsd.org Fri Jan 3 20:09:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 867171E2815; Fri, 3 Jan 2020 20:09:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qGGC32j2z4JFB; Fri, 3 Jan 2020 20:09:39 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F2A01708; Fri, 3 Jan 2020 20:09:39 +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 003K9dw4090025; Fri, 3 Jan 2020 20:09:39 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003K9d0K090024; Fri, 3 Jan 2020 20:09:39 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202001032009.003K9d0K090024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 3 Jan 2020 20:09:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356329 - head/contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc X-SVN-Commit-Revision: 356329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 20:09:39 -0000 Author: dim Date: Fri Jan 3 20:09:38 2020 New Revision: 356329 URL: https://svnweb.freebsd.org/changeset/base/356329 Log: Merge commit 41449c58c from llvm git (by Roger Ferrer Ibanez): [RISCV] Fix evaluation of %pcrel_lo The following testcase function: .Lpcrel_label1: auipc a0, %pcrel_hi(other_function) addi a1, a0, %pcrel_lo(.Lpcrel_label1) .p2align 2 # Causes a new fragment to be emitted .type other_function,@function other_function: ret exposes an odd behaviour in which only the %pcrel_hi relocation is evaluated but not the %pcrel_lo. $ llvm-mc -triple riscv64 -filetype obj t.s | llvm-objdump -d -r - : file format ELF64-riscv Disassembly of section .text: 0000000000000000 function: 0: 17 05 00 00 auipc a0, 0 4: 93 05 05 00 mv a1, a0 0000000000000004: R_RISCV_PCREL_LO12_I other_function+4 0000000000000008 other_function: 8: 67 80 00 00 ret The reason seems to be that in RISCVAsmBackend::shouldForceRelocation we only consider the fragment but in RISCVMCExpr::evaluatePCRelLo we consider the section. This usually works but there are cases where the section may still be the same but the fragment may be another one. In that case we end forcing a %pcrel_lo relocation without any %pcrel_hi. This patch makes RISCVAsmBackend::shouldForceRelocation use the section, if any, to determine if the relocation must be forced or not. Differential Revision: https://reviews.llvm.org/D60657 This is a prerequisite for building and linking hard- and soft-float riscv worlds with clang and lld. Requested by: jhb MFC after: 1 week X-MFC-With: r353358 Modified: head/contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp Modified: head/contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp Fri Jan 3 20:01:36 2020 (r356328) +++ head/contrib/llvm-project/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp Fri Jan 3 20:09:38 2020 (r356329) @@ -64,10 +64,14 @@ bool RISCVAsmBackend::shouldForceRelocation(const MCAs case RISCV::fixup_riscv_tls_gd_hi20: ShouldForce = true; break; - case RISCV::fixup_riscv_pcrel_hi20: - ShouldForce = T->getValue()->findAssociatedFragment() != - Fixup.getValue()->findAssociatedFragment(); + case RISCV::fixup_riscv_pcrel_hi20: { + MCFragment *TFragment = T->getValue()->findAssociatedFragment(); + MCFragment *FixupFragment = Fixup.getValue()->findAssociatedFragment(); + assert(FixupFragment && "We should have a fragment for this fixup"); + ShouldForce = + !TFragment || TFragment->getParent() != FixupFragment->getParent(); break; + } } break; } From owner-svn-src-head@freebsd.org Fri Jan 3 20:11:41 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B0401E2FE5; Fri, 3 Jan 2020 20:11:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qGJX5snNz4Jfh; Fri, 3 Jan 2020 20:11:40 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4D7F1877; Fri, 3 Jan 2020 20:11:40 +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 003KBeJO093188; Fri, 3 Jan 2020 20:11:40 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003KBeJr093187; Fri, 3 Jan 2020 20:11:40 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202001032011.003KBeJr093187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 3 Jan 2020 20:11:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356330 - head/contrib/llvm-project/llvm/lib/Target/RISCV X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/llvm/lib/Target/RISCV X-SVN-Commit-Revision: 356330 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 20:11:41 -0000 Author: dim Date: Fri Jan 3 20:11:40 2020 New Revision: 356330 URL: https://svnweb.freebsd.org/changeset/base/356330 Log: Merge commit da7b129b1 from llvm git (by James Clarke): [RISCV] Don't force Local Exec TLS for non-PIC Summary: Forcing Local Exec TLS requires the use of copy relocations. Copy relocations need special handling in the runtime linker when being used against TLS symbols, which is present in glibc, but not in FreeBSD nor musl, and so cannot be relied upon. Moreover, copy relocations are a hack that embed the size of an object in the ABI when it otherwise wouldn't be, and break protected symbols (which are expected to be DSO local), whilst also wasting space, thus they should be avoided whenever possible. As discussed in D70398, RISC-V should move away from forcing Local Exec, and instead use Initial Exec like other targets, with possible linker relaxation to follow. The RISC-V GCC maintainers also intend to adopt this more-conventional behaviour (see https://github.com/riscv/riscv-elf-psabi-doc/issues/122). Reviewers: asb, MaskRay Reviewed By: MaskRay Subscribers: emaste, krytarowski, hiraditya, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, llvm-commits, bsdjhb Tags: #llvm Differential Revision: https://reviews.llvm.org/D70649 This is a prerequisite for building and linking hard- and soft-float riscv worlds with clang and lld. Requested by: jhb MFC after: 1 week X-MFC-With: r353358 Modified: head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp Modified: head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp Fri Jan 3 20:09:38 2020 (r356329) +++ head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp Fri Jan 3 20:11:40 2020 (r356330) @@ -570,10 +570,7 @@ SDValue RISCVTargetLowering::lowerGlobalTLSAddress(SDV int64_t Offset = N->getOffset(); MVT XLenVT = Subtarget.getXLenVT(); - // Non-PIC TLS lowering should always use the LocalExec model. - TLSModel::Model Model = isPositionIndependent() - ? getTargetMachine().getTLSModel(N->getGlobal()) - : TLSModel::LocalExec; + TLSModel::Model Model = getTargetMachine().getTLSModel(N->getGlobal()); SDValue Addr; switch (Model) { From owner-svn-src-head@freebsd.org Fri Jan 3 20:19:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DABE01E3CF3; Fri, 3 Jan 2020 20:19:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qGTK5Vchz4K4j; Fri, 3 Jan 2020 20:19:17 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B81BD18DB; Fri, 3 Jan 2020 20:19:17 +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 003KJHbg096184; Fri, 3 Jan 2020 20:19:17 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003KJHd8096183; Fri, 3 Jan 2020 20:19:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202001032019.003KJHd8096183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 3 Jan 2020 20:19:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356331 - head/contrib/llvm-project/llvm/lib/Target/RISCV X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/llvm/lib/Target/RISCV X-SVN-Commit-Revision: 356331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 20:19:17 -0000 Author: dim Date: Fri Jan 3 20:19:17 2020 New Revision: 356331 URL: https://svnweb.freebsd.org/changeset/base/356331 Log: Merge commit c6b09bff5 from llvm git (by Luís Marques): [RISCV] Fix wrong CFI directives Summary: Removes CFI CFA directives that could incorrectly propagate beyond the basic block they were inteded for. Specifically it removes the epilogue CFI directives. See the branch_and_tail_call test for an example of the issue. Should fix the stack unwinding issues caused by the incorrect directives. Reviewers: asb, lenary, shiva0217 Reviewed By: lenary Tags: #llvm Differential Revision: https://reviews.llvm.org/D69723 This is a prerequisite for building and linking hard- and soft-float riscv worlds with clang and lld. Requested by: jhb MFC after: 1 week X-MFC-With: r353358 Modified: head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp Modified: head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp Fri Jan 3 20:11:40 2020 (r356330) +++ head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp Fri Jan 3 20:19:17 2020 (r356331) @@ -205,7 +205,6 @@ void RISCVFrameLowering::emitEpilogue(MachineFunction MachineFrameInfo &MFI = MF.getFrameInfo(); auto *RVFI = MF.getInfo(); DebugLoc DL = MBBI->getDebugLoc(); - const RISCVInstrInfo *TII = STI.getInstrInfo(); unsigned FPReg = getFPReg(STI); unsigned SPReg = getSPReg(STI); @@ -226,47 +225,8 @@ void RISCVFrameLowering::emitEpilogue(MachineFunction MachineInstr::FrameDestroy); } - if (hasFP(MF)) { - // To find the instruction restoring FP from stack. - for (auto &I = LastFrameDestroy; I != MBBI; ++I) { - if (I->mayLoad() && I->getOperand(0).isReg()) { - unsigned DestReg = I->getOperand(0).getReg(); - if (DestReg == FPReg) { - // If there is frame pointer, after restoring $fp registers, we - // need adjust CFA to ($sp - FPOffset). - // Emit ".cfi_def_cfa $sp, -FPOffset" - unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa( - nullptr, RI->getDwarfRegNum(SPReg, true), -FPOffset)); - BuildMI(MBB, std::next(I), DL, - TII->get(TargetOpcode::CFI_INSTRUCTION)) - .addCFIIndex(CFIIndex); - break; - } - } - } - } - - // Add CFI directives for callee-saved registers. - const std::vector &CSI = MFI.getCalleeSavedInfo(); - // Iterate over list of callee-saved registers and emit .cfi_restore - // directives. - for (const auto &Entry : CSI) { - unsigned Reg = Entry.getReg(); - unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createRestore( - nullptr, RI->getDwarfRegNum(Reg, true))); - BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) - .addCFIIndex(CFIIndex); - } - // Deallocate stack adjustReg(MBB, MBBI, DL, SPReg, SPReg, StackSize, MachineInstr::FrameDestroy); - - // After restoring $sp, we need to adjust CFA to $(sp + 0) - // Emit ".cfi_def_cfa_offset 0" - unsigned CFIIndex = - MF.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, 0)); - BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) - .addCFIIndex(CFIIndex); } int RISCVFrameLowering::getFrameIndexReference(const MachineFunction &MF, From owner-svn-src-head@freebsd.org Fri Jan 3 20:28:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E92C1E4BC5; Fri, 3 Jan 2020 20:28:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qGgW2bv3z4KXj; Fri, 3 Jan 2020 20:28:07 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 506881AA4; Fri, 3 Jan 2020 20:28:07 +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 003KS7Un002367; Fri, 3 Jan 2020 20:28:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003KS7Qf002366; Fri, 3 Jan 2020 20:28:07 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202001032028.003KS7Qf002366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 3 Jan 2020 20:28:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356332 - head/contrib/llvm-project/llvm/lib/Target/RISCV X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/llvm/lib/Target/RISCV X-SVN-Commit-Revision: 356332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 20:28:07 -0000 Author: dim Date: Fri Jan 3 20:28:06 2020 New Revision: 356332 URL: https://svnweb.freebsd.org/changeset/base/356332 Log: Merge commit d7be3eab5 from llvm git (by Luís Marques): [RISCV] Handle fcopysign(f32, f64) and fcopysign(f64, f32) Summary: Adds tablegen patterns to explicitly handle fcopysign where the magnitude and sign arguments have different types, due to the sign value casts being removed the by DAGCombiner. Support for RV32IF follows in a separate commit. Adds tests for all relevant scenarios except RV32IF. Reviewers: lenary Reviewed By: lenary Tags: #llvm Differential Revision: https://reviews.llvm.org/D70678 This is a prerequisite for building and linking hard- and soft-float riscv worlds with clang and lld. Requested by: jhb MFC after: 1 week X-MFC-With: r353358 Modified: head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoD.td Modified: head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoD.td ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoD.td Fri Jan 3 20:19:17 2020 (r356331) +++ head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoD.td Fri Jan 3 20:28:06 2020 (r356332) @@ -231,6 +231,9 @@ def : Pat<(fabs FPR64:$rs1), (FSGNJX_D $rs1, $rs1)>; def : PatFpr64Fpr64; def : Pat<(fcopysign FPR64:$rs1, (fneg FPR64:$rs2)), (FSGNJN_D $rs1, $rs2)>; +def : Pat<(fcopysign FPR64:$rs1, FPR32:$rs2), (FSGNJ_D $rs1, (FCVT_D_S $rs2))>; +def : Pat<(fcopysign FPR32:$rs1, FPR64:$rs2), (FSGNJ_S $rs1, (FCVT_S_D $rs2, + 0b111))>; // fmadd: rs1 * rs2 + rs3 def : Pat<(fma FPR64:$rs1, FPR64:$rs2, FPR64:$rs3), From owner-svn-src-head@freebsd.org Fri Jan 3 20:29:43 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CE341E4EA2; Fri, 3 Jan 2020 20:29:43 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qGjL3z8Pz4Kgv; Fri, 3 Jan 2020 20:29:42 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f47.google.com with SMTP id c16so12655473ioh.6; Fri, 03 Jan 2020 12:29:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wvtdlUiXg+hdx0hsux/0Wk9tG7YDyen0oP3Qt2C7Nns=; b=P9uC1AS5EtX8qtABNZTHQf1d9wCj/oZ47jLqZjc4HeccDl1EJ5wGHVMYdujNdtxlFH iQuv+KQm+0vj5QtHLMZzhIfXaU+AeylvvrdE77dYxHOEANq0M0yPg2Q6oSRN/s+oEjgq 1X/SSnb3m1k0UMQXkPXeXXLBp0nKN6I5d6+XKKZPp37LqgmMR9fKZpjk85TJUXHJaRCA OXlFsCze3Xm0l5Jukl4hjx7K/hOJBNvPTjvPgZxqp+WgxSD5whbMQsuxBwAkNz+H7afI K0JO1wVQ50swHGOZEnfW/fKUQIkgGqFFnYBL52uPNYxpCyrJJPq4tcXWm/Kr9EWWq6jw nIYw== X-Gm-Message-State: APjAAAU1SlroHES3z6Y0dQnAfcCBYNtCzBkNPozIHVPGadekPpOSBkqw OZ8YZPJSHnuTzE3Y0UFUKQ1LlRQYcRb3O+SqE3qZdw== X-Google-Smtp-Source: APXvYqwTpEhrFWVRnJqvk8s4FAxdPPxWeDRb8rGOqt9b5Uan0ttpYWrfp7bYiBwjRWCJ8hNU/LiDrnyP7bu0DRhOudY= X-Received: by 2002:a6b:6712:: with SMTP id b18mr61183955ioc.256.1578083381480; Fri, 03 Jan 2020 12:29:41 -0800 (PST) MIME-Version: 1.0 References: <202001031811.003IBtqt019822@repo.freebsd.org> In-Reply-To: From: Ed Maste Date: Fri, 3 Jan 2020 15:29:29 -0500 Message-ID: Subject: Re: svn commit: r356322 - head/share/mk To: Enji Cooper Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47qGjL3z8Pz4Kgv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.47 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[47.166.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.00)[ip: (-4.98), ipnet: 209.85.128.0/17(-3.11), asn: 15169(-1.86), country: US(-0.05)]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[47.166.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 20:29:43 -0000 On Fri, 3 Jan 2020 at 14:23, Enji Cooper wrote: > > Thank you for doing this <3. FWIW, MK_TESTS:= no should have also > covered this, but no real harm nor foul in making it explicit. Hmm, it looks like MK_TESTS_SUPPORT == no turns off MK_GOOGLETEST but MK_TESTS does not. I'm happy enough if someone wants to clean this up further, but IMO it's not worth putting in a lot of effort just yet; in a few months GCC 4.2.1 and all of its build infrastructure will be out of the tree and there may be many more opportunities to simplify src.opts.mk logic. In particular all of the ${COMPILER_FEATURES:Mc++11} tests can disappear. From owner-svn-src-head@freebsd.org Fri Jan 3 20:29:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B4641E4EFD; Fri, 3 Jan 2020 20:29:55 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qGjb2hdSz4Kp9; Fri, 3 Jan 2020 20:29:55 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5306E1AA5; Fri, 3 Jan 2020 20:29:55 +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 003KTtDZ002492; Fri, 3 Jan 2020 20:29:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003KTtUL002491; Fri, 3 Jan 2020 20:29:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202001032029.003KTtUL002491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 3 Jan 2020 20:29:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356333 - head/contrib/llvm-project/lld/ELF/Arch X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/lld/ELF/Arch X-SVN-Commit-Revision: 356333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 20:29:55 -0000 Author: dim Date: Fri Jan 3 20:29:54 2020 New Revision: 356333 URL: https://svnweb.freebsd.org/changeset/base/356333 Log: Merge commit 189b7393d from llvm git (by John Baldwin): [lld][RISCV] Use an e_flags of 0 if there are only binary input files. Summary: If none of the input files are ELF object files (for example, when generating an object file from a single binary input file via "-b binary"), use a fallback value for the ELF header flags instead of crashing with an assertion failure. Reviewers: MaskRay, ruiu, espindola Reviewed By: MaskRay, ruiu Subscribers: kevans, grimar, emaste, arichardson, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, llvm-commits, jrtc27 Tags: #llvm Differential Revision: https://reviews.llvm.org/D71101 This is a prerequisite for building and linking hard- and soft-float riscv worlds with clang and lld. Requested by: jhb MFC after: 1 week X-MFC-With: r353358 Modified: head/contrib/llvm-project/lld/ELF/Arch/RISCV.cpp Modified: head/contrib/llvm-project/lld/ELF/Arch/RISCV.cpp ============================================================================== --- head/contrib/llvm-project/lld/ELF/Arch/RISCV.cpp Fri Jan 3 20:28:06 2020 (r356332) +++ head/contrib/llvm-project/lld/ELF/Arch/RISCV.cpp Fri Jan 3 20:29:54 2020 (r356333) @@ -105,7 +105,10 @@ static uint32_t getEFlags(InputFile *f) { } uint32_t RISCV::calcEFlags() const { - assert(!objectFiles.empty()); + // If there are only binary input files (from -b binary), use a + // value of 0 for the ELF header flags. + if (objectFiles.empty()) + return 0; uint32_t target = getEFlags(objectFiles.front()); From owner-svn-src-head@freebsd.org Fri Jan 3 20:32:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C4241E55F9; Fri, 3 Jan 2020 20:32:05 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qGm43Gn9z4L3t; Fri, 3 Jan 2020 20:32:04 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f44.google.com with SMTP id n21so40942820ioo.10; Fri, 03 Jan 2020 12:32:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=+CQKiNUCNmLXiSdAhZEp2QVKzvIfLFdUpjm5zp43C9I=; b=fcLx3K6Eb93C6UYSy/lvWl19pJ93ktgWhtriv906sM3b4/wcEcS+qIbOdxF6IfDNO7 wfnRWy9SrpdC2YnDstEc7HUuG9It6fBa1pdY7DUIZu9RDXobTgMjGjGUKIDTZ1UnMls5 fKggxZ6Bk7+WiOTaEM8DZh31dU0tY5pcf2/uWtkOFSrK/8TP88CipSXN2CzBTcWo8fJd WUdtcvZ/pF023t5y4GVdDSl8iUYkZRue4SEe9Yqr2aimjWAzNN4ti1TAmMD804NrtlGw g7c3EiT/KUAfm3Ve7MLCvnXzH8tGG964PBm13b21fhfPsuvEIQmhcAunMXbUkRFu2iwB NSAw== X-Gm-Message-State: APjAAAWdpajDE5TU+3cWzfNtCvc68yPUquCzG5efNMPGPSn8Y2h2IMu6 5NZToDYLpcbSl/hjoeZIOXbfpTuYOM3p+WlsrGpmiw== X-Google-Smtp-Source: APXvYqw/EOFul3WuaA7VXT4hW+1wfMm9h/eFzNOghXBg55O5bI4dRjbIwyUTMR45pt/DueZf5Grtw6s4TXJ06giWBeU= X-Received: by 2002:a6b:39d4:: with SMTP id g203mr51503975ioa.100.1578083522945; Fri, 03 Jan 2020 12:32:02 -0800 (PST) MIME-Version: 1.0 References: <202001031820.003IK3En024039@repo.freebsd.org> In-Reply-To: <202001031820.003IK3En024039@repo.freebsd.org> From: Ed Maste Date: Fri, 3 Jan 2020 15:31:50 -0500 Message-ID: Subject: Re: svn commit: r356323 - head/share/mk To: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47qGm43Gn9z4L3t X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.44 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-3.65 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-1.65)[ip: (-3.22), ipnet: 209.85.128.0/17(-3.11), asn: 15169(-1.86), country: US(-0.05)]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[44.166.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[44.166.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 20:32:05 -0000 On Fri, 3 Jan 2020 at 13:20, Ed Maste wrote: > > Author: emaste > Date: Fri Jan 3 18:20:03 2020 > New Revision: 356323 > URL: https://svnweb.freebsd.org/changeset/base/356323 > > Log: > src.opts.mk: SVNLITE requires FILE It's actually libmagic(3) that's required and not file(1), but both are controlled by the FILE knob. It may be possible to configure svnlite to optionally build without libmagic support (disabling the associated functionality) but I don't think it's worth doing this. From owner-svn-src-head@freebsd.org Fri Jan 3 21:40:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 638BC1EC47E; Fri, 3 Jan 2020 21:40:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qJH520p2z4P4R; Fri, 3 Jan 2020 21:40:33 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40249277A; Fri, 3 Jan 2020 21:40:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 003LeXQW044216; Fri, 3 Jan 2020 21:40:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003LeXT8044215; Fri, 3 Jan 2020 21:40:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001032140.003LeXT8044215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 3 Jan 2020 21:40:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356334 - head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 356334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 21:40:33 -0000 Author: kevans Date: Fri Jan 3 21:40:32 2020 New Revision: 356334 URL: https://svnweb.freebsd.org/changeset/base/356334 Log: Makefile.inc1: remove libcompiler_rt from _startup_libs libcompiler_rt is already present in _prereq_libs, which will get built just before _startup_libs and in advance of shared libc. Dedupe. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Jan 3 20:29:54 2020 (r356333) +++ head/Makefile.inc1 Fri Jan 3 21:40:32 2020 (r356334) @@ -2800,7 +2800,6 @@ _startup_libs= lib/csu .if ${MK_BSD_CRTBEGIN} == "no" _startup_libs+= gnu/lib/csu .endif -_startup_libs+= lib/libcompiler_rt _startup_libs+= lib/libc _startup_libs+= lib/libc_nonshared .if ${MK_LIBCPLUSPLUS} != "no" From owner-svn-src-head@freebsd.org Fri Jan 3 22:10:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EFA11EF2AE; Fri, 3 Jan 2020 22:10:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qJxJ2vv7z4Qc8; Fri, 3 Jan 2020 22:10:12 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F3A02D24; Fri, 3 Jan 2020 22:10:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 003MACRQ062218; Fri, 3 Jan 2020 22:10:12 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003MAC1Z062217; Fri, 3 Jan 2020 22:10:12 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202001032210.003MAC1Z062217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 3 Jan 2020 22:10:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356335 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 356335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 22:10:12 -0000 Author: mjg Date: Fri Jan 3 22:10:11 2020 New Revision: 356335 URL: https://svnweb.freebsd.org/changeset/base/356335 Log: vfs: add VOP_UNLOCK_FLAGS The flags argument from VOP_UNLOCK is about to be removed and some filesystems unlock the interlock as a convienience with it. Add a helper to retain the behavior for the few cases it is needed. Modified: head/sys/sys/vnode.h Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Fri Jan 3 21:40:32 2020 (r356334) +++ head/sys/sys/vnode.h Fri Jan 3 22:10:11 2020 (r356335) @@ -955,6 +955,21 @@ int vn_chown(struct file *fp, uid_t uid, gid_t gid, st void vn_fsid(struct vnode *vp, struct vattr *va); +#define VOP_UNLOCK_FLAGS(vp, flags) ({ \ + struct vnode *_vp = (vp); \ + int _flags = (flags); \ + int _error; \ + \ + CTASSERT(__builtin_constant_p(flags) ? \ + (flags & ~(LK_INTERLOCK | LK_RELEASE)) == 0 : 1); \ + if ((_flags & ~(LK_INTERLOCK | LK_RELEASE)) != 0) \ + panic("%s: unsupported flags %x\n", __func__, flags); \ + _error = VOP_UNLOCK(_vp, 0); \ + if (_flags & LK_INTERLOCK) \ + VI_UNLOCK(_vp); \ + _error; \ +}) + #include #define VFS_VOP_VECTOR_REGISTER(vnodeops) \ From owner-svn-src-head@freebsd.org Fri Jan 3 22:12:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47FEF1EF83B; Fri, 3 Jan 2020 22:12:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qJzt1Hbtz4Qxq; Fri, 3 Jan 2020 22:12:26 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 277EB2ED9; Fri, 3 Jan 2020 22:12:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 003MCQM3067730; Fri, 3 Jan 2020 22:12:26 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003MCP5L067726; Fri, 3 Jan 2020 22:12:25 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202001032212.003MCP5L067726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 3 Jan 2020 22:12:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356336 - head/sys/fs/unionfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/unionfs X-SVN-Commit-Revision: 356336 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 22:12:26 -0000 Author: mjg Date: Fri Jan 3 22:12:25 2020 New Revision: 356336 URL: https://svnweb.freebsd.org/changeset/base/356336 Log: unionfs: fix up VOP_UNLOCK use after flags stopped being supported For the most part the code was passing the LK_RELEASE flag. The 2 cases which did not use the VOP_UNLOCK_FLAGS macro. This fixes a panic when stacking unionfs on top of e.g., tmpfs when debug is enabled. Note there are latent bugs which prevent unionfs from working with debug regardless of this change. PR: 243064 Reported by: Mason Loring Bliss Modified: head/sys/fs/unionfs/union_subr.c head/sys/fs/unionfs/union_vfsops.c head/sys/fs/unionfs/union_vnops.c Modified: head/sys/fs/unionfs/union_subr.c ============================================================================== --- head/sys/fs/unionfs/union_subr.c Fri Jan 3 22:10:11 2020 (r356335) +++ head/sys/fs/unionfs/union_subr.c Fri Jan 3 22:12:25 2020 (r356336) @@ -361,9 +361,9 @@ unionfs_noderem(struct vnode *vp, struct thread *td) VI_UNLOCK(vp); if (lvp != NULLVP) - VOP_UNLOCK(lvp, LK_RELEASE); + VOP_UNLOCK(lvp, 0); if (uvp != NULLVP) - VOP_UNLOCK(uvp, LK_RELEASE); + VOP_UNLOCK(uvp, 0); if (dvp != NULLVP && unp->un_hash.le_prev != NULL) unionfs_rem_cached_vnode(unp, dvp); @@ -551,7 +551,7 @@ unionfs_relookup(struct vnode *dvp, struct vnode **vpp cn->cn_flags |= NOCACHE; vref(dvp); - VOP_UNLOCK(dvp, LK_RELEASE); + VOP_UNLOCK(dvp, 0); if ((error = relookup(dvp, vpp, cn))) { uma_zfree(namei_zone, cn->cn_pnbuf); @@ -961,7 +961,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct } unionfs_vn_create_on_upper_free_out1: - VOP_UNLOCK(udvp, LK_RELEASE); + VOP_UNLOCK(udvp, 0); unionfs_vn_create_on_upper_free_out2: if (cn.cn_flags & HASBUF) { Modified: head/sys/fs/unionfs/union_vfsops.c ============================================================================== --- head/sys/fs/unionfs/union_vfsops.c Fri Jan 3 22:10:11 2020 (r356335) +++ head/sys/fs/unionfs/union_vfsops.c Fri Jan 3 22:12:25 2020 (r356336) @@ -167,7 +167,7 @@ unionfs_domount(struct mount *mp) uid = va.va_uid; gid = va.va_gid; } - VOP_UNLOCK(mp->mnt_vnodecovered, LK_RELEASE); + VOP_UNLOCK(mp->mnt_vnodecovered, 0); if (error) return (error); @@ -252,7 +252,7 @@ unionfs_domount(struct mount *mp) * Save reference */ if (below) { - VOP_UNLOCK(upperrootvp, LK_RELEASE); + VOP_UNLOCK(upperrootvp, 0); vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY); ump->um_lowervp = upperrootvp; ump->um_uppervp = lowerrootvp; @@ -278,7 +278,7 @@ unionfs_domount(struct mount *mp) /* * Unlock the node */ - VOP_UNLOCK(ump->um_uppervp, LK_RELEASE); + VOP_UNLOCK(ump->um_uppervp, 0); /* * Get the unionfs root vnode. Modified: head/sys/fs/unionfs/union_vnops.c ============================================================================== --- head/sys/fs/unionfs/union_vnops.c Fri Jan 3 22:10:11 2020 (r356335) +++ head/sys/fs/unionfs/union_vnops.c Fri Jan 3 22:12:25 2020 (r356336) @@ -128,7 +128,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) if (udvp != NULLVP) { dtmpvp = udvp; if (ldvp != NULLVP) - VOP_UNLOCK(ldvp, LK_RELEASE); + VOP_UNLOCK(ldvp, 0); } else dtmpvp = ldvp; @@ -136,7 +136,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) error = VOP_LOOKUP(dtmpvp, &vp, cnp); if (dtmpvp == udvp && ldvp != NULLVP) { - VOP_UNLOCK(udvp, LK_RELEASE); + VOP_UNLOCK(udvp, 0); vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); } @@ -148,10 +148,10 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) */ if (nameiop == DELETE || nameiop == RENAME || (cnp->cn_lkflags & LK_TYPE_MASK)) - VOP_UNLOCK(vp, LK_RELEASE); + VOP_UNLOCK(vp, 0); vrele(vp); - VOP_UNLOCK(dvp, LK_RELEASE); + VOP_UNLOCK(dvp, 0); *(ap->a_vpp) = dunp->un_dvp; vref(dunp->un_dvp); @@ -188,7 +188,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) } if (nameiop == DELETE || nameiop == RENAME || (cnp->cn_lkflags & LK_TYPE_MASK)) - VOP_UNLOCK(uvp, LK_RELEASE); + VOP_UNLOCK(uvp, 0); } /* check whiteout */ @@ -232,7 +232,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) return (lerror); } if (cnp->cn_lkflags & LK_TYPE_MASK) - VOP_UNLOCK(lvp, LK_RELEASE); + VOP_UNLOCK(lvp, 0); } } @@ -267,7 +267,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) goto unionfs_lookup_out; if (LK_SHARED == (cnp->cn_lkflags & LK_TYPE_MASK)) - VOP_UNLOCK(vp, LK_RELEASE); + VOP_UNLOCK(vp, 0); if (LK_EXCLUSIVE != VOP_ISLOCKED(vp)) { vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); lockflag = 1; @@ -275,7 +275,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) error = unionfs_mkshadowdir(MOUNTTOUNIONFSMOUNT(dvp->v_mount), udvp, VTOUNIONFS(vp), cnp, td); if (lockflag != 0) - VOP_UNLOCK(vp, LK_RELEASE); + VOP_UNLOCK(vp, 0); if (error != 0) { UNIONFSDEBUG("unionfs_lookup: Unable to create shadow dir."); if ((cnp->cn_lkflags & LK_TYPE_MASK) == LK_EXCLUSIVE) @@ -372,7 +372,7 @@ unionfs_create(struct vop_create_args *ap) if (vp->v_type == VSOCK) *(ap->a_vpp) = vp; else { - VOP_UNLOCK(vp, LK_RELEASE); + VOP_UNLOCK(vp, 0); error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, curthread); vrele(vp); @@ -446,7 +446,7 @@ unionfs_mknod(struct vop_mknod_args *ap) if (vp->v_type == VSOCK) *(ap->a_vpp) = vp; else { - VOP_UNLOCK(vp, LK_RELEASE); + VOP_UNLOCK(vp, 0); error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, curthread); vrele(vp); @@ -903,7 +903,7 @@ unionfs_ioctl(struct vop_ioctl_args *ap) unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); unionfs_tryrem_node_status(unp, unsp); - VOP_UNLOCK(ap->a_vp, LK_RELEASE); + VOP_UNLOCK(ap->a_vp, 0); if (ovp == NULLVP) return (EBADF); @@ -930,7 +930,7 @@ unionfs_poll(struct vop_poll_args *ap) unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); unionfs_tryrem_node_status(unp, unsp); - VOP_UNLOCK(ap->a_vp, LK_RELEASE); + VOP_UNLOCK(ap->a_vp, 0); if (ovp == NULLVP) return (EBADF); @@ -990,7 +990,7 @@ unionfs_remove(struct vop_remove_args *ap) ump = NULL; vp = uvp = lvp = NULLVP; /* search vnode */ - VOP_UNLOCK(ap->a_vp, LK_RELEASE); + VOP_UNLOCK(ap->a_vp, 0); error = unionfs_relookup(udvp, &vp, cnp, &cn, td, cnp->cn_nameptr, strlen(cnp->cn_nameptr), DELETE); if (error != 0 && error != ENOENT) { @@ -1193,7 +1193,7 @@ unionfs_rename(struct vop_rename_args *ap) if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0) goto unionfs_rename_abort; error = unionfs_copyfile(unp, 1, fcnp->cn_cred, td); - VOP_UNLOCK(fvp, LK_RELEASE); + VOP_UNLOCK(fvp, 0); if (error != 0) goto unionfs_rename_abort; break; @@ -1201,7 +1201,7 @@ unionfs_rename(struct vop_rename_args *ap) if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0) goto unionfs_rename_abort; error = unionfs_mkshadowdir(ump, rfdvp, unp, fcnp, td); - VOP_UNLOCK(fvp, LK_RELEASE); + VOP_UNLOCK(fvp, 0); if (error != 0) goto unionfs_rename_abort; break; @@ -1258,13 +1258,13 @@ unionfs_rename(struct vop_rename_args *ap) if ((error = vn_lock(fdvp, LK_EXCLUSIVE)) != 0) goto unionfs_rename_abort; error = unionfs_relookup_for_delete(fdvp, fcnp, td); - VOP_UNLOCK(fdvp, LK_RELEASE); + VOP_UNLOCK(fdvp, 0); if (error != 0) goto unionfs_rename_abort; /* Locke of tvp is canceled in order to avoid recursive lock. */ if (tvp != NULLVP && tvp != tdvp) - VOP_UNLOCK(tvp, LK_RELEASE); + VOP_UNLOCK(tvp, 0); error = unionfs_relookup_for_rename(tdvp, tcnp, td); if (tvp != NULLVP && tvp != tdvp) vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY); @@ -1282,11 +1282,11 @@ unionfs_rename(struct vop_rename_args *ap) } if (ltdvp != NULLVP) - VOP_UNLOCK(ltdvp, LK_RELEASE); + VOP_UNLOCK(ltdvp, 0); if (tdvp != rtdvp) vrele(tdvp); if (ltvp != NULLVP) - VOP_UNLOCK(ltvp, LK_RELEASE); + VOP_UNLOCK(ltvp, 0); if (tvp != rtvp && tvp != NULLVP) { if (rtvp == NULLVP) vput(tvp); @@ -1360,7 +1360,7 @@ unionfs_mkdir(struct vop_mkdir_args *ap) } if ((error = VOP_MKDIR(udvp, &uvp, cnp, ap->a_vap)) == 0) { - VOP_UNLOCK(uvp, LK_RELEASE); + VOP_UNLOCK(uvp, 0); cnp->cn_lkflags = LK_EXCLUSIVE; error = unionfs_nodeget(ap->a_dvp->v_mount, uvp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, td); @@ -1458,7 +1458,7 @@ unionfs_symlink(struct vop_symlink_args *ap) if (udvp != NULLVP) { error = VOP_SYMLINK(udvp, &uvp, cnp, ap->a_vap, ap->a_target); if (error == 0) { - VOP_UNLOCK(uvp, LK_RELEASE); + VOP_UNLOCK(uvp, 0); cnp->cn_lkflags = LK_EXCLUSIVE; error = unionfs_nodeget(ap->a_dvp->v_mount, uvp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, td); @@ -1817,7 +1817,7 @@ static void unionfs_revlock(struct vnode *vp, int flags) { if (flags & LK_RELEASE) - VOP_UNLOCK(vp, flags); + VOP_UNLOCK_FLAGS(vp, flags); else { /* UPGRADE */ if (vn_lock(vp, flags) != 0) @@ -1849,7 +1849,7 @@ unionfs_lock(struct vop_lock1_args *ap) vp = ap->a_vp; if (LK_RELEASE == (flags & LK_TYPE_MASK) || !(flags & LK_TYPE_MASK)) - return (VOP_UNLOCK(vp, flags | LK_RELEASE)); + return (VOP_UNLOCK_FLAGS(vp, flags | LK_RELEASE)); if ((flags & LK_INTERLOCK) == 0) VI_LOCK(vp); @@ -1884,12 +1884,12 @@ unionfs_lock(struct vop_lock1_args *ap) /* Share Lock is once released and a deadlock is avoided. */ vholdnz(uvp); uhold = 1; - VOP_UNLOCK(uvp, LK_RELEASE); + VOP_UNLOCK(uvp, 0); unp = VTOUNIONFS(vp); if (unp == NULL) { /* vnode is released. */ VI_UNLOCK(vp); - VOP_UNLOCK(lvp, LK_RELEASE); + VOP_UNLOCK(lvp, 0); vdrop(uvp); return (EBUSY); } @@ -1909,7 +1909,7 @@ unionfs_lock(struct vop_lock1_args *ap) /* vnode is released. */ VI_UNLOCK(vp); if (error == 0) - VOP_UNLOCK(lvp, LK_RELEASE); + VOP_UNLOCK(lvp, 0); vdrop(lvp); if (uhold != 0) vdrop(uvp); @@ -1940,10 +1940,10 @@ unionfs_lock(struct vop_lock1_args *ap) /* vnode is released. */ VI_UNLOCK(vp); if (error == 0) - VOP_UNLOCK(uvp, LK_RELEASE); + VOP_UNLOCK(uvp, 0); vdrop(uvp); if (lvp != NULLVP) { - VOP_UNLOCK(lvp, LK_RELEASE); + VOP_UNLOCK(lvp, 0); vdrop(lvp); } return (vop_stdlock(ap)); @@ -1974,7 +1974,6 @@ static int unionfs_unlock(struct vop_unlock_args *ap) { int error; - int flags; int uhold; struct vnode *vp; struct vnode *lvp; @@ -1985,7 +1984,6 @@ unionfs_unlock(struct vop_unlock_args *ap) error = 0; uhold = 0; - flags = ap->a_flags | LK_RELEASE; vp = ap->a_vp; unp = VTOUNIONFS(vp); @@ -1996,13 +1994,13 @@ unionfs_unlock(struct vop_unlock_args *ap) if (lvp != NULLVP) { vholdnz(lvp); - error = VOP_UNLOCK(lvp, flags); + error = VOP_UNLOCK(lvp, 0); } if (error == 0 && uvp != NULLVP) { vholdnz(uvp); uhold = 1; - error = VOP_UNLOCK(uvp, flags); + error = VOP_UNLOCK(uvp, 0); } if (lvp != NULLVP) @@ -2072,7 +2070,7 @@ unionfs_advlock(struct vop_advlock_args *ap) unionfs_tryrem_node_status(unp, unsp); } - VOP_UNLOCK(vp, LK_RELEASE); + VOP_UNLOCK(vp, 0); error = VOP_ADVLOCK(uvp, ap->a_id, ap->a_op, ap->a_fl, ap->a_flags); @@ -2081,7 +2079,7 @@ unionfs_advlock(struct vop_advlock_args *ap) return error; unionfs_advlock_abort: - VOP_UNLOCK(vp, LK_RELEASE); + VOP_UNLOCK(vp, 0); UNIONFS_INTERNAL_DEBUG("unionfs_advlock: leave (%d)\n", error); From owner-svn-src-head@freebsd.org Fri Jan 3 22:30:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 520A01F0F44; Fri, 3 Jan 2020 22:30:05 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qKNF1r0qz4RXL; Fri, 3 Jan 2020 22:30:05 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DBBE30D2; Fri, 3 Jan 2020 22:30:05 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 003MU5dY074116; Fri, 3 Jan 2020 22:30:05 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003MTw9G074041; Fri, 3 Jan 2020 22:29:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202001032229.003MTw9G074041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 3 Jan 2020 22:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356337 - in head/sys: cam/ctl cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs compat/cloudabi compat/linux compat/linuxkpi/common/sr... X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: cam/ctl cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs compat/cloudabi compat/linux compat/linuxkpi/common/src compat/ndis dev/beri/vi... X-SVN-Commit-Revision: 356337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 22:30:05 -0000 Author: mjg Date: Fri Jan 3 22:29:58 2020 New Revision: 356337 URL: https://svnweb.freebsd.org/changeset/base/356337 Log: vfs: drop the mostly unused flags argument from VOP_UNLOCK Filesystems which want to use it in limited capacity can employ the VOP_UNLOCK_FLAGS macro. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D21427 Modified: head/sys/cam/ctl/ctl_backend_block.c head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c head/sys/compat/cloudabi/cloudabi_file.c head/sys/compat/linux/linux_misc.c head/sys/compat/linuxkpi/common/src/linux_compat.c head/sys/compat/ndis/subr_ndis.c head/sys/dev/beri/virtio/virtio_block.c head/sys/dev/md/md.c head/sys/dev/veriexec/verified_exec.c head/sys/dev/xen/blkback/blkback.c head/sys/fs/autofs/autofs_vnops.c head/sys/fs/cd9660/cd9660_vfsops.c head/sys/fs/cd9660/cd9660_vnops.c head/sys/fs/devfs/devfs_devs.c head/sys/fs/devfs/devfs_vfsops.c head/sys/fs/devfs/devfs_vnops.c head/sys/fs/ext2fs/ext2_vfsops.c head/sys/fs/ext2fs/ext2_vnops.c head/sys/fs/fdescfs/fdesc_vfsops.c head/sys/fs/fdescfs/fdesc_vnops.c head/sys/fs/fifofs/fifo_vnops.c head/sys/fs/fuse/fuse_vfsops.c head/sys/fs/msdosfs/msdosfs_vfsops.c head/sys/fs/msdosfs/msdosfs_vnops.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfsport.h head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/nfsserver/nfs_nfsdsocket.c head/sys/fs/nfsserver/nfs_nfsdstate.c head/sys/fs/nullfs/null_vfsops.c head/sys/fs/nullfs/null_vnops.c head/sys/fs/pseudofs/pseudofs_vncache.c head/sys/fs/pseudofs/pseudofs_vnops.c head/sys/fs/smbfs/smbfs_vfsops.c head/sys/fs/smbfs/smbfs_vnops.c head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/fs/udf/udf_vfsops.c head/sys/fs/unionfs/union_subr.c head/sys/fs/unionfs/union_vfsops.c head/sys/fs/unionfs/union_vnops.c head/sys/i386/linux/imgact_linux.c head/sys/kern/imgact_aout.c head/sys/kern/imgact_elf.c head/sys/kern/kern_acct.c head/sys/kern/kern_alq.c head/sys/kern/kern_ctf.c head/sys/kern/kern_descrip.c head/sys/kern/kern_exec.c head/sys/kern/kern_jail.c head/sys/kern/kern_ktrace.c head/sys/kern/kern_linker.c head/sys/kern/kern_proc.c head/sys/kern/kern_sendfile.c head/sys/kern/kern_shutdown.c head/sys/kern/kern_sig.c head/sys/kern/link_elf.c head/sys/kern/link_elf_obj.c head/sys/kern/uipc_mqueue.c head/sys/kern/uipc_usrreq.c head/sys/kern/vfs_acl.c head/sys/kern/vfs_aio.c head/sys/kern/vfs_bio.c head/sys/kern/vfs_cache.c head/sys/kern/vfs_default.c head/sys/kern/vfs_extattr.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_mount.c head/sys/kern/vfs_mountroot.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c head/sys/kern/vnode_if.src head/sys/nfs/nfs_lock.c head/sys/nlm/nlm_advlock.c head/sys/nlm/nlm_prot_impl.c head/sys/security/audit/audit_arg.c head/sys/security/audit/audit_syscalls.c head/sys/security/audit/audit_worker.c head/sys/security/mac/mac_process.c head/sys/security/mac/mac_syscalls.c head/sys/security/mac_veriexec/mac_veriexec.c head/sys/security/mac_veriexec_parser/mac_veriexec_parser.c head/sys/sys/param.h head/sys/sys/vnode.h head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_inode.c head/sys/ufs/ffs/ffs_rawread.c head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ffs/ffs_suspend.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ufs/ufs_extattr.c head/sys/ufs/ufs/ufs_lookup.c head/sys/ufs/ufs/ufs_quota.c head/sys/ufs/ufs/ufs_vnops.c head/sys/vm/swap_pager.c head/sys/vm/vm_map.c head/sys/vm/vm_object.c head/sys/vm/vnode_pager.c Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cam/ctl/ctl_backend_block.c Fri Jan 3 22:29:58 2020 (r356337) @@ -592,7 +592,7 @@ ctl_be_block_flush_file(struct ctl_be_block_lun *be_lu vn_lock(be_lun->vn, lock_flags | LK_RETRY); error = VOP_FSYNC(be_lun->vn, beio->io_arg ? MNT_NOWAIT : MNT_WAIT, curthread); - VOP_UNLOCK(be_lun->vn, 0); + VOP_UNLOCK(be_lun->vn); vn_finished_write(mountpoint); @@ -685,7 +685,7 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be */ error = VOP_READ(be_lun->vn, &xuio, flags, file_data->cred); - VOP_UNLOCK(be_lun->vn, 0); + VOP_UNLOCK(be_lun->vn); SDT_PROBE0(cbb, , read, file_done); if (error == 0 && xuio.uio_resid > 0) { /* @@ -732,7 +732,7 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be * cache before returning. */ error = VOP_WRITE(be_lun->vn, &xuio, flags, file_data->cred); - VOP_UNLOCK(be_lun->vn, 0); + VOP_UNLOCK(be_lun->vn); vn_finished_write(mountpoint); SDT_PROBE0(cbb, , write, file_done); @@ -810,7 +810,7 @@ ctl_be_block_gls_file(struct ctl_be_block_lun *be_lun, off = be_lun->size_bytes; } } - VOP_UNLOCK(be_lun->vn, 0); + VOP_UNLOCK(be_lun->vn); data = (struct scsi_get_lba_status_data *)io->scsiio.kern_data_ptr; scsi_u64to8b(lbalen->lba, data->descr[0].addr); @@ -845,7 +845,7 @@ ctl_be_block_getattr_file(struct ctl_be_block_lun *be_ val = statfs.f_bavail * statfs.f_bsize / be_lun->cbe_lun.blocksize; } - VOP_UNLOCK(be_lun->vn, 0); + VOP_UNLOCK(be_lun->vn); return (val); } @@ -2188,7 +2188,7 @@ again: snprintf(req->error_str, sizeof(req->error_str), "%s is not a disk or plain file", be_lun->dev_path); } - VOP_UNLOCK(be_lun->vn, 0); + VOP_UNLOCK(be_lun->vn); if (error != 0) ctl_be_block_close(be_lun); @@ -2604,7 +2604,7 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, else if (be_lun->vn->v_type == VREG) { vn_lock(be_lun->vn, LK_SHARED | LK_RETRY); error = ctl_be_block_open_file(be_lun, req); - VOP_UNLOCK(be_lun->vn, 0); + VOP_UNLOCK(be_lun->vn); } else error = EINVAL; if ((cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) && Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Fri Jan 3 22:29:58 2020 (r356337) @@ -79,7 +79,7 @@ kobj_open_file_vnode(const char *file) return (NULL); NDFREE(&nd, NDF_ONLY_PNBUF); /* We just unlock so we hold a reference. */ - VOP_UNLOCK(nd.ni_vp, 0); + VOP_UNLOCK(nd.ni_vp); return (nd.ni_vp); } @@ -121,7 +121,7 @@ kobj_get_filesize_vnode(struct _buf *file, uint64_t *s vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_GETATTR(vp, &va, curthread->td_ucred); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); if (error == 0) *size = (uint64_t)va.va_size; return (error); @@ -174,7 +174,7 @@ kobj_read_file_vnode(struct _buf *file, char *buf, uns vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_READ(vp, &auio, IO_UNIT | IO_SYNC, td->td_ucred); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); return (error != 0 ? -1 : size - auio.uio_resid); } Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Fri Jan 3 22:29:58 2020 (r356337) @@ -53,7 +53,7 @@ lookupnameat(char *dirname, enum uio_seg seg, enum sym vref(startvp); ltype = VOP_ISLOCKED(startvp); - VOP_UNLOCK(startvp, 0); + VOP_UNLOCK(startvp); NDINIT_ATVP(&nd, LOOKUP, LOCKLEAF | follow, seg, dirname, startvp, curthread); error = namei(&nd); Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Fri Jan 3 22:29:58 2020 (r356337) @@ -154,7 +154,7 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const cha vput(vp); return (error); } - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); /* * Allocate and initialize the filesystem. @@ -241,7 +241,7 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const cha vfs_event_signal(NULL, VQ_MOUNT, 0); if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp)) panic("mount: lost mount"); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vfs_op_exit(mp); vfs_unbusy(mp); *vpp = mvp; Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/vnode.h Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Fri Jan 3 22:29:58 2020 (r356337) @@ -185,7 +185,7 @@ vn_openat(char *pnamep, enum uio_seg seg, int filemode NDFREE(&nd, NDF_ONLY_PNBUF); if (error == 0) { /* We just unlock so we hold a reference. */ - VOP_UNLOCK(nd.ni_vp, 0); + VOP_UNLOCK(nd.ni_vp); *vpp = nd.ni_vp; } return (error); @@ -241,7 +241,7 @@ zfs_vop_fsync(vnode_t *vp, int flag, cred_t *cr) goto drop; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_FSYNC(vp, MNT_WAIT, curthread); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vn_finished_write(mp); drop: return (error); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Jan 3 22:29:58 2020 (r356337) @@ -139,7 +139,7 @@ skip_open: vattr.va_mask = AT_SIZE; vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_GETATTR(vp, &vattr, kcred); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); if (error) { (void) VOP_CLOSE(vp, spa_mode(vd->vdev_spa), 1, 0, kcred, NULL); vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jan 3 22:29:58 2020 (r356337) @@ -721,7 +721,7 @@ zfsctl_root_vptocnp(struct vop_vptocnp_args *ap) if (error != 0) return (SET_ERROR(error)); - VOP_UNLOCK(dvp, 0); + VOP_UNLOCK(dvp); *ap->a_vpp = dvp; *ap->a_buflen -= sizeof (dotzfs_name); bcopy(dotzfs_name, ap->a_buf + *ap->a_buflen, sizeof (dotzfs_name)); @@ -1233,7 +1233,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap) /* Look up .zfs/snapshot, our parent. */ error = zfsctl_snapdir_vnode(vp->v_mount, NULL, LK_SHARED, &dvp); if (error == 0) { - VOP_UNLOCK(dvp, 0); + VOP_UNLOCK(dvp); *ap->a_vpp = dvp; *ap->a_buflen -= len; bcopy(node->sn_name, ap->a_buf + *ap->a_buflen, len); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Fri Jan 3 22:29:58 2020 (r356337) @@ -923,7 +923,7 @@ top: goto top; } if (error == 0) - VOP_UNLOCK(*xvpp, 0); + VOP_UNLOCK(*xvpp); return (error); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c Fri Jan 3 22:29:58 2020 (r356337) @@ -546,7 +546,7 @@ zfs_replay_create(void *arg1, void *arg2, boolean_t by default: error = SET_ERROR(ENOTSUP); } - VOP_UNLOCK(ZTOV(dzp), 0); + VOP_UNLOCK(ZTOV(dzp)); out: if (error == 0 && vp != NULL) @@ -590,7 +590,7 @@ zfs_replay_remove(void *arg1, void *arg2, boolean_t by vn_lock(ZTOV(dzp), LK_EXCLUSIVE | LK_RETRY); error = VOP_LOOKUP(ZTOV(dzp), &vp, &cn); if (error != 0) { - VOP_UNLOCK(ZTOV(dzp), 0); + VOP_UNLOCK(ZTOV(dzp)); goto fail; } @@ -605,7 +605,7 @@ zfs_replay_remove(void *arg1, void *arg2, boolean_t by error = SET_ERROR(ENOTSUP); } vput(vp); - VOP_UNLOCK(ZTOV(dzp), 0); + VOP_UNLOCK(ZTOV(dzp)); fail: VN_RELE(ZTOV(dzp)); @@ -646,8 +646,8 @@ zfs_replay_link(void *arg1, void *arg2, boolean_t byte vn_lock(ZTOV(dzp), LK_EXCLUSIVE | LK_RETRY); vn_lock(ZTOV(zp), LK_EXCLUSIVE | LK_RETRY); error = VOP_LINK(ZTOV(dzp), ZTOV(zp), &cn /*,vflg*/); - VOP_UNLOCK(ZTOV(zp), 0); - VOP_UNLOCK(ZTOV(dzp), 0); + VOP_UNLOCK(ZTOV(zp)); + VOP_UNLOCK(ZTOV(dzp)); VN_RELE(ZTOV(zp)); VN_RELE(ZTOV(dzp)); @@ -693,10 +693,10 @@ zfs_replay_rename(void *arg1, void *arg2, boolean_t by scn.cn_thread = td; vn_lock(ZTOV(sdzp), LK_EXCLUSIVE | LK_RETRY); error = VOP_LOOKUP(ZTOV(sdzp), &svp, &scn); - VOP_UNLOCK(ZTOV(sdzp), 0); + VOP_UNLOCK(ZTOV(sdzp)); if (error != 0) goto fail; - VOP_UNLOCK(svp, 0); + VOP_UNLOCK(svp); tcn.cn_nameptr = tname; tcn.cn_namelen = strlen(tname); @@ -710,7 +710,7 @@ zfs_replay_rename(void *arg1, void *arg2, boolean_t by if (error == EJUSTRETURN) tvp = NULL; else if (error != 0) { - VOP_UNLOCK(ZTOV(tdzp), 0); + VOP_UNLOCK(ZTOV(tdzp)); goto fail; } @@ -925,7 +925,7 @@ zfs_replay_setattr(void *arg1, void *arg2, boolean_t b vp = ZTOV(zp); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_SETATTR(vp, vap, kcred); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); zfs_fuid_info_free(zfsvfs->z_fuid_replay); zfsvfs->z_fuid_replay = NULL; @@ -966,7 +966,7 @@ zfs_replay_acl_v0(void *arg1, void *arg2, boolean_t by vp = ZTOV(zp); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = zfs_setsecattr(vp, &vsa, 0, kcred, NULL); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); VN_RELE(vp); @@ -1030,7 +1030,7 @@ zfs_replay_acl(void *arg1, void *arg2, boolean_t bytes vp = ZTOV(zp); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = zfs_setsecattr(vp, &vsa, 0, kcred, NULL); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); if (zfsvfs->z_fuid_replay) zfs_fuid_info_free(zfsvfs->z_fuid_replay); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c Fri Jan 3 22:29:58 2020 (r356337) @@ -305,7 +305,7 @@ zfs_sa_upgrade(sa_handle_t *hdl, dmu_tx_t *tx) zp->z_is_sa = B_TRUE; done: - VOP_UNLOCK(ZTOV(zp), 0); + VOP_UNLOCK(ZTOV(zp)); } void Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Jan 3 22:29:58 2020 (r356337) @@ -1855,16 +1855,16 @@ zfs_mount(vfs_t *vfsp) vn_lock(mvp, LK_SHARED | LK_RETRY); if (VOP_GETATTR(mvp, &vattr, cr)) { - VOP_UNLOCK(mvp, 0); + VOP_UNLOCK(mvp); goto out; } if (secpolicy_vnode_owner(mvp, cr, vattr.va_uid) != 0 && VOP_ACCESS(mvp, VWRITE, cr, td) != 0) { - VOP_UNLOCK(mvp, 0); + VOP_UNLOCK(mvp); goto out; } - VOP_UNLOCK(mvp, 0); + VOP_UNLOCK(mvp); } secpolicy_fs_mount_clearopts(cr, vfsp); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Jan 3 22:29:58 2020 (r356337) @@ -1569,7 +1569,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, stru ZFS_EXIT(zfsvfs); ltype = VOP_ISLOCKED(dvp); - VOP_UNLOCK(dvp, 0); + VOP_UNLOCK(dvp); error = zfsctl_root(zfsvfs->z_parent, LK_SHARED, &zfsctl_vp); if (error == 0) { @@ -3455,9 +3455,9 @@ zfs_rename_relock(struct vnode *sdvp, struct vnode **s const char *tnm = tcnp->cn_nameptr; int error; - VOP_UNLOCK(tdvp, 0); + VOP_UNLOCK(tdvp); if (*tvpp != NULL && *tvpp != tdvp) - VOP_UNLOCK(*tvpp, 0); + VOP_UNLOCK(*tvpp); relock: error = vn_lock(sdvp, LK_EXCLUSIVE); @@ -3467,13 +3467,13 @@ relock: error = vn_lock(tdvp, LK_EXCLUSIVE | LK_NOWAIT); if (error != 0) { - VOP_UNLOCK(sdvp, 0); + VOP_UNLOCK(sdvp); if (error != EBUSY) goto out; error = vn_lock(tdvp, LK_EXCLUSIVE); if (error) goto out; - VOP_UNLOCK(tdvp, 0); + VOP_UNLOCK(tdvp); goto relock; } tdzp = VTOZ(tdvp); @@ -3499,8 +3499,8 @@ relock: */ if (tdzp->z_sa_hdl == NULL || sdzp->z_sa_hdl == NULL) { ZFS_EXIT(zfsvfs); - VOP_UNLOCK(sdvp, 0); - VOP_UNLOCK(tdvp, 0); + VOP_UNLOCK(sdvp); + VOP_UNLOCK(tdvp); error = SET_ERROR(EIO); goto out; } @@ -3513,8 +3513,8 @@ relock: if (error != 0) { /* Source entry invalid or not there. */ ZFS_EXIT(zfsvfs); - VOP_UNLOCK(sdvp, 0); - VOP_UNLOCK(tdvp, 0); + VOP_UNLOCK(sdvp); + VOP_UNLOCK(tdvp); if ((scnp->cn_flags & ISDOTDOT) != 0 || (scnp->cn_namelen == 1 && scnp->cn_nameptr[0] == '.')) error = SET_ERROR(EINVAL); @@ -3528,8 +3528,8 @@ relock: error = zfs_dirent_lookup(tdzp, tnm, &tzp, 0); if (error != 0) { ZFS_EXIT(zfsvfs); - VOP_UNLOCK(sdvp, 0); - VOP_UNLOCK(tdvp, 0); + VOP_UNLOCK(sdvp); + VOP_UNLOCK(tdvp); vrele(svp); if ((tcnp->cn_flags & ISDOTDOT) != 0) error = SET_ERROR(EINVAL); @@ -3552,8 +3552,8 @@ relock: nvp = svp; error = vn_lock(nvp, LK_EXCLUSIVE | LK_NOWAIT); if (error != 0) { - VOP_UNLOCK(sdvp, 0); - VOP_UNLOCK(tdvp, 0); + VOP_UNLOCK(sdvp); + VOP_UNLOCK(tdvp); if (tvp != NULL) vrele(tvp); if (error != EBUSY) { @@ -3565,7 +3565,7 @@ relock: vrele(nvp); goto out; } - VOP_UNLOCK(nvp, 0); + VOP_UNLOCK(nvp); /* * Concurrent rename race. * XXX ? @@ -3589,9 +3589,9 @@ relock: nvp = tvp; error = vn_lock(nvp, LK_EXCLUSIVE | LK_NOWAIT); if (error != 0) { - VOP_UNLOCK(sdvp, 0); - VOP_UNLOCK(tdvp, 0); - VOP_UNLOCK(*svpp, 0); + VOP_UNLOCK(sdvp); + VOP_UNLOCK(tdvp); + VOP_UNLOCK(*svpp); if (error != EBUSY) { vrele(nvp); goto out; @@ -3913,17 +3913,17 @@ zfs_rename(vnode_t *sdvp, vnode_t **svpp, struct compo unlockout: /* all 4 vnodes are locked, ZFS_ENTER called */ ZFS_EXIT(zfsvfs); - VOP_UNLOCK(*svpp, 0); - VOP_UNLOCK(sdvp, 0); + VOP_UNLOCK(*svpp); + VOP_UNLOCK(sdvp); out: /* original two vnodes are locked */ if (error == 0 && zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) zil_commit(zilog, 0); if (*tvpp != NULL) - VOP_UNLOCK(*tvpp, 0); + VOP_UNLOCK(*tvpp); if (tdvp != *tvpp) - VOP_UNLOCK(tdvp, 0); + VOP_UNLOCK(tdvp); return (error); } @@ -5505,7 +5505,7 @@ vop_getextattr { } else if (ap->a_uio != NULL) error = VOP_READ(vp, ap->a_uio, IO_UNIT, ap->a_cred); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vn_close(vp, flags, ap->a_cred, td); ZFS_EXIT(zfsvfs); @@ -5640,7 +5640,7 @@ vop_setextattr { if (error == 0) VOP_WRITE(vp, ap->a_uio, IO_UNIT, ap->a_cred); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vn_close(vp, flags, ap->a_cred, td); ZFS_EXIT(zfsvfs); @@ -5903,7 +5903,7 @@ zfs_vptocnp(struct vop_vptocnp_args *ap) covered_vp = vp->v_mount->mnt_vnodecovered; vs = vget_prep(covered_vp); ltype = VOP_ISLOCKED(vp); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); error = vget_finish(covered_vp, LK_SHARED, vs); if (error == 0) { error = VOP_VPTOCNP(covered_vp, ap->a_vpp, ap->a_cred, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Fri Jan 3 22:29:58 2020 (r356337) @@ -1272,7 +1272,7 @@ again: err = insmntque(vp, zfsvfs->z_vfs); if (err == 0) { vp->v_hash = obj_num; - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); } else { zp->z_vnode = NULL; zfs_znode_dmu_fini(zp); Modified: head/sys/compat/cloudabi/cloudabi_file.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_file.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/compat/cloudabi/cloudabi_file.c Fri Jan 3 22:29:58 2020 (r356337) @@ -291,7 +291,7 @@ cloudabi_sys_file_open(struct thread *td, finit(fp, (fflags & FMASK) | (fp->f_flag & FHASLOCK), DTYPE_VNODE, vp, &vnops); } - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); /* Truncate file. */ if (fflags & O_TRUNC) { @@ -434,14 +434,14 @@ cloudabi_sys_file_readdir(struct thread *td, /* Validate file type. */ vn_lock(vp, LK_SHARED | LK_RETRY); if (vp->v_type != VDIR) { - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); error = ENOTDIR; goto done; } #ifdef MAC error = mac_vnode_check_readdir(td->td_ucred, vp); if (error != 0) { - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); goto done; } #endif /* MAC */ @@ -451,7 +451,7 @@ cloudabi_sys_file_readdir(struct thread *td, ncookies = 0; error = VOP_READDIR(vp, &readuio, fp->f_cred, &eof, &ncookies, &cookies); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); if (error != 0) goto done; Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/compat/linux/linux_misc.c Fri Jan 3 22:29:58 2020 (r356337) @@ -396,7 +396,7 @@ linux_uselib(struct thread *td, struct linux_uselib_ar * Lock no longer needed */ locked = false; - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); /* * Check if file_offset page aligned. Currently we cannot handle @@ -469,7 +469,7 @@ linux_uselib(struct thread *td, struct linux_uselib_ar cleanup: if (opened) { if (locked) - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); locked = false; VOP_CLOSE(vp, FREAD, td->td_ucred, td); } @@ -481,7 +481,7 @@ cleanup: VOP_UNSET_TEXT_CHECKED(vp); } if (locked) - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); /* Release the temporary mapping. */ if (a_out) Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Fri Jan 3 22:29:58 2020 (r356337) @@ -1663,7 +1663,7 @@ linux_file_stat(struct file *fp, struct stat *sb, stru vn_lock(vp, LK_SHARED | LK_RETRY); error = vn_stat(vp, sb, td->td_ucred, NOCRED, td); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); return (error); } Modified: head/sys/compat/ndis/subr_ndis.c ============================================================================== --- head/sys/compat/ndis/subr_ndis.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/compat/ndis/subr_ndis.c Fri Jan 3 22:29:58 2020 (r356337) @@ -2845,7 +2845,7 @@ NdisOpenFile(status, filehandle, filelength, filename, /* Get the file size. */ VOP_GETATTR(nd.ni_vp, vap, td->td_ucred); - VOP_UNLOCK(nd.ni_vp, 0); + VOP_UNLOCK(nd.ni_vp); fh->nf_vp = nd.ni_vp; fh->nf_map = NULL; Modified: head/sys/dev/beri/virtio/virtio_block.c ============================================================================== --- head/sys/dev/beri/virtio/virtio_block.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/dev/beri/virtio/virtio_block.c Fri Jan 3 22:29:58 2020 (r356337) @@ -133,12 +133,12 @@ vtblk_rdwr(struct beri_vtblk_softc *sc, struct iovec * if (operation == 0) { vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_READ(vp, &auio, IO_DIRECT, sc->cred); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); } else { (void) vn_start_write(vp, &mp, V_WAIT); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_WRITE(vp, &auio, IO_SYNC, sc->cred); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vn_finished_write(mp); } @@ -218,7 +218,7 @@ close_file(struct beri_vtblk_softc *sc, struct thread if (sc->vnode != NULL) { vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY); sc->vnode->v_vflag &= ~VV_MD; - VOP_UNLOCK(sc->vnode, 0); + VOP_UNLOCK(sc->vnode); error = vn_close(sc->vnode, (FREAD|FWRITE), sc->cred, td); if (error != 0) @@ -263,7 +263,7 @@ open_file(struct beri_vtblk_softc *sc, struct thread * } } nd.ni_vp->v_vflag |= VV_MD; - VOP_UNLOCK(nd.ni_vp, 0); + VOP_UNLOCK(nd.ni_vp); sc->vnode = nd.ni_vp; sc->cred = crhold(td->td_ucred); Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/dev/md/md.c Fri Jan 3 22:29:58 2020 (r356337) @@ -915,7 +915,7 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) (void) vn_start_write(vp, &mp, V_WAIT); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_FSYNC(vp, MNT_WAIT, td); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vn_finished_write(mp); return (error); } @@ -986,13 +986,13 @@ unmapped_step: if (auio.uio_rw == UIO_READ) { vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_READ(vp, &auio, 0, sc->cred); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); } else { (void) vn_start_write(vp, &mp, V_WAIT); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_WRITE(vp, &auio, sc->flags & MD_ASYNC ? 0 : IO_SYNC, sc->cred); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vn_finished_write(mp); if (error == 0) sc->flags &= ~MD_VERIFY; @@ -1405,7 +1405,7 @@ mdsetcred(struct md_s *sc, struct ucred *cred) auio.uio_resid = aiov.iov_len; vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY); error = VOP_READ(sc->vnode, &auio, 0, sc->cred); - VOP_UNLOCK(sc->vnode, 0); + VOP_UNLOCK(sc->vnode); free(tmpbuf, M_TEMP); } return (error); @@ -1456,7 +1456,7 @@ mdcreate_vnode(struct md_s *sc, struct md_req *mdr, st } } nd.ni_vp->v_vflag |= VV_MD; - VOP_UNLOCK(nd.ni_vp, 0); + VOP_UNLOCK(nd.ni_vp); if (mdr->md_fwsectors != 0) sc->fwsectors = mdr->md_fwsectors; @@ -1479,7 +1479,7 @@ mdcreate_vnode(struct md_s *sc, struct md_req *mdr, st } return (0); bad: - VOP_UNLOCK(nd.ni_vp, 0); + VOP_UNLOCK(nd.ni_vp); (void)vn_close(nd.ni_vp, flags, td->td_ucred, td); return (error); } @@ -1523,7 +1523,7 @@ mddestroy(struct md_s *sc, struct thread *td) if (sc->vnode != NULL) { vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY); sc->vnode->v_vflag &= ~VV_MD; - VOP_UNLOCK(sc->vnode, 0); + VOP_UNLOCK(sc->vnode); (void)vn_close(sc->vnode, sc->flags & MD_READONLY ? FREAD : (FREAD|FWRITE), sc->cred, td); } Modified: head/sys/dev/veriexec/verified_exec.c ============================================================================== --- head/sys/dev/veriexec/verified_exec.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/dev/veriexec/verified_exec.c Fri Jan 3 22:29:58 2020 (r356337) @@ -205,7 +205,7 @@ verifiedexecioctl(struct cdev *dev __unused, u_long cm if (error != 0) { mac_veriexec_set_fingerprint_status(nid.ni_vp, FINGERPRINT_INVALID); - VOP_UNLOCK(nid.ni_vp, 0); + VOP_UNLOCK(nid.ni_vp); (void) vn_close(nid.ni_vp, FREAD, td->td_ucred, td); return (error); @@ -227,7 +227,7 @@ verifiedexecioctl(struct cdev *dev __unused, u_long cm */ mac_veriexec_set_fingerprint_status(nid.ni_vp, FINGERPRINT_INVALID); - VOP_UNLOCK(nid.ni_vp, 0); + VOP_UNLOCK(nid.ni_vp); (void) vn_close(nid.ni_vp, FREAD, td->td_ucred, td); if (params->flags & VERIEXEC_LABEL) labellen = strnlen(lparams->label, Modified: head/sys/dev/xen/blkback/blkback.c ============================================================================== --- head/sys/dev/xen/blkback/blkback.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/dev/xen/blkback/blkback.c Fri Jan 3 22:29:58 2020 (r356337) @@ -2282,7 +2282,7 @@ xbb_dispatch_file(struct xbb_softc *xbb, struct xbb_xe vn_lock(xbb->vn, LK_EXCLUSIVE | LK_RETRY); error = VOP_FSYNC(xbb->vn, MNT_WAIT, curthread); - VOP_UNLOCK(xbb->vn, 0); + VOP_UNLOCK(xbb->vn); vn_finished_write(mountpoint); @@ -2401,7 +2401,7 @@ xbb_dispatch_file(struct xbb_softc *xbb, struct xbb_xe error = VOP_READ(xbb->vn, &xuio, (flags & BIO_ORDERED) ? (IO_DIRECT|IO_SYNC) : 0, file_data->cred); - VOP_UNLOCK(xbb->vn, 0); + VOP_UNLOCK(xbb->vn); break; case BIO_WRITE: { struct mount *mountpoint; @@ -2434,7 +2434,7 @@ xbb_dispatch_file(struct xbb_softc *xbb, struct xbb_xe */ error = VOP_WRITE(xbb->vn, &xuio, (flags & BIO_ORDERED) ? IO_SYNC : 0, file_data->cred); - VOP_UNLOCK(xbb->vn, 0); + VOP_UNLOCK(xbb->vn); vn_finished_write(mountpoint); @@ -2744,7 +2744,7 @@ xbb_open_backend(struct xbb_softc *xbb) xenbus_dev_fatal(xbb->dev, error, "%s is not a disk " "or file", xbb->dev_name); } - VOP_UNLOCK(xbb->vn, 0); + VOP_UNLOCK(xbb->vn); if (error != 0) { xbb_close_backend(xbb); Modified: head/sys/fs/autofs/autofs_vnops.c ============================================================================== --- head/sys/fs/autofs/autofs_vnops.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/fs/autofs/autofs_vnops.c Fri Jan 3 22:29:58 2020 (r356337) @@ -152,7 +152,7 @@ autofs_trigger_vn(struct vnode *vp, const char *path, */ lock_flags = VOP_ISLOCKED(vp); vref(vp); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); sx_xlock(&autofs_softc->sc_lock); Modified: head/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vfsops.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/fs/cd9660/cd9660_vfsops.c Fri Jan 3 22:29:58 2020 (r356337) @@ -235,7 +235,7 @@ iso_mountfs(devvp, mp) if (error == 0) g_getattr("MNT::verified", cp, &isverified); g_topology_unlock(); - VOP_UNLOCK(devvp, 0); + VOP_UNLOCK(devvp); if (error) goto out; if (devvp->v_rdev->si_iosize_max != 0) Modified: head/sys/fs/cd9660/cd9660_vnops.c ============================================================================== --- head/sys/fs/cd9660/cd9660_vnops.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/fs/cd9660/cd9660_vnops.c Fri Jan 3 22:29:58 2020 (r356337) @@ -261,11 +261,11 @@ cd9660_ioctl(ap) vp = ap->a_vp; vn_lock(vp, LK_SHARED | LK_RETRY); if (VN_IS_DOOMED(vp)) { - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); return (EBADF); } if (vp->v_type == VCHR || vp->v_type == VBLK) { - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); return (EOPNOTSUPP); } @@ -281,7 +281,7 @@ cd9660_ioctl(ap) break; } - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); return (error); } Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/fs/devfs/devfs_devs.c Fri Jan 3 22:29:58 2020 (r356337) @@ -407,7 +407,7 @@ devfs_delete(struct devfs_mount *dm, struct devfs_dire VI_UNLOCK(vp); vgone(vp); if ((flags & DEVFS_DEL_VNLOCKED) == 0) - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vdrop(vp); sx_xlock(&dm->dm_lock); } else Modified: head/sys/fs/devfs/devfs_vfsops.c ============================================================================== --- head/sys/fs/devfs/devfs_vfsops.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/fs/devfs/devfs_vfsops.c Fri Jan 3 22:29:58 2020 (r356337) @@ -156,7 +156,7 @@ devfs_mount(struct mount *mp) sx_xunlock(&fmp->dm_lock); } - VOP_UNLOCK(rvp, 0); + VOP_UNLOCK(rvp); vfs_cache_root_set(mp, rvp); vfs_mountedfrom(mp, "devfs"); Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/fs/devfs/devfs_vnops.c Fri Jan 3 22:29:58 2020 (r356337) @@ -241,7 +241,7 @@ devfs_populate_vp(struct vnode *vp) DEVFS_DMP_HOLD(dmp); /* Can't call devfs_populate() with the vnode lock held. */ - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); devfs_populate(dmp); sx_xunlock(&dmp->dm_lock); @@ -635,7 +635,7 @@ devfs_close(struct vop_close_args *ap) vholdnz(vp); VI_UNLOCK(vp); vp_locked = VOP_ISLOCKED(vp); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); KASSERT(dev->si_refcount > 0, ("devfs_close() on un-referenced struct cdev *(%s)", devtoname(dev))); error = dsw->d_close(dev, ap->a_fflag | dflags, S_IFCHR, td); @@ -965,7 +965,7 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlo if (de == NULL) return (ENOENT); dvplocked = VOP_ISLOCKED(dvp); - VOP_UNLOCK(dvp, 0); + VOP_UNLOCK(dvp); error = devfs_allocv(de, mp, cnp->cn_lkflags & LK_TYPE_MASK, vpp); *dm_unlock = 0; @@ -1153,7 +1153,7 @@ devfs_open(struct vop_open_args *ap) } vlocked = VOP_ISLOCKED(vp); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); fpop = td->td_fpop; td->td_fpop = fp; @@ -1464,9 +1464,9 @@ devfs_remove(struct vop_remove_args *ap) de_covered->de_flags &= ~DE_COVERED; } /* We need to unlock dvp because devfs_delete() may lock it. */ - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); if (dvp != vp) - VOP_UNLOCK(dvp, 0); + VOP_UNLOCK(dvp); devfs_delete(dmp, de, 0); sx_xunlock(&dmp->dm_lock); if (dvp != vp) @@ -1507,7 +1507,7 @@ devfs_revoke(struct vop_revoke_args *ap) vgone(vp); vdrop(vp); - VOP_UNLOCK(vp,0); + VOP_UNLOCK(vp); loop: for (;;) { mtx_lock(&devfs_de_interlock); @@ -1563,12 +1563,12 @@ devfs_rioctl(struct vop_ioctl_args *ap) vp = ap->a_vp; vn_lock(vp, LK_SHARED | LK_RETRY); if (VN_IS_DOOMED(vp)) { - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); return (EBADF); } dmp = VFSTODEVFS(vp->v_mount); sx_xlock(&dmp->dm_lock); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); DEVFS_DMP_HOLD(dmp); devfs_populate(dmp); if (DEVFS_DMP_DROP(dmp)) { Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/fs/ext2fs/ext2_vfsops.c Fri Jan 3 22:29:58 2020 (r356337) @@ -197,10 +197,10 @@ ext2_mount(struct mount *mp) if (error) error = priv_check(td, PRIV_VFS_MOUNT_PERM); if (error) { - VOP_UNLOCK(devvp, 0); + VOP_UNLOCK(devvp); return (error); } - VOP_UNLOCK(devvp, 0); + VOP_UNLOCK(devvp); g_topology_lock(); error = g_access(ump->um_cp, 0, 1, 0); g_topology_unlock(); @@ -744,7 +744,7 @@ ext2_reload(struct mount *mp, struct thread *td) vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); if (vinvalbuf(devvp, 0, 0, 0) != 0) panic("ext2_reload: dirty1"); - VOP_UNLOCK(devvp, 0); + VOP_UNLOCK(devvp); /* * Step 2: re-read superblock from disk. @@ -802,7 +802,7 @@ loop: error = bread(devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), (int)fs->e2fs_bsize, NOCRED, &bp); if (error) { - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vrele(vp); MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp); return (error); @@ -812,7 +812,7 @@ loop: EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)), ip); brelse(bp); - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vrele(vp); if (error) { @@ -849,7 +849,7 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp) g_topology_lock(); error = g_vfs_open(devvp, &cp, "ext2fs", ronly ? 0 : 1); g_topology_unlock(); - VOP_UNLOCK(devvp, 0); + VOP_UNLOCK(devvp); if (error) return (error); @@ -1155,7 +1155,7 @@ loop: } if ((error = VOP_FSYNC(vp, waitfor, td)) != 0) allerror = error; - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vrele(vp); } @@ -1166,7 +1166,7 @@ loop: vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY); if ((error = VOP_FSYNC(ump->um_devvp, waitfor, td)) != 0) allerror = error; - VOP_UNLOCK(ump->um_devvp, 0); + VOP_UNLOCK(ump->um_devvp); } /* Modified: head/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vnops.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/fs/ext2fs/ext2_vnops.c Fri Jan 3 22:29:58 2020 (r356337) @@ -837,13 +837,13 @@ abortit: ip = VTOI(fvp); if (ip->i_nlink >= EXT4_LINK_MAX && !EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, EXT2F_ROCOMPAT_DIR_NLINK)) { - VOP_UNLOCK(fvp, 0); + VOP_UNLOCK(fvp); error = EMLINK; goto abortit; } if ((ip->i_flags & (NOUNLINK | IMMUTABLE | APPEND)) || (dp->i_flags & APPEND)) { - VOP_UNLOCK(fvp, 0); + VOP_UNLOCK(fvp); error = EPERM; goto abortit; } @@ -854,7 +854,7 @@ abortit: if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') || dp == ip || (fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT || (ip->i_flag & IN_RENAME)) { - VOP_UNLOCK(fvp, 0); + VOP_UNLOCK(fvp); error = EINVAL; goto abortit; } @@ -882,7 +882,7 @@ abortit: ext2_inc_nlink(ip); ip->i_flag |= IN_CHANGE; if ((error = ext2_update(fvp, !DOINGASYNC(fvp))) != 0) { - VOP_UNLOCK(fvp, 0); + VOP_UNLOCK(fvp); goto bad; } @@ -897,7 +897,7 @@ abortit: * call to checkpath(). */ error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread); - VOP_UNLOCK(fvp, 0); + VOP_UNLOCK(fvp); if (oldparent != dp->i_number) newparent = dp->i_number; if (doingdirectory && newparent) { @@ -1494,7 +1494,7 @@ ext2_rmdir(struct vop_rmdir_args *ap) ext2_dec_nlink(dp); dp->i_flag |= IN_CHANGE; cache_purge(dvp); - VOP_UNLOCK(dvp, 0); + VOP_UNLOCK(dvp); /* * Truncate inode. The only stuff left * in the directory is "." and "..". @@ -1504,7 +1504,7 @@ ext2_rmdir(struct vop_rmdir_args *ap) cnp->cn_thread); cache_purge(ITOV(ip)); if (vn_lock(dvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp); vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); } Modified: head/sys/fs/fdescfs/fdesc_vfsops.c ============================================================================== --- head/sys/fs/fdescfs/fdesc_vfsops.c Fri Jan 3 22:12:25 2020 (r356336) +++ head/sys/fs/fdescfs/fdesc_vfsops.c Fri Jan 3 22:29:58 2020 (r356337) @@ -110,7 +110,7 @@ fdesc_mount(struct mount *mp) rvp->v_type = VDIR; rvp->v_vflag |= VV_ROOT; fmp->f_root = rvp; - VOP_UNLOCK(rvp, 0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jan 3 22:47:32 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03EBB1F2CD3; Fri, 3 Jan 2020 22:47:32 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qKmM6Mwhz4Sk4; Fri, 3 Jan 2020 22:47:31 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D60C73489; Fri, 3 Jan 2020 22:47:31 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 003MlVmL085680; Fri, 3 Jan 2020 22:47:31 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003MlVKi085679; Fri, 3 Jan 2020 22:47:31 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202001032247.003MlVKi085679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 3 Jan 2020 22:47:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356338 - head/cddl/contrib/opensolaris/lib/libzpool/common/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzpool/common/sys X-SVN-Commit-Revision: 356338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 22:47:32 -0000 Author: mjg Date: Fri Jan 3 22:47:31 2020 New Revision: 356338 URL: https://svnweb.freebsd.org/changeset/base/356338 Log: vfs: add a file missed in r356337 Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Fri Jan 3 22:29:58 2020 (r356337) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Fri Jan 3 22:47:31 2020 (r356338) @@ -526,7 +526,7 @@ extern int fop_getattr(vnode_t *vp, vattr_t *vap); #define VN_RELE_ASYNC(vp, taskq) vn_close(vp, 0, NULL, NULL) #define vn_lock(vp, type) -#define VOP_UNLOCK(vp, type) +#define VOP_UNLOCK(vp) extern int vn_open(char *path, int x1, int oflags, int mode, vnode_t **vpp, int x2, int x3); From owner-svn-src-head@freebsd.org Fri Jan 3 23:31:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2B441F6940; Fri, 3 Jan 2020 23:31:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qLlG4NvDz4VGL; Fri, 3 Jan 2020 23:31:38 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91F063FF0; Fri, 3 Jan 2020 23:31:38 +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 003NVcaI011192; Fri, 3 Jan 2020 23:31:38 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 003NVcNk011191; Fri, 3 Jan 2020 23:31:38 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202001032331.003NVcNk011191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 3 Jan 2020 23:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356339 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 356339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 03 Jan 2020 23:31:38 -0000 Author: jhb Date: Fri Jan 3 23:31:38 2020 New Revision: 356339 URL: https://svnweb.freebsd.org/changeset/base/356339 Log: Set correct lib32 MACHINE_ARCH for mips64el*. Use "mipsel" instead of "mips" as the 32-bit MACHINE_ARCH when building lib32 for little-endian 64-bit MIPS targets. This fixes an error where some objects were compiled as LE and others compiled as BE causing a link error for rtld32. Reviewed by: emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D23028 Modified: head/share/mk/bsd.compat.mk Modified: head/share/mk/bsd.compat.mk ============================================================================== --- head/share/mk/bsd.compat.mk Fri Jan 3 22:47:31 2020 (r356338) +++ head/share/mk/bsd.compat.mk Fri Jan 3 23:31:38 2020 (r356339) @@ -79,10 +79,11 @@ LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 .endif LIB32CPUFLAGS+= -mabi=32 LIB32_MACHINE= mips -LIB32_MACHINE_ARCH= mips .if ${COMPAT_ARCH:Mmips64el*} != "" +LIB32_MACHINE_ARCH= mipsel _EMULATION= elf32ltsmip_fbsd .else +LIB32_MACHINE_ARCH= mips _EMULATION= elf32btsmip_fbsd .endif LIB32WMAKEFLAGS= LD="${XLD} -m ${_EMULATION}" From owner-svn-src-head@freebsd.org Sat Jan 4 00:44:54 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66DC91D6450; Sat, 4 Jan 2020 00:44:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qNMp1gkZz4YQd; Sat, 4 Jan 2020 00:44:54 +0000 (UTC) (envelope-from mjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30BBC4D1C; Sat, 4 Jan 2020 00:44:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0040is6r057110; Sat, 4 Jan 2020 00:44:54 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0040isC1057109; Sat, 4 Jan 2020 00:44:54 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202001040044.0040isC1057109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 4 Jan 2020 00:44:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356342 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 356342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 00:44:54 -0000 Author: mjg Date: Sat Jan 4 00:44:53 2020 New Revision: 356342 URL: https://svnweb.freebsd.org/changeset/base/356342 Log: vfs: remove CTASSERT from VOP_UNLOCK_FLAGS gcc does not like it and it's not worth working around just for that compiler. Modified: head/sys/sys/vnode.h Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sat Jan 4 00:44:49 2020 (r356341) +++ head/sys/sys/vnode.h Sat Jan 4 00:44:53 2020 (r356342) @@ -960,8 +960,6 @@ void vn_fsid(struct vnode *vp, struct vattr *va); int _flags = (flags); \ int _error; \ \ - CTASSERT(__builtin_constant_p(flags) ? \ - (flags & ~(LK_INTERLOCK | LK_RELEASE)) == 0 : 1); \ if ((_flags & ~(LK_INTERLOCK | LK_RELEASE)) != 0) \ panic("%s: unsupported flags %x\n", __func__, flags); \ _error = VOP_UNLOCK(_vp); \ From owner-svn-src-head@freebsd.org Sat Jan 4 00:59:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94EC71D868C; Sat, 4 Jan 2020 00:59:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qNj03CNTz4ZZT; Sat, 4 Jan 2020 00:59: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50C534EEE; Sat, 4 Jan 2020 00:59: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 0040xmpw063383; Sat, 4 Jan 2020 00:59:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0040xmcl063382; Sat, 4 Jan 2020 00:59:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202001040059.0040xmcl063382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 4 Jan 2020 00:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356344 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 356344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 00:59:48 -0000 Author: jhb Date: Sat Jan 4 00:59:47 2020 New Revision: 356344 URL: https://svnweb.freebsd.org/changeset/base/356344 Log: Use the freebsd-gcc6 toolchains instead of powerpc64-xtoolchain-gcc. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D23029 Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Sat Jan 4 00:51:03 2020 (r356343) +++ head/Makefile Sat Jan 4 00:59:47 2020 (r356344) @@ -509,15 +509,15 @@ TARGET_ARCHES_${target}?= ${target} MAKE_PARAMS_riscv?= CROSS_TOOLCHAIN=riscv64-gcc .if !defined(MAKE_OBSOLETE_GCC) OBSOLETE_GCC_TARGETS=${_OBSOLETE_GCC_TARGETS} -MAKE_PARAMS_mips?= CROSS_TOOLCHAIN=mips-gcc -MAKE_PARAMS_powerpc?= CROSS_TOOLCHAIN=powerpc64-gcc -MAKE_PARAMS_sparc64?= CROSS_TOOLCHAIN=sparc64-gcc +MAKE_PARAMS_mips?= CROSS_TOOLCHAIN=mips-gcc6 +MAKE_PARAMS_powerpc?= CROSS_TOOLCHAIN=powerpc64-gcc6 +MAKE_PARAMS_sparc64?= CROSS_TOOLCHAIN=sparc64-gcc6 .endif -TOOLCHAINS_mips= mips -TOOLCHAINS_powerpc= powerpc64 -TOOLCHAINS_riscv= riscv64 -TOOLCHAINS_sparc64= sparc64 +TOOLCHAINS_mips= mips-gcc6 +TOOLCHAINS_powerpc= powerpc64-gcc6 +TOOLCHAINS_riscv= riscv64-gcc +TOOLCHAINS_sparc64= sparc64-gcc6 # Remove architectures only supported by external toolchain from # universe if required toolchain packages are missing. riscv requires @@ -526,12 +526,12 @@ TOOLCHAINS_sparc64= sparc64 .for target in riscv ${OBSOLETE_GCC_TARGETS} .if ${_UNIVERSE_TARGETS:M${target}} .for toolchain in ${TOOLCHAINS_${target}} -.if !exists(/usr/local/share/toolchains/${toolchain}-gcc.mk) +.if !exists(/usr/local/share/toolchains/${toolchain}.mk) _UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:N${target}} universe: universe_${toolchain}_skip .PHONY universe_epilogue: universe_${toolchain}_skip .PHONY universe_${toolchain}_skip: universe_prologue .PHONY - @echo ">> ${target} skipped - install ${toolchain}-xtoolchain-gcc port or package to build" + @echo ">> ${target} skipped - install ${toolchain} port or package to build" .endif .endfor .endif From owner-svn-src-head@freebsd.org Sat Jan 4 01:13:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC92A1DA13C; Sat, 4 Jan 2020 01:13:00 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qP0D64bGz4bc8; Sat, 4 Jan 2020 01:13:00 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C67815298; Sat, 4 Jan 2020 01:13:00 +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 0041D0Ji075034; Sat, 4 Jan 2020 01:13:00 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0041D0IQ075033; Sat, 4 Jan 2020 01:13:00 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <202001040113.0041D0IQ075033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 4 Jan 2020 01:13:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356346 - head/sys/powerpc/conf X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/conf X-SVN-Commit-Revision: 356346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 01:13:01 -0000 Author: jhibbits Date: Sat Jan 4 01:13:00 2020 New Revision: 356346 URL: https://svnweb.freebsd.org/changeset/base/356346 Log: powerpc: Remove 'sec' device from QORIQ64 config The SEC crypto engine, as implemented in this driver, does not exist on any 64-bit SoC, so don't bother compiling it in. Modified: head/sys/powerpc/conf/QORIQ64 Modified: head/sys/powerpc/conf/QORIQ64 ============================================================================== --- head/sys/powerpc/conf/QORIQ64 Sat Jan 4 01:09:33 2020 (r356345) +++ head/sys/powerpc/conf/QORIQ64 Sat Jan 4 01:13:00 2020 (r356346) @@ -103,7 +103,6 @@ device pci device scbus device scc device sdhci -device sec device spibus device spigen device tuntap From owner-svn-src-head@freebsd.org Sat Jan 4 01:54:28 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 937171DC00A; Sat, 4 Jan 2020 01:54:28 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qPw40smpz4d3d; Sat, 4 Jan 2020 01:54:27 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id 0041sJBd017168 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 3 Jan 2020 17:54:19 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id 0041sJIK017167; Fri, 3 Jan 2020 17:54:19 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 3 Jan 2020 17:54:19 -0800 From: Gleb Smirnoff To: Pawel Biernacki Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r356262 - head/sys/kern Message-ID: <20200104015419.GG3339@FreeBSD.org> References: <202001020123.0021NhgC049141@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202001020123.0021NhgC049141@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47qPw40smpz4d3d X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.93)[-0.928,0]; NEURAL_HAM_LONG(-0.96)[-0.964,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 01:54:28 -0000 On Thu, Jan 02, 2020 at 01:23:43AM +0000, Pawel Biernacki wrote: P> Author: kaktus P> Date: Thu Jan 2 01:23:43 2020 P> New Revision: 356262 P> URL: https://svnweb.freebsd.org/changeset/base/356262 P> P> Log: P> sysctl: hide 2.x era compat node P> P> r23081 introduced kern.dummy oid as a semi ABI compat for kern.maxsockbuf P> that was moved to a new namespace. It never functioned as an alias of any P> kind and was just returning 0 unconditionally, hence it was probably P> provided to keep some 3rd party programmes happy about sysctl(3) not P> reporting an error because of non-existing oid. P> After nearly 23 years it seems reasonable to just hide it from sysctl(8) P> list not to cause unnecessary confusion as for its purpose. P> P> Reported by: Antranig Vartanian P> Reviewed by: kib (mentor) P> Approved by: kib (mentor) P> Differential Revision: https://reviews.freebsd.org/D22982 Is there any reason to keep it at all even hidden after 23 years? -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Sat Jan 4 03:04:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66C2F1DDB2A; Sat, 4 Jan 2020 03:04:47 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qRTC2tVmz3CTk; Sat, 4 Jan 2020 03:04:47 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E0CD668F; Sat, 4 Jan 2020 03:04:47 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00434luU041631; Sat, 4 Jan 2020 03:04:47 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00434llG041629; Sat, 4 Jan 2020 03:04:47 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <202001040304.00434llG041629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 4 Jan 2020 03:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356347 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 03:04:47 -0000 Author: jeff Date: Sat Jan 4 03:04:46 2020 New Revision: 356347 URL: https://svnweb.freebsd.org/changeset/base/356347 Log: Use atomics for the zone limit and sleeper count. This relies on the sleepq to serialize sleepers. This patch retains the existing sleep/wakeup paradigm to limit 'thundering herd' wakeups. It resolves a missing wakeup in one case but otherwise should be bug for bug compatible. In particular, there are still various races surrounding adjusting the limit via sysctl that are now documented. Discussed with: markj Reviewed by: rlibby Differential Revision: https://reviews.freebsd.org/D22827 Modified: head/sys/vm/uma_core.c head/sys/vm/uma_int.h Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sat Jan 4 01:13:00 2020 (r356346) +++ head/sys/vm/uma_core.c Sat Jan 4 03:04:46 2020 (r356347) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -267,8 +268,9 @@ static void hash_free(struct uma_hash *hash); static void uma_timeout(void *); static void uma_startup3(void); static void *zone_alloc_item(uma_zone_t, void *, int, int); -static void *zone_alloc_item_locked(uma_zone_t, void *, int, int); static void zone_free_item(uma_zone_t, void *, void *, enum zfreeskip); +static int zone_alloc_limit(uma_zone_t zone, int count, int flags); +static void zone_free_limit(uma_zone_t zone, int count); static void bucket_enable(void); static void bucket_init(void); static uma_bucket_t bucket_alloc(uma_zone_t zone, void *, int); @@ -290,6 +292,7 @@ static int sysctl_handle_uma_zone_allocs(SYSCTL_HANDLE static int sysctl_handle_uma_zone_frees(SYSCTL_HANDLER_ARGS); static int sysctl_handle_uma_zone_flags(SYSCTL_HANDLER_ARGS); static int sysctl_handle_uma_slab_efficiency(SYSCTL_HANDLER_ARGS); +static int sysctl_handle_uma_zone_items(SYSCTL_HANDLER_ARGS); #ifdef INVARIANTS static inline struct noslabbits *slab_dbg_bits(uma_slab_t slab, uma_keg_t keg); @@ -893,7 +896,7 @@ hash_free(struct uma_hash *hash) * * Arguments: * zone The zone to free to, must be unlocked. - * bucket The free/alloc bucket with items, cpu queue must be locked. + * bucket The free/alloc bucket with items. * * Returns: * Nothing @@ -904,20 +907,15 @@ bucket_drain(uma_zone_t zone, uma_bucket_t bucket) { int i; - if (bucket == NULL) + if (bucket == NULL || bucket->ub_cnt == 0) return; if (zone->uz_fini) for (i = 0; i < bucket->ub_cnt; i++) zone->uz_fini(bucket->ub_bucket[i], zone->uz_size); zone->uz_release(zone->uz_arg, bucket->ub_bucket, bucket->ub_cnt); - if (zone->uz_max_items > 0) { - ZONE_LOCK(zone); - zone->uz_items -= bucket->ub_cnt; - if (zone->uz_sleepers && zone->uz_items < zone->uz_max_items) - wakeup_one(zone); - ZONE_UNLOCK(zone); - } + if (zone->uz_max_items > 0) + zone_free_limit(zone, bucket->ub_cnt); bucket->ub_cnt = 0; } @@ -2096,10 +2094,11 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused) */ oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(zone->uz_oid), OID_AUTO, "limit", CTLFLAG_RD, NULL, ""); + SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "items", CTLFLAG_RD | CTLTYPE_U64 | CTLFLAG_MPSAFE, + zone, 0, sysctl_handle_uma_zone_items, "QU", + "current number of allocated items if limit is set"); SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, - "items", CTLFLAG_RD, &zone->uz_items, 0, - "current number of cached items"); - SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "max_items", CTLFLAG_RD, &zone->uz_max_items, 0, "Maximum number of cached items"); SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, @@ -2108,6 +2107,12 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused) SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "sleeps", CTLFLAG_RD, &zone->uz_sleeps, 0, "Total zone limit sleeps"); + SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "bucket_max", CTLFLAG_RD, &zone->uz_bkt_max, 0, + "Maximum number of items in the bucket cache"); + SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "bucket_cnt", CTLFLAG_RD, &zone->uz_bkt_count, 0, + "Number of items in the bucket cache"); /* * Per-domain information. @@ -2961,15 +2966,15 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags domain = PCPU_GET(domain); else domain = UMA_ANYDOMAIN; - return (zone_alloc_item_locked(zone, udata, domain, flags)); + return (zone_alloc_item(zone, udata, domain, flags)); } /* * Replenish an alloc bucket and possibly restore an old one. Called in * a critical section. Returns in a critical section. * - * A false return value indicates failure and returns with the zone lock - * held. A true return value indicates success and the caller should retry. + * A false return value indicates an allocation failure. + * A true return value indicates success and the caller should retry. */ static __noinline bool cache_alloc(uma_zone_t zone, uma_cache_t cache, void *udata, int flags) @@ -2998,6 +3003,12 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * if (bucket != NULL) bucket_free(zone, bucket, udata); + /* Short-circuit for zones without buckets and low memory. */ + if (zone->uz_bucket_size == 0 || bucketdisable) { + critical_enter(); + return (false); + } + /* * Attempt to retrieve the item from the per-CPU cache has failed, so * we must go back to the zone. This requires the zone lock, so we @@ -3014,14 +3025,9 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * lockfail = 1; } + /* See if we lost the race to fill the cache. */ critical_enter(); - /* Short-circuit for zones without buckets and low memory. */ - if (zone->uz_bucket_size == 0 || bucketdisable) - return (false); - cache = &zone->uz_cpu[curcpu]; - - /* See if we lost the race to fill the cache. */ if (cache->uc_allocbucket.ucb_bucket != NULL) { ZONE_UNLOCK(zone); return (true); @@ -3054,6 +3060,7 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * */ if (lockfail && zone->uz_bucket_size < zone->uz_bucket_size_max) zone->uz_bucket_size++; + ZONE_UNLOCK(zone); /* * Fill a bucket and attempt to use it as the alloc bucket. @@ -3061,15 +3068,18 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * bucket = zone_alloc_bucket(zone, udata, domain, flags); CTR3(KTR_UMA, "uma_zalloc: zone %s(%p) bucket zone returned %p", zone->uz_name, zone, bucket); - critical_enter(); - if (bucket == NULL) + if (bucket == NULL) { + critical_enter(); return (false); + } /* * See if we lost the race or were migrated. Cache the * initialized bucket to make this less likely or claim * the memory directly. */ + ZONE_LOCK(zone); + critical_enter(); cache = &zone->uz_cpu[curcpu]; if (cache->uc_allocbucket.ucb_bucket == NULL && ((zone->uz_flags & UMA_ZONE_NUMA) == 0 || @@ -3202,10 +3212,6 @@ restart: if (flags & M_NOVM) break; - KASSERT(zone->uz_max_items == 0 || - zone->uz_items <= zone->uz_max_items, - ("%s: zone %p overflow", __func__, zone)); - slab = keg_alloc_slab(keg, zone, domain, flags, aflags); /* * If we got a slab here it's safe to mark it partially used @@ -3316,6 +3322,159 @@ zone_import(void *arg, void **bucket, int max, int dom return i; } +static int +zone_alloc_limit_hard(uma_zone_t zone, int count, int flags) +{ + uint64_t old, new, total, max; + + /* + * The hard case. We're going to sleep because there were existing + * sleepers or because we ran out of items. This routine enforces + * fairness by keeping fifo order. + * + * First release our ill gotten gains and make some noise. + */ + for (;;) { + zone_free_limit(zone, count); + zone_log_warning(zone); + zone_maxaction(zone); + if (flags & M_NOWAIT) + return (0); + + /* + * We need to allocate an item or set ourself as a sleeper + * while the sleepq lock is held to avoid wakeup races. This + * is essentially a home rolled semaphore. + */ + sleepq_lock(&zone->uz_max_items); + old = zone->uz_items; + do { + MPASS(UZ_ITEMS_SLEEPERS(old) < UZ_ITEMS_SLEEPERS_MAX); + /* Cache the max since we will evaluate twice. */ + max = zone->uz_max_items; + if (UZ_ITEMS_SLEEPERS(old) != 0 || + UZ_ITEMS_COUNT(old) >= max) + new = old + UZ_ITEMS_SLEEPER; + else + new = old + MIN(count, max - old); + } while (atomic_fcmpset_64(&zone->uz_items, &old, new) == 0); + + /* We may have successfully allocated under the sleepq lock. */ + if (UZ_ITEMS_SLEEPERS(new) == 0) { + sleepq_release(&zone->uz_max_items); + return (new - old); + } + + /* + * This is in a different cacheline from uz_items so that we + * don't constantly invalidate the fastpath cacheline when we + * adjust item counts. This could be limited to toggling on + * transitions. + */ + atomic_add_32(&zone->uz_sleepers, 1); + atomic_add_64(&zone->uz_sleeps, 1); + + /* + * We have added ourselves as a sleeper. The sleepq lock + * protects us from wakeup races. Sleep now and then retry. + */ + sleepq_add(&zone->uz_max_items, NULL, "zonelimit", 0, 0); + sleepq_wait(&zone->uz_max_items, PVM); + + /* + * After wakeup, remove ourselves as a sleeper and try + * again. We no longer have the sleepq lock for protection. + * + * Subract ourselves as a sleeper while attempting to add + * our count. + */ + atomic_subtract_32(&zone->uz_sleepers, 1); + old = atomic_fetchadd_64(&zone->uz_items, + -(UZ_ITEMS_SLEEPER - count)); + /* We're no longer a sleeper. */ + old -= UZ_ITEMS_SLEEPER; + + /* + * If we're still at the limit, restart. Notably do not + * block on other sleepers. Cache the max value to protect + * against changes via sysctl. + */ + total = UZ_ITEMS_COUNT(old); + max = zone->uz_max_items; + if (total >= max) + continue; + /* Truncate if necessary, otherwise wake other sleepers. */ + if (total + count > max) { + zone_free_limit(zone, total + count - max); + count = max - total; + } else if (total + count < max && UZ_ITEMS_SLEEPERS(old) != 0) + wakeup_one(&zone->uz_max_items); + + return (count); + } +} + +/* + * Allocate 'count' items from our max_items limit. Returns the number + * available. If M_NOWAIT is not specified it will sleep until at least + * one item can be allocated. + */ +static int +zone_alloc_limit(uma_zone_t zone, int count, int flags) +{ + uint64_t old; + uint64_t max; + + max = zone->uz_max_items; + MPASS(max > 0); + + /* + * We expect normal allocations to succeed with a simple + * fetchadd. + */ + old = atomic_fetchadd_64(&zone->uz_items, count); + if (__predict_true(old + count <= max)) + return (count); + + /* + * If we had some items and no sleepers just return the + * truncated value. We have to release the excess space + * though because that may wake sleepers who weren't woken + * because we were temporarily over the limit. + */ + if (old < max) { + zone_free_limit(zone, (old + count) - max); + return (max - old); + } + return (zone_alloc_limit_hard(zone, count, flags)); +} + +/* + * Free a number of items back to the limit. + */ +static void +zone_free_limit(uma_zone_t zone, int count) +{ + uint64_t old; + + MPASS(count > 0); + + /* + * In the common case we either have no sleepers or + * are still over the limit and can just return. + */ + old = atomic_fetchadd_64(&zone->uz_items, -count); + if (__predict_true(UZ_ITEMS_SLEEPERS(old) == 0 || + UZ_ITEMS_COUNT(old) - count >= zone->uz_max_items)) + return; + + /* + * Moderate the rate of wakeups. Sleepers will continue + * to generate wakeups if necessary. + */ + wakeup_one(&zone->uz_max_items); +} + static uma_bucket_t zone_alloc_bucket(uma_zone_t zone, void *udata, int domain, int flags) { @@ -3328,15 +3487,13 @@ zone_alloc_bucket(uma_zone_t zone, void *udata, int do if (domain != UMA_ANYDOMAIN && VM_DOMAIN_EMPTY(domain)) domain = UMA_ANYDOMAIN; - if (zone->uz_max_items > 0) { - if (zone->uz_items >= zone->uz_max_items) - return (false); - maxbucket = MIN(zone->uz_bucket_size, - zone->uz_max_items - zone->uz_items); - zone->uz_items += maxbucket; - } else + if (zone->uz_max_items > 0) + maxbucket = zone_alloc_limit(zone, zone->uz_bucket_size, + M_NOWAIT); + else maxbucket = zone->uz_bucket_size; - ZONE_UNLOCK(zone); + if (maxbucket == 0) + return (false); /* Don't wait for buckets, preserve caller's NOVM setting. */ bucket = bucket_alloc(zone, udata, M_NOWAIT | (flags & M_NOVM)); @@ -3380,15 +3537,8 @@ zone_alloc_bucket(uma_zone_t zone, void *udata, int do bucket = NULL; } out: - ZONE_LOCK(zone); - if (zone->uz_max_items > 0 && cnt < maxbucket) { - MPASS(zone->uz_items >= maxbucket - cnt); - zone->uz_items -= maxbucket - cnt; - if (zone->uz_sleepers > 0 && - (cnt == 0 ? zone->uz_items + 1 : zone->uz_items) < - zone->uz_max_items) - wakeup_one(zone); - } + if (zone->uz_max_items > 0 && cnt < maxbucket) + zone_free_limit(zone, maxbucket - cnt); return (bucket); } @@ -3410,43 +3560,11 @@ out: static void * zone_alloc_item(uma_zone_t zone, void *udata, int domain, int flags) { - - ZONE_LOCK(zone); - return (zone_alloc_item_locked(zone, udata, domain, flags)); -} - -/* - * Returns with zone unlocked. - */ -static void * -zone_alloc_item_locked(uma_zone_t zone, void *udata, int domain, int flags) -{ void *item; - ZONE_LOCK_ASSERT(zone); + if (zone->uz_max_items > 0 && zone_alloc_limit(zone, 1, flags) == 0) + return (NULL); - if (zone->uz_max_items > 0) { - if (zone->uz_items >= zone->uz_max_items) { - zone_log_warning(zone); - zone_maxaction(zone); - if (flags & M_NOWAIT) { - ZONE_UNLOCK(zone); - return (NULL); - } - zone->uz_sleeps++; - zone->uz_sleepers++; - while (zone->uz_items >= zone->uz_max_items) - mtx_sleep(zone, zone->uz_lockptr, PVM, - "zonelimit", 0); - zone->uz_sleepers--; - if (zone->uz_sleepers > 0 && - zone->uz_items + 1 < zone->uz_max_items) - wakeup_one(zone); - } - zone->uz_items++; - } - ZONE_UNLOCK(zone); - /* Avoid allocs targeting empty domains. */ if (domain != UMA_ANYDOMAIN && VM_DOMAIN_EMPTY(domain)) domain = UMA_ANYDOMAIN; @@ -3479,14 +3597,11 @@ zone_alloc_item_locked(uma_zone_t zone, void *udata, i fail_cnt: counter_u64_add(zone->uz_fails, 1); fail: - if (zone->uz_max_items > 0) { - ZONE_LOCK(zone); - /* XXX Decrement without wakeup */ - zone->uz_items--; - ZONE_UNLOCK(zone); - } + if (zone->uz_max_items > 0) + zone_free_limit(zone, 1); CTR2(KTR_UMA, "zone_alloc_item failed from %s(%p)", zone->uz_name, zone); + return (NULL); } @@ -3832,14 +3947,8 @@ zone_free_item(uma_zone_t zone, void *item, void *udat counter_u64_add(zone->uz_frees, 1); - if (zone->uz_max_items > 0) { - ZONE_LOCK(zone); - zone->uz_items--; - if (zone->uz_sleepers > 0 && - zone->uz_items < zone->uz_max_items) - wakeup_one(zone); - ZONE_UNLOCK(zone); - } + if (zone->uz_max_items > 0) + zone_free_limit(zone, 1); } /* See uma.h */ @@ -3849,6 +3958,11 @@ uma_zone_set_max(uma_zone_t zone, int nitems) struct uma_bucket_zone *ubz; int count; + /* + * XXX This can misbehave if the zone has any allocations with + * no limit and a limit is imposed. There is currently no + * way to clear a limit. + */ ZONE_LOCK(zone); ubz = bucket_zone_max(zone, nitems); count = ubz != NULL ? ubz->ubz_entries : 0; @@ -3858,6 +3972,8 @@ uma_zone_set_max(uma_zone_t zone, int nitems) zone->uz_max_items = nitems; zone->uz_flags |= UMA_ZFLAG_LIMIT; zone_update_caches(zone); + /* We may need to wake waiters. */ + wakeup(&zone->uz_max_items); ZONE_UNLOCK(zone); return (nitems); @@ -4416,6 +4532,7 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) struct sbuf sbuf; uma_keg_t kz; uma_zone_t z; + uint64_t items; int count, error, i; error = sysctl_wire_old_buffer(req, 0); @@ -4452,10 +4569,11 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) uth.uth_align = kz->uk_align; uth.uth_size = kz->uk_size; uth.uth_rsize = kz->uk_rsize; - if (z->uz_max_items > 0) - uth.uth_pages = (z->uz_items / kz->uk_ipers) * + if (z->uz_max_items > 0) { + items = UZ_ITEMS_COUNT(z->uz_items); + uth.uth_pages = (items / kz->uk_ipers) * kz->uk_ppera; - else + } else uth.uth_pages = kz->uk_pages; uth.uth_maxpages = (z->uz_max_items / kz->uk_ipers) * kz->uk_ppera; @@ -4587,6 +4705,16 @@ sysctl_handle_uma_slab_efficiency(SYSCTL_HANDLER_ARGS) avail *= mp_maxid + 1; effpct = 100 * avail / total; return (sysctl_handle_int(oidp, &effpct, 0, req)); +} + +static int +sysctl_handle_uma_zone_items(SYSCTL_HANDLER_ARGS) +{ + uma_zone_t zone = arg1; + uint64_t cur; + + cur = UZ_ITEMS_COUNT(atomic_load_64(&zone->uz_items)); + return (sysctl_handle_64(oidp, &cur, 0, req)); } #ifdef INVARIANTS Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Sat Jan 4 01:13:00 2020 (r356346) +++ head/sys/vm/uma_int.h Sat Jan 4 03:04:46 2020 (r356347) @@ -406,10 +406,7 @@ struct uma_zone_domain { typedef struct uma_zone_domain * uma_zone_domain_t; /* - * Zone management structure - * - * TODO: Optimize for cache line size - * + * Zone structure - per memory type. */ struct uma_zone { /* Offset 0, used in alloc/free fast/medium fast path and const. */ @@ -422,9 +419,9 @@ struct uma_zone { uint32_t uz_size; /* Size inherited from kegs */ uma_ctor uz_ctor; /* Constructor for each allocation */ uma_dtor uz_dtor; /* Destructor */ - uint64_t uz_items; /* Total items count */ + uint64_t uz_spare0; uint64_t uz_max_items; /* Maximum number of items to alloc */ - uint32_t uz_sleepers; /* Number of sleepers on memory */ + uint32_t uz_sleepers; /* Threads sleeping on limit */ uint16_t uz_bucket_size; /* Number of items in full bucket */ uint16_t uz_bucket_size_max; /* Maximum number of bucket items */ @@ -434,7 +431,7 @@ struct uma_zone { void *uz_arg; /* Import/release argument. */ uma_init uz_init; /* Initializer for each item */ uma_fini uz_fini; /* Finalizer for each item. */ - void *uz_spare; + void *uz_spare1; uint64_t uz_bkt_count; /* Items in bucket cache */ uint64_t uz_bkt_max; /* Maximum bucket cache size */ @@ -459,6 +456,8 @@ struct uma_zone { counter_u64_t uz_fails; /* Total number of alloc failures */ uint64_t uz_sleeps; /* Total number of alloc sleeps */ uint64_t uz_xdomain; /* Total number of cross-domain frees */ + volatile uint64_t uz_items; /* Total items count & sleepers */ + char *uz_ctlname; /* sysctl safe name string. */ struct sysctl_oid *uz_oid; /* sysctl oid pointer. */ int uz_namecnt; /* duplicate name count. */ @@ -514,6 +513,17 @@ struct uma_zone { "\3STATIC" \ "\2ZINIT" \ "\1PAGEABLE" + +/* + * Macros for interpreting the uz_items field. 20 bits of sleeper count + * and 44 bit of item count. + */ +#define UZ_ITEMS_SLEEPER_SHIFT 44LL +#define UZ_ITEMS_SLEEPERS_MAX ((1 << (64 - UZ_ITEMS_SLEEPER_SHIFT)) - 1) +#define UZ_ITEMS_COUNT_MASK ((1LL << UZ_ITEMS_SLEEPER_SHIFT) - 1) +#define UZ_ITEMS_COUNT(x) ((x) & UZ_ITEMS_COUNT_MASK) +#define UZ_ITEMS_SLEEPERS(x) ((x) >> UZ_ITEMS_SLEEPER_SHIFT) +#define UZ_ITEMS_SLEEPER (1LL << UZ_ITEMS_SLEEPER_SHIFT) #undef UMA_ALIGN From owner-svn-src-head@freebsd.org Sat Jan 4 03:15:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39ABE1DDF9B; Sat, 4 Jan 2020 03:15:35 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qRjg1FHTz3D5H; Sat, 4 Jan 2020 03:15:35 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25CD66876; Sat, 4 Jan 2020 03:15:35 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0043FZCg047980; Sat, 4 Jan 2020 03:15:35 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0043FYhn047977; Sat, 4 Jan 2020 03:15:34 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <202001040315.0043FYhn047977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 4 Jan 2020 03:15:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356348 - in head/sys: kern vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: kern vm X-SVN-Commit-Revision: 356348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 03:15:35 -0000 Author: jeff Date: Sat Jan 4 03:15:34 2020 New Revision: 356348 URL: https://svnweb.freebsd.org/changeset/base/356348 Log: Use a separate lock for the zone and keg. This provides concurrency between populating buckets from the slab layer and fetching full buckets from the zone layer. Eliminate some nonsense locking patterns where we lock to fetch a single variable. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D22828 Modified: head/sys/kern/kern_mbuf.c head/sys/vm/uma.h head/sys/vm/uma_core.c head/sys/vm/uma_int.h Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat Jan 4 03:04:46 2020 (r356347) +++ head/sys/kern/kern_mbuf.c Sat Jan 4 03:15:34 2020 (r356348) @@ -715,7 +715,7 @@ mb_dtor_pack(void *mem, int size, void *arg) * is deliberate. We don't want to acquire the zone lock for every * mbuf free. */ - if (uma_zone_exhausted_nolock(zone_clust)) + if (uma_zone_exhausted(zone_clust)) uma_zone_reclaim(zone_pack, UMA_RECLAIM_DRAIN); } Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Sat Jan 4 03:04:46 2020 (r356347) +++ head/sys/vm/uma.h Sat Jan 4 03:15:34 2020 (r356348) @@ -641,7 +641,6 @@ void uma_prealloc(uma_zone_t zone, int itemcnt); * Non-zero if zone is exhausted. */ int uma_zone_exhausted(uma_zone_t zone); -int uma_zone_exhausted_nolock(uma_zone_t zone); /* * Common UMA_ZONE_PCPU zones. Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sat Jan 4 03:04:46 2020 (r356347) +++ head/sys/vm/uma_core.c Sat Jan 4 03:15:34 2020 (r356348) @@ -922,7 +922,7 @@ bucket_drain(uma_zone_t zone, uma_bucket_t bucket) /* * Drains the per cpu caches for a zone. * - * NOTE: This may only be called while the zone is being turn down, and not + * NOTE: This may only be called while the zone is being torn down, and not * during normal operation. This is necessary in order that we do not have * to migrate CPUs to drain the per-CPU caches. * @@ -1041,7 +1041,7 @@ pcpu_cache_drain_safe(uma_zone_t zone) int cpu; /* - * Polite bucket sizes shrinking was not enouth, shrink aggressively. + * Polite bucket sizes shrinking was not enough, shrink aggressively. */ if (zone) cache_shrink(zone, NULL); @@ -1222,7 +1222,7 @@ zone_reclaim(uma_zone_t zone, int waitok, bool drain) while (zone->uz_flags & UMA_ZFLAG_RECLAIMING) { if (waitok == M_NOWAIT) goto out; - msleep(zone, zone->uz_lockptr, PVM, "zonedrain", 1); + msleep(zone, &zone->uz_lock, PVM, "zonedrain", 1); } zone->uz_flags |= UMA_ZFLAG_RECLAIMING; bucket_cache_reclaim(zone, drain); @@ -1258,8 +1258,8 @@ zone_trim(uma_zone_t zone, void *unused) /* * Allocate a new slab for a keg. This does not insert the slab onto a list. - * If the allocation was successful, the keg lock will be held upon return, - * otherwise the keg will be left unlocked. + * The keg should be locked on entry and will be dropped and reacquired on + * return. * * Arguments: * flags Wait flags for the item initialization routine @@ -1283,8 +1283,6 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom KASSERT(domain >= 0 && domain < vm_ndomains, ("keg_alloc_slab: domain %d out of range", domain)); KEG_LOCK_ASSERT(keg); - MPASS(zone->uz_lockptr == &keg->uk_lock); - allocf = keg->uk_allocf; KEG_UNLOCK(keg); @@ -1293,7 +1291,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom if (keg->uk_flags & UMA_ZONE_OFFPAGE) { slab = zone_alloc_item(keg->uk_slabzone, NULL, domain, aflags); if (slab == NULL) - goto out; + goto fail; } /* @@ -1317,8 +1315,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom if (mem == NULL) { if (keg->uk_flags & UMA_ZONE_OFFPAGE) zone_free_item(keg->uk_slabzone, slab, NULL, SKIP_NONE); - slab = NULL; - goto out; + goto fail; } uma_total_inc(size); @@ -1348,8 +1345,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom break; if (i != keg->uk_ipers) { keg_free_slab(keg, slab, i); - slab = NULL; - goto out; + goto fail; } } KEG_LOCK(keg); @@ -1363,8 +1359,11 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom keg->uk_pages += keg->uk_ppera; keg->uk_free += keg->uk_ipers; -out: return (slab); + +fail: + KEG_LOCK(keg); + return (NULL); } /* @@ -2237,6 +2236,7 @@ zone_ctor(void *mem, int size, void *udata, int flags) cnt.count = 0; zone_foreach(zone_count, &cnt); zone->uz_namecnt = cnt.count; + ZONE_LOCK_INIT(zone, (arg->flags & UMA_ZONE_MTXCLASS)); for (i = 0; i < vm_ndomains; i++) TAILQ_INIT(&zone->uz_domain[i].uzd_buckets); @@ -2250,6 +2250,8 @@ zone_ctor(void *mem, int size, void *udata, int flags) * This is a pure cache zone, no kegs. */ if (arg->import) { + KASSERT((arg->flags & UMA_ZFLAG_CACHE) != 0, + ("zone_ctor: Import specified for non-cache zone.")); if (arg->flags & UMA_ZONE_VM) arg->flags |= UMA_ZFLAG_CACHEONLY; zone->uz_flags = arg->flags; @@ -2257,8 +2259,6 @@ zone_ctor(void *mem, int size, void *udata, int flags) zone->uz_import = arg->import; zone->uz_release = arg->release; zone->uz_arg = arg->arg; - zone->uz_lockptr = &zone->uz_lock; - ZONE_LOCK_INIT(zone, (arg->flags & UMA_ZONE_MTXCLASS)); rw_wlock(&uma_rwlock); LIST_INSERT_HEAD(&uma_cachezones, zone, uz_link); rw_wunlock(&uma_rwlock); @@ -2279,7 +2279,6 @@ zone_ctor(void *mem, int size, void *udata, int flags) KASSERT(arg->keg != NULL, ("Secondary zone on zero'd keg")); zone->uz_init = arg->uminit; zone->uz_fini = arg->fini; - zone->uz_lockptr = &keg->uk_lock; zone->uz_flags |= UMA_ZONE_SECONDARY; rw_wlock(&uma_rwlock); ZONE_LOCK(zone); @@ -2419,8 +2418,7 @@ zone_dtor(void *arg, int size, void *udata) counter_u64_free(zone->uz_frees); counter_u64_free(zone->uz_fails); free(zone->uz_ctlname, M_UMA); - if (zone->uz_lockptr == &zone->uz_lock) - ZONE_LOCK_FINI(zone); + ZONE_LOCK_FINI(zone); } /* @@ -3223,7 +3221,6 @@ restart: LIST_INSERT_HEAD(&dom->ud_part_slab, slab, us_link); return (slab); } - KEG_LOCK(keg); if (!rr && (flags & M_WAITOK) == 0) break; if (rr && vm_domainset_iter_policy(&di, &domain) != 0) { @@ -3869,7 +3866,6 @@ slab_free_item(uma_zone_t zone, uma_slab_t slab, void uint8_t freei; keg = zone->uz_keg; - MPASS(zone->uz_lockptr == &keg->uk_lock); KEG_LOCK_ASSERT(keg); dom = &keg->uk_domain[slab->us_domain]; @@ -4012,9 +4008,7 @@ uma_zone_get_max(uma_zone_t zone) { int nitems; - ZONE_LOCK(zone); - nitems = zone->uz_max_items; - ZONE_UNLOCK(zone); + nitems = atomic_load_64(&zone->uz_max_items); return (nitems); } @@ -4024,9 +4018,8 @@ void uma_zone_set_warning(uma_zone_t zone, const char *warning) { - ZONE_LOCK(zone); + ZONE_ASSERT_COLD(zone); zone->uz_warning = warning; - ZONE_UNLOCK(zone); } /* See uma.h */ @@ -4034,9 +4027,8 @@ void uma_zone_set_maxaction(uma_zone_t zone, uma_maxaction_t maxaction) { - ZONE_LOCK(zone); + ZONE_ASSERT_COLD(zone); TASK_INIT(&zone->uz_maxaction, 0, (task_fn_t *)maxaction, zone); - ZONE_UNLOCK(zone); } /* See uma.h */ @@ -4046,22 +4038,11 @@ uma_zone_get_cur(uma_zone_t zone) int64_t nitems; u_int i; - ZONE_LOCK(zone); nitems = counter_u64_fetch(zone->uz_allocs) - counter_u64_fetch(zone->uz_frees); - if ((zone->uz_flags & UMA_ZFLAG_INTERNAL) == 0) { - CPU_FOREACH(i) { - /* - * See the comment in uma_vm_zone_stats() regarding - * the safety of accessing the per-cpu caches. With - * the zone lock held, it is safe, but can potentially - * result in stale data. - */ - nitems += zone->uz_cpu[i].uc_allocs - - zone->uz_cpu[i].uc_frees; - } - } - ZONE_UNLOCK(zone); + CPU_FOREACH(i) + nitems += atomic_load_64(&zone->uz_cpu[i].uc_allocs) - + atomic_load_64(&zone->uz_cpu[i].uc_frees); return (nitems < 0 ? 0 : nitems); } @@ -4072,20 +4053,9 @@ uma_zone_get_allocs(uma_zone_t zone) uint64_t nitems; u_int i; - ZONE_LOCK(zone); nitems = counter_u64_fetch(zone->uz_allocs); - if ((zone->uz_flags & UMA_ZFLAG_INTERNAL) == 0) { - CPU_FOREACH(i) { - /* - * See the comment in uma_vm_zone_stats() regarding - * the safety of accessing the per-cpu caches. With - * the zone lock held, it is safe, but can potentially - * result in stale data. - */ - nitems += zone->uz_cpu[i].uc_allocs; - } - } - ZONE_UNLOCK(zone); + CPU_FOREACH(i) + nitems += atomic_load_64(&zone->uz_cpu[i].uc_allocs); return (nitems); } @@ -4096,20 +4066,9 @@ uma_zone_get_frees(uma_zone_t zone) uint64_t nitems; u_int i; - ZONE_LOCK(zone); nitems = counter_u64_fetch(zone->uz_frees); - if ((zone->uz_flags & UMA_ZFLAG_INTERNAL) == 0) { - CPU_FOREACH(i) { - /* - * See the comment in uma_vm_zone_stats() regarding - * the safety of accessing the per-cpu caches. With - * the zone lock held, it is safe, but can potentially - * result in stale data. - */ - nitems += zone->uz_cpu[i].uc_frees; - } - } - ZONE_UNLOCK(zone); + CPU_FOREACH(i) + nitems += atomic_load_64(&zone->uz_cpu[i].uc_frees); return (nitems); } @@ -4121,11 +4080,8 @@ uma_zone_set_init(uma_zone_t zone, uma_init uminit) uma_keg_t keg; KEG_GET(zone, keg); - KEG_LOCK(keg); - KASSERT(keg->uk_pages == 0, - ("uma_zone_set_init on non-empty keg")); + KEG_ASSERT_COLD(keg); keg->uk_init = uminit; - KEG_UNLOCK(keg); } /* See uma.h */ @@ -4135,11 +4091,8 @@ uma_zone_set_fini(uma_zone_t zone, uma_fini fini) uma_keg_t keg; KEG_GET(zone, keg); - KEG_LOCK(keg); - KASSERT(keg->uk_pages == 0, - ("uma_zone_set_fini on non-empty keg")); + KEG_ASSERT_COLD(keg); keg->uk_fini = fini; - KEG_UNLOCK(keg); } /* See uma.h */ @@ -4147,11 +4100,8 @@ void uma_zone_set_zinit(uma_zone_t zone, uma_init zinit) { - ZONE_LOCK(zone); - KASSERT(zone->uz_keg->uk_pages == 0, - ("uma_zone_set_zinit on non-empty keg")); + ZONE_ASSERT_COLD(zone); zone->uz_init = zinit; - ZONE_UNLOCK(zone); } /* See uma.h */ @@ -4159,38 +4109,30 @@ void uma_zone_set_zfini(uma_zone_t zone, uma_fini zfini) { - ZONE_LOCK(zone); - KASSERT(zone->uz_keg->uk_pages == 0, - ("uma_zone_set_zfini on non-empty keg")); + ZONE_ASSERT_COLD(zone); zone->uz_fini = zfini; - ZONE_UNLOCK(zone); } /* See uma.h */ -/* XXX uk_freef is not actually used with the zone locked */ void uma_zone_set_freef(uma_zone_t zone, uma_free freef) { uma_keg_t keg; KEG_GET(zone, keg); - KASSERT(keg != NULL, ("uma_zone_set_freef: Invalid zone type")); - KEG_LOCK(keg); + KEG_ASSERT_COLD(keg); keg->uk_freef = freef; - KEG_UNLOCK(keg); } /* See uma.h */ -/* XXX uk_allocf is not actually used with the zone locked */ void uma_zone_set_allocf(uma_zone_t zone, uma_alloc allocf) { uma_keg_t keg; KEG_GET(zone, keg); - KEG_LOCK(keg); + KEG_ASSERT_COLD(keg); keg->uk_allocf = allocf; - KEG_UNLOCK(keg); } /* See uma.h */ @@ -4200,9 +4142,8 @@ uma_zone_reserve(uma_zone_t zone, int items) uma_keg_t keg; KEG_GET(zone, keg); - KEG_LOCK(keg); + KEG_ASSERT_COLD(keg); keg->uk_reserve = items; - KEG_UNLOCK(keg); } /* See uma.h */ @@ -4214,6 +4155,8 @@ uma_zone_reserve_kva(uma_zone_t zone, int count) u_int pages; KEG_GET(zone, keg); + KEG_ASSERT_COLD(keg); + ZONE_ASSERT_COLD(zone); pages = count / keg->uk_ipers; if (pages * keg->uk_ipers < count) @@ -4277,7 +4220,6 @@ uma_prealloc(uma_zone_t zone, int items) us_link); break; } - KEG_LOCK(keg); if (vm_domainset_iter_policy(&di, &domain) != 0) { KEG_UNLOCK(keg); vm_wait_doms(&keg->uk_dr.dr_policy->ds_mask); @@ -4376,20 +4318,10 @@ uma_zone_reclaim(uma_zone_t zone, int req) int uma_zone_exhausted(uma_zone_t zone) { - int full; - ZONE_LOCK(zone); - full = zone->uz_sleepers > 0; - ZONE_UNLOCK(zone); - return (full); + return (atomic_load_32(&zone->uz_sleepers) > 0); } -int -uma_zone_exhausted_nolock(uma_zone_t zone) -{ - return (zone->uz_sleepers > 0); -} - unsigned long uma_limit(void) { @@ -4725,25 +4657,22 @@ uma_dbg_getslab(uma_zone_t zone, void *item) uma_keg_t keg; uint8_t *mem; + /* + * It is safe to return the slab here even though the + * zone is unlocked because the item's allocation state + * essentially holds a reference. + */ mem = (uint8_t *)((uintptr_t)item & (~UMA_SLAB_MASK)); - if (zone->uz_flags & UMA_ZONE_VTOSLAB) { - slab = vtoslab((vm_offset_t)mem); - } else { - /* - * It is safe to return the slab here even though the - * zone is unlocked because the item's allocation state - * essentially holds a reference. - */ - if (zone->uz_lockptr == &zone->uz_lock) - return (NULL); - ZONE_LOCK(zone); - keg = zone->uz_keg; - if (keg->uk_flags & UMA_ZONE_HASH) - slab = hash_sfind(&keg->uk_hash, mem); - else - slab = (uma_slab_t)(mem + keg->uk_pgoff); - ZONE_UNLOCK(zone); - } + if ((zone->uz_flags & UMA_ZFLAG_CACHE) != 0) + return (NULL); + if (zone->uz_flags & UMA_ZONE_VTOSLAB) + return (vtoslab((vm_offset_t)mem)); + keg = zone->uz_keg; + if ((keg->uk_flags & UMA_ZONE_HASH) == 0) + return ((uma_slab_t)(mem + keg->uk_pgoff)); + KEG_LOCK(keg); + slab = hash_sfind(&keg->uk_hash, mem); + KEG_UNLOCK(keg); return (slab); } @@ -4752,7 +4681,7 @@ static bool uma_dbg_zskip(uma_zone_t zone, void *mem) { - if (zone->uz_lockptr == &zone->uz_lock) + if ((zone->uz_flags & UMA_ZFLAG_CACHE) != 0) return (true); return (uma_dbg_kskip(zone->uz_keg, mem)); Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Sat Jan 4 03:04:46 2020 (r356347) +++ head/sys/vm/uma_int.h Sat Jan 4 03:15:34 2020 (r356348) @@ -257,7 +257,7 @@ struct uma_domain { struct slabhead ud_part_slab; /* partially allocated slabs */ struct slabhead ud_free_slab; /* completely unallocated slabs */ struct slabhead ud_full_slab; /* fully allocated slabs */ -}; +} __aligned(CACHE_LINE_SIZE); typedef struct uma_domain * uma_domain_t; @@ -268,9 +268,7 @@ typedef struct uma_domain * uma_domain_t; * */ struct uma_keg { - struct mtx uk_lock; /* Lock for the keg must be first. - * See shared uz_keg/uz_lockptr - * member of struct uma_zone. */ + struct mtx uk_lock; /* Lock for the keg. */ struct uma_hash uk_hash; LIST_HEAD(,uma_zone) uk_zones; /* Keg's zones */ @@ -306,6 +304,10 @@ struct uma_keg { typedef struct uma_keg * uma_keg_t; #ifdef _KERNEL +#define KEG_ASSERT_COLD(k) \ + KASSERT((k)->uk_pages == 0, ("keg %s initialization after use.",\ + (k)->uk_name)) + /* * Free bits per-slab. */ @@ -401,7 +403,7 @@ struct uma_zone_domain { long uzd_imax; /* maximum item count this period */ long uzd_imin; /* minimum item count this period */ long uzd_wss; /* working set size estimate */ -}; +} __aligned(CACHE_LINE_SIZE); typedef struct uma_zone_domain * uma_zone_domain_t; @@ -410,10 +412,7 @@ typedef struct uma_zone_domain * uma_zone_domain_t; */ struct uma_zone { /* Offset 0, used in alloc/free fast/medium fast path and const. */ - union { - uma_keg_t uz_keg; /* This zone's keg */ - struct mtx *uz_lockptr; /* To keg or to self */ - }; + uma_keg_t uz_keg; /* This zone's keg if !CACHE */ struct uma_zone_domain *uz_domain; /* per-domain buckets */ uint32_t uz_flags; /* Flags inherited from kegs */ uint32_t uz_size; /* Size inherited from kegs */ @@ -525,6 +524,10 @@ struct uma_zone { #define UZ_ITEMS_SLEEPERS(x) ((x) >> UZ_ITEMS_SLEEPER_SHIFT) #define UZ_ITEMS_SLEEPER (1LL << UZ_ITEMS_SLEEPER_SHIFT) +#define ZONE_ASSERT_COLD(z) \ + KASSERT((z)->uz_bkt_count == 0, \ + ("zone %s initialization after use.", (z)->uz_name)) + #undef UMA_ALIGN #ifdef _KERNEL @@ -564,11 +567,11 @@ static __inline uma_slab_t hash_sfind(struct uma_hash "UMA zone", MTX_DEF | MTX_DUPOK); \ } while (0) -#define ZONE_LOCK(z) mtx_lock((z)->uz_lockptr) -#define ZONE_TRYLOCK(z) mtx_trylock((z)->uz_lockptr) -#define ZONE_UNLOCK(z) mtx_unlock((z)->uz_lockptr) +#define ZONE_LOCK(z) mtx_lock(&(z)->uz_lock) +#define ZONE_TRYLOCK(z) mtx_trylock(&(z)->uz_lock) +#define ZONE_UNLOCK(z) mtx_unlock(&(z)->uz_lock) #define ZONE_LOCK_FINI(z) mtx_destroy(&(z)->uz_lock) -#define ZONE_LOCK_ASSERT(z) mtx_assert((z)->uz_lockptr, MA_OWNED) +#define ZONE_LOCK_ASSERT(z) mtx_assert(&(z)->uz_lock, MA_OWNED) /* * Find a slab within a hash table. This is used for OFFPAGE zones to lookup From owner-svn-src-head@freebsd.org Sat Jan 4 03:30:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9E131DE38E; Sat, 4 Jan 2020 03:30:09 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qS2T4TLzz3DcM; Sat, 4 Jan 2020 03:30:09 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C7EB6A6F; Sat, 4 Jan 2020 03:30:09 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0043U93A054272; Sat, 4 Jan 2020 03:30:09 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0043U8JE054269; Sat, 4 Jan 2020 03:30:08 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <202001040330.0043U8JE054269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 4 Jan 2020 03:30:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356349 - in head: lib/libmemstat sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head: lib/libmemstat sys/vm X-SVN-Commit-Revision: 356349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 03:30:09 -0000 Author: jeff Date: Sat Jan 4 03:30:08 2020 New Revision: 356349 URL: https://svnweb.freebsd.org/changeset/base/356349 Log: Use per-domain keg locks. This provides both a lock and separate space accounting for each NUMA domain. Independent keg domain locks are important with cross-domain frees. Hashed zones are non-numa and use a single keg lock to protect the hash table. Reviewed by: markj, rlibby Differential Revision: https://reviews.freebsd.org/D22829 Modified: head/lib/libmemstat/memstat_uma.c head/sys/vm/uma_core.c head/sys/vm/uma_int.h Modified: head/lib/libmemstat/memstat_uma.c ============================================================================== --- head/lib/libmemstat/memstat_uma.c Sat Jan 4 03:15:34 2020 (r356348) +++ head/lib/libmemstat/memstat_uma.c Sat Jan 4 03:30:08 2020 (r356349) @@ -311,10 +311,12 @@ memstat_kvm_uma(struct memory_type_list *list, void *k LIST_HEAD(, uma_keg) uma_kegs; struct memory_type *mtp; struct uma_zone_domain uzd; + struct uma_domain ukd; struct uma_bucket *ubp, ub; struct uma_cache *ucp, *ucp_array; struct uma_zone *uzp, uz; struct uma_keg *kzp, kz; + uint64_t kegfree; int hint_dontsearch, i, mp_maxid, ndomains, ret; char name[MEMTYPE_MAXNAME]; cpuset_t all_cpus; @@ -454,18 +456,29 @@ skip_percpu: for (i = 0; i < ndomains; i++) { ret = kread(kvm, &uz.uz_domain[i], &uzd, sizeof(uzd), 0); + if (ret != 0) + continue; for (ubp = TAILQ_FIRST(&uzd.uzd_buckets); ubp != NULL; ubp = TAILQ_NEXT(&ub, ub_link)) { ret = kread(kvm, ubp, &ub, sizeof(ub), 0); + if (ret != 0) + continue; mtp->mt_zonefree += ub.ub_cnt; } } if (!((kz.uk_flags & UMA_ZONE_SECONDARY) && LIST_FIRST(&kz.uk_zones) != uzp)) { - mtp->mt_kegfree = kz.uk_free; + kegfree = 0; + for (i = 0; i < ndomains; i++) { + ret = kread(kvm, &kzp->uk_domain[i], + &ukd, sizeof(ukd), 0); + if (ret != 0) + kegfree += ukd.ud_free; + } + mtp->mt_kegfree = kegfree; mtp->mt_free += mtp->mt_kegfree; } mtp->mt_free += mtp->mt_zonefree; Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sat Jan 4 03:15:34 2020 (r356348) +++ head/sys/vm/uma_core.c Sat Jan 4 03:30:08 2020 (r356349) @@ -740,23 +740,28 @@ static void zone_timeout(uma_zone_t zone, void *unused) { uma_keg_t keg; - u_int slabs; + u_int slabs, pages; if ((zone->uz_flags & UMA_ZONE_HASH) == 0) goto update_wss; keg = zone->uz_keg; - KEG_LOCK(keg); + /* + * Hash zones are non-numa by definition so the first domain + * is the only one present. + */ + KEG_LOCK(keg, 0); + pages = keg->uk_domain[0].ud_pages; + + /* * Expand the keg hash table. * * This is done if the number of slabs is larger than the hash size. * What I'm trying to do here is completely reduce collisions. This * may be a little aggressive. Should I allow for two collisions max? */ - if (keg->uk_flags & UMA_ZONE_HASH && - (slabs = keg->uk_pages / keg->uk_ppera) > - keg->uk_hash.uh_hashsize) { + if ((slabs = pages / keg->uk_ppera) > keg->uk_hash.uh_hashsize) { struct uma_hash newhash; struct uma_hash oldhash; int ret; @@ -767,9 +772,9 @@ zone_timeout(uma_zone_t zone, void *unused) * I have to do everything in stages and check for * races. */ - KEG_UNLOCK(keg); + KEG_UNLOCK(keg, 0); ret = hash_alloc(&newhash, 1 << fls(slabs)); - KEG_LOCK(keg); + KEG_LOCK(keg, 0); if (ret) { if (hash_expand(&keg->uk_hash, &newhash)) { oldhash = keg->uk_hash; @@ -777,12 +782,12 @@ zone_timeout(uma_zone_t zone, void *unused) } else oldhash = newhash; - KEG_UNLOCK(keg); + KEG_UNLOCK(keg, 0); hash_free(&oldhash); - return; + goto update_wss; } } - KEG_UNLOCK(keg); + KEG_UNLOCK(keg, 0); update_wss: ZONE_LOCK(zone); @@ -1166,7 +1171,7 @@ keg_drain(uma_keg_t keg) struct slabhead freeslabs = { 0 }; uma_domain_t dom; uma_slab_t slab, tmp; - int i; + int i, n; /* * We don't want to take pages from statically allocated kegs at this @@ -1175,33 +1180,27 @@ keg_drain(uma_keg_t keg) if (keg->uk_flags & UMA_ZONE_NOFREE || keg->uk_freef == NULL) return; - CTR3(KTR_UMA, "keg_drain %s(%p) free items: %u", - keg->uk_name, keg, keg->uk_free); - KEG_LOCK(keg); - if (keg->uk_free == 0) - goto finished; - for (i = 0; i < vm_ndomains; i++) { + CTR4(KTR_UMA, "keg_drain %s(%p) domain %d free items: %u", + keg->uk_name, keg, i, dom->ud_free); + n = 0; dom = &keg->uk_domain[i]; + KEG_LOCK(keg, i); LIST_FOREACH_SAFE(slab, &dom->ud_free_slab, us_link, tmp) { /* We have nowhere to free these to. */ if (slab->us_flags & UMA_SLAB_BOOT) continue; - - LIST_REMOVE(slab, us_link); - keg->uk_pages -= keg->uk_ppera; - keg->uk_free -= keg->uk_ipers; - if (keg->uk_flags & UMA_ZONE_HASH) UMA_HASH_REMOVE(&keg->uk_hash, slab); - + n++; + LIST_REMOVE(slab, us_link); LIST_INSERT_HEAD(&freeslabs, slab, us_link); } + dom->ud_pages -= n * keg->uk_ppera; + dom->ud_free -= n * keg->uk_ipers; + KEG_UNLOCK(keg, i); } -finished: - KEG_UNLOCK(keg); - while ((slab = LIST_FIRST(&freeslabs)) != NULL) { LIST_REMOVE(slab, us_link); keg_free_slab(keg, slab, keg->uk_ipers); @@ -1257,9 +1256,9 @@ zone_trim(uma_zone_t zone, void *unused) } /* - * Allocate a new slab for a keg. This does not insert the slab onto a list. - * The keg should be locked on entry and will be dropped and reacquired on - * return. + * Allocate a new slab for a keg and inserts it into the partial slab list. + * The keg should be unlocked on entry. If the allocation succeeds it will + * be locked on return. * * Arguments: * flags Wait flags for the item initialization routine @@ -1273,6 +1272,7 @@ static uma_slab_t keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int flags, int aflags) { + uma_domain_t dom; uma_alloc allocf; uma_slab_t slab; unsigned long size; @@ -1282,10 +1282,8 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom KASSERT(domain >= 0 && domain < vm_ndomains, ("keg_alloc_slab: domain %d out of range", domain)); - KEG_LOCK_ASSERT(keg); - allocf = keg->uk_allocf; - KEG_UNLOCK(keg); + allocf = keg->uk_allocf; slab = NULL; mem = NULL; if (keg->uk_flags & UMA_ZONE_OFFPAGE) { @@ -1319,6 +1317,10 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom } uma_total_inc(size); + /* For HASH zones all pages go to the same uma_domain. */ + if ((keg->uk_flags & UMA_ZONE_HASH) != 0) + domain = 0; + /* Point the slab into the allocated memory */ if (!(keg->uk_flags & UMA_ZONE_OFFPAGE)) slab = (uma_slab_t )(mem + keg->uk_pgoff); @@ -1333,6 +1335,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom slab->us_freecount = keg->uk_ipers; slab->us_flags = sflags; slab->us_domain = domain; + BIT_FILL(keg->uk_ipers, &slab->us_free); #ifdef INVARIANTS BIT_ZERO(keg->uk_ipers, slab_dbg_bits(slab, keg)); @@ -1348,7 +1351,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom goto fail; } } - KEG_LOCK(keg); + KEG_LOCK(keg, domain); CTR3(KTR_UMA, "keg_alloc_slab: allocated slab %p for %s(%p)", slab, keg->uk_name, keg); @@ -1356,13 +1359,19 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom if (keg->uk_flags & UMA_ZONE_HASH) UMA_HASH_INSERT(&keg->uk_hash, slab, mem); - keg->uk_pages += keg->uk_ppera; - keg->uk_free += keg->uk_ipers; + /* + * If we got a slab here it's safe to mark it partially used + * and return. We assume that the caller is going to remove + * at least one item. + */ + dom = &keg->uk_domain[domain]; + LIST_INSERT_HEAD(&dom->ud_part_slab, slab, us_link); + dom->ud_pages += keg->uk_ppera; + dom->ud_free += keg->uk_ipers; return (slab); fail: - KEG_LOCK(keg); return (NULL); } @@ -1875,15 +1884,14 @@ keg_ctor(void *mem, int size, void *udata, int flags) struct uma_kctor_args *arg = udata; uma_keg_t keg = mem; uma_zone_t zone; + int i; bzero(keg, size); keg->uk_size = arg->size; keg->uk_init = arg->uminit; keg->uk_fini = arg->fini; keg->uk_align = arg->align; - keg->uk_free = 0; keg->uk_reserve = 0; - keg->uk_pages = 0; keg->uk_flags = arg->flags; keg->uk_slabzone = NULL; @@ -1926,6 +1934,15 @@ keg_ctor(void *mem, int size, void *udata, int flags) keg_small_init(keg); } + /* + * Sets all kegs with memory that comes from the page array to a + * first-touch domain policy. + */ +#ifdef UMA_FIRSTTOUCH + if ((keg->uk_flags & UMA_ZONE_HASH) == 0) + keg->uk_flags |= UMA_ZONE_NUMA; +#endif + if (keg->uk_flags & UMA_ZONE_OFFPAGE) keg->uk_slabzone = slabzone; @@ -1954,9 +1971,10 @@ keg_ctor(void *mem, int size, void *udata, int flags) keg->uk_freef = page_free; /* - * Initialize keg's lock + * Initialize keg's locks. */ - KEG_LOCK_INIT(keg, (arg->flags & UMA_ZONE_MTXCLASS)); + for (i = 0; i < vm_ndomains; i++) + KEG_LOCK_INIT(keg, i, (arg->flags & UMA_ZONE_MTXCLASS)); /* * If we're putting the slab header in the actual page we need to @@ -1983,10 +2001,7 @@ keg_ctor(void *mem, int size, void *udata, int flags) if (keg->uk_flags & UMA_ZONE_HASH) hash_alloc(&keg->uk_hash, 0); - CTR5(KTR_UMA, "keg_ctor %p zone %s(%p) out %d free %d\n", - keg, zone->uz_name, zone, - (keg->uk_pages / keg->uk_ppera) * keg->uk_ipers - keg->uk_free, - keg->uk_free); + CTR3(KTR_UMA, "keg_ctor %p zone %s(%p)\n", keg, zone->uz_name, zone); LIST_INSERT_HEAD(&keg->uk_zones, zone, uz_link); @@ -2009,6 +2024,7 @@ static void zone_alloc_sysctl(uma_zone_t zone, void *unused) { uma_zone_domain_t zdom; + uma_domain_t dom; uma_keg_t keg; struct sysctl_oid *oid, *domainoid; int domains, i, cnt; @@ -2056,6 +2072,10 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused) /* * keg if present. */ + if ((zone->uz_flags & UMA_ZONE_HASH) == 0) + domains = vm_ndomains; + else + domains = 1; oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(zone->uz_oid), OID_AUTO, "keg", CTLFLAG_RD, NULL, ""); keg = zone->uz_keg; @@ -2074,16 +2094,24 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused) SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "align", CTLFLAG_RD, &keg->uk_align, 0, "item alignment mask"); - SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, - "pages", CTLFLAG_RD, &keg->uk_pages, 0, - "Total pages currently allocated from VM"); - SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, - "free", CTLFLAG_RD, &keg->uk_free, 0, - "items free in the slab layer"); SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "efficiency", CTLFLAG_RD | CTLTYPE_INT | CTLFLAG_MPSAFE, keg, 0, sysctl_handle_uma_slab_efficiency, "I", "Slab utilization (100 - internal fragmentation %)"); + domainoid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(oid), + OID_AUTO, "domain", CTLFLAG_RD, NULL, ""); + for (i = 0; i < domains; i++) { + dom = &keg->uk_domain[i]; + oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(domainoid), + OID_AUTO, VM_DOMAIN(i)->vmd_name, CTLFLAG_RD, + NULL, ""); + SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "pages", CTLFLAG_RD, &dom->ud_pages, 0, + "Total pages currently allocated from VM"); + SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free", CTLFLAG_RD, &dom->ud_free, 0, + "items free in the slab layer"); + } } else SYSCTL_ADD_CONST_STRING(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "name", CTLFLAG_RD, nokeg, "Keg name"); @@ -2114,14 +2142,12 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused) "Number of items in the bucket cache"); /* - * Per-domain information. + * Per-domain zone information. */ - if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) - domains = vm_ndomains; - else - domains = 1; domainoid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(zone->uz_oid), OID_AUTO, "domain", CTLFLAG_RD, NULL, ""); + if ((zone->uz_flags & UMA_ZONE_NUMA) == 0) + domains = 1; for (i = 0; i < domains; i++) { zdom = &zone->uz_domain[i]; oid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(domainoid), @@ -2359,20 +2385,23 @@ static void keg_dtor(void *arg, int size, void *udata) { uma_keg_t keg; + uint32_t free, pages; + int i; keg = (uma_keg_t)arg; - KEG_LOCK(keg); - if (keg->uk_free != 0) { - printf("Freed UMA keg (%s) was not empty (%d items). " - " Lost %d pages of memory.\n", - keg->uk_name ? keg->uk_name : "", - keg->uk_free, keg->uk_pages); + free = pages = 0; + for (i = 0; i < vm_ndomains; i++) { + free += keg->uk_domain[i].ud_free; + pages += keg->uk_domain[i].ud_pages; + KEG_LOCK_FINI(keg, i); } - KEG_UNLOCK(keg); + if (free != 0) + printf("Freed UMA keg (%s) was not empty (%u items). " + " Lost %u pages of memory.\n", + keg->uk_name ? keg->uk_name : "", + free, pages); hash_free(&keg->uk_hash); - - KEG_LOCK_FINI(keg); } /* @@ -2659,11 +2688,6 @@ uma_zcreate(const char *name, size_t size, uma_ctor ct KASSERT(powerof2(align + 1), ("invalid zone alignment %d for \"%s\"", align, name)); - /* Sets all zones to a first-touch domain policy. */ -#ifdef UMA_FIRSTTOUCH - flags |= UMA_ZONE_NUMA; -#endif - /* This stuff is essential for the zone ctor */ memset(&args, 0, sizeof(args)); args.name = name; @@ -3135,7 +3159,7 @@ keg_first_slab(uma_keg_t keg, int domain, bool rr) KASSERT(domain >= 0 && domain < vm_ndomains, ("keg_first_slab: domain %d out of range", domain)); - KEG_LOCK_ASSERT(keg); + KEG_LOCK_ASSERT(keg, domain); slab = NULL; start = domain; @@ -3156,31 +3180,39 @@ keg_first_slab(uma_keg_t keg, int domain, bool rr) return (NULL); } +/* + * Fetch an existing slab from a free or partial list. Returns with the + * keg domain lock held if a slab was found or unlocked if not. + */ static uma_slab_t keg_fetch_free_slab(uma_keg_t keg, int domain, bool rr, int flags) { + uma_slab_t slab; uint32_t reserve; - KEG_LOCK_ASSERT(keg); + /* HASH has a single free list. */ + if ((keg->uk_flags & UMA_ZONE_HASH) != 0) + domain = 0; + KEG_LOCK(keg, domain); reserve = (flags & M_USE_RESERVE) != 0 ? 0 : keg->uk_reserve; - if (keg->uk_free <= reserve) + if (keg->uk_domain[domain].ud_free <= reserve || + (slab = keg_first_slab(keg, domain, rr)) == NULL) { + KEG_UNLOCK(keg, domain); return (NULL); - return (keg_first_slab(keg, domain, rr)); + } + return (slab); } static uma_slab_t keg_fetch_slab(uma_keg_t keg, uma_zone_t zone, int rdomain, const int flags) { struct vm_domainset_iter di; - uma_domain_t dom; uma_slab_t slab; int aflags, domain; bool rr; restart: - KEG_LOCK_ASSERT(keg); - /* * Use the keg's policy if upper layers haven't already specified a * domain (as happens with first-touch zones). @@ -3211,23 +3243,13 @@ restart: break; slab = keg_alloc_slab(keg, zone, domain, flags, aflags); - /* - * If we got a slab here it's safe to mark it partially used - * and return. We assume that the caller is going to remove - * at least one item. - */ - if (slab) { - dom = &keg->uk_domain[slab->us_domain]; - LIST_INSERT_HEAD(&dom->ud_part_slab, slab, us_link); + if (slab != NULL) return (slab); - } if (!rr && (flags & M_WAITOK) == 0) break; if (rr && vm_domainset_iter_policy(&di, &domain) != 0) { if ((flags & M_WAITOK) != 0) { - KEG_UNLOCK(keg); vm_wait_doms(&keg->uk_dr.dr_policy->ds_mask); - KEG_LOCK(keg); goto restart; } break; @@ -3239,9 +3261,9 @@ restart: * could have while we were unlocked. Check again before we * fail. */ - if ((slab = keg_fetch_free_slab(keg, domain, rr, flags)) != NULL) { + if ((slab = keg_fetch_free_slab(keg, domain, rr, flags)) != NULL) return (slab); - } + return (NULL); } @@ -3252,18 +3274,18 @@ slab_alloc_item(uma_keg_t keg, uma_slab_t slab) void *item; uint8_t freei; - KEG_LOCK_ASSERT(keg); + KEG_LOCK_ASSERT(keg, slab->us_domain); + dom = &keg->uk_domain[slab->us_domain]; freei = BIT_FFS(keg->uk_ipers, &slab->us_free) - 1; BIT_CLR(keg->uk_ipers, freei, &slab->us_free); item = slab_item(slab, keg, freei); slab->us_freecount--; - keg->uk_free--; + dom->ud_free--; /* Move this slab to the full list */ if (slab->us_freecount == 0) { LIST_REMOVE(slab, us_link); - dom = &keg->uk_domain[slab->us_domain]; LIST_INSERT_HEAD(&dom->ud_full_slab, slab, us_link); } @@ -3273,6 +3295,7 @@ slab_alloc_item(uma_keg_t keg, uma_slab_t slab) static int zone_import(void *arg, void **bucket, int max, int domain, int flags) { + uma_domain_t dom; uma_zone_t zone; uma_slab_t slab; uma_keg_t keg; @@ -3284,7 +3307,6 @@ zone_import(void *arg, void **bucket, int max, int dom zone = arg; slab = NULL; keg = zone->uz_keg; - KEG_LOCK(keg); /* Try to keep the buckets totally full */ for (i = 0; i < max; ) { if ((slab = keg_fetch_slab(keg, zone, domain, flags)) == NULL) @@ -3292,9 +3314,10 @@ zone_import(void *arg, void **bucket, int max, int dom #ifdef NUMA stripe = howmany(max, vm_ndomains); #endif + dom = &keg->uk_domain[slab->us_domain]; while (slab->us_freecount && i < max) { bucket[i++] = slab_alloc_item(keg, slab); - if (keg->uk_free <= keg->uk_reserve) + if (dom->ud_free <= keg->uk_reserve) break; #ifdef NUMA /* @@ -3310,11 +3333,11 @@ zone_import(void *arg, void **bucket, int max, int dom break; #endif } + KEG_UNLOCK(keg, slab->us_domain); /* Don't block if we allocated any successfully. */ flags &= ~M_WAITOK; flags |= M_NOWAIT; } - KEG_UNLOCK(keg); return i; } @@ -3866,11 +3889,10 @@ slab_free_item(uma_zone_t zone, uma_slab_t slab, void uint8_t freei; keg = zone->uz_keg; - KEG_LOCK_ASSERT(keg); + KEG_LOCK_ASSERT(keg, slab->us_domain); - dom = &keg->uk_domain[slab->us_domain]; - /* Do we need to remove from any lists? */ + dom = &keg->uk_domain[slab->us_domain]; if (slab->us_freecount+1 == keg->uk_ipers) { LIST_REMOVE(slab, us_link); LIST_INSERT_HEAD(&dom->ud_free_slab, slab, us_link); @@ -3885,37 +3907,45 @@ slab_free_item(uma_zone_t zone, uma_slab_t slab, void slab->us_freecount++; /* Keg statistics. */ - keg->uk_free++; + dom->ud_free++; } static void zone_release(void *arg, void **bucket, int cnt) { + struct mtx *lock; uma_zone_t zone; - void *item; uma_slab_t slab; uma_keg_t keg; uint8_t *mem; + void *item; int i; zone = arg; keg = zone->uz_keg; - KEG_LOCK(keg); + lock = NULL; + if (__predict_false((zone->uz_flags & UMA_ZONE_HASH) != 0)) + lock = KEG_LOCK(keg, 0); for (i = 0; i < cnt; i++) { item = bucket[i]; - if (!(zone->uz_flags & UMA_ZONE_VTOSLAB)) { + if (__predict_true((zone->uz_flags & UMA_ZONE_VTOSLAB) != 0)) { + slab = vtoslab((vm_offset_t)item); + } else { mem = (uint8_t *)((uintptr_t)item & (~UMA_SLAB_MASK)); - if (zone->uz_flags & UMA_ZONE_HASH) { + if ((zone->uz_flags & UMA_ZONE_HASH) != 0) slab = hash_sfind(&keg->uk_hash, mem); - } else { - mem += keg->uk_pgoff; - slab = (uma_slab_t)mem; - } - } else - slab = vtoslab((vm_offset_t)item); + else + slab = (uma_slab_t)(mem + keg->uk_pgoff); + } + if (lock != KEG_LOCKPTR(keg, slab->us_domain)) { + if (lock != NULL) + mtx_unlock(lock); + lock = KEG_LOCK(keg, slab->us_domain); + } slab_free_item(zone, slab, item); } - KEG_UNLOCK(keg); + if (lock != NULL) + mtx_unlock(lock); } /* @@ -4203,7 +4233,6 @@ uma_prealloc(uma_zone_t zone, int items) int aflags, domain, slabs; KEG_GET(zone, keg); - KEG_LOCK(keg); slabs = items / keg->uk_ipers; if (slabs * keg->uk_ipers < items) slabs++; @@ -4216,18 +4245,16 @@ uma_prealloc(uma_zone_t zone, int items) aflags); if (slab != NULL) { dom = &keg->uk_domain[slab->us_domain]; + LIST_REMOVE(slab, us_link); LIST_INSERT_HEAD(&dom->ud_free_slab, slab, us_link); + KEG_UNLOCK(keg, slab->us_domain); break; } - if (vm_domainset_iter_policy(&di, &domain) != 0) { - KEG_UNLOCK(keg); + if (vm_domainset_iter_policy(&di, &domain) != 0) vm_wait_doms(&keg->uk_dr.dr_policy->ds_mask); - KEG_LOCK(keg); - } } } - KEG_UNLOCK(keg); } /* See uma.h */ @@ -4465,6 +4492,7 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) uma_keg_t kz; uma_zone_t z; uint64_t items; + uint32_t kfree, pages; int count, error, i; error = sysctl_wire_old_buffer(req, 0); @@ -4494,6 +4522,11 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) (void)sbuf_bcat(&sbuf, &ush, sizeof(ush)); LIST_FOREACH(kz, &uma_kegs, uk_link) { + kfree = pages = 0; + for (i = 0; i < vm_ndomains; i++) { + kfree += kz->uk_domain[i].ud_free; + pages += kz->uk_domain[i].ud_pages; + } LIST_FOREACH(z, &kz->uk_zones, uz_link) { bzero(&uth, sizeof(uth)); ZONE_LOCK(z); @@ -4506,11 +4539,11 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) uth.uth_pages = (items / kz->uk_ipers) * kz->uk_ppera; } else - uth.uth_pages = kz->uk_pages; + uth.uth_pages = pages; uth.uth_maxpages = (z->uz_max_items / kz->uk_ipers) * kz->uk_ppera; uth.uth_limit = z->uz_max_items; - uth.uth_keg_free = z->uz_keg->uk_free; + uth.uth_keg_free = kfree; /* * A zone is secondary is it is not the first entry @@ -4670,9 +4703,9 @@ uma_dbg_getslab(uma_zone_t zone, void *item) keg = zone->uz_keg; if ((keg->uk_flags & UMA_ZONE_HASH) == 0) return ((uma_slab_t)(mem + keg->uk_pgoff)); - KEG_LOCK(keg); + KEG_LOCK(keg, 0); slab = hash_sfind(&keg->uk_hash, mem); - KEG_UNLOCK(keg); + KEG_UNLOCK(keg, 0); return (slab); } @@ -4791,11 +4824,12 @@ get_uma_stats(uma_keg_t kz, uma_zone_t z, uint64_t *al } else uma_zone_sumstat(z, cachefree, allocs, &frees, sleeps, xdomain); - if (!((z->uz_flags & UMA_ZONE_SECONDARY) && - (LIST_FIRST(&kz->uk_zones) != z))) - *cachefree += kz->uk_free; - for (i = 0; i < vm_ndomains; i++) + for (i = 0; i < vm_ndomains; i++) { *cachefree += z->uz_domain[i].uzd_nitems; + if (!((z->uz_flags & UMA_ZONE_SECONDARY) && + (LIST_FIRST(&kz->uk_zones) != z))) + *cachefree += kz->uk_domain[i].ud_free; + } *used = *allocs - frees; return (((int64_t)*used + *cachefree) * kz->uk_size); } Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Sat Jan 4 03:15:34 2020 (r356348) +++ head/sys/vm/uma_int.h Sat Jan 4 03:30:08 2020 (r356349) @@ -254,9 +254,12 @@ cache_uz_size(uma_cache_t cache) * Per-domain slab lists. Embedded in the kegs. */ struct uma_domain { + struct mtx_padalign ud_lock; /* Lock for the domain lists. */ struct slabhead ud_part_slab; /* partially allocated slabs */ struct slabhead ud_free_slab; /* completely unallocated slabs */ struct slabhead ud_full_slab; /* fully allocated slabs */ + uint32_t ud_pages; /* Total page count */ + uint32_t ud_free; /* Count of items free in slabs */ } __aligned(CACHE_LINE_SIZE); typedef struct uma_domain * uma_domain_t; @@ -268,14 +271,11 @@ typedef struct uma_domain * uma_domain_t; * */ struct uma_keg { - struct mtx uk_lock; /* Lock for the keg. */ struct uma_hash uk_hash; LIST_HEAD(,uma_zone) uk_zones; /* Keg's zones */ struct domainset_ref uk_dr; /* Domain selection policy. */ uint32_t uk_align; /* Alignment mask */ - uint32_t uk_pages; /* Total page count */ - uint32_t uk_free; /* Count of items free in slabs */ uint32_t uk_reserve; /* Number of reserved items. */ uint32_t uk_size; /* Requested size of each item */ uint32_t uk_rsize; /* Real size of each item */ @@ -305,8 +305,8 @@ typedef struct uma_keg * uma_keg_t; #ifdef _KERNEL #define KEG_ASSERT_COLD(k) \ - KASSERT((k)->uk_pages == 0, ("keg %s initialization after use.",\ - (k)->uk_name)) + KASSERT((k)->uk_domain[0].ud_pages == 0, \ + ("keg %s initialization after use.", (k)->uk_name)) /* * Free bits per-slab. @@ -536,20 +536,22 @@ static __inline uma_slab_t hash_sfind(struct uma_hash /* Lock Macros */ -#define KEG_LOCK_INIT(k, lc) \ - do { \ - if ((lc)) \ - mtx_init(&(k)->uk_lock, (k)->uk_name, \ - (k)->uk_name, MTX_DEF | MTX_DUPOK); \ - else \ - mtx_init(&(k)->uk_lock, (k)->uk_name, \ - "UMA zone", MTX_DEF | MTX_DUPOK); \ +#define KEG_LOCKPTR(k, d) (struct mtx *)&(k)->uk_domain[(d)].ud_lock +#define KEG_LOCK_INIT(k, d, lc) \ + do { \ + if ((lc)) \ + mtx_init(KEG_LOCKPTR(k, d), (k)->uk_name, \ + (k)->uk_name, MTX_DEF | MTX_DUPOK); \ + else \ + mtx_init(KEG_LOCKPTR(k, d), (k)->uk_name, \ + "UMA zone", MTX_DEF | MTX_DUPOK); \ } while (0) -#define KEG_LOCK_FINI(k) mtx_destroy(&(k)->uk_lock) -#define KEG_LOCK(k) mtx_lock(&(k)->uk_lock) -#define KEG_UNLOCK(k) mtx_unlock(&(k)->uk_lock) -#define KEG_LOCK_ASSERT(k) mtx_assert(&(k)->uk_lock, MA_OWNED) +#define KEG_LOCK_FINI(k, d) mtx_destroy(KEG_LOCKPTR(k, d)) +#define KEG_LOCK(k, d) \ + ({ mtx_lock(KEG_LOCKPTR(k, d)); KEG_LOCKPTR(k, d); }) +#define KEG_UNLOCK(k, d) mtx_unlock(KEG_LOCKPTR(k, d)) +#define KEG_LOCK_ASSERT(k, d) mtx_assert(KEG_LOCKPTR(k, d), MA_OWNED) #define KEG_GET(zone, keg) do { \ (keg) = (zone)->uz_keg; \ From owner-svn-src-head@freebsd.org Sat Jan 4 04:39:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EB201DF907 for ; Sat, 4 Jan 2020 04:39:24 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic316-8.consmr.mail.gq1.yahoo.com (sonic316-8.consmr.mail.gq1.yahoo.com [98.137.69.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47qTZM02crz3HWg for ; Sat, 4 Jan 2020 04:39:22 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: zAbes2UVM1m3glYiHChmzqQmOr3TLwZ_qQpbiJYvM50hSJffk9v6C1J_gx9o2sI oGxy1oIBr5As11NGvxh4UbQ2pwtUFI0O9Fgy5PVmnB0dHAs93.a_iec1XT177MbiyCTDSMc4EGHt u66Zwukx2f0H0Yq1Fd49aIlYXnbyforQZqlN_ZEDqWAsrRxifzGBqZZtPZPxOoRnPbLwDBI2M87B bSj_7lFpO.g0or5F7wgo6R4kHYqqLFV1OAWk2ZnYumctp2jIOcrMm5LG2DPG5_Kt4oiQEDGg6s3L c7LwZO9M7ndCW3RP4o5hsRraA4OqNRIqchP0fah77wXi4Gn26wjsi1GCT0ZWFgJVzpnQUsdGGolW XQZ9bhnZ.Q_QadnXko74rHc1_5XoUDP4kVv4gq5SOJlFh9BQKz_A70Lf3BMOA0AaCz5xeMYcwAhB Tb2RQaTfnf8UnB7L3In2PKM4udCfrBXj.t0Ts17HU3_qsoWGgFS.dKJBProCfsTwCARSRtUtQSeK BIGJ2LUJWhlFz5yB1b7I1WmsRPx89DY8DvThxThGSiTlgfgNL9ltMXKxgp93Dd33QSIhQIxjV4eO hy_1ITXS_MuPJ4cIHXO2LG_64dDfg3AjklMaCIuxqD3Q5bLGjvrk7_x782x910lKXT0sAob8qTaX n6Iv9fCXmDiOsWMwEETsF.Chz79xm_ywg6UTbo2DQ8K5TZTj9CWLQuBngNh4g3wT3LcTfmvIujS1 Q1vmEDxnF0QJQoayE4O4BAInTrEkUCvxjgv1PcgDbaJTXCqibZZfoIcReeEv.miKqXROTn8EdXJY 405Gdb3SpQK.XuHLCHMbGH9jjTM32ENoQadSyA9Sm1I.zQ5FP.HqxDW2CplaQU5rGZw2Yeo_ewbA G0q7lrz1pTW4L_t0RjNywQ957TYAsqkkL8K4geJJ7y_kyF3KBnAmKZpJpfDqf8MMHYuc3Qotxi8U 5aSoXCwV.zgaMHFPfXzvbmZ.BGkQOsQH7_oVvFqGQEGIfeDXcPWcf7AEr9dbsp1vD2lfJ8SKXmEz xtECFGaiThOmQ6eu6QXnyRJuKj1E8uz1dUb3WL5AiMbwQooB.z8YBqkKpNttfA7dvT9XQkAIhYX3 8sMzW7AnOrIhdyk__6Y2jCZwOOIBEzMyAgPykpQTCIB.Im30tEQYpX6lEUcBaT7X9E2zmwQEMKLY cl1kLFQP.w.qmckn9yWTjT1bswchAX7_iop4gfhi5bNCzhsxjtr_sIQlQ0LJd6bITWYOn414s97e Q0tKah5MceW6RAl5He56RFiWuRIM6I8vp8c_xNXvD4d7TnBCWeRsQLt4VS9OE8oClHew53Th3Eq0 a_xx1ZhErFz5DCVjBZHs4GifVx7CnsTskrk18VDrdYS_LDcPc_PKDiEVwe.3L6C8E1wlArxTjTvO lLlRMjmcOTOSYQ3chsThTe4fGQ5lcu2VZADHOug-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.gq1.yahoo.com with HTTP; Sat, 4 Jan 2020 04:39:21 +0000 Received: by smtp427.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID ff124f3d87fdb5ecb8b198c5793390e2; Sat, 04 Jan 2020 04:39:16 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: svn commit: r356344 - head Message-Id: Date: Fri, 3 Jan 2020 20:39:16 -0800 To: John Baldwin , svn-src-head@freebsd.org X-Mailer: Apple Mail (2.3608.40.2.2.4) References: X-Rspamd-Queue-Id: 47qTZM02crz3HWg X-Spamd-Bar: - X-Spamd-Result: default: False [-1.10 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.20)[-0.200,0]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; FREEMAIL_FROM(0.00)[yahoo.com]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-0.40)[-0.401,0]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[32.69.137.98.list.dnswl.org : 127.0.5.0]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.00)[ip: (5.20), ipnet: 98.137.64.0/21(0.88), asn: 36647(0.70), country: US(-0.05)]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 04:39:24 -0000 > Author: jhb > Date: Sat Jan 4 00:59:47 2020 > New Revision: 356344 > URL: > https://svnweb.freebsd.org/changeset/base/356344 > . . . > +MAKE_PARAMS_powerpc?= CROSS_TOOLCHAIN=powerpc64-gcc6 > . . . > +TOOLCHAINS_powerpc= powerpc64-gcc6 > . . . (I know that for now gcc9 is not in use but I'm looking at the overall pattern going forward vs. what is expected to work shorter term, even if not yet fully.) Given the likes of: TARGET=powerpc TARGET_ARCH=powerpc TARGET=powerpc TARGET_ARCH=powerpc64 Is this going to change at some point to use powerpc-gcc9 and powerpc64-gcc9 (and the matching devel/binutils@powerpc and devel/binutils@powerpc64 related commands), picking the matching commands? (More TARGET_ARCH based?) Until then, is it really restricted to powerpc64 because of the toolchain used (and lack of various command parameters to possibly control all the required behavioral differences for targeting 32-bit powerpc)? (powerpcspe has been dropped from gcc, if I understand right. So I do not expect that it can be covered. So I did not list it as another TARGET_ARCH value above.) === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Sat Jan 4 07:56:29 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6DF51F0EE8; Sat, 4 Jan 2020 07:56:29 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qYxn2ytgz3QGZ; Sat, 4 Jan 2020 07:56:29 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C6909C6E; Sat, 4 Jan 2020 07:56:29 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0047uTIB016262; Sat, 4 Jan 2020 07:56:29 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0047uT3b016260; Sat, 4 Jan 2020 07:56:29 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <202001040756.0047uT3b016260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 4 Jan 2020 07:56:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356350 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 07:56:29 -0000 Author: jeff Date: Sat Jan 4 07:56:28 2020 New Revision: 356350 URL: https://svnweb.freebsd.org/changeset/base/356350 Log: Sort cross-domain frees into per-domain buckets before inserting these onto their respective bucket lists. This is a several order of magnitude improvement in contention on the keg lock under heavy free traffic while requiring only an additional bucket per-domain worth of memory. Discussed with: markj, rlibby Differential Revision: https://reviews.freebsd.org/D22830 Modified: head/sys/vm/uma_core.c head/sys/vm/uma_int.h Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sat Jan 4 03:30:08 2020 (r356349) +++ head/sys/vm/uma_core.c Sat Jan 4 07:56:28 2020 (r356350) @@ -951,10 +951,6 @@ cache_drain(uma_zone_t zone) * * XXX: It would good to be able to assert that the zone is being * torn down to prevent improper use of cache_drain(). - * - * XXX: We lock the zone before passing into bucket_cache_reclaim() as - * it is used elsewhere. Should the tear-down path be made special - * there in some form? */ CPU_FOREACH(cpu) { cache = &zone->uz_cpu[cpu]; @@ -974,9 +970,7 @@ cache_drain(uma_zone_t zone) bucket_free(zone, bucket, NULL); } } - ZONE_LOCK(zone); bucket_cache_reclaim(zone, true); - ZONE_UNLOCK(zone); } static void @@ -1082,9 +1076,29 @@ bucket_cache_reclaim(uma_zone_t zone, bool drain) int i; for (i = 0; i < vm_ndomains; i++) { + /* + * The cross bucket is partially filled and not part of + * the item count. Reclaim it individually here. + */ zdom = &zone->uz_domain[i]; + ZONE_CROSS_LOCK(zone); + bucket = zdom->uzd_cross; + zdom->uzd_cross = NULL; + ZONE_CROSS_UNLOCK(zone); + if (bucket != NULL) { + bucket_drain(zone, bucket); + bucket_free(zone, bucket, NULL); + } /* + * Shrink the zone bucket size to ensure that the per-CPU caches + * don't grow too large. + */ + ZONE_LOCK(zone); + if (i == 0 && zone->uz_bucket_size > zone->uz_bucket_size_min) + zone->uz_bucket_size--; + + /* * If we were asked to drain the zone, we are done only once * this bucket cache is empty. Otherwise, we reclaim items in * excess of the zone's estimated working set size. If the @@ -1114,14 +1128,8 @@ bucket_cache_reclaim(uma_zone_t zone, bool drain) bucket_free(zone, bucket, NULL); ZONE_LOCK(zone); } + ZONE_UNLOCK(zone); } - - /* - * Shrink the zone bucket size to ensure that the per-CPU caches - * don't grow too large. - */ - if (zone->uz_bucket_size > zone->uz_bucket_size_min) - zone->uz_bucket_size--; } static void @@ -1224,8 +1232,8 @@ zone_reclaim(uma_zone_t zone, int waitok, bool drain) msleep(zone, &zone->uz_lock, PVM, "zonedrain", 1); } zone->uz_flags |= UMA_ZFLAG_RECLAIMING; - bucket_cache_reclaim(zone, drain); ZONE_UNLOCK(zone); + bucket_cache_reclaim(zone, drain); /* * The DRAINING flag protects us from being freed while @@ -2263,6 +2271,7 @@ zone_ctor(void *mem, int size, void *udata, int flags) zone_foreach(zone_count, &cnt); zone->uz_namecnt = cnt.count; ZONE_LOCK_INIT(zone, (arg->flags & UMA_ZONE_MTXCLASS)); + ZONE_CROSS_LOCK_INIT(zone); for (i = 0; i < vm_ndomains; i++) TAILQ_INIT(&zone->uz_domain[i].uzd_buckets); @@ -2448,6 +2457,7 @@ zone_dtor(void *arg, int size, void *udata) counter_u64_free(zone->uz_fails); free(zone->uz_ctlname, M_UMA); ZONE_LOCK_FINI(zone); + ZONE_CROSS_LOCK_FINI(zone); } /* @@ -3724,7 +3734,76 @@ zfree_item: zone_free_item(zone, item, udata, SKIP_DTOR); } +#ifdef UMA_XDOMAIN +/* + * sort crossdomain free buckets to domain correct buckets and cache + * them. + */ static void +zone_free_cross(uma_zone_t zone, uma_bucket_t bucket, void *udata) +{ + struct uma_bucketlist fullbuckets; + uma_zone_domain_t zdom; + uma_bucket_t b; + void *item; + int domain; + + CTR3(KTR_UMA, + "uma_zfree: zone %s(%p) draining cross bucket %p", + zone->uz_name, zone, bucket); + + TAILQ_INIT(&fullbuckets); + + /* + * To avoid having ndomain * ndomain buckets for sorting we have a + * lock on the current crossfree bucket. A full matrix with + * per-domain locking could be used if necessary. + */ + ZONE_CROSS_LOCK(zone); + while (bucket->ub_cnt > 0) { + item = bucket->ub_bucket[bucket->ub_cnt - 1]; + domain = _vm_phys_domain(pmap_kextract((vm_offset_t)item)); + zdom = &zone->uz_domain[domain]; + if (zdom->uzd_cross == NULL) { + zdom->uzd_cross = bucket_alloc(zone, udata, M_NOWAIT); + if (zdom->uzd_cross == NULL) + break; + } + zdom->uzd_cross->ub_bucket[zdom->uzd_cross->ub_cnt++] = item; + if (zdom->uzd_cross->ub_cnt == zdom->uzd_cross->ub_entries) { + TAILQ_INSERT_HEAD(&fullbuckets, zdom->uzd_cross, + ub_link); + zdom->uzd_cross = NULL; + } + bucket->ub_cnt--; + } + ZONE_CROSS_UNLOCK(zone); + if (!TAILQ_EMPTY(&fullbuckets)) { + ZONE_LOCK(zone); + while ((b = TAILQ_FIRST(&fullbuckets)) != NULL) { + TAILQ_REMOVE(&fullbuckets, b, ub_link); + if (zone->uz_bkt_count >= zone->uz_bkt_max) { + ZONE_UNLOCK(zone); + bucket_drain(zone, b); + bucket_free(zone, b, udata); + ZONE_LOCK(zone); + } else { + domain = _vm_phys_domain( + pmap_kextract( + (vm_offset_t)b->ub_bucket[0])); + zdom = &zone->uz_domain[domain]; + zone_put_bucket(zone, zdom, b, true); + } + } + ZONE_UNLOCK(zone); + } + if (bucket->ub_cnt != 0) + bucket_drain(zone, bucket); + bucket_free(zone, bucket, udata); +} +#endif + +static void zone_free_bucket(uma_zone_t zone, uma_bucket_t bucket, void *udata, int domain, int itemdomain) { @@ -3735,17 +3814,14 @@ zone_free_bucket(uma_zone_t zone, uma_bucket_t bucket, * Buckets coming from the wrong domain will be entirely for the * only other domain on two domain systems. In this case we can * simply cache them. Otherwise we need to sort them back to - * correct domains by freeing the contents to the slab layer. + * correct domains. */ if (domain != itemdomain && vm_ndomains > 2) { - CTR3(KTR_UMA, - "uma_zfree: zone %s(%p) draining cross bucket %p", - zone->uz_name, zone, bucket); - bucket_drain(zone, bucket); - bucket_free(zone, bucket, udata); + zone_free_cross(zone, bucket, udata); return; } #endif + /* * Attempt to save the bucket in the zone's domain bucket cache. * Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Sat Jan 4 03:30:08 2020 (r356349) +++ head/sys/vm/uma_int.h Sat Jan 4 07:56:28 2020 (r356350) @@ -399,6 +399,7 @@ TAILQ_HEAD(uma_bucketlist, uma_bucket); struct uma_zone_domain { struct uma_bucketlist uzd_buckets; /* full buckets */ + uma_bucket_t uzd_cross; /* Fills from cross buckets. */ long uzd_nitems; /* total item count */ long uzd_imax; /* maximum item count this period */ long uzd_imin; /* minimum item count this period */ @@ -449,6 +450,8 @@ struct uma_zone { struct task uz_maxaction; /* Task to run when at limit */ uint16_t uz_bucket_size_min; /* Min number of items in bucket */ + struct mtx_padalign uz_cross_lock; /* Cross domain free lock */ + /* Offset 256+, stats and misc. */ counter_u64_t uz_allocs; /* Total number of allocations */ counter_u64_t uz_frees; /* Total number of frees */ @@ -574,6 +577,12 @@ static __inline uma_slab_t hash_sfind(struct uma_hash #define ZONE_UNLOCK(z) mtx_unlock(&(z)->uz_lock) #define ZONE_LOCK_FINI(z) mtx_destroy(&(z)->uz_lock) #define ZONE_LOCK_ASSERT(z) mtx_assert(&(z)->uz_lock, MA_OWNED) + +#define ZONE_CROSS_LOCK_INIT(z) \ + mtx_init(&(z)->uz_cross_lock, "UMA Cross", NULL, MTX_DEF) +#define ZONE_CROSS_LOCK(z) mtx_lock(&(z)->uz_cross_lock) +#define ZONE_CROSS_UNLOCK(z) mtx_unlock(&(z)->uz_cross_lock) +#define ZONE_CROSS_LOCK_FINI(z) mtx_destroy(&(z)->uz_cross_lock) /* * Find a slab within a hash table. This is used for OFFPAGE zones to lookup From owner-svn-src-head@freebsd.org Sat Jan 4 13:27:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D5BB1ECC33 for ; Sat, 4 Jan 2020 13:27:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qjJ32lbPz4FLJ; Sat, 4 Jan 2020 13:27:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-7.local (unknown [IPv6:2601:648:8881:1e90:8d3e:cb31:1f4e:f50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 0E3C91EF0A; Sat, 4 Jan 2020 13:27:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r356344 - head To: Mark Millard , svn-src-head@freebsd.org References: From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Sat, 4 Jan 2020 05:27:44 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 13:27:47 -0000 On 1/3/20 8:39 PM, Mark Millard wrote: > >> Author: jhb >> Date: Sat Jan 4 00:59:47 2020 >> New Revision: 356344 >> URL: >> https://svnweb.freebsd.org/changeset/base/356344 >> . . . >> +MAKE_PARAMS_powerpc?= CROSS_TOOLCHAIN=powerpc64-gcc6 >> . . . >> +TOOLCHAINS_powerpc= powerpc64-gcc6 >> . . . > > (I know that for now gcc9 is not in use but > I'm looking at the overall pattern going > forward vs. what is expected to work shorter > term, even if not yet fully.) > > Given the likes of: > > TARGET=powerpc TARGET_ARCH=powerpc > TARGET=powerpc TARGET_ARCH=powerpc64 > > Is this going to change at some point to use > powerpc-gcc9 and powerpc64-gcc9 (and the matching > devel/binutils@powerpc and devel/binutils@powerpc64 > related commands), picking the matching commands? > (More TARGET_ARCH based?) > > Until then, is it really restricted to powerpc64 > because of the toolchain used (and lack of various > command parameters to possibly control all the > required behavioral differences for targeting > 32-bit powerpc)? > > (powerpcspe has been dropped from gcc, if I > understand right. So I do not expect that it > can be covered. So I did not list it as another > TARGET_ARCH value above.) For powerpc, I'm about to switch it to just using clang. riscv is now almost ready for clang as well (I have one hack I need to do to the kernel so lld can link it after dim@'s merges yesterday). I probably will add some kind of WITH_GCC=yes to 'make tinderbox' I think, but that will require untangling the mess so it can pick per-machine_arch toolchains rather than per-cpuarch. -- John Baldwin From owner-svn-src-head@freebsd.org Sat Jan 4 13:31:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54C241ED254; Sat, 4 Jan 2020 13:31:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qjNg1btPz4FZB; Sat, 4 Jan 2020 13:31:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-7.local (unknown [IPv6:2601:648:8881:1e90:8d3e:cb31:1f4e:f50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id BAF2E1F047; Sat, 4 Jan 2020 13:31:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r356289 - head To: Mark Millard , svn-src-head@freebsd.org Cc: FreeBSD Toolchain References: From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Sat, 4 Jan 2020 05:31:44 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 13:31:47 -0000 On 1/3/20 2:34 AM, Mark Millard wrote: > John Baldwin jhb at FreeBSD.org wrote on > Thu Jan 2 21:41:07 UTC 2020 : > >> On 1/2/20 1:34 PM, John Baldwin wrote: >>> Author: jhb >>> Date: Thu Jan 2 21:34:44 2020 >>> New Revision: 356289 >>> URL: https://svnweb.freebsd.org/changeset/base/356289 >>> >>> Log: >>> Look for cross toolchain makefiles in /usr/share/toolchains. >>> >>> The freebsd-binutils and freebsd-gcc* packages install toolchain >>> makefiles to /usr/share/toolchains rather than LOCALBASE. >> >> The short version is that you can do something like this to use GCC >> as the system compiler (/usr/bin/cc): >> >> cd /usr/ports/base/binutils ; make install clean >> cd ../gcc6 ; make install clean >> >> Then 'make CROSS_TOOLCHAIN=freebsd-gcc6 buildworld', etc. If you aren't >> planning on doing cross-builds you can set CROSS_TOOLCHAIN in /etc/src.conf. >> >> As described elsewhere, the base/* packages can be cross-built (along >> with pkg), so for any architectures not yet using clang we could fairly >> easily provide a cross-built package repo (though that architecture list >> is becoming rather small). I will probably add a base/gcc9 port once we >> can build a full system with gcc9. > > Just an FYI from some experiments that I did recently: > > devel/binutils@powerpc and devel/binutils@powerpc64 and > base/binutils@powerpc and base_binutils@powerpc64 do > not put out the same content as lld or the old > toolchain's ld (still used normally for 32-bit powerpc). > buildkernel runs to completion but the result > crashes from the kernel sseflf-loading and what was > produced not matching. For example, binutils put out > very few ABS symbols compared to lld/old-ld and > classifies the kernel as ET_EXEC, not ET_DYN, because > of the non-zero VirtAddr in: > > Program Headers: > Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align > . . . > LOAD 0x000000 0x00100000 0x00100000 0xd9786c 0x1083648 RWE 0x10000 > . . . > > (I'm not claiming that is all there is that matters.) > > > These points are true using system-clang as the > compiler. (I've only cross-built so far.) > > I do not know if other architectures have similar issues > or not. But, it appears that in some cases, there is more > work to allowing the GNU linker to be used, for at least > buildkernel . > > I do not know if there is an intent to support a (modern) > GNU binutils ld (in addition to lld) or not. So it may be > that the effort would not be put in. (I'm not claiming > which side(s) would change if the effort was put in.) I have only really tested amd64, mips, and risc-v with GCC. Other platform maintainers would have to work through any MD issues. The expectation is that GCC + ld.bfd should hopefully work as well as clang + lld. Trying to cross-thread those (GCC + lld or clang + ld.bfd) might also work in theory, but is a bit harder to guarantee, especially GCC + lld. -- John Baldwin From owner-svn-src-head@freebsd.org Sat Jan 4 18:48:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7481E1EE12D; Sat, 4 Jan 2020 18:48:14 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qrPp2VKMz4V5M; Sat, 4 Jan 2020 18:48:14 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50C98193F0; Sat, 4 Jan 2020 18:48:14 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 004ImEI3008822; Sat, 4 Jan 2020 18:48:14 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 004ImDbR008817; Sat, 4 Jan 2020 18:48:13 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <202001041848.004ImDbR008817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 4 Jan 2020 18:48:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356351 - in head/sys: conf vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: conf vm X-SVN-Commit-Revision: 356351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 18:48:14 -0000 Author: jeff Date: Sat Jan 4 18:48:13 2020 New Revision: 356351 URL: https://svnweb.freebsd.org/changeset/base/356351 Log: UMA NUMA flag day. UMA_ZONE_NUMA was a source of confusion. Make the names more consistent with other NUMA features as UMA_ZONE_FIRSTTOUCH and UMA_ZONE_ROUNDROBIN. The system will now pick a select a default depending on kernel configuration. API users need only specify one if they want to override the default. Remove the UMA_XDOMAIN and UMA_FIRSTTOUCH kernel options and key only off of NUMA. XDOMAIN is now fast enough in all cases to enable whenever NUMA is. Reviewed by: markj Discussed with: rlibby Differential Revision: https://reviews.freebsd.org/D22831 Modified: head/sys/conf/options head/sys/vm/uma.h head/sys/vm/uma_core.c head/sys/vm/uma_int.h head/sys/vm/vm_glue.c Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sat Jan 4 07:56:28 2020 (r356350) +++ head/sys/conf/options Sat Jan 4 18:48:13 2020 (r356351) @@ -621,8 +621,6 @@ NO_SWAPPING opt_vm.h MALLOC_MAKE_FAILURES opt_vm.h MALLOC_PROFILE opt_vm.h MALLOC_DEBUG_MAXZONES opt_vm.h -UMA_XDOMAIN opt_vm.h -UMA_FIRSTTOUCH opt_vm.h # The MemGuard replacement allocator used for tamper-after-free detection DEBUG_MEMGUARD opt_vm.h Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Sat Jan 4 07:56:28 2020 (r356350) +++ head/sys/vm/uma.h Sat Jan 4 18:48:13 2020 (r356351) @@ -268,11 +268,9 @@ uma_zone_t uma_zcache_create(char *name, int size, uma #define UMA_ZONE_PCPU 0x8000 /* * Allocates mp_maxid + 1 slabs of PAGE_SIZE */ -#define UMA_ZONE_NUMA 0x10000 /* - * NUMA aware Zone. Implements a best - * effort first-touch policy. - */ -#define UMA_ZONE_MINBUCKET 0x20000 /* Use smallest buckets. */ +#define UMA_ZONE_MINBUCKET 0x10000 /* Use smallest buckets. */ +#define UMA_ZONE_FIRSTTOUCH 0x20000 /* First touch NUMA policy */ +#define UMA_ZONE_ROUNDROBIN 0x40000 /* Round-robin NUMA policy. */ /* * These flags are shared between the keg and zone. In zones wishing to add @@ -281,7 +279,8 @@ uma_zone_t uma_zcache_create(char *name, int size, uma */ #define UMA_ZONE_INHERIT \ (UMA_ZONE_OFFPAGE | UMA_ZONE_MALLOC | UMA_ZONE_NOFREE | \ - UMA_ZONE_HASH | UMA_ZONE_VTOSLAB | UMA_ZONE_PCPU | UMA_ZONE_NUMA) + UMA_ZONE_HASH | UMA_ZONE_VTOSLAB | UMA_ZONE_PCPU | \ + UMA_ZONE_FIRSTTOUCH | UMA_ZONE_ROUNDROBIN) /* Definitions for align */ #define UMA_ALIGN_PTR (sizeof(void *) - 1) /* Alignment fit for ptr */ Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sat Jan 4 07:56:28 2020 (r356350) +++ head/sys/vm/uma_core.c Sat Jan 4 18:48:13 2020 (r356351) @@ -360,7 +360,8 @@ bucket_init(void) size += sizeof(void *) * ubz->ubz_entries; ubz->ubz_zone = uma_zcreate(ubz->ubz_name, size, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, - UMA_ZONE_MTXCLASS | UMA_ZFLAG_BUCKET | UMA_ZONE_NUMA); + UMA_ZONE_MTXCLASS | UMA_ZFLAG_BUCKET | + UMA_ZONE_FIRSTTOUCH); } } @@ -387,11 +388,9 @@ bucket_zone_max(uma_zone_t zone, int nitems) int bpcpu; bpcpu = 2; -#ifdef UMA_XDOMAIN - if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) + if ((zone->uz_flags & UMA_ZONE_FIRSTTOUCH) != 0) /* Count the cross-domain bucket. */ bpcpu++; -#endif for (ubz = &bucket_zones[0]; ubz->ubz_entries != 0; ubz++) if (ubz->ubz_entries * bpcpu * mp_ncpus > nitems) @@ -637,7 +636,7 @@ cache_bucket_load_free(uma_cache_t cache, uma_bucket_t cache_bucket_load(&cache->uc_freebucket, b); } -#ifdef UMA_XDOMAIN +#ifdef NUMA static inline void cache_bucket_load_cross(uma_cache_t cache, uma_bucket_t b) { @@ -999,7 +998,7 @@ cache_drain_safe_cpu(uma_zone_t zone, void *unused) b1 = b2 = b3 = NULL; ZONE_LOCK(zone); critical_enter(); - if (zone->uz_flags & UMA_ZONE_NUMA) + if (zone->uz_flags & UMA_ZONE_FIRSTTOUCH) domain = PCPU_GET(domain); else domain = 0; @@ -1905,8 +1904,8 @@ keg_ctor(void *mem, int size, void *udata, int flags) /* * We use a global round-robin policy by default. Zones with - * UMA_ZONE_NUMA set will use first-touch instead, in which case the - * iterator is never run. + * UMA_ZONE_FIRSTTOUCH set will use first-touch instead, in which + * case the iterator is never run. */ keg->uk_dr.dr_policy = DOMAINSET_RR(); keg->uk_dr.dr_iter = 0; @@ -1943,12 +1942,18 @@ keg_ctor(void *mem, int size, void *udata, int flags) } /* - * Sets all kegs with memory that comes from the page array to a - * first-touch domain policy. + * Use a first-touch NUMA policy for all kegs that pmap_extract() + * will work on with the exception of critical VM structures + * necessary for paging. + * + * Zones may override the default by specifying either. */ -#ifdef UMA_FIRSTTOUCH - if ((keg->uk_flags & UMA_ZONE_HASH) == 0) - keg->uk_flags |= UMA_ZONE_NUMA; +#ifdef NUMA + if ((keg->uk_flags & + (UMA_ZONE_HASH | UMA_ZONE_VM | UMA_ZONE_ROUNDROBIN)) == 0) + keg->uk_flags |= UMA_ZONE_FIRSTTOUCH; + else if ((keg->uk_flags & UMA_ZONE_FIRSTTOUCH) == 0) + keg->uk_flags |= UMA_ZONE_ROUNDROBIN; #endif if (keg->uk_flags & UMA_ZONE_OFFPAGE) @@ -2154,7 +2159,7 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused) */ domainoid = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(zone->uz_oid), OID_AUTO, "domain", CTLFLAG_RD, NULL, ""); - if ((zone->uz_flags & UMA_ZONE_NUMA) == 0) + if ((zone->uz_flags & UMA_ZONE_FIRSTTOUCH) == 0) domains = 1; for (i = 0; i < domains; i++) { zdom = &zone->uz_domain[i]; @@ -2994,7 +2999,7 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags /* * We can not get a bucket so try to return a single item. */ - if (uz_flags & UMA_ZONE_NUMA) + if (uz_flags & UMA_ZONE_FIRSTTOUCH) domain = PCPU_GET(domain); else domain = UMA_ANYDOMAIN; @@ -3068,7 +3073,7 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * /* * Check the zone's cache of buckets. */ - if (zone->uz_flags & UMA_ZONE_NUMA) { + if (zone->uz_flags & UMA_ZONE_FIRSTTOUCH) { domain = PCPU_GET(domain); zdom = &zone->uz_domain[domain]; } else { @@ -3114,7 +3119,7 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * critical_enter(); cache = &zone->uz_cpu[curcpu]; if (cache->uc_allocbucket.ucb_bucket == NULL && - ((zone->uz_flags & UMA_ZONE_NUMA) == 0 || + ((zone->uz_flags & UMA_ZONE_FIRSTTOUCH) == 0 || domain == PCPU_GET(domain))) { cache_bucket_load_alloc(cache, bucket); zdom->uzd_imax += bucket->ub_cnt; @@ -3338,7 +3343,7 @@ zone_import(void *arg, void **bucket, int max, int dom * produces more fragmentation and requires more cpu * time but yields better distribution. */ - if ((zone->uz_flags & UMA_ZONE_NUMA) == 0 && + if ((zone->uz_flags & UMA_ZONE_ROUNDROBIN) != 0 && vm_ndomains > 1 && --stripe == 0) break; #endif @@ -3698,27 +3703,32 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata * detect and handle migration if it has occurred. */ domain = itemdomain = 0; +#ifdef NUMA + if ((uz_flags & UMA_ZONE_FIRSTTOUCH) != 0) + itemdomain = _vm_phys_domain(pmap_kextract((vm_offset_t)item)); +#endif critical_enter(); do { cache = &zone->uz_cpu[curcpu]; - bucket = &cache->uc_allocbucket; -#ifdef UMA_XDOMAIN - if ((uz_flags & UMA_ZONE_NUMA) != 0) { - itemdomain = _vm_phys_domain(pmap_kextract((vm_offset_t)item)); - domain = PCPU_GET(domain); - } - if ((uz_flags & UMA_ZONE_NUMA) != 0 && domain != itemdomain) { +#ifdef NUMA + domain = PCPU_GET(domain); + if ((uz_flags & UMA_ZONE_FIRSTTOUCH) != 0 && + domain != itemdomain) { bucket = &cache->uc_crossbucket; } else #endif - - /* - * Try to free into the allocbucket first to give LIFO ordering - * for cache-hot datastructures. Spill over into the freebucket - * if necessary. Alloc will swap them if one runs dry. - */ - if (__predict_false(bucket->ucb_cnt >= bucket->ucb_entries)) - bucket = &cache->uc_freebucket; + { + /* + * Try to free into the allocbucket first to give LIFO + * ordering for cache-hot datastructures. Spill over + * into the freebucket if necessary. Alloc will swap + * them if one runs dry. + */ + bucket = &cache->uc_allocbucket; + if (__predict_false(bucket->ucb_cnt >= + bucket->ucb_entries)) + bucket = &cache->uc_freebucket; + } if (__predict_true(bucket->ucb_cnt < bucket->ucb_entries)) { cache_bucket_push(cache, bucket, item); critical_exit(); @@ -3734,7 +3744,7 @@ zfree_item: zone_free_item(zone, item, udata, SKIP_DTOR); } -#ifdef UMA_XDOMAIN +#ifdef NUMA /* * sort crossdomain free buckets to domain correct buckets and cache * them. @@ -3809,7 +3819,7 @@ zone_free_bucket(uma_zone_t zone, uma_bucket_t bucket, { uma_zone_domain_t zdom; -#ifdef UMA_XDOMAIN +#ifdef NUMA /* * Buckets coming from the wrong domain will be entirely for the * only other domain on two domain systems. In this case we can @@ -3864,6 +3874,7 @@ static __noinline bool cache_free(uma_zone_t zone, uma_cache_t cache, void *udata, void *item, int itemdomain) { + uma_cache_bucket_t cbucket; uma_bucket_t bucket; int domain; @@ -3875,28 +3886,25 @@ cache_free(uma_zone_t zone, uma_cache_t cache, void *u cache = &zone->uz_cpu[curcpu]; /* - * NUMA domains need to free to the correct zdom. When XDOMAIN - * is enabled this is the zdom of the item and the bucket may be - * the cross bucket if they do not match. + * FIRSTTOUCH domains need to free to the correct zdom. When + * enabled this is the zdom of the item. The bucket is the + * cross bucket if the current domain and itemdomain do not match. */ - if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) -#ifdef UMA_XDOMAIN + cbucket = &cache->uc_freebucket; +#ifdef NUMA + if ((zone->uz_flags & UMA_ZONE_FIRSTTOUCH) != 0) { domain = PCPU_GET(domain); -#else - itemdomain = domain = PCPU_GET(domain); -#endif - else - itemdomain = domain = 0; -#ifdef UMA_XDOMAIN - if (domain != itemdomain) { - bucket = cache_bucket_unload_cross(cache); - if (bucket != NULL) - atomic_add_64(&zone->uz_xdomain, bucket->ub_cnt); + if (domain != itemdomain) { + cbucket = &cache->uc_crossbucket; + if (cbucket->ucb_cnt != 0) + atomic_add_64(&zone->uz_xdomain, + cbucket->ucb_cnt); + } } else #endif - bucket = cache_bucket_unload_free(cache); + itemdomain = domain = 0; + bucket = cache_bucket_unload(cbucket); - /* We are no longer associated with this CPU. */ critical_exit(); @@ -3910,13 +3918,13 @@ cache_free(uma_zone_t zone, uma_cache_t cache, void *u if (bucket == NULL) return (false); cache = &zone->uz_cpu[curcpu]; -#ifdef UMA_XDOMAIN +#ifdef NUMA /* * Check to see if we should be populating the cross bucket. If it * is already populated we will fall through and attempt to populate * the free bucket. */ - if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) { + if ((zone->uz_flags & UMA_ZONE_FIRSTTOUCH) != 0) { domain = PCPU_GET(domain); if (domain != itemdomain && cache->uc_crossbucket.ucb_bucket == NULL) { @@ -4092,11 +4100,9 @@ uma_zone_set_maxcache(uma_zone_t zone, int nitems) ubz = bucket_zone_max(zone, nitems); if (ubz != NULL) { bpcpu = 2; -#ifdef UMA_XDOMAIN - if ((zone->uz_flags & UMA_ZONE_NUMA) != 0) + if ((zone->uz_flags & UMA_ZONE_FIRSTTOUCH) != 0) /* Count the cross-domain bucket. */ bpcpu++; -#endif nitems -= ubz->ubz_entries * bpcpu * mp_ncpus; zone->uz_bucket_size_max = ubz->ubz_entries; } else { Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Sat Jan 4 07:56:28 2020 (r356350) +++ head/sys/vm/uma_int.h Sat Jan 4 18:48:13 2020 (r356351) @@ -497,8 +497,9 @@ struct uma_zone { "\33CACHE" \ "\32LIMIT" \ "\31CTORDTOR" \ - "\22MINBUCKET" \ - "\21NUMA" \ + "\23ROUNDROBIN" \ + "\22FIRSTTOUCH" \ + "\21MINBUCKET" \ "\20PCPU" \ "\17NODUMP" \ "\16VTOSLAB" \ Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sat Jan 4 07:56:28 2020 (r356350) +++ head/sys/vm/vm_glue.c Sat Jan 4 18:48:13 2020 (r356351) @@ -474,7 +474,7 @@ kstack_cache_init(void *null) kstack_cache = uma_zcache_create("kstack_cache", kstack_pages * PAGE_SIZE, NULL, NULL, NULL, NULL, kstack_import, kstack_release, NULL, - UMA_ZONE_NUMA); + UMA_ZONE_FIRSTTOUCH); kstack_cache_size = imax(128, mp_ncpus * 4); uma_zone_set_maxcache(kstack_cache, kstack_cache_size); } From owner-svn-src-head@freebsd.org Sat Jan 4 18:59:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2ED91EF13C; Sat, 4 Jan 2020 18:59:46 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qrg64pwDz4VW5; Sat, 4 Jan 2020 18:59:46 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A00AF195D5; Sat, 4 Jan 2020 18:59:46 +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 004IxkCb014704; Sat, 4 Jan 2020 18:59:46 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 004Ixkct014703; Sat, 4 Jan 2020 18:59:46 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202001041859.004Ixkct014703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 4 Jan 2020 18:59:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356352 - head/tests/sys/aio X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/tests/sys/aio X-SVN-Commit-Revision: 356352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 18:59:46 -0000 Author: bdrewery Date: Sat Jan 4 18:59:46 2020 New Revision: 356352 URL: https://svnweb.freebsd.org/changeset/base/356352 Log: lio_listio_empty_nowait_thread sometimes does *not* hang. The other tests consistently do hang though. Sponsored by: DellEMC Modified: head/tests/sys/aio/lio_test.c Modified: head/tests/sys/aio/lio_test.c ============================================================================== --- head/tests/sys/aio/lio_test.c Sat Jan 4 18:48:13 2020 (r356351) +++ head/tests/sys/aio/lio_test.c Sat Jan 4 18:59:46 2020 (r356352) @@ -189,6 +189,7 @@ ATF_TC_BODY(lio_listio_empty_nowait_thread, tc) struct aiocb *list = NULL; struct sigevent sev; + atf_tc_skip("Sometimes hangs and sometimes passes"); atf_tc_expect_timeout("Bug 220398 - lio_listio(2) never sends" " asynchronous notification if nent==0"); ATF_REQUIRE_EQ(0, sem_init(&completions, false, 0)); From owner-svn-src-head@freebsd.org Sat Jan 4 19:29:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DCE41F1BD3; Sat, 4 Jan 2020 19:29:26 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qsKL2p7Fz4Wbd; Sat, 4 Jan 2020 19:29:26 +0000 (UTC) (envelope-from jeff@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B5C819B37; Sat, 4 Jan 2020 19:29:26 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 004JTQov032619; Sat, 4 Jan 2020 19:29:26 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 004JTQ7M032617; Sat, 4 Jan 2020 19:29:26 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <202001041929.004JTQ7M032617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sat, 4 Jan 2020 19:29:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356353 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 19:29:26 -0000 Author: jeff Date: Sat Jan 4 19:29:25 2020 New Revision: 356353 URL: https://svnweb.freebsd.org/changeset/base/356353 Log: Fix an assertion introduced in r356348. On architectures without UMA_MD_SMALL_ALLOC vmem has a more complicated startup sequence that violated the new assert. Resolve this by rewriting the COLD asserts to look at the per-cpu allocation counts for evidence of api activity. Discussed with: rlibby Reviewed by: markj Reported by: lwhsu Modified: head/sys/vm/uma_core.c head/sys/vm/uma_int.h Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sat Jan 4 18:59:46 2020 (r356352) +++ head/sys/vm/uma_core.c Sat Jan 4 19:29:25 2020 (r356353) @@ -294,7 +294,10 @@ static int sysctl_handle_uma_zone_flags(SYSCTL_HANDLER static int sysctl_handle_uma_slab_efficiency(SYSCTL_HANDLER_ARGS); static int sysctl_handle_uma_zone_items(SYSCTL_HANDLER_ARGS); +static uint64_t uma_zone_get_allocs(uma_zone_t zone); + #ifdef INVARIANTS +static uint64_t uma_keg_get_allocs(uma_keg_t zone); static inline struct noslabbits *slab_dbg_bits(uma_slab_t slab, uma_keg_t keg); static bool uma_dbg_kskip(uma_keg_t keg, void *mem); @@ -4184,6 +4187,22 @@ uma_zone_get_frees(uma_zone_t zone) return (nitems); } + +#ifdef INVARIANTS +/* Used only for KEG_ASSERT_COLD(). */ +static uint64_t +uma_keg_get_allocs(uma_keg_t keg) +{ + uma_zone_t z; + uint64_t nitems; + + nitems = 0; + LIST_FOREACH(z, &keg->uk_zones, uz_link) + nitems += uma_zone_get_allocs(z); + + return (nitems); +} +#endif /* See uma.h */ void Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Sat Jan 4 18:59:46 2020 (r356352) +++ head/sys/vm/uma_int.h Sat Jan 4 19:29:25 2020 (r356353) @@ -305,7 +305,7 @@ typedef struct uma_keg * uma_keg_t; #ifdef _KERNEL #define KEG_ASSERT_COLD(k) \ - KASSERT((k)->uk_domain[0].ud_pages == 0, \ + KASSERT(uma_keg_get_allocs((k)) == 0, \ ("keg %s initialization after use.", (k)->uk_name)) /* @@ -529,7 +529,7 @@ struct uma_zone { #define UZ_ITEMS_SLEEPER (1LL << UZ_ITEMS_SLEEPER_SHIFT) #define ZONE_ASSERT_COLD(z) \ - KASSERT((z)->uz_bkt_count == 0, \ + KASSERT(uma_zone_get_allocs((z)) == 0, \ ("zone %s initialization after use.", (z)->uz_name)) #undef UMA_ALIGN From owner-svn-src-head@freebsd.org Sat Jan 4 19:50:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E6F61F38DB; Sat, 4 Jan 2020 19:50:26 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qsnZ2qZKz4XZW; Sat, 4 Jan 2020 19:50:26 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57EFD19F10; Sat, 4 Jan 2020 19:50:26 +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 004JoQJs044818; Sat, 4 Jan 2020 19:50:26 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 004JoPY6044815; Sat, 4 Jan 2020 19:50:25 GMT (envelope-from alc@FreeBSD.org) Message-Id: <202001041950.004JoPY6044815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 4 Jan 2020 19:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356354 - in head/sys: amd64/amd64 arm64/arm64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm64/arm64 i386/i386 X-SVN-Commit-Revision: 356354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 19:50:26 -0000 Author: alc Date: Sat Jan 4 19:50:25 2020 New Revision: 356354 URL: https://svnweb.freebsd.org/changeset/base/356354 Log: When a copy-on-write fault occurs, pmap_enter() is called on to replace the mapping to the old read-only page with a mapping to the new read-write page. To destroy the old mapping, pmap_enter() must destroy its page table and PV entries and invalidate its TLB entry. This change simply invalidates that TLB entry a little earlier, specifically, on amd64 and arm64, before the PV list lock is held. Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D23027 Modified: head/sys/amd64/amd64/pmap.c head/sys/arm64/arm64/pmap.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Jan 4 19:29:25 2020 (r356353) +++ head/sys/amd64/amd64/pmap.c Sat Jan 4 19:50:25 2020 (r356354) @@ -6131,8 +6131,10 @@ retry: */ if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(om); - if ((origpte & PG_A) != 0) + if ((origpte & PG_A) != 0) { + pmap_invalidate_page(pmap, va); vm_page_aflag_set(om, PGA_REFERENCED); + } CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, opa); pv = pmap_pvh_remove(&om->md, pmap, va); KASSERT(pv != NULL, @@ -6144,9 +6146,13 @@ retry: ((om->flags & PG_FICTITIOUS) != 0 || TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) vm_page_aflag_clear(om, PGA_WRITEABLE); - } - if ((origpte & PG_A) != 0) + } else { + /* + * Since this mapping is unmanaged, assume that PG_A + * is set. + */ pmap_invalidate_page(pmap, va); + } origpte = 0; } else { /* Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sat Jan 4 19:29:25 2020 (r356353) +++ head/sys/arm64/arm64/pmap.c Sat Jan 4 19:50:25 2020 (r356354) @@ -3449,8 +3449,10 @@ havel3: */ if (pmap_pte_dirty(orig_l3)) vm_page_dirty(om); - if ((orig_l3 & ATTR_AF) != 0) + if ((orig_l3 & ATTR_AF) != 0) { + pmap_invalidate_page(pmap, va); vm_page_aflag_set(om, PGA_REFERENCED); + } CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, opa); pv = pmap_pvh_remove(&om->md, pmap, va); if ((m->oflags & VPO_UNMANAGED) != 0) @@ -3460,8 +3462,11 @@ havel3: ((om->flags & PG_FICTITIOUS) != 0 || TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) vm_page_aflag_clear(om, PGA_WRITEABLE); + } else { + KASSERT((orig_l3 & ATTR_AF) != 0, + ("pmap_enter: unmanaged mapping lacks ATTR_AF")); + pmap_invalidate_page(pmap, va); } - pmap_invalidate_page(pmap, va); orig_l3 = 0; } else { /* Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sat Jan 4 19:29:25 2020 (r356353) +++ head/sys/i386/i386/pmap.c Sat Jan 4 19:50:25 2020 (r356354) @@ -3798,8 +3798,10 @@ __CONCAT(PMTYPE, enter)(pmap_t pmap, vm_offset_t va, v */ if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(om); - if ((origpte & PG_A) != 0) + if ((origpte & PG_A) != 0) { + pmap_invalidate_page_int(pmap, va); vm_page_aflag_set(om, PGA_REFERENCED); + } pv = pmap_pvh_remove(&om->md, pmap, va); KASSERT(pv != NULL, ("pmap_enter: no PV entry for %#x", va)); @@ -3810,9 +3812,13 @@ __CONCAT(PMTYPE, enter)(pmap_t pmap, vm_offset_t va, v ((om->flags & PG_FICTITIOUS) != 0 || TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) vm_page_aflag_clear(om, PGA_WRITEABLE); - } - if ((origpte & PG_A) != 0) + } else { + /* + * Since this mapping is unmanaged, assume that PG_A + * is set. + */ pmap_invalidate_page_int(pmap, va); + } origpte = 0; } else { /* From owner-svn-src-head@freebsd.org Sat Jan 4 20:07:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1A9D1F45DD; Sat, 4 Jan 2020 20:07:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qt8v5j0Fz4YZs; Sat, 4 Jan 2020 20:07:11 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEFCA1A2DE; Sat, 4 Jan 2020 20:07:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 004K7Bbk056653; Sat, 4 Jan 2020 20:07:11 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 004K7BNM056652; Sat, 4 Jan 2020 20:07:11 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001042007.004K7BNM056652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 4 Jan 2020 20:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356355 - head/lib/libc/secure X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/secure X-SVN-Commit-Revision: 356355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 20:07:11 -0000 Author: kevans Date: Sat Jan 4 20:07:11 2020 New Revision: 356355 URL: https://svnweb.freebsd.org/changeset/base/356355 Log: ssp: knock out some trivial warnings that come up with WARNS=6 A future commit will rebuild this as part of libssp. The exact warnings are fairly trivially fixed: - No previous declaration for __stack_chk_guard - idx is the wrong type, nitems yields a size_t - Casting away volatile on the tmp_stack_chk_guard directly is a no-no. Reviewed by: kib, emaste, pfg, Oliver Pinter (earlier version) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22943 Modified: head/lib/libc/secure/stack_protector.c Modified: head/lib/libc/secure/stack_protector.c ============================================================================== --- head/lib/libc/secure/stack_protector.c Sat Jan 4 19:50:25 2020 (r356354) +++ head/lib/libc/secure/stack_protector.c Sat Jan 4 20:07:11 2020 (r356355) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); __attribute__((__constructor__, __used__)); #endif +extern long __stack_chk_guard[8]; extern int __sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen); @@ -73,8 +74,8 @@ __guard_setup(void) { static const int mib[2] = { CTL_KERN, KERN_ARND }; volatile long tmp_stack_chk_guard[nitems(__stack_chk_guard)]; - size_t len; - int error, idx; + size_t idx, len; + int error; if (__stack_chk_guard[0] != 0) return; @@ -84,7 +85,8 @@ __guard_setup(void) * data into a temporal array, then do manual volatile copy to * not allow optimizer to call memcpy() behind us. */ - error = _elf_aux_info(AT_CANARY, (void *)tmp_stack_chk_guard, + error = _elf_aux_info(AT_CANARY, + __DEQUALIFY(void *, tmp_stack_chk_guard), sizeof(tmp_stack_chk_guard)); if (error == 0 && tmp_stack_chk_guard[0] != 0) { for (idx = 0; idx < nitems(__stack_chk_guard); idx++) { From owner-svn-src-head@freebsd.org Sat Jan 4 20:19:28 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 781831F5799; Sat, 4 Jan 2020 20:19:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qtR438x2z4ZFp; Sat, 4 Jan 2020 20:19:28 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 679FB1A4DC; Sat, 4 Jan 2020 20:19:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 004KJSVw062769; Sat, 4 Jan 2020 20:19:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 004KJPQC062754; Sat, 4 Jan 2020 20:19:25 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001042019.004KJPQC062754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 4 Jan 2020 20:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356356 - in head: . gnu/lib lib lib/libssp lib/libssp_nonshared share/mk tools/build/mk X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: . gnu/lib lib lib/libssp lib/libssp_nonshared share/mk tools/build/mk X-SVN-Commit-Revision: 356356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 20:19:28 -0000 Author: kevans Date: Sat Jan 4 20:19:25 2020 New Revision: 356356 URL: https://svnweb.freebsd.org/changeset/base/356356 Log: Provide libssp based on libc For libssp.so, rebuild stack_protector.c with FORTIFY_SOURCE stubs that just abort built into it. For libssp_nonshared.a, steal stack_protector_compat.c from ^/lib/libc/secure and massage it to maintain that __stack_chk_fail_local is a hidden symbol. libssp is now built unconditionally regardless of {WITH,WITHOUT}_SSP in the build environment, and the gcclibs version has been disconnected from the build in favor of this one. PR: 242950 (exp-run) Reviewed by: kib, emaste, pfg, Oliver Pinter (earlier version) Also discussed with: kan MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22943 Added: head/lib/libssp/ head/lib/libssp/Makefile (contents, props changed) head/lib/libssp/Symbol.map (contents, props changed) head/lib/libssp/Versions.def (contents, props changed) head/lib/libssp/fortify_stubs.c (contents, props changed) head/lib/libssp_nonshared/ head/lib/libssp_nonshared/Makefile (contents, props changed) head/lib/libssp_nonshared/libssp_nonshared.c (contents, props changed) Modified: head/Makefile.inc1 head/ObsoleteFiles.inc head/gnu/lib/Makefile head/lib/Makefile head/share/mk/local.dirdeps.mk head/share/mk/local.gendirdeps.mk head/share/mk/src.libnames.mk head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sat Jan 4 20:07:11 2020 (r356355) +++ head/Makefile.inc1 Sat Jan 4 20:19:25 2020 (r356356) @@ -2788,7 +2788,7 @@ libraries: .MAKE .PHONY # _prereq_libs= lib/libcompiler_rt .if ${MK_SSP} != "no" -_prereq_libs+= gnu/lib/libssp/libssp_nonshared +_prereq_libs+= lib/libssp_nonshared .endif # These dependencies are not automatically generated: Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sat Jan 4 20:07:11 2020 (r356355) +++ head/ObsoleteFiles.inc Sat Jan 4 20:19:25 2020 (r356356) @@ -36,6 +36,13 @@ # xargs -n1 | sort | uniq -d; # done +# 20200104: gcc libssp removed +OLD_FILES+=usr/include/ssp/ssp.h +OLD_FILES+=usr/include/ssp/stdio.h +OLD_FILES+=usr/include/ssp/string.h +OLD_FILES+=usr/include/ssp/unistd.h +OLD_DIRS+=usr/include/ssp + # 20191222: new clang import which bumps version from 9.0.0 to 9.0.1. OLD_FILES+=usr/lib/clang/9.0.0/include/cuda_wrappers/algorithm OLD_FILES+=usr/lib/clang/9.0.0/include/cuda_wrappers/complex Modified: head/gnu/lib/Makefile ============================================================================== --- head/gnu/lib/Makefile Sat Jan 4 20:07:11 2020 (r356355) +++ head/gnu/lib/Makefile Sat Jan 4 20:19:25 2020 (r356356) @@ -8,7 +8,6 @@ SUBDIR.${MK_GCC}+= libgcov .if ${MK_GCC} != "no" && ${MK_OPENMP} == "no" SUBDIR+= libgomp .endif -SUBDIR.${MK_SSP}+= libssp SUBDIR.${MK_TESTS}+= tests .if ${MK_BSD_CRTBEGIN} == "no" Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Sat Jan 4 20:07:11 2020 (r356355) +++ head/lib/Makefile Sat Jan 4 20:19:25 2020 (r356356) @@ -18,6 +18,8 @@ SUBDIR_BOOTSTRAP= \ ${_libcplusplus} \ ${_libcxxrt} \ libelf \ + libssp \ + libssp_nonshared \ msun # The main list; please keep these sorted alphabetically. @@ -106,7 +108,9 @@ SUBDIR_DEPEND_libarchive= libz libbz2 libexpat liblzma SUBDIR_DEPEND_libauditdm= libbsm SUBDIR_DEPEND_libbsnmp= ${_libnetgraph} SUBDIR_DEPEND_libc++:= libcxxrt -SUBDIR_DEPEND_libc= libcompiler_rt +# libssp_nonshared doesn't need to be linked into libc on every arch, but it is +# small enough to build that this bit of serialization is likely insignificant. +SUBDIR_DEPEND_libc= libcompiler_rt libssp_nonshared SUBDIR_DEPEND_libcam= libsbuf SUBDIR_DEPEND_libcasper= libnv SUBDIR_DEPEND_libdevstat= libkvm Added: head/lib/libssp/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libssp/Makefile Sat Jan 4 20:19:25 2020 (r356356) @@ -0,0 +1,20 @@ +# $FreeBSD$ + +PACKAGE= clibs +SHLIBDIR?= /lib +SHLIB= ssp +SHLIB_MAJOR= 0 + +VERSION_DEF= ${.CURDIR}/Versions.def +SYMBOL_MAPS= ${.CURDIR}/Symbol.map + +.PATH: ${SRCTOP}/lib/libc/secure +CFLAGS+= -I${SRCTOP}/lib/libc/include +# _elf_aux_info is exported from libc as elf_aux_info(3), so just that for the +# libssp build instead. +CFLAGS+= -D_elf_aux_info=elf_aux_info +SRCS= stack_protector.c fortify_stubs.c + +CFLAGS.fortify_stubs.c= -Wno-unused-parameter + +.include Added: head/lib/libssp/Symbol.map ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libssp/Symbol.map Sat Jan 4 20:19:25 2020 (r356356) @@ -0,0 +1,26 @@ +/* + * $FreeBSD$ + */ + +LIBSSP_1.0 { + __chk_fail; + __stack_chk_fail; + __stack_chk_guard; + + /* + * Currently unsupported: _FORTIFY_SOURCE symbols. It is believed + * that these have never been used on FreeBSD, as our headers lack the + * support that would have generated references to them. + */ + __memcpy_chk; + __memset_chk; + __snprintf_chk; + __sprintf_chk; + __stpcpy_chk; + __strcat_chk; + __strcpy_chk; + __strncat_chk; + __strncpy_chk; + __vsnprintf_chk; + __vsprintf_chk; +}; Added: head/lib/libssp/Versions.def ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libssp/Versions.def Sat Jan 4 20:19:25 2020 (r356356) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +LIBSSP_1.0 { +}; Added: head/lib/libssp/fortify_stubs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libssp/fortify_stubs.c Sat Jan 4 20:19:25 2020 (r356356) @@ -0,0 +1,134 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Kyle Evans + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include + +/* Signatures grabbed from LSB Core Specification 4.1 */ +void *__memcpy_chk(void *dst, const void *src, size_t len, + size_t dstlen); +void *__memset_chk(void *dst, int c, size_t len, size_t dstlen); +int __snprintf_chk(char *str, size_t maxlen, int flag, size_t strlen, + const char *fmt); +int __sprintf_chk(char *str, int flag, size_t strlen, const char *fmt); +char *__stpcpy_chk(char *dst, const char *src, size_t dstlen); +char *__strcat_chk(char *dst, const char *src, size_t dstlen); +char *__strcpy_chk(char *dst, const char *src, size_t dstlen); +char *__strncat_chk(char *dst, const char *src, size_t len, size_t dstlen); +char *__strncpy_chk(char *dst, const char *src, size_t len, size_t dstlen); +int __vsnprintf_chk(char *str, size_t size, const char *format, + va_list ap); +int __vsprintf_chk(char *str, int flag, size_t slen, const char *format, + va_list ap); + +#define ABORT() abort2("_FORTIFY_SOURCE not supported", 0, NULL) + +void * +__memcpy_chk(void *dst, const void *src, size_t len, + size_t dstlen) +{ + + ABORT(); +} + +void * +__memset_chk(void *dst, int c, size_t len, size_t dstlen) +{ + + ABORT(); +} + +int +__snprintf_chk(char *str, size_t maxlen, int flag, size_t strlen, + const char *fmt) +{ + + ABORT(); +} + +int +__sprintf_chk(char *str, int flag, size_t strlen, const char *fmt) +{ + + ABORT(); +} + +char * +__stpcpy_chk(char *dst, const char *src, size_t dstlen) +{ + + ABORT(); +} + +char * +__strcat_chk(char *dst, const char *src, size_t dstlen) +{ + + ABORT(); +} + +char * +__strcpy_chk(char *dst, const char *src, size_t dstlen) +{ + + ABORT(); +} + +char * +__strncat_chk(char *dst, const char *src, size_t len, size_t dstlen) +{ + + ABORT(); +} + +char * +__strncpy_chk(char *dst, const char *src, size_t len, size_t dstlen) +{ + + ABORT(); +} + +int +__vsnprintf_chk(char *str, size_t size, const char *format, + va_list ap) +{ + + ABORT(); +} + +int +__vsprintf_chk(char *str, int flag, size_t slen, const char *format, + va_list ap) +{ + + ABORT(); +} Added: head/lib/libssp_nonshared/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libssp_nonshared/Makefile Sat Jan 4 20:19:25 2020 (r356356) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +PACKAGE= clibs +LIB= ssp_nonshared +NO_PIC= +MK_PROFILE= no + +SRCS= libssp_nonshared.c +CFLAGS+= -fPIC + +.include Added: head/lib/libssp_nonshared/libssp_nonshared.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libssp_nonshared/libssp_nonshared.c Sat Jan 4 20:19:25 2020 (r356356) @@ -0,0 +1,17 @@ +/* + * Written by Alexander Kabaev + * The file is in public domain. + */ + +#include +__FBSDID("$FreeBSD$"); + +void __stack_chk_fail(void); +void __stack_chk_fail_local(void); + +void __hidden +__stack_chk_fail_local(void) +{ + + __stack_chk_fail(); +} Modified: head/share/mk/local.dirdeps.mk ============================================================================== --- head/share/mk/local.dirdeps.mk Sat Jan 4 20:07:11 2020 (r356355) +++ head/share/mk/local.dirdeps.mk Sat Jan 4 20:19:25 2020 (r356356) @@ -75,7 +75,7 @@ DIRDEPS_FILTER.xtras+= Nusr.bin/clang/clang.host .if ${DEP_RELDIR} == "lib/libc" DIRDEPS += lib/libc_nonshared .if ${MK_SSP:Uno} != "no" -DIRDEPS += gnu/lib/libssp/libssp_nonshared +DIRDEPS += lib/libssp_nonshared .endif .else DIRDEPS_FILTER.xtras+= Nlib/libc_nonshared Modified: head/share/mk/local.gendirdeps.mk ============================================================================== --- head/share/mk/local.gendirdeps.mk Sat Jan 4 20:07:11 2020 (r356355) +++ head/share/mk/local.gendirdeps.mk Sat Jan 4 20:19:25 2020 (r356356) @@ -7,7 +7,7 @@ GENDIRDEPS_HEADER= echo '\# ${FreeBSD:L:@v@$$$v$$ @:M* # local.dirdeps.mk will put them in if necessary GENDIRDEPS_FILTER+= \ Nbin/cat.host \ - Ngnu/lib/libssp/libssp_nonshared \ + Nlib/libssp_nonshared \ Ncddl/usr.bin/ctf* \ Nlib/libc_nonshared \ Ngnu/lib/csu \ Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Sat Jan 4 20:07:11 2020 (r356355) +++ head/share/mk/src.libnames.mk Sat Jan 4 20:19:25 2020 (r356356) @@ -566,8 +566,8 @@ LIBDIALOGDIR= ${OBJTOP}/gnu/lib/libdialog LIBGCOVDIR= ${OBJTOP}/gnu/lib/libgcov LIBGOMPDIR= ${OBJTOP}/gnu/lib/libgomp LIBGNUREGEXDIR= ${OBJTOP}/gnu/lib/libregex -LIBSSPDIR= ${OBJTOP}/gnu/lib/libssp -LIBSSP_NONSHAREDDIR= ${OBJTOP}/gnu/lib/libssp/libssp_nonshared +LIBSSPDIR= ${OBJTOP}/lib/libssp +LIBSSP_NONSHAREDDIR= ${OBJTOP}/lib/libssp_nonshared LIBSUPCPLUSPLUSDIR= ${OBJTOP}/gnu/lib/libsupc++ LIBASN1DIR= ${OBJTOP}/kerberos5/lib/libasn1 LIBGSSAPI_KRB5DIR= ${OBJTOP}/kerberos5/lib/libgssapi_krb5 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sat Jan 4 20:07:11 2020 (r356355) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sat Jan 4 20:19:25 2020 (r356356) @@ -8646,41 +8646,6 @@ OLD_FILES+=usr/share/doc/pjdfstest/README OLD_DIRS+=usr/share/doc/pjdfstest .endif -.if ${MK_SSP} == no -OLD_LIBS+=lib/libssp.so.0 -OLD_FILES+=usr/include/ssp/ssp.h -OLD_FILES+=usr/include/ssp/stdio.h -OLD_FILES+=usr/include/ssp/string.h -OLD_FILES+=usr/include/ssp/unistd.h -OLD_FILES+=usr/lib/libssp.a -OLD_FILES+=usr/lib/libssp.so -OLD_FILES+=usr/lib/libssp_nonshared.a -OLD_FILES+=usr/lib32/libssp.a -OLD_FILES+=usr/lib32/libssp.so -OLD_LIBS+=usr/lib32/libssp.so.0 -OLD_FILES+=usr/lib32/libssp_nonshared.a -OLD_FILES+=usr/tests/lib/libc/ssp/Kyuafile -OLD_FILES+=usr/tests/lib/libc/ssp/h_fgets -OLD_FILES+=usr/tests/lib/libc/ssp/h_getcwd -OLD_FILES+=usr/tests/lib/libc/ssp/h_gets -OLD_FILES+=usr/tests/lib/libc/ssp/h_memcpy -OLD_FILES+=usr/tests/lib/libc/ssp/h_memmove -OLD_FILES+=usr/tests/lib/libc/ssp/h_memset -OLD_FILES+=usr/tests/lib/libc/ssp/h_read -OLD_FILES+=usr/tests/lib/libc/ssp/h_readlink -OLD_FILES+=usr/tests/lib/libc/ssp/h_snprintf -OLD_FILES+=usr/tests/lib/libc/ssp/h_sprintf -OLD_FILES+=usr/tests/lib/libc/ssp/h_stpcpy -OLD_FILES+=usr/tests/lib/libc/ssp/h_stpncpy -OLD_FILES+=usr/tests/lib/libc/ssp/h_strcat -OLD_FILES+=usr/tests/lib/libc/ssp/h_strcpy -OLD_FILES+=usr/tests/lib/libc/ssp/h_strncat -OLD_FILES+=usr/tests/lib/libc/ssp/h_strncpy -OLD_FILES+=usr/tests/lib/libc/ssp/h_vsnprintf -OLD_FILES+=usr/tests/lib/libc/ssp/h_vsprintf -OLD_FILES+=usr/tests/lib/libc/ssp/ssp_test -.endif - .if ${MK_SYSCONS} == no OLD_FILES+=usr/share/syscons/fonts/INDEX.fonts OLD_FILES+=usr/share/syscons/fonts/armscii8-8x14.fnt From owner-svn-src-head@freebsd.org Sat Jan 4 20:33:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F41561F6D6D; Sat, 4 Jan 2020 20:33:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qtkx60D8z4bX1; Sat, 4 Jan 2020 20:33:13 +0000 (UTC) (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8FB81A8E1; Sat, 4 Jan 2020 20:33:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 004KXDkL075510; Sat, 4 Jan 2020 20:33:13 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 004KXCg9075502; Sat, 4 Jan 2020 20:33:12 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202001042033.004KXCg9075502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 4 Jan 2020 20:33:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356357 - in head: share/man/man4 sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head: share/man/man4 sys/netinet X-SVN-Commit-Revision: 356357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 20:33:14 -0000 Author: tuexen Date: Sat Jan 4 20:33:12 2020 New Revision: 356357 URL: https://svnweb.freebsd.org/changeset/base/356357 Log: Make the message size limit used for SCTP_SENDALL configurable via a sysctl variable instead of a compiled in constant. This is based on a patch provided by nwhitehorn@. Modified: head/share/man/man4/sctp.4 head/sys/netinet/sctp.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h Modified: head/share/man/man4/sctp.4 ============================================================================== --- head/share/man/man4/sctp.4 Sat Jan 4 20:19:25 2020 (r356356) +++ head/share/man/man4/sctp.4 Sat Jan 4 20:33:12 2020 (r356357) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 10, 2018 +.Dd January 4, 2020 .Dt SCTP 4 .Os .Sh NAME @@ -472,6 +472,8 @@ Enable SCTP blackholing. See .Xr blackhole 4 for more details. +.It Va sendall_limit +Maximum message size (in bytes) that can be transmitted with SCTP_SENDALL flags set. .It Va buffer_splitting Enable send/receive buffer splitting. .It Va vtag_time_wait Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Sat Jan 4 20:19:25 2020 (r356356) +++ head/sys/netinet/sctp.h Sat Jan 4 20:33:12 2020 (r356357) @@ -491,7 +491,6 @@ struct sctp_error_auth_invalid_hmac { * time */ #define SCTP_SAT_NETWORK_BURST_INCR 2 /* how many times to multiply maxburst * in sat */ -#define SCTP_MAX_SENDALL_LIMIT 1024 /* Data Chuck Specific Flags */ #define SCTP_DATA_FRAG_MASK 0x03 Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Jan 4 20:19:25 2020 (r356356) +++ head/sys/netinet/sctp_output.c Sat Jan 4 20:33:12 2020 (r356357) @@ -6885,8 +6885,8 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, /* There is another. */ return (EBUSY); } - if (uio->uio_resid > SCTP_MAX_SENDALL_LIMIT) { - /* You must be less than the max! */ + if (uio->uio_resid > SCTP_BASE_SYSCTL(sctp_sendall_limit)) { + /* You must not be larger than the limit! */ return (EMSGSIZE); } SCTP_MALLOC(ca, struct sctp_copy_all *, sizeof(struct sctp_copy_all), Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Sat Jan 4 20:19:25 2020 (r356356) +++ head/sys/netinet/sctp_sysctl.c Sat Jan 4 20:33:12 2020 (r356357) @@ -119,6 +119,7 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_steady_step) = SCTPCTL_RTTVAR_STEADYS_DEFAULT; SCTP_BASE_SYSCTL(sctp_use_dccc_ecn) = SCTPCTL_RTTVAR_DCCCECN_DEFAULT; SCTP_BASE_SYSCTL(sctp_blackhole) = SCTPCTL_BLACKHOLE_DEFAULT; + SCTP_BASE_SYSCTL(sctp_sendall_limit) = SCTPCTL_SENDALL_LIMIT_DEFAULT; SCTP_BASE_SYSCTL(sctp_diag_info_code) = SCTPCTL_DIAG_INFO_CODE_DEFAULT; #if defined(SCTP_LOCAL_TRACE_BUF) memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); @@ -943,6 +944,7 @@ SCTP_UINT_SYSCTL(rttvar_eqret, sctp_rttvar_eqret, SCTP SCTP_UINT_SYSCTL(rttvar_steady_step, sctp_steady_step, SCTPCTL_RTTVAR_STEADYS) SCTP_UINT_SYSCTL(use_dcccecn, sctp_use_dccc_ecn, SCTPCTL_RTTVAR_DCCCECN) SCTP_UINT_SYSCTL(blackhole, sctp_blackhole, SCTPCTL_BLACKHOLE) +SCTP_UINT_SYSCTL(sendall_limit, sctp_sendall_limit, SCTPCTL_SENDALL_LIMIT) SCTP_UINT_SYSCTL(diag_info_code, sctp_diag_info_code, SCTPCTL_DIAG_INFO_CODE) #ifdef SCTP_DEBUG SCTP_UINT_SYSCTL(debug, sctp_debug_on, SCTPCTL_DEBUG) Modified: head/sys/netinet/sctp_sysctl.h ============================================================================== --- head/sys/netinet/sctp_sysctl.h Sat Jan 4 20:19:25 2020 (r356356) +++ head/sys/netinet/sctp_sysctl.h Sat Jan 4 20:33:12 2020 (r356357) @@ -116,6 +116,7 @@ struct sctp_sysctl { uint32_t sctp_buffer_splitting; uint32_t sctp_initial_cwnd; uint32_t sctp_blackhole; + uint32_t sctp_sendall_limit; #if defined(SCTP_DEBUG) uint32_t sctp_debug_on; #endif @@ -537,6 +538,12 @@ struct sctp_sysctl { #define SCTPCTL_BLACKHOLE_MIN 0 #define SCTPCTL_BLACKHOLE_MAX 2 #define SCTPCTL_BLACKHOLE_DEFAULT SCTPCTL_BLACKHOLE_MIN + +/* sendall_limit: Maximum message with SCTP_SENDALL */ +#define SCTPCTL_SENDALL_LIMIT_DESC "Maximum size of a message send with SCTP_SENDALL" +#define SCTPCTL_SENDALL_LIMIT_MIN 0 +#define SCTPCTL_SENDALL_LIMIT_MAX 0xFFFFFFFF +#define SCTPCTL_SENDALL_LIMIT_DEFAULT 1432 #define SCTPCTL_DIAG_INFO_CODE_DESC "Diagnostic information error cause code" #define SCTPCTL_DIAG_INFO_CODE_MIN 0 From owner-svn-src-head@freebsd.org Sat Jan 4 22:05:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2AE61D8F92; Sat, 4 Jan 2020 22:05:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qwmr6CNrz4gpQ; Sat, 4 Jan 2020 22:05:00 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA3841B9BB; Sat, 4 Jan 2020 22:05:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 004M50Re029149; Sat, 4 Jan 2020 22:05:00 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 004M502L029148; Sat, 4 Jan 2020 22:05:00 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001042205.004M502L029148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 4 Jan 2020 22:05:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356358 - head/lib/libssp X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libssp X-SVN-Commit-Revision: 356358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 22:05:01 -0000 Author: kevans Date: Sat Jan 4 22:05:00 2020 New Revision: 356358 URL: https://svnweb.freebsd.org/changeset/base/356358 Log: libssp: fix FORTIFY_SOURCE stub declarations The LSB 4.1 that I referenced omitted the varargs, and I failed to catch it. The __vsnprintf_chk error was from just downright misreading the page. GCC6 caught all of these, but I had only tested GCC4.2. X-MFC-With: r356356 Modified: head/lib/libssp/fortify_stubs.c Modified: head/lib/libssp/fortify_stubs.c ============================================================================== --- head/lib/libssp/fortify_stubs.c Sat Jan 4 20:33:12 2020 (r356357) +++ head/lib/libssp/fortify_stubs.c Sat Jan 4 22:05:00 2020 (r356358) @@ -38,15 +38,15 @@ void *__memcpy_chk(void *dst, const void *src, size_t size_t dstlen); void *__memset_chk(void *dst, int c, size_t len, size_t dstlen); int __snprintf_chk(char *str, size_t maxlen, int flag, size_t strlen, - const char *fmt); -int __sprintf_chk(char *str, int flag, size_t strlen, const char *fmt); + const char *fmt, ...); +int __sprintf_chk(char *str, int flag, size_t strlen, const char *fmt, ...); char *__stpcpy_chk(char *dst, const char *src, size_t dstlen); char *__strcat_chk(char *dst, const char *src, size_t dstlen); char *__strcpy_chk(char *dst, const char *src, size_t dstlen); char *__strncat_chk(char *dst, const char *src, size_t len, size_t dstlen); char *__strncpy_chk(char *dst, const char *src, size_t len, size_t dstlen); -int __vsnprintf_chk(char *str, size_t size, const char *format, - va_list ap); +int __vsnprintf_chk(char *str, size_t size, int flags, size_t len, + const char *format, va_list ap); int __vsprintf_chk(char *str, int flag, size_t slen, const char *format, va_list ap); @@ -69,14 +69,14 @@ __memset_chk(void *dst, int c, size_t len, size_t dstl int __snprintf_chk(char *str, size_t maxlen, int flag, size_t strlen, - const char *fmt) + const char *fmt, ...) { ABORT(); } int -__sprintf_chk(char *str, int flag, size_t strlen, const char *fmt) +__sprintf_chk(char *str, int flag, size_t strlen, const char *fmt, ...) { ABORT(); @@ -118,8 +118,8 @@ __strncpy_chk(char *dst, const char *src, size_t len, } int -__vsnprintf_chk(char *str, size_t size, const char *format, - va_list ap) +__vsnprintf_chk(char *str, size_t size, int flags, size_t len, + const char *format, va_list ap) { ABORT(); From owner-svn-src-head@freebsd.org Sat Jan 4 23:39:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C6C01E37BA; Sat, 4 Jan 2020 23:39:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qytR0w5Nz4mPx; Sat, 4 Jan 2020 23:39:59 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A9A31CA32; Sat, 4 Jan 2020 23:39:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 004NdwEc083347; Sat, 4 Jan 2020 23:39:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 004NdwTq083344; Sat, 4 Jan 2020 23:39:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001042339.004NdwTq083344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 4 Jan 2020 23:39:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356359 - in head/sys: compat/linux sys vm X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: compat/linux sys vm X-SVN-Commit-Revision: 356359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 23:39:59 -0000 Author: kevans Date: Sat Jan 4 23:39:58 2020 New Revision: 356359 URL: https://svnweb.freebsd.org/changeset/base/356359 Log: kern_mmap: add a variant that allows caller to inspect fp Linux mmap rejects mmap() on a write-only file with EACCES. linux_mmap_common currently does a fun dance to grab the fp associated with the passed in fd, validates it, then drops the reference and calls into kern_mmap(). Doing so is perhaps both fragile and premature; there's still plenty of chance for the request to get rejected with a more appropriate error, and it's prone to a race where the file we ultimately mmap has changed after it drops its referenced. This change alleviates the need to do this by providing a kern_mmap variant that allows the caller to inspect the fp just before calling into the fileop layer. The callback takes flags, prot, and maxprot as one could imagine scenarios where any of these, in conjunction with the file itself, may influence a caller's decision. The file type check in the linux compat layer has been removed; EINVAL is seemingly not an appropriate response to the file not being a vnode or device. The fileop layer will reject the operation with ENODEV if it's not supported, which more closely matches the common linux description of mmap(2) return values. If we discover that we're allowing an mmap() on a file type that Linux normally wouldn't, we should restrict those explicitly. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22977 Modified: head/sys/compat/linux/linux_mmap.c head/sys/sys/syscallsubr.h head/sys/vm/vm_mmap.c Modified: head/sys/compat/linux/linux_mmap.c ============================================================================== --- head/sys/compat/linux/linux_mmap.c Sat Jan 4 22:05:00 2020 (r356358) +++ head/sys/compat/linux/linux_mmap.c Sat Jan 4 23:39:58 2020 (r356359) @@ -62,7 +62,17 @@ __FBSDID("$FreeBSD$"); static void linux_fixup_prot(struct thread *td, int *prot); #endif +static int +linux_mmap_check_fp(struct file *fp, int flags, int prot, int maxprot) +{ + /* Linux mmap() just fails for O_WRONLY files */ + if ((fp->f_flag & FREAD) == 0) + return (EACCES); + + return (0); +} + int linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot, int flags, int fd, off_t pos) @@ -117,31 +127,6 @@ linux_mmap_common(struct thread *td, uintptr_t addr, s /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */ fd = (bsd_flags & MAP_ANON) ? -1 : fd; - if (fd != -1) { - /* - * Linux follows Solaris mmap(2) description: - * The file descriptor fildes is opened with - * read permission, regardless of the - * protection options specified. - */ - - error = fget(td, fd, &cap_mmap_rights, &fp); - if (error != 0) - return (error); - if (fp->f_type != DTYPE_VNODE && fp->f_type != DTYPE_DEV) { - fdrop(fp, td); - return (EINVAL); - } - - /* Linux mmap() just fails for O_WRONLY files */ - if (!(fp->f_flag & FREAD)) { - fdrop(fp, td); - return (EACCES); - } - - fdrop(fp, td); - } - if (flags & LINUX_MAP_GROWSDOWN) { /* * The Linux MAP_GROWSDOWN option does not limit auto @@ -211,13 +196,15 @@ linux_mmap_common(struct thread *td, uintptr_t addr, s */ if (addr != 0 && (bsd_flags & MAP_FIXED) == 0 && (bsd_flags & MAP_EXCL) == 0) { - error = kern_mmap(td, addr, len, prot, - bsd_flags | MAP_FIXED | MAP_EXCL, fd, pos); + error = kern_mmap_fpcheck(td, addr, len, prot, + bsd_flags | MAP_FIXED | MAP_EXCL, fd, pos, + linux_mmap_check_fp); if (error == 0) goto out; } - error = kern_mmap(td, addr, len, prot, bsd_flags, fd, pos); + error = kern_mmap_fpcheck(td, addr, len, prot, bsd_flags, fd, pos, + linux_mmap_check_fp); out: LINUX_CTR2(mmap2, "return: %d (%p)", error, td->td_retval[0]); Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Sat Jan 4 22:05:00 2020 (r356358) +++ head/sys/sys/syscallsubr.h Sat Jan 4 23:39:58 2020 (r356359) @@ -63,6 +63,8 @@ struct stat; struct thr_param; struct uio; +typedef int (*mmap_check_fp_fn)(struct file *, int, int, int); + int kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, size_t buflen, size_t path_max); int kern_accept(struct thread *td, int s, struct sockaddr **name, @@ -179,6 +181,9 @@ int kern_mlock(struct proc *proc, struct ucred *cred, size_t len); int kern_mmap(struct thread *td, uintptr_t addr, size_t len, int prot, int flags, int fd, off_t pos); +int kern_mmap_fpcheck(struct thread *td, uintptr_t addr, size_t len, + int prot, int flags, int fd, off_t pos, + mmap_check_fp_fn check_fp_fn); int kern_mmap_maxprot(struct proc *p, int prot); int kern_mprotect(struct thread *td, uintptr_t addr, size_t size, int prot); int kern_msgctl(struct thread *, int, int, struct msqid_ds *); Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Sat Jan 4 22:05:00 2020 (r356358) +++ head/sys/vm/vm_mmap.c Sat Jan 4 23:39:58 2020 (r356359) @@ -199,6 +199,18 @@ int kern_mmap(struct thread *td, uintptr_t addr0, size_t len, int prot, int flags, int fd, off_t pos) { + + return (kern_mmap_fpcheck(td, addr, len, prot, flags, fd, pos, NULL)); +} + +/* + * When mmap'ing a file, check_fp_fn may be used for the caller to do any + * last-minute validation based on the referenced file in a non-racy way. + */ +int +kern_mmap_fpcheck(struct thread *td, uintptr_t addr0, size_t len, int prot, + int flags, int fd, off_t pos, mmap_check_fp_fn check_fp_fn) +{ struct vmspace *vms; struct file *fp; struct proc *p; @@ -394,7 +406,12 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t l error = EINVAL; goto done; } - + if (check_fp_fn != NULL) { + error = check_fp_fn(fp, prot, max_prot & cap_maxprot, + flags); + if (error != 0) + goto done; + } /* This relies on VM_PROT_* matching PROT_*. */ error = fo_mmap(fp, &vms->vm_map, &addr, size, prot, max_prot & cap_maxprot, flags, pos, td); From owner-svn-src-head@freebsd.org Sat Jan 4 23:51:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8919D1E5124; Sat, 4 Jan 2020 23:51:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qz812rQdz4nJm; Sat, 4 Jan 2020 23:51:45 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C4FA1CC73; Sat, 4 Jan 2020 23:51:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 004NpjtI093800; Sat, 4 Jan 2020 23:51:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 004NpjKR093799; Sat, 4 Jan 2020 23:51:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001042351.004NpjKR093799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 4 Jan 2020 23:51:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356360 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 356360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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, 04 Jan 2020 23:51:45 -0000 Author: kevans Date: Sat Jan 4 23:51:44 2020 New Revision: 356360 URL: https://svnweb.freebsd.org/changeset/base/356360 Log: kern_mmap: restore character deleted in transit Pointy hat to: kevans X-MFC-With: r356359 Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Sat Jan 4 23:39:58 2020 (r356359) +++ head/sys/vm/vm_mmap.c Sat Jan 4 23:51:44 2020 (r356360) @@ -200,7 +200,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t l int fd, off_t pos) { - return (kern_mmap_fpcheck(td, addr, len, prot, flags, fd, pos, NULL)); + return (kern_mmap_fpcheck(td, addr0, len, prot, flags, fd, pos, NULL)); } /*